当前位置: 首页>>代码示例>>C++>>正文


C++ process_message函数代码示例

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


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

示例1: switch

void bronco::serverconnection::process_type(const size_t type)
{
    protocol::Confirm confirm;
    protocol::Config config;
    protocol::Peers peers;

    /* Perform operation determined by message type */
    switch (type) {
        case protocol::confirmtype:
            deserialize(confirm);
            process_message(confirm);
            break;

        case protocol::configtype:
            deserialize(config);
            process_message(config);
            break;

        case protocol::peerstype:
            deserialize(peers);
            process_message(peers);
            break;

        default:
            throw std::runtime_error("Unknown message type received");
            break;
    }
}
开发者ID:hundeboll,项目名称:bronco,代码行数:28,代码来源:serverconnection.cpp

示例2: pad_message

void pad_message(sha *op)
{
    int i;
    if(op->sub_count == 4)
    {
        ++(op->count);
        op->message[op->count] = 0x80000000;
    }
    else

    if(op->sub_count == 0)
        op->message[op->count] = 0x80000000;

    else
    {
        op->message[op->count] = ((op->message[op->count])<<8) | 0x80 ;
        ++(op->sub_count);
        while(op->sub_count!=4)
        {
            op->message[op->count] = ((op->message[op->count])<<8);
            ++(op->sub_count);
        }
    }


    if(op->count >13)
    {
        while(!((op->count == 15)&&(op->sub_count == 4)))
        {
            if((op->sub_count == 4)&&(op->count<15))
            {
                op->message[++(op->count)] = 0;
            }
            else
            {
                op->message[op->count] = (op->message[op->count]) << 8;
                ++(op->sub_count);
            }
        }
        process_message(op);

        for(i=0;i<16;++i)
            op->message[i] = 0;
    }

    op->message[14] = op->higher_count;
    op->message[15] = op->lower_count;

    process_message(op);
    op->completed = 1;
}
开发者ID:akshayhebbarys,项目名称:SHA1-calculator,代码行数:51,代码来源:sha_implementation.c

示例3: authentication_task

static void
authentication_task (void *parameter)
{
	TBouncerEnvelope Bouncer;
	(void) parameter;
	memset (&authentication_state, 0, sizeof (authentication_state));
	authentication_state.state = AUTHENTICATION_IDLE;
	
	
	while(1) {
		if (nRFCMD_WaitRx (10)) {
			
			do {
				vLedSetRed (1);
				// read packet from nRF chip
				nRFCMD_RegReadBuf (RD_RX_PLOAD, (unsigned char *) &Bouncer, sizeof (Bouncer));
				
				process_message(&Bouncer);
				
				vLedSetRed (0);
			} while ((nRFAPI_GetFifoStatus () & FIFO_RX_EMPTY) == 0);
			
			nRFAPI_GetFifoStatus();
		}
		nRFAPI_ClearIRQ (MASK_IRQ_FLAGS);
	}
}
开发者ID:bomma,项目名称:openbeacon,代码行数:27,代码来源:authentication.c

示例4: wrt_recv_cb

static void wrt_recv_cb(mrp_transport_t *t, void *data, void *user_data)
{
    pep_proxy_t *proxy = (pep_proxy_t *)user_data;
    char        *name  = proxy && proxy->name ? proxy->name : "<unknown>";
    msg_t       *msg;
    int          seqno;

    MRP_UNUSED(t);

    /*
      mrp_log_info("Message from WRT client %p:", proxy);
    */

    msg = json_decode_message(data);

    if (msg != NULL) {
        process_message(proxy, msg);
        msg_free_message(msg);
    }
    else {
        if (!mrp_json_get_integer(data, "seq", &seqno))
            seqno = 0;
        mrp_log_error("Failed to decode message from %s.", name);
        msg_send_nak(proxy, seqno, 1, "failed to decode message");
    }
}
开发者ID:sanyaade-mobiledev,项目名称:murphy,代码行数:26,代码来源:domain-control.c

