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 );
}
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);
}
Esempio n. 3
0
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()));
}
Esempio n. 4
0
/* 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;
}
// . 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 );
}
Esempio n. 6
0
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;
    }
Esempio n. 7
0
    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.");
      }
    }
Esempio n. 8
0
 void
 Session::handleDELE(const std::string& arg)
 {
   try
   {
     Path path = getAbsolutePath(arg);
     path.remove(Path::MODE_RECURSIVE);
     sendReply(250, "Requested file action okay, completed.");
   }
   catch (...)
   {
     sendReply(550, "Requested file action not taken.");
   }
 }
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;
	}
}
Esempio n. 10
0
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);
  }
}
Esempio n. 11
0
void LLAgentListener::getAutoPilot(const LLSD& event_data) const
{
	LLSD reply = LLSD::emptyMap();
	
	LLSD::Boolean enabled = mAgent.getAutoPilot();
	reply["enabled"] = enabled;
	
	reply["target_global"] = ll_sd_from_vector3d(mAgent.getAutoPilotTargetGlobal());
	
	reply["leader_id"] = mAgent.getAutoPilotLeaderID();
	
	reply["stop_distance"] = mAgent.getAutoPilotStopDistance();

	reply["target_distance"] = mAgent.getAutoPilotTargetDist();
	if (!enabled &&
		mFollowTarget.notNull())
	{	// Get an actual distance from the target object we were following
		LLViewerObject * target = gObjectList.findObject(mFollowTarget);
		if (target)
		{	// Found the target AV, return the actual distance to them as well as their ID
			LLVector3 difference = target->getPositionRegion() - mAgent.getPositionAgent();
			reply["target_distance"] = difference.length();
			reply["leader_id"] = mFollowTarget;
		}
	}

	reply["use_rotation"] = (LLSD::Boolean) mAgent.getAutoPilotUseRotation();
	reply["target_facing"] = ll_sd_from_vector3(mAgent.getAutoPilotTargetFacing());
	reply["rotation_threshold"] = mAgent.getAutoPilotRotationThreshold();
	reply["behavior_name"] = mAgent.getAutoPilotBehaviorName();
	reply["fly"] = (LLSD::Boolean) mAgent.getFlying();

	sendReply(reply, event_data);
}
Esempio n. 12
0
 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);
         }
     }
 }
Esempio n. 13
0
void LLSideTrayListener::getTabs(const LLSD& event) const
{
    LLSD reply;

    LLSideTray* tray = mGetter();
    LLSD::Integer ord(0);
    for (LLSideTray::child_list_const_iter_t chi(tray->beginChild()), chend(tray->endChild());
         chi != chend; ++chi, ++ord)
    {
        LLView* child = *chi;
        // How much info is important? Toss in as much as seems reasonable for
        // each tab. But to me, at least for the moment, the most important
        // item is the tab name.
        LLSD info;
        // I like the idea of returning a map keyed by tab name. But as
        // compared to an array of maps, that loses sequence information.
        // Address that by indicating the original order in each map entry.
        info["ord"] = ord;
        info["visible"] = bool(child->getVisible());
        info["enabled"] = bool(child->getEnabled());
        info["available"] = child->isAvailable();
        reply[child->getName()] = info;
    }

    sendReply(reply, event);
}
Esempio n. 14
0
 void
 Session::handleQUIT(const std::string& arg)
 {
   (void)arg;
   sendReply(221, "Service closing control connection");
   stop();
 }
Esempio n. 15
0
	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 ();
	}
// . 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 );
}
Esempio n. 17
0
void LLSideTrayListener::getPanels(const LLSD& event) const
{
    LLSD reply;

    LLSideTray* tray = mGetter();
    // Iterate through the attached tabs.
    LLSD::Integer ord(0);
    for (LLSideTray::child_vector_t::const_iterator
             ati(tray->mTabs.begin()), atend(tray->mTabs.end());
         ati != atend; ++ati)
    {
        // We don't have access to LLSideTrayTab: the class definition is
        // hidden in llsidetray.cpp. But as LLSideTrayTab isa LLPanel, use the
        // LLPanel API. Unfortunately, without the LLSideTrayTab definition,
        // the compiler doesn't even know this LLSideTrayTab* is an LLPanel*.
        // Persuade it.
        LLPanel* tab(tab_cast<LLPanel*>(*ati));
        reply[tab->getName()] = getTabInfo(tab).with("attached", true).with("ord", ord);
    }

    // Now iterate over the detached tabs. These can also be opened via
    // SideTray.ShowPanel.
    ord = 0;
    for (LLSideTray::child_vector_t::const_iterator
             dti(tray->mDetachedTabs.begin()), dtend(tray->mDetachedTabs.end());
         dti != dtend; ++dti)
    {
        LLPanel* tab(tab_cast<LLPanel*>(*dti));
        reply[tab->getName()] = getTabInfo(tab).with("attached", false).with("ord", ord);
    }

    sendReply(reply, event);
}
Esempio n. 18
0
void HTTPServer::notFound()
{
    if (havePacket()) {
        printHeaders(typePlain, status404);
        println(status404);
        sendReply();
    }
}
Esempio n. 19
0
 void
 Session::handleMODE(const std::string& arg)
 {
   if (arg == "S")
     sendOK();
   else
     sendReply(504, "Command not implemented for that parameter.");
 }
Esempio n. 20
0
    void
    Session::handleREST(const std::string& arg)
    {
      std::istringstream is(arg);
      is >> m_rest_offset;

      sendReply(350, "Requested file action pending further information.");
    }
void RKDebugConsole::sendReply () {
	RK_TRACE (APP);

	QString reply = reply_edit->currentText ();
	sendReply (reply);
	RKConsole::mainConsole ()->addCommandToHistory (reply);
	reply_edit->clear ();
}
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 ();
}	
Esempio n. 23
0
    void
    Session::handleLIST(const std::string& arg)
    {
      Path path = m_root / m_path;

      // @fixme don't allow going below root.
      if (arg.size() > 0)
      {
        if (arg != "-aL" && arg != "-la")
        {
          path = getAbsolutePath(arg);
        }
      }

      // Check if we're trying to go below root.
      if (String::startsWith(m_root.str(), path.str()))
        path = m_root;

      Path::Type type = path.type();
      if (type == Path::PT_INVALID)
      {
        sendReply(450, "Requested file action not taken.");
        return;
      }

      sendReply(150, "File status okay; about to open data connection.");

      Time::BrokenDown time_ref;
      TCPSocket* data = openDataConnection();
      if (type == Path::PT_FILE)
      {
        sendFileInfo(path, data, time_ref);
      }
      else
      {
        Directory dir(path);
        const char* entry = NULL;
        while ((entry = dir.readEntry(Directory::RD_FULL_NAME)))
        {
          sendFileInfo(entry, data, time_ref);
        }
      }

      closeDataConnection(data);
    }
// 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 );
}
Esempio n. 25
0
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());
}
Esempio n. 26
0
void HTTPServer::redirect(const __FlashStringHelper* location)
{
    printStatus(status302);
    print(F("Location: "));
    println(location);
    println();
    println(status302);
    sendReply();
}
Esempio n. 27
0
    void
    Session::handleCWD(const std::string& arg)
    {
      Path suffix;
      if (arg[0] == '/')
        suffix = arg;
      else
        suffix = m_path / arg;

      Path path = m_root / suffix;

      if (path.isDirectory())
      {
        m_path = suffix;
        sendReply(250, "Requested file action okay, completed.");
      }
      else
      {
        sendReply(550, "Requested action not taken.");
      }
    }
void LLAgentListener::getAxes(const LLSD& event) const
{
    LLQuaternion quat(mAgent.getQuat());
    F32 roll, pitch, yaw;
    quat.getEulerAngles(&roll, &pitch, &yaw);
    // The official query API for LLQuaternion's [x, y, z, w] values is its
    // public member mQ...
    sendReply(LLSDMap
              ("quat", llsd_copy_array(boost::begin(quat.mQ), boost::end(quat.mQ)))
              ("euler", LLSDMap("roll", roll)("pitch", pitch)("yaw", yaw)),
              event);
}
Esempio n. 29
0
void TFarmExecutor::onReceive(int socket, const QString &data) {
  QString reply;

  try {
    std::vector<QString> argv;
    extractArgs(data, argv);
    reply = execute(argv);
  } catch (...) {
  }

  sendReply(socket, reply);
}
RKDebugConsole::RKDebugConsole (QWidget *parent, bool tool_window, const char *name) : RKMDIWindow (parent, DebugConsoleWindow, tool_window, name) {
	RK_TRACE (APP);

	QVBoxLayout *main_layout = new QVBoxLayout (this);
	main_layout->setContentsMargins (0, 0, 0, 0);
	QHBoxLayout *upper_layout = new QHBoxLayout ();
	main_layout->addLayout (upper_layout);

	context_view = new QTextEdit (this);
	context_view->setReadOnly (true);
	context_view->setAcceptRichText (false);
	upper_layout->addWidget (context_view);

	QVBoxLayout *button_layout = new QVBoxLayout ();
	upper_layout->addLayout (button_layout);
	step_button = new QPushButton (i18n ("Next"), this);
	connect (step_button, SIGNAL (clicked()), this, SLOT (stepButtonClicked()));
	button_layout->addWidget (step_button);
	step_out_button = new QPushButton (i18n ("Step out"), this);
	connect (step_out_button, SIGNAL (clicked()), this, SLOT (stepOutButtonClicked()));
	RKCommonFunctions::setTips (i18n ("<p>Continue until the caller of this function is reached (unless another debug statement is hit, earlier)</p>"
	                                  "<p><b>Note:</b> In some cases, the calling function will never be reached, because the call was the last step in the caller."
	                                  "In these cases, the behavior is identical to 'Continue'.</p>"), step_out_button);
	button_layout->addWidget (step_out_button);
	continue_button = new QPushButton (i18n ("Continue"), this);
	connect (continue_button, SIGNAL (clicked()), this, SLOT (continueButtonClicked()));
	button_layout->addWidget (continue_button);
	cancel_button = new QPushButton (i18n ("Cancel"), this);
	connect (cancel_button, SIGNAL (clicked()), this, SLOT (cancelButtonClicked()));
	button_layout->addWidget (cancel_button);
	button_layout->addStretch ();

	QHBoxLayout *lower_layout = new QHBoxLayout ();
	main_layout->addLayout (lower_layout);

	prompt_label = new QLabel (this);
	lower_layout->addWidget (prompt_label);
	reply_edit = new KHistoryComboBox (this);
	reply_edit->setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
	connect (reply_edit, SIGNAL (returnPressed()), this, SLOT (sendReply()));
	lower_layout->addWidget (reply_edit);
	setFocusProxy (reply_edit);

	setFocusPolicy (Qt::StrongFocus);

	setPart (new RKDummyPart (this, this));
	initializeActivationSignals ();

	connect (RKDebugHandler::instance (), SIGNAL (newDebugState()), this, SLOT (newDebugState()));
	newDebugState ();
}