• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ processPacket函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中processPacket函数的典型用法代码示例。如果您正苦于以下问题:C++ processPacket函数的具体用法?C++ processPacket怎么用?C++ processPacket使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了processPacket函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tftpPoll

/**
 * Looks for a connection
 */
uint8_t tftpPoll()
{
	uint8_t response = ACK;
	// Get the size of the recieved data
	uint16_t packetSize = netReadWord(REG_S3_RX_RSR0);

	if(packetSize) {
		tftpFlashing = TRUE;

		for(;;) {
			if(!(netReadReg(REG_S3_IR) & IR_RECV)) break;

			netWriteReg(REG_S3_IR, IR_RECV);

			//FIXME: is this right after all? smaller delay but
			//still a delay and it still breaks occasionally
			_delay_ms(400);
		}
		// Process Packet and get TFTP response code
#ifdef _DEBUG_TFTP
		response = processPacket(packetSize);
#else
		response = processPacket();
#endif
		// Send the response
		sendResponse(response);
	}
	if(response == FINAL_ACK) {
		netWriteReg(REG_S3_CR, CR_CLOSE);
		// Complete
		return(0);
	}
	// Tftp continues
	return(1);
}
开发者ID:Zekom,项目名称:Ariadne-Bootloader,代码行数:38,代码来源:tftp.c


示例2: main

// --------------------------------------------------------------------
// main
// --------------------------------------------------------------------
int main(int argc, char*argv[]) 
{    
    parseArgs(argc, argv);

    struct sigaction a;
    a.sa_handler = traitementInterrupt;      /* fonction à lancer */
    sigemptyset(&a.sa_mask);    /* rien à masquer */
    
    sigaction(SIGTSTP, &a, NULL);       /* pause contrôle-Z */
    sigaction(SIGINT,  &a, NULL);       /* fin contrôle-C */
    sigaction(SIGTERM, &a, NULL);       /* arrêt */
    sigaction(SIGSEGV, &a, NULL);       /* segmentation fault ! */

    int sock=0;
    initSocket(sock);
    sock_=sock;
    
    ZFile file;
    initFile(&file);
    file_=&file;
    
    while(1) {
	bool close=false;
        processPacket(sock, &file, false, close);
	if (close) {
	    file.close();
	    initFile(&file);
	    file_=&file;
	}
    }
    return(EXIT_SUCCESS);
}
开发者ID:BackupTheBerlios,项目名称:robotm6,代码行数:35,代码来源:logger.cpp


示例3: playGame

void playGame(void)
{
    int len;
    struct packet p;
    lcdPrintln("Now playing:");
    lcdPrintln(gameTitle);
    lcdRefresh();

    while(1){
        uint8_t button = getInputRaw();
        sendButton(button);
        
        while(1){
            if( flags & FLAGS_LONG_RECV )
                len = nrf_rcv_pkt_time(64,sizeof(p),(uint8_t*)&p);
            else
                len = nrf_rcv_pkt_time(32,sizeof(p),(uint8_t*)&p);
                
            if(len==sizeof(p)){
                processPacket(&p);
            }else{
                break;
            }
        }
        int rnd = getRandom() % jitter;
        delayms(interval*5+rnd);
        
        volatile uint16_t i;
        i = getRandom()&0xfff;
        while(i--);

    };
}
开发者ID:Bediko,项目名称:r0ket,代码行数:33,代码来源:r_player.c


示例4: assert

NetworkServer::AutoPacket NetworkServer::receive()
{
	assert(isConnected());

	for (;;) {
		if (_queuedUser) {
			removeUser(_queuedUser);
			_queuedUser = 0;
		}

		Packet* raw = _peer->Receive();
		if (!raw) {
			return AutoPacket();
		}
		AutoDepacketer depacketer(*_peer, raw);

		AutoPacket packet(processPacket(*raw));
		if (packet.get()) {
			User *user = findUser(raw->systemAddress);
			if (!user) {
				packetHeader(std::cout, *raw);
				std::cout << "Packet from unknown user: " << int(packet->kind()) << std::endl;
				continue;
			}
			packet->read(raw, user);
			return packet;
		}
	}
}
开发者ID:weimingtom,项目名称:mmomm,代码行数:29,代码来源:networkServer.cpp