示例5: while

	bool DisplayMessageQueue_X11::process(int timeout_ms)
	{
		auto end_time = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeout_ms);

		while (true)
		{
			process_message();
			process_queued_events(); // What is this? If its related to Event then it should be removed
			process_window_sockets(); // Same for this thing

			if (end_time <= std::chrono::steady_clock::now())
				break;

			int x11_handle = ConnectionNumber(display);

			struct timeval tv;
			if (timeout_ms > 0)
			{
				tv.tv_sec = timeout_ms / 1000;
				tv.tv_usec = (timeout_ms % 1000) * 1000;
			}
			else if (timeout_ms == 0)
			{
				tv.tv_sec = 0;
				tv.tv_usec = 0;
			}
			else
			{
				tv.tv_sec = 0x7FFFFFFF;
				tv.tv_usec = 0;
			}

			fd_set rfds;
			FD_ZERO(&rfds);

			FD_SET(x11_handle, &rfds);
			FD_SET(async_work_event.read_fd(), &rfds);
			FD_SET(exit_event.read_fd(), &rfds);

			int result = select(std::max(std::max(async_work_event.read_fd(), x11_handle), exit_event.read_fd()) + 1, &rfds, nullptr, nullptr, &tv);
			if (result > 0)
			{
				if (FD_ISSET(async_work_event.read_fd(), &rfds))
				{
					async_work_event.reset();
					process_async_work();
				}
				if (FD_ISSET(exit_event.read_fd(), &rfds))
				{
					exit_event.reset();
					return false;
				}
			}
			else
			{
				break;
			}
		}
		return true;
	}
开发者ID:ARMCoderCHS,项目名称:ClanLib,代码行数:60,代码来源:display_message_queue_x11.cpp

示例6: process_frame

static void process_frame(const char * const body)
{
   jsmn_parser parser;
   qword elapsed = time_ms();
   
   jsmn_init(&parser);
   int r = jsmn_parse(&parser, body, tokens, NUM_TOKENS);
   if(r != 0) 
   {
      _log(MAJOR, "Parser result %d.  Message discarded.", r);
      stats[NotRecog]++;
   }
   else
   {
      size_t messages, i, index;
      // Is it an array?
      if(tokens[0].type == JSMN_ARRAY)
      {
         messages = tokens[0].size;
         index = 1;
         _log(DEBUG, "STOMP message is array of %d TD messages.", messages);
      }
      else
      {
         messages = 1;
         index = 0;
         _log(DEBUG, "STOMP message contains a single TD message.");
      }

      for(i=0; i < messages && run; i++)
      {
         char area_id[4];
         word describer;
         jsmn_find_extract_token(body, tokens, index, "area_id", area_id, sizeof(area_id));

         stats[GoodMessage]++;
         message_count++;

         for(describer = 0; describer < DESCRIBERS; describer++)
         {
            if(!strcasecmp(area_id, describers[describer]))
            {
               process_message(describer, body, index);
               stats[RelMessage]++;
               message_count_rel++;
               describer = DESCRIBERS;
            }
         }
         
         size_t message_ends = tokens[index].end;
          do  index++; 
         while ( tokens[index].start < message_ends && tokens[index].start >= 0 && index < NUM_TOKENS);
      }
   }
   elapsed = time_ms() - elapsed;
   if(debug || elapsed > 2500)
   {
      _log(MINOR, "Frame took %s ms to process.", commas_q(elapsed));
   }
}
开发者ID:tinnerdxp,项目名称:openrail,代码行数:60,代码来源:tddb.c

示例7: clear_spell_targeter

void t_adventure_map_window::run_object_mover( t_counted_ptr<t_army_mover> mover,
											   bool allow_cancel )
{
	// a little paranoid self-reference if this window is closed during the move.
	t_window_ptr					ref = this;
	t_counted_ptr<t_adventure_map>	map = m_map;

	clear_spell_targeter();
	m_object_mover = mover;
	m_frame->reset_pathfinder();

	// override all the game's input
	// any mouse or key press will abort the move
	t_override_input input_handler;

	if (allow_cancel)
	{
		// override all the game's input
		// any mouse or key press will abort the move
		t_handler cancel_handler = bound_handler( *mover, &t_army_mover::cancel_move );

		input_handler.set_input_handler( cancel_handler );
	}
	// run one cycle before anything else happens.
	mover->on_idle();
	while ( !map->is_game_over() && !mover->is_done()) 
	{
		process_message();
	}
}
开发者ID:sundoom,项目名称:sunstudio,代码行数:30,代码来源:adventure_map_window.cpp

