本文整理汇总了C++中sendReply函数的典型用法代码示例。如果您正苦于以下问题:C++ sendReply函数的具体用法?C++ sendReply怎么用?C++ sendReply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendReply函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: handleRequest7
void handleRequest7 ( UdpSlot *slot , long netnice ) {
//m_state = state;
//m_callback = callback;
// shortcut
XmlDoc *xd;
try { xd = new (XmlDoc); }
catch ( ... ) {
g_errno = ENOMEM;
log("PageInject: import failed: new(%i): %s",
(int)sizeof(XmlDoc),mstrerror(g_errno));
sendReply(slot);
return;
}
mnew ( xd, sizeof(XmlDoc) , "PageInject" );
//xd->reset();
char *titleRec = slot->m_readBuf;
long titleRecSize = slot->m_readBufSize;
long collnum = *(long *)titleRec;
titleRec += 4;
titleRecSize -= 4;
CollectionRec *cr = g_collectiondb.m_recs[collnum];
if ( ! cr ) {
sendReply(slot);
return;
}
// if injecting a titlerec from an import operation use set2()
//if ( m_sbuf.length() > 0 ) {
xd->set2 ( titleRec,//m_sbuf.getBufStart() ,
titleRecSize,//m_sbuf.length() ,
cr->m_coll ,
NULL, // pbuf
MAX_NICENESS ,
NULL ); // sreq
// log it i guess
log("inject: importing %s",xd->m_firstUrl.getUrl());
// call this when done indexing
//xd->m_masterState = this;
//xd->m_masterLoop = doneInjectingWrapper9;
xd->m_state = xd;//this;
xd->m_callback1 = doneInjectingWrapper10;
xd->m_isImporting = true;
xd->m_isImportingValid = true;
// hack this
xd->m_slot = slot;
// then index it
if ( ! xd->indexDoc() )
// return if would block
return;
// all done?
//return true;
sendReply ( slot );
}
开发者ID:chushuai,项目名称:open-source-search-engine,代码行数:60,代码来源:PageInject.cpp
示例2: ftpService
void ftpService(int sock) {
char buf [BUF_SIZE];
char reply [BUF_SIZE];
bool terminate = false;
int n, on, i;
char *delimiters = " \n\r";
char *temp, *cmd, *arg;
// don't wait for system buffer to be full
on = 1;
if (setsockopt(sock, SOL_SOCKET, SO_OOBINLINE, (char*)&on, sizeof(on)) == -1) {
syslog(LOG_FTP | LOG_ERR, "ftpService: setsockopt: %m");
exit(1);
}
// let the peer know that you are ready
snprintf(reply, BUF_SIZE, FTP_R220, "LightFTPServer v0.1");
sendReply(sock, reply);
while (!terminate) {
// read command
memset(buf, 0, BUF_SIZE);
// TODO: loop to read all data
if ( (n = read(sock, buf, BUF_SIZE)) == -1) {
syslog(LOG_FTP | LOG_ERR, "ftpService: read: %m");
exit(1);
}
// TODO: check if command too large for buffer = not ending in CRLF
// parse cmd and arguments
temp = strdupa(buf);
cmd = strtok(temp, delimiters);
arg = strtok(NULL, delimiters);
// free(temp);
// should ignore blank commands or send a reply?
if (cmd != NULL) {
// look for handler
for (i = 0; i < _FTPCMDS_END; i++)
if (strcasecmp(cmd, ftpcmds[i]) == 0) {
ftphandlers[i](cmd, arg, (char*)&reply, BUF_SIZE, &terminate);
// // say good bye and terminate
// if (i == FTP_CQUIT) {
// terminate = true;
// snprintf(reply, BUF_SIZE, FTP_R221);
// }
// else
// // handle command
// snprintf(reply, BUF_SIZE, FTP_R200, cmd);
break;
}
// unknown command
if (i == _FTPCMDS_END)
snprintf(reply, BUF_SIZE, FTP_R500, cmd);
// send back reply
sendReply(sock, reply);
}
}
close(sock);
}
开发者ID:BackupTheBerlios,项目名称:lightftpserver-svn,代码行数:60,代码来源:ftp_server.cpp
示例3: QDialog
UserDataRequest::UserDataRequest(QWidget *parent, const char *, bool,
Qt::WFlags)
: QDialog(parent)
{
setupUi(this);
connect(buttonOk, SIGNAL(clicked()), this, SLOT(sendReply()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(queryEdit, SIGNAL(returnPressed()), this, SLOT(sendReply()));
}
开发者ID:OSLL,项目名称:avmconf,代码行数:10,代码来源:userdatarequest.cpp
示例4: getCapability
/* Query a Registered transformer's capabilities */
static
MME_ERROR getCapability (ICS_UINT srcCpu, ICS_UINT messageSize, mme_manager_msg_t *message)
{
MME_ERROR res;
mme_capability_t *get = &message->u.get;
mme_transformer_reg_t *treg;
MME_PRINTF(MME_DBG_MANAGER, "srcCpu %d messageSize %d message %p\n",
srcCpu, messageSize, message);
MME_assert(strlen(get->name) > 0);
MME_PRINTF(MME_DBG_MANAGER, "get %p name '%s'\n",
get, get->name);
/* First lookup the corresponding Registered transformer */
treg = mme_transformer_lookup(get->name);
if (treg == NULL)
{
MME_EPRINTF(MME_DBG_MANAGER, "Failed to find transformer '%s'\n",
get->name);
res = MME_INVALID_ARGUMENT;
goto error;
}
/* Point the TransformerInfo_p at the correct place in the message */
get->capability.TransformerInfo_p = (get->capability.TransformerInfoSize ? message + 1 : NULL);
/* Call the Registered Transformer Get Capability function */
res = (treg->funcs.getTransformerCapability) (&get->capability);
MME_PRINTF(MME_DBG_MANAGER, "transformer function %p returned : %s (%d)\n",
treg->funcs.getTransformerCapability,
MME_Error_Str(res), res);
/* Send back a response to the source */
res = sendReply(message, messageSize, res);
return res;
error:
MME_EPRINTF(MME_DBG_MANAGER, "Failed : %s (%d)\n",
MME_Error_Str(res), res);
/* Send back a response to the source */
res = sendReply(message, messageSize, res);
return res;
}
开发者ID:Audioniek,项目名称:Fortis-4G,代码行数:55,代码来源:manager.c
示例5: sendPageInject
// . returns false if blocked, true otherwise
// . sets g_errno on error
bool sendPageInject ( TcpSocket *s , HttpRequest *r ) {
// get the collection
long collLen = 0;
char *coll = r->getString ( "c" , &collLen , NULL /*default*/);
// get collection rec
CollectionRec *cr = g_collectiondb.getRec ( coll );
// bitch if no collection rec found
if ( ! cr ) {
g_errno = ENOCOLLREC;
log("build: Injection from %s failed. "
"Collection \"%s\" does not exist.",
iptoa(s->m_ip),coll);
return g_httpServer.sendErrorReply(s,500,
"collection does not exist");
}
// make a new state
Msg7 *msg7;
try { msg7= new (Msg7); }
catch ( ... ) {
g_errno = ENOMEM;
log("PageInject: new(%i): %s",
sizeof(Msg7),mstrerror(g_errno));
return g_httpServer.sendErrorReply(s,500,mstrerror(g_errno));}
mnew ( msg7, sizeof(Msg7) , "PageInject" );
msg7->m_socket = s;
msg7->m_isScrape = false;
// a scrape request?
char *qts = r->getString("qts",NULL);
if ( qts && ! qts[0] ) qts = NULL;
if ( qts ) {
// qts is html encoded? NO! fix that below then...
//char *uf="http://www.google.com/search?num=50&"
// "q=%s&scoring=d&filter=0";
strncpy(msg7->m_coll,coll,MAX_COLL_LEN);
msg7->m_isScrape = true;
msg7->m_qbuf.safeStrcpy(qts);
msg7->m_linkDedupTable.set(4,0,512,NULL,0,false,0,"ldtab");
msg7->m_useAhrefs = r->getLong("useahrefs",0);
// default to yes, injectlinks.. no default to no
msg7->m_injectLinks = r->getLong("injectlinks",0);
if ( ! msg7->scrapeQuery ( ) ) return false;
return sendReply ( msg7 );
}
if ( ! msg7->inject ( s , r , msg7 , sendReplyWrapper ) )
return false;
// it did not block, i gues we are done
return sendReply ( msg7 );
}
开发者ID:BKJackson,项目名称:open-source-search-engine,代码行数:56,代码来源:PageInject.cpp
示例6: handleReadRef
static bool handleReadRef(int type, int size, const byte *msg, CONTEXT *context)
{
byte bind = msg[2];
byte *expr = (byte *) &msg[3];
byte refIndex = evalWord8Expr(&expr, context);
byte readReply[5];
byte *lVal;
// ToDo: Check for param errors
switch (type)
{
case REF_BOOL:
readReply[0] = EXPR(EXPR_BOOL, EXPR_LIT);
readReply[1] = *((bool *) haskinoRefs[refIndex].ref);
sendReply(sizeof(bool)+1, REF_RESP_READ, readReply, context, bind);
break;
case REF_WORD8:
readReply[0] = EXPR(EXPR_WORD8, EXPR_LIT);
readReply[1] = *((uint8_t *) haskinoRefs[refIndex].ref);
sendReply(sizeof(uint8_t)+1, REF_RESP_READ, readReply, context, bind);
break;
case REF_WORD16:
readReply[0] = EXPR(EXPR_WORD16, EXPR_LIT);
memcpy(&readReply[1], (byte *) haskinoRefs[refIndex].ref, sizeof(uint16_t));
sendReply(sizeof(uint16_t)+1, REF_RESP_READ, readReply, context, bind);
break;
case REF_WORD32:
readReply[0] = EXPR(EXPR_WORD32, EXPR_LIT);
memcpy(&readReply[1], (byte *) haskinoRefs[refIndex].ref, sizeof(uint32_t));
sendReply(sizeof(uint32_t)+1, REF_RESP_READ, readReply, context, bind);
break;
case REF_INT8:
readReply[0] = EXPR(EXPR_INT8, EXPR_LIT);
readReply[1] = *((int8_t *) haskinoRefs[refIndex].ref);
sendReply(sizeof(int8_t)+1, REF_RESP_READ, readReply, context, bind);
break;
case REF_INT16:
readReply[0] = EXPR(EXPR_INT16, EXPR_LIT);
memcpy(&readReply[1], (byte *) haskinoRefs[refIndex].ref, sizeof(int16_t));
sendReply(sizeof(int16_t)+1, REF_RESP_READ, readReply, context, bind);
break;
case REF_INT32:
readReply[0] = EXPR(EXPR_INT32, EXPR_LIT);
memcpy(&readReply[1], (byte *) haskinoRefs[refIndex].ref, sizeof(int32_t));
sendReply(sizeof(int32_t)+1, REF_RESP_READ, readReply, context, bind);
break;
case REF_LIST8:
lVal = (byte *) haskinoRefs[refIndex].ref;
sendReply(lVal[1]+2, REF_RESP_READ, lVal, context, bind);
break;
case REF_FLOAT:
readReply[0] = EXPR_F(EXPR_LIT);
memcpy(&readReply[1], (byte *) haskinoRefs[refIndex].ref, sizeof(float));
sendReply(sizeof(float)+1, REF_RESP_READ, readReply, context, bind);
break;
}
return false;
}
开发者ID:LambdaBoy,项目名称:haskino,代码行数:58,代码来源:HaskinoRefs.cpp
示例7: getAbsolutePath
void
Session::handleSIZE(const std::string& arg)
{
Path path = getAbsolutePath(arg);
if (path.isFile())
{
sendReply(212, String::str("%llu", path.size()));
}
else
{
sendReply(550, "Could not get file size.");
}
}
开发者ID:HSOFEUP,项目名称:dune,代码行数:14,代码来源:Session.cpp
示例8: while
void
XWindowsClipboard::pushReplies(ReplyMap::iterator& mapIndex,
ReplyList& replies, ReplyList::iterator index)
{
Reply* reply = *index;
while (sendReply(reply)) {
// reply is complete. discard it and send the next reply,
// if any.
index = replies.erase(index);
delete reply;
if (index == replies.end()) {
break;
}
reply = *index;
}
// if there are no more replies in the list then remove the list
// and stop watching the requestor for events.
if (replies.empty()) {
XWindowsUtil::ErrorLock lock(m_display);
Window requestor = mapIndex->first;
XSelectInput(m_display, requestor, m_eventMasks[requestor]);
m_replies.erase(mapIndex++);
m_eventMasks.erase(requestor);
}
else {
++mapIndex;
}
}
开发者ID:Baoxiyi-Github,项目名称:synergy,代码行数:29,代码来源:XWindowsClipboard.cpp
示例9: socket
void Server::worker (int id) {
bool moreToReceive;
bool moreToSend;
pb::RequestEnvelope requestEnvelope;
pb::ReplyEnvelope replyEnvelope;
zmq::socket_t socket (*context, ZMQ_REP);
socket.connect (workerConn.c_str ());
while (true) {
moreToReceive = getRequest (socket, requestEnvelope);
// creating appropriate service to handle request
TServiceMap::iterator it = serviceMap.find (requestEnvelope.service ());
bool notInMap = (it == serviceMap.end());
scoped_ptr<IService> service (notInMap ? new NotImplemented : it->second ());
std::cout << id << ": " << requestEnvelope.service () << " -> " <<
service->getService () << "\n";
service->setRequest (requestEnvelope, moreToReceive);
requestEnvelope.Clear ();
while (moreToReceive) {
moreToReceive = getRequest (socket, requestEnvelope);
service->setRequest (requestEnvelope, moreToReceive);
requestEnvelope.Clear ();
}
do {
moreToSend = service->getReply (replyEnvelope);
sendReply (socket, replyEnvelope, moreToSend);
replyEnvelope.Clear ();
} while (moreToSend);
}
}
开发者ID:brobits,项目名称:uRPC,代码行数:34,代码来源:server.cpp
示例10: test_flexible_executor
void test_flexible_executor(dbustl::Message call)
{
double a, b;
call >> a >> b;
if(!call.error()){
if(b == 0) {
dbustl::Message mreturn = call.createErrorReply("org.mycompany.test", "Division by 0");
sendReply(mreturn);
}
else {
dbustl::Message mreturn = call.createMethodReturn();
mreturn << (a / b);
sendReply(mreturn);
}
}
}
开发者ID:Koshak90,项目名称:dbustl,代码行数:16,代码来源:service.cpp
示例11: sendReply
void
Session::handleQUIT(const std::string& arg)
{
(void)arg;
sendReply(221, "Service closing control connection");
stop();
}
开发者ID:HSOFEUP,项目名称:dune,代码行数:7,代码来源:Session.cpp
示例12: qWarning
void TwitterPage::reply (QListWidgetItem *index)
{
QListWidgetItem *idx = index;
if (!index)
idx = Ui_.TwitList_->currentItem ();
const auto twitid = idx->data (Qt::UserRole).value<Tweet_ptr> ()->GetId ();
auto replyto = std::find_if (ScreenTwits_.begin (), ScreenTwits_.end (),
[twitid] (decltype (ScreenTwits_.front ()) tweet)
{ return tweet->GetId () == twitid; });
if (replyto == ScreenTwits_.end ())
{
qWarning () << Q_FUNC_INFO << "Failed to find twit";
return;
}
Tweet_ptr found_twit = *replyto;
Ui_.TwitEdit_->setText (QString ("@") +
((*replyto)->GetAuthor ()->GetUsername ()) +
" ");
disconnect (Ui_.TwitButton_,
SIGNAL (clicked ()),
0,
0);
connect (Ui_.TwitButton_,
SIGNAL (clicked ()),
this,
SLOT (sendReply ()));
Ui_.TwitEdit_->setFocus ();
}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:30,代码来源:twitterpage.cpp
示例13: log
// . returns false if blocked, true otherwise
// . sets g_errno on error
// . calls gotDocIds to send a reply
void Msg39::getDocIds ( UdpSlot *slot ) {
// remember the slot
m_slot = slot;
// reset this
m_errno = 0;
// get the request
m_r = (Msg39Request *) m_slot->m_readBuf;
int32_t requestSize = m_slot->m_readBufSize;
// ensure it's size is ok
if ( requestSize < 8 ) {
g_errno = EBADREQUESTSIZE;
log(LOG_LOGIC,"query: msg39: getDocIds: %s." ,
mstrerror(g_errno) );
sendReply ( m_slot , this , NULL , 0 , 0 , true );
return ;
}
// deserialize it before we do anything else
int32_t finalSize = deserializeMsg ( sizeof(Msg39Request) ,
&m_r->size_readSizes ,
&m_r->size_whiteList,//coll ,
&m_r->ptr_readSizes,
m_r->m_buf );
// sanity check
if ( finalSize != requestSize ) {char *xx=NULL;*xx=0; }
getDocIds2 ( m_r );
}
开发者ID:DeadNumbers,项目名称:open-source-search-engine,代码行数:32,代码来源:Msg39.cpp
示例14: printHeaders
void HTTPServer::notFound()
{
if (havePacket()) {
printHeaders(typePlain, status404);
println(status404);
sendReply();
}
}
开发者ID:njh,项目名称:EtherSia,代码行数:8,代码来源:HTTPServer.cpp
示例15: sendOK
void
Session::handleMODE(const std::string& arg)
{
if (arg == "S")
sendOK();
else
sendReply(504, "Command not implemented for that parameter.");
}
开发者ID:HSOFEUP,项目名称:dune,代码行数:8,代码来源:Session.cpp
示例16: is
void
Session::handleREST(const std::string& arg)
{
std::istringstream is(arg);
is >> m_rest_offset;
sendReply(350, "Requested file action pending further information.");
}
开发者ID:HSOFEUP,项目名称:dune,代码行数:8,代码来源:Session.cpp
示例17: RK_TRACE
void RKDebugConsole::sendReply () {
RK_TRACE (APP);
QString reply = reply_edit->currentText ();
sendReply (reply);
RKConsole::mainConsole ()->addCommandToHistory (reply);
reply_edit->clear ();
}
开发者ID:svn2github,项目名称:rkward-svn-mirror,代码行数:8,代码来源:rkdebugconsole.cpp
示例18: sendReply
void Msg39::gotClusterRecs ( ) {
// now tell msg5 to set the cluster levels
if ( ! setClusterLevels ( m_clusterRecs ,
m_clusterDocIds ,
m_numClusterDocIds ,
2 , // maxdocidsperhostname
m_r->m_doSiteClustering ,
m_r->m_familyFilter ,
// turn this off, not needed now that
// we have the langid in every posdb key
0,//m_r->m_language ,
m_debug ,
m_clusterLevels )) {
m_errno = g_errno;
// send back an error reply
sendReply ( m_slot , this , NULL , 0 , 0 ,true);
return;
}
// count this
m_numVisible = 0;
// now put the info back into the top tree
long nd = 0;
for ( long ti = m_tt.getHighNode() ; ti >= 0 ;
ti = m_tt.getPrev(ti) , nd++ ) {
// get the guy
TopNode *t = &m_tt.m_nodes[ti];
// get the docid
//long long docId = getDocIdFromPtr(t->m_docIdPtr);
// sanity check
if ( t->m_docId != m_clusterDocIds[nd] ) {char *xx=NULL;*xx=0;}
// set it
t->m_clusterLevel = m_clusterLevels[nd];
t->m_clusterRec = m_clusterRecs [nd];
// visible?
if ( t->m_clusterLevel == CR_OK ) m_numVisible++;
}
log(LOG_DEBUG,"query: msg39: %li docids out of %li are visible",
m_numVisible,nd);
// free this junk now
mfree ( m_buf , m_bufSize , "Msg39cluster");
m_buf = NULL;
// accumulate total hit count over each docid split!
//m_numTotalHits += m_posdbTable.m_docIdVoteBuf.length() / 6;
// before wrapping up, complete our docid split loops!
// so do not send the reply back yet... send reply back from
// the docid loop function... doDocIdSplitLoop()
//if ( m_numDocIdSplits >= 2 ) return;
// finish up and send back the reply
estimateHits ();
}
开发者ID:abhayprakash,项目名称:open-source-search-engine,代码行数:58,代码来源:Msg39.cpp
示例19: doneInjectingWrapper10
// when XmlDoc::inject() complets it calls this
void doneInjectingWrapper10 ( void *state ) {
XmlDoc *xd = (XmlDoc *)state;
UdpSlot *slot = (UdpSlot *)xd->m_slot;
long err = g_errno;
mdelete ( xd, sizeof(XmlDoc) , "PageInject" );
delete (xd);
g_errno = err;
sendReply ( slot );
}
开发者ID:chushuai,项目名称:open-source-search-engine,代码行数:10,代码来源:PageInject.cpp
示例20: sendReply
void CCollector::requestSensorFrameStatistic(lib::protocol::CNetworkMessage *msg)
{
int sensorIndex = msg->string().find(MON_PROTOCOL_DELIMITER(sensorname ,framename));
std::string sensor = msg->string().substr(0, sensorIndex);
std::string frame = msg->string().substr(sensorIndex+1, msg->string().length()-1);
sendReply(msg, msg->string() +
MON_PROTOCOL_DELIMITER(framename ,statistic) +
MON_ST_SENSORS_MANAGER->sensor(sensor)->frame(frame)->requestCachedData());
}
开发者ID:Sheridan,项目名称:mon,代码行数:9,代码来源:ccollector.cpp
注:本文中的sendReply函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论