示例5: read

bool Communicator::readFromClient()
{
	bool result = false;
	ssize_t r = 0;
	uint32_t packetSize = 0;

	r = read(mSocket, &packetSize, 4);

	if (r == 4) {
		packetSize = le32toh(packetSize);
		//syslog(LOG_INFO, "incoming packet size: %d", packetSize);

		uint8_t *buf = (uint8_t *) malloc(packetSize - 4);

		r = read(mSocket, buf, packetSize - 4);

		if (r == (packetSize - 4)) {
			result = processPacket(buf, packetSize - 4);
		}
		else
			syslog(LOG_ERR, "Error reading packet : %ld", r);

		free(buf);

	} else
		syslog(LOG_ERR, "Error reading total packet size: %ld", r);



	return result;
}
开发者ID:Ivo924,项目名称:DslrDashboardServer,代码行数:31,代码来源:communicator.cpp


示例6: while

void JobThread::run()
{
   Packet* packet = NULL;
   while ( !terminated ) {
      
      packet = m_jobQueue->dequeue();

      // loop until we get a packet
      if ( packet == NULL ) {
         continue;
      }

      if ( packet->timedOut() ) {
         mc2dbg << "[JobThread]: Packet timed out, type="
                << packet->getSubTypeAsString()
                << " age "
                << float(packet->getTimeSinceArrival() / 1000.0 )
                << " max age " << packet->getTimeout() << endl;
         delete packet;
         continue;
      }

      processPacket( packet );

   }
   // make sure the dispatcher dies quickly 
   m_dispatcher.reset( NULL );
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:28,代码来源:JobThread.cpp


示例7: sleep_time

int ManageMemberSessionOutput::svc()
{
	ACE_Time_Value sleep_time(0, 1000);
	PacketVec_t	output_packet_vec;
	while (true)
	{
		{
			ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, m_output_packet_vec_mutex, 1);
			std::copy(m_output_packet_vec.begin(), m_output_packet_vec.end(), std::back_inserter(output_packet_vec));
			m_output_packet_vec.clear();
		}

		if (output_packet_vec.size() == 0)
		{
			ACE_OS::sleep(sleep_time);
			continue;
		}
	
		for (PacketVec_t::iterator it = output_packet_vec.begin(); it != output_packet_vec.end(); ++it)
		{
			Packet * packet = *it;
			processPacket(packet);
		}

		output_packet_vec.clear();
	}
	return 0;
}
开发者ID:BianJian,项目名称:steppingstone,代码行数:28,代码来源:ManageMemberSessionOutput.cpp


示例8: playGame

void playGame(void)
{
    int len;
    struct packet p;

    while(1){
        uint8_t button = getInputRaw();
        sendButton(button);
        
        while(1){
            if( flags & FLAGS_LONG_RECV )
                len = nrf_rcv_pkt_time(64,sizeof(p),(uint8_t*)&p);
            else
                len = nrf_rcv_pkt_time(32,sizeof(p),(uint8_t*)&p);
                
            if(len==sizeof(p)){
                processPacket(&p);
            }else{
                break;
            }
        }
        int rnd = getRandom() % jitter;
        delayms(interval+rnd);
    };
}
开发者ID:tuxcodejohn,项目名称:r0ket,代码行数:25,代码来源:r_player.c