示例8: log

// Check if there's a handler for this message and call it, else
// discard message.
void sac_dispatch::operator()(meta_message_ptr& in)
{
	/** __no__ authentication at this point */

	uint mid = in->mid();

	log(1, "(sac) dispatching message with mid: ", mid);
	//
	// no thread safety because insertion should __only__ be made
	// on MIHF initialization
	//
	std::map<uint, handler_t>::iterator it;
	it = _callbacks.find(mid);

	if(it != _callbacks.end()) {
		handler_t process_message = it->second;
		meta_message_ptr out(new meta_message);

		out->tid(in->tid());
		// send response if it was generated
		if (process_message(in, out))
		 	_transmit(out);
        } else {
		log(1, "(sac) (warning) message with mid: ", mid,
		    " unknown, discarding.");
	}
}
开发者ID:shtrom,项目名称:odtone,代码行数:29,代码来源:service_access_controller.cpp

示例9: my_trans_data_in

/* returns error */
int DEFAULT_CC
my_trans_data_in(struct trans *trans)
{
    struct stream *s = (struct stream *)NULL;
    int id = 0;
    int size = 0;
    int error = 0;

    if (trans == 0)
    {
        return 0;
    }

    if (trans != g_con_trans)
    {
        return 1;
    }

    LOGM((LOG_LEVEL_DEBUG, "my_trans_data_in:"));
    s = trans_get_in_s(trans);
    in_uint32_le(s, id);
    in_uint32_le(s, size);
    error = trans_force_read(trans, size - 8);

    if (error == 0)
    {
        /* here, the entire message block is read in, process it */
        error = process_message();
    }

    return error;
}
开发者ID:eric011,项目名称:xrdp,代码行数:33,代码来源:chansrv.c

示例10: get_server_message

/* check if there's a message from the server */
void get_server_message () {
  int nr_active_sock, reclen, startptr = 0, msglen;

try_again:
  nr_active_sock = SDLNet_CheckSockets (theset, 1);
  if (nr_active_sock == 0) return;
  if (!SDLNet_SocketReady (thesock)) return;

  reclen = get_packet ();
  if (reclen == -1) return;
  if (reclen <= 0) {
    log_error ("Disconnected by the server!\n");
    exit_connection (EXIT_ALL);
    exit (1);
  }

  msglen = *((short *) (msgbuf + startptr + 1));
  msglen += 2;
  if (process_message(msgbuf+startptr, msglen) == 0) {
    /* something went wrong when processing our message. Log out. */
    exit_connection (EXIT_ALL);
    log_error ("Unable to process message");
    exit (1);
  }

  goto try_again;
}
开发者ID:BackupTheBerlios,项目名称:redknight,代码行数:28,代码来源:connection.c

示例11: client_read

//-----------------------------------------------------------------------------
static void client_read(TcpClient * socket, char *buf, int len)
{
	TcpClientState *state = tcpclient_get_user_data(socket);	
	
	int i = 0;
	while (i != len) {
		/* reading new msg */
		if (state->msg_size == 0) {
			state->msg_type = buf[i++];													
			state->msg_size = *(uint32_t*)(buf + i);				
			state->read_buf = realloc(state->read_buf, state->msg_size);
			state->num_read_bytes = 0;
			i += sizeof(uint32_t);				
		}
		
		int nbytes = state->msg_size - state->num_read_bytes;		
		int rbytes = (len - i) < nbytes ? (len - i) : nbytes;
		memcpy(state->read_buf + state->num_read_bytes, buf + i, rbytes);		
		i += rbytes;
		state->num_read_bytes += rbytes;		
			
		if (state->msg_type != TCP_MSG_NONE && state->num_read_bytes == state->msg_size) {						
			process_message(state);
			state->msg_size = 0;
			if (i != len) {
				printf("warning: more than one message per buffer (%d bytes).\n", len - i);				
			}
		}
	}		
}
开发者ID:pmurias,项目名称:Commander-Luke,代码行数:31,代码来源:tcp_client_state.c

示例12: main

int main(int argc, char **argv)
{
    option_define_bool("version", OPT_OPTIONAL, 0, NULL, version_cb, VERSION);
    option_define_bool("verbose", OPT_OPTIONAL, 0, &verbose, NULL, "verbose output (to stderr)");
    option_define_str("blacklist_fields", OPT_OPTIONAL, NULL, NULL, parse_blacklisted_fields, "comma separated list of fields to remove");
    option_define_str("encrypted_fields", OPT_OPTIONAL, NULL, NULL, parse_encrypted_fields, "comma separated list of fields to encrypt");
    option_define_str("expected_key", OPT_OPTIONAL, NULL, &expected_key, NULL, "key to expect in messages before echoing to clients");
    option_define_str("expected_value", OPT_OPTIONAL, NULL, &expected_value, NULL, "value to expect in --expected-key field in messages before echoing to clients");
    
    if (!option_parse_command_line(argc, argv)) {
        return 1;
    }
    
    if ( !!expected_key ^ !!expected_value ) {
        fprintf(stderr, "--expected-key and --expected-value must be used together\n");
        exit(1);
    }
    
    while (fgets(buf, BUF_SZ, stdin)) {
        msgRecv++;
        process_message(buf);
    }
    
    fprintf(stderr, "processed %lu lines, failed to parse %lu of them\n", msgRecv, msgFail);
    free_options();
    free_fields(blacklisted_fields, num_blacklisted_fields);
    free_fields(encrypted_fields, num_encrypted_fields);
    
    return 0;
}
开发者ID:GoCatalyst,项目名称:simplehttp,代码行数:30,代码来源:stream_filter.c

示例13: ACE_DEBUG

/// Implement its svc() hook method to perform the "half-sync"
int Echo_Task::svc(void)
{
  ACE_DEBUG((LM_INFO,
	     ACE_TEXT("(%t) Echo_task::svc\n")));

  while (1)
    {
      // Dequeueing messages (ACE_Message_Blocks obtained via ACE_Task::getq()) 
      // containing the client input that was put into its synchronized request queue
      ACE_Message_Block *mb = NULL;
      if (this->getq(mb) == -1)
	{
	  ACE_DEBUG((LM_INFO,
		     ACE_TEXT("(%t) Shutting down\n")));
	  break;
	}

      ACE_DEBUG((LM_INFO, 
		 ACE_TEXT("(%t) Call process_message\n")));

      process_message(mb);
    }

  return 0;
}
开发者ID:MrSparc,项目名称:mobilecloud-14,代码行数:26,代码来源:ConcurrentWebserver.cpp

示例14: ACE_TRACE

// Listing 1
// Listing 2 code/ch16
int
LF_ThreadPool::svc (void)
{
  ACE_TRACE (ACE_TEXT ("LF_ThreadPool::svc"));
  while (!done ())
    {
      become_leader ();  // Block until this thread is the leader.

      ACE_Message_Block *mb = NULL;
      ACE_Time_Value tv (LONG_TIME);
      tv += ACE_OS::gettimeofday ();

      // Get a message, elect new leader, then process message.
      if (this->getq (mb, &tv) < 0)
        {
          if (elect_new_leader () == 0)
            break;
          continue;
        }

      elect_new_leader ();
      process_message (mb);
    }

  return 0;
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:28,代码来源:LF_ThreadPool.cpp

示例15: generic_message

static DBusHandlerResult generic_message(DBusConnection *connection,
					DBusMessage *message, void *user_data)
{
	struct generic_data *data = user_data;
	struct interface_data *iface;
	const GDBusMethodTable *method;
	const char *interface;

	interface = dbus_message_get_interface(message);

	iface = find_interface(data->interfaces, interface);
	if (iface == NULL)
		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

	for (method = iface->methods; method &&
			method->name && method->function; method++) {
		if (dbus_message_is_method_call(message, iface->name,
							method->name) == FALSE)
			continue;

		if (dbus_message_has_signature(message,
						method->signature) == FALSE)
			continue;

		if (check_privilege(connection, message, method,
						iface->user_data) == TRUE)
			return DBUS_HANDLER_RESULT_HANDLED;

		return process_message(connection, message, method,
							iface->user_data);
	}

	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
开发者ID:593141477,项目名称:bluez-rda,代码行数:34,代码来源:object.c


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