示例9: savePoint

    bool WirelessParser::findPacketInBytes(DataBuffer& data, WirelessTypes::Frequency freq)
    {
        //create a read save point for the DataBuffer
        ReadBufferSavePoint savePoint(&data);

        std::size_t lastReadPosition;

        //while there are enough bytes remaining to make an ASPP response packet
        while(data.bytesRemaining() > WirelessPacket::ASPP_MIN_RESPONSE_PACKET_SIZE)
        {
            lastReadPosition = data.readPosition();

            //move to the next byte
            data.read_uint8();

            WirelessPacket packet;

            //if we found a packet within the bytes
            if(parseAsPacket(data, packet, freq) == parsePacketResult_completePacket)
            {
                //commit the data that was read
                savePoint.commit();

                //process the packet
                processPacket(packet, lastReadPosition);
                return true;
            }
        }

        //we didn't find any packet in the bytes buffer
        return false;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:32,代码来源:WirelessParser.cpp


示例10: while

//
// bool processPackets()
// Last modified: 27Aug2006
//
// Attempts to process all packets received by the cell,
// returning true if successful, false otherwise.
//
// Returns:     true if successful, false otherwise
// Parameters:  <none>
//
bool Cell::processPackets()
{
    Packet p;
    while (msgQueue.dequeue(p))
        if (!processPacket(p)) return false;
    return true;
}   // processPackets()
开发者ID:dtbinh,项目名称:lego-rover-formation,代码行数:17,代码来源:Cell.cpp


示例11: savePoint

    bool InertialParser::findPacketInBytes(DataBuffer& data)
    {
        //create a read save point for the DataBuffer
        ReadBufferSavePoint savePoint(&data);

        //while there are enough bytes remaining to make a MIP packet
        while(data.bytesRemaining() > InertialPacketInfo::MIP_MIN_PACKET_SIZE)
        {
            //move to the next byte
            data.read_uint8();

            InertialPacket packet;

            //if we found a packet within the bytes
            if(parseAsPacket(data, packet) == inertialParserResult_completePacket)
            {
                //commit the data that was read
                savePoint.commit();

                //process the packet
                processPacket(packet);
                return true;
            }
        }

        //we didn't find any packet in the bytes buffer
        return false;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:28,代码来源:InertialParser.cpp


示例12: connection_handler

void* connection_handler(void* argsp) {
    //Get the socket descriptor
    struct threadArgs* args = argsp;
    int client_socket = args->sock, read_size;
    List* codeList = args->list;
    free(argsp);
    unsigned char* client_message = (unsigned char*) malloc(BUFFER_SIZE);
     
    //Receive a message from client
    while((read_size = recv(client_socket, client_message, BUFFER_SIZE-1, 0)) > 0) {

        client_message[read_size] = '\0';
        processPacket(client_socket, client_message, read_size, codeList);

    }

    free(client_message);
     
    if(read_size == 0) {
        puts("Client disconnected");
    } else if(read_size == -1){
        perror("recv failed");
    }
     
    return NULL;
}
开发者ID:BigNerd95,项目名称:Samote,代码行数:26,代码来源:RCR.c


示例13: packetPrinter

void packetPrinter (u_char *user, struct pcap_pkthdr *h, u_char *pp)
{
	int rc;
	nfs_pkt_t record;

	rc = processPacket (h, pp, &record);

}
开发者ID:yoursunny,项目名称:nfsdump,代码行数:8,代码来源:iprecord.c


示例14: Packet

Packet* IPReassembly::processPacket(RawPacket* fragment, ReassemblyStatus& status, ProtocolType parseUntil, OsiModelLayer parseUntilLayer)
{
	Packet* parsedFragment = new Packet(fragment, false, parseUntil, parseUntilLayer);
	Packet* result = processPacket(parsedFragment, status, parseUntil, parseUntilLayer);
	if (result != parsedFragment)
		delete parsedFragment;

	return result;
}
开发者ID:seladb,项目名称:PcapPlusPlus,代码行数:9,代码来源:IPReassembly.cpp


示例15: processPacket

void Server::receivePackets()
{
	for (auto client = clients.begin(); client != clients.end(); ++client)
	{
		sf::Packet p;
		if (client->receive(p))
			processPacket(p, client);
	}	
}	
开发者ID:knarf0,项目名称:mmo,代码行数:9,代码来源:Server.cpp


示例16: selectGame

uint8_t selectGame()
{  
    int len, i, selected;
    struct packet p;
    int a = 0;
    config.channel = ANNOUNCE_CHANNEL;
    memcpy(config.mac0, ANNOUNCE_MAC, 5);
    nrf_config_set(&config);

    gamecount = 0;
    for(i=0;i<60;i++){
        len= nrf_rcv_pkt_time(30, sizeof(p), (uint8_t*)&p);
        if (len==sizeof(p)){
            if( a ) a = 0; else a = 1;
            gpioSetValue (RB_LED2, a);
            processPacket(&p);
        }
    }
    selected = 0;
    while(1){
        showGames(selected);
        int key=getInputWait();
        getInputWaitRelease();
        switch(key){
            case BTN_DOWN:
                if( selected < gamecount-1 ){
                    selected++;
                }
                break;
            case BTN_UP:
                if( selected > 0 ){
                    selected--;
                }
                break;
            case BTN_LEFT:
                return 0;
            case BTN_ENTER:
            case BTN_RIGHT:
                if( gamecount == 0 )
                    return 0;
                gameId = games[selected].gameId;
                memcpy(config.txmac, games[selected].gameMac, 5);
                memcpy(config.mac0, games[selected].gameMac, 5);
                config.mac0[4]++;
                config.channel = games[selected].gameChannel;
                interval = games[selected].interval;
                jitter = games[selected].jitter;
                flags = games[selected].gameFlags;
                nrf_config_set(&config);
                if( games[selected].gameFlags & FLAGS_MASS_GAME )
                    return 1;
                else
                    return joinGame();
        }
    }
}
开发者ID:tuxcodejohn,项目名称:r0ket,代码行数:56,代码来源:r_player.c


示例17: processPacket

void Drf1600::onReadyRead()
{
	if (mCurrentCommand == Idle) {
		mSerialPort->read(mSerialPort->bytesAvailable());
		return;
	}
	if (mSerialPort->bytesAvailable() < mBytesExpected)
		return;
	processPacket(mSerialPort->read(mSerialPort->bytesAvailable()));
}
开发者ID:victronenergy,项目名称:dbus-cgwacs,代码行数:10,代码来源:drf1600.cpp


示例18: readPacket

bool RtspStreamWorker::processStream()
{
    bool ok;
    AVPacket packet = readPacket(&ok);
    if (!ok)
        return false;

    bool result = processPacket(packet);
    av_packet_unref(&packet);
    return result;
}
开发者ID:Wellsen,项目名称:bluecherry-client,代码行数:11,代码来源:RtspStreamWorker.cpp


示例19: main

/** Entry point. This is the first thing which is called after startup code.
  * This never returns. */
int main(void)
{
	initUsart();
	initAdc();
	initLcdAndInput();

	do
	{
		processPacket();
	} while (true);
}
开发者ID:BrotherPhil,项目名称:hardware-bitcoin-wallet,代码行数:13,代码来源:main.c


示例20: while

//
// bool processPackets()
// Last modified: 29Nov2009
//
// Handles incoming packets, returning true
// if successful, false otherwise.
//
// Returns:    true if successful, false otherwise
// Parameters: <none>
bool Robot::processPackets()
{
    bool   success = true;
    Packet p;
    while (!msgQueue.empty())
    {
        p = msgQueue.front();
        if (!processPacket(p)) success = false;
        msgQueue.pop();
		}
    return success;
}   // processPackets()
开发者ID:arrogantrobot,项目名称:CATALST-Robot-Formations-Simulator,代码行数:21,代码来源:Robot.cpp



注:本文中的processPacket函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ processParentFlags函数代码示例发布时间:2022-05-30
下一篇:
C++ processNode函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap