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


C++ meta_message_ptr::source方法代码示例

本文整理汇总了C++中meta_message_ptr::source方法的典型用法代码示例。如果您正苦于以下问题:C++ meta_message_ptr::source方法的具体用法?C++ meta_message_ptr::source怎么用?C++ meta_message_ptr::source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在meta_message_ptr的用法示例。


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

示例1: link_actions_request

// This message is handled by the Link SAP.
//
// If this MIHF is the destination of the message, forward it to the
// default Link SAP. If not then forward it to a peer MIHF.
bool command_service::link_actions_request(meta_message_ptr &in,
					   meta_message_ptr &out)
{
	log(1, "(mics) received a Link_Actions.request from",
	    in->source().to_string());

	if(utils::this_mihf_is_destination(in)) {
		//
		// Kick this message to MIH_Link SAP.
		//
		// The solution found to handle this corner case in the
		// 802.21 standard was to send the message, as is, to the
		// link sap.
		//
		in->destination(mih::id("link"));
		_lpool.add(in);
		in->source(mihfid);
		_transmit(in);

		return false;
	} else {
		utils::forward_request(in, _lpool, _transmit);
		return false;
	}

	return false;
}
开发者ID:shtrom,项目名称:odtone,代码行数:31,代码来源:command_service.cpp

示例2: link_get_parameters_confirm

/**
 * Link Get Parameters Confirm message handler.
 *
 * @param in input message.
 * @param out output message.
 * @return true if the response is sent immediately or false otherwise.
 */
bool command_service::link_get_parameters_confirm(meta_message_ptr &in,
						   meta_message_ptr &out)
{
	ODTONE_LOG(1, "(mics) received Link_Get_Parameters.confirm from ",
	    in->source().to_string());

	_link_abook.reset(in->source().to_string());

	if(_lpool.set_user_tid(in)) {
		mih::status st;
		boost::optional<mih::link_param_list> lpl;
		boost::optional<mih::link_states_rsp_list> lsrl;
		boost::optional<mih::link_desc_rsp_list> ldrl;

		*in >> mih::confirm(mih::confirm::link_get_parameters)
		       & mih::tlv_status(st)
		       & mih::tlv_link_parameters_status_list(lpl)
		       & mih::tlv_link_states_rsp(lsrl)
		       & mih::tlv_link_descriptor_rsp(ldrl);

		if(st == mih::status_success) {
			mih::link_status_rsp link_status;

			link_status.states_rsp_list = lsrl.get();
			link_status.param_list = lpl.get();
			link_status.desc_rsp_list = ldrl.get();

			_lrpool.add(in->source().to_string(),
			           in->tid(),
			           link_status);
		}

		return false;
	}
开发者ID:ATNoG,项目名称:EMICOM,代码行数:41,代码来源:command_service.cpp

示例3: link_get_parameters_request

// This message is handled by the Link SAP.
//
// If this MIHF is the destination of the message, forward it to the
// default Link SAP. If not then forward it to a peer MIHF.
bool command_service::link_get_parameters_request(meta_message_ptr &in,
						  meta_message_ptr &out)
{
	log(1, "(mics) received a Link_Get_Parameters.request from",
	    in->source().to_string());


	if(utils::this_mihf_is_destination(in)) {
		//
		// Kick this message to MIH_Link SAP.
		//
		// The solution found to handle this corner case in the
		// 802.21 standard was to send the message, as is, to the
		// link sap.
		//
		// local_transactions was made to handle request's
		// from users to peer mihf's but in this case we add an
		// entry to handle the MIH_Link_Get_Parameters and
		// Link_Get_Parameters.
		//
		in->destination(mih::id("link"));
		_lpool.add(in);
		in->source(mihfid);
		_transmit(in);

		return false;
	} else {
		utils::forward_request(in, _lpool, _transmit);
		return false;
	}

	return false;
}
开发者ID:shtrom,项目名称:odtone,代码行数:37,代码来源:command_service.cpp

示例4: operator

/**
 * Checks, in the transaction pool, if the incoming message belongs to a pending
 * transaction. If true it runs the transaction, otherwise it creates a new
 * transaction.
 *
 * @param in The input message.
 */
void message_in::operator()(meta_message_ptr& in)
{
	// TODO: FIXME: check page 143 when adding support for fragment payload
	if ((in->ackrsp() && (in->opcode() == mih::operation::request || in->opcode() == mih::operation::indication))
		    ||
	   (!in->ackrsp() && in->opcode() == mih::operation::response)
	        ||
	   (in->ackrsp() && in->opcode() == mih::operation::response && in->has_service_specific_tlv()))
	{		
		// src
		src_transaction_ptr t;
		_tpool.find(in->source(), in->tid(), t);

		if (t) {
			t->in = in;
			t->msg_in_avail = true;

			if (t->start_ack_requestor)
				t->ack_requestor();

			if (t->start_ack_responder)
				t->ack_responder();

			if(t->transaction_status == ONGOING)
				if(!(in->ackrsp() == true && in->opcode() == mih::operation::request))
					t->run();

			if (t->transaction_status != ONGOING && t->ack_requestor_status != ONGOING)
				_tpool.del(t);
		} else {
			new_dst_transaction(in);
		}
	} else {
		dst_transaction_ptr t;
		_tpool.find(in->source(), in->tid(), t);

		if (t) {
			t->in = in;
			t->msg_in_avail = true;

			if (t->start_ack_requestor)
				t->ack_requestor();

			if(t->transaction_status == ONGOING)
				t->run();

			if (t->start_ack_responder && t->transaction_status == ONGOING)
				t->ack_responder();

			if (t->transaction_status != ONGOING && t->ack_requestor_status != ONGOING)
				_tpool.del(t);
		} else {
			new_dst_transaction(in);
		}
        }
}
开发者ID:ATNoG,项目名称:EMICOM,代码行数:63,代码来源:message_in.cpp

示例5: link_capability_discover_request

/**
 * Asks for the capabilities of all local Link SAPs.
 *
 * @param in The input message.
 * @param out The output message.
 * @return Always false, because it does not send any response directly.
 */
bool service_management::link_capability_discover_request(meta_message_ptr &in,
														  meta_message_ptr &out)
{
	// Asks for local Link SAPs capabilities
	ODTONE_LOG(1, "(mism) gathering information about local Link SAPs capabilities");

	*out << mih::request(mih::request::capability_discover);
	out->tid(in->tid());
	out->destination(in->source());

	// Check if the Link SAP is still active
	uint16 fails = _link_abook.fail(out->destination().to_string());
	if(fails > kConf_MIHF_Link_Delete_Value) {
		mih::octet_string dst = out->destination().to_string();
		_link_abook.inactive(dst);

		// Update MIHF capabilities
		utils::update_local_capabilities(_abook, _link_abook, _user_abook);
	}
	else {
		ODTONE_LOG(1, "(mics) forwarding Link_Capability_Discover.request to ",
			out->destination().to_string());
		utils::forward_request(out, _lpool, _transmit);
	}

	return false;
}
开发者ID:ATNoG,项目名称:ODTONE,代码行数:34,代码来源:service_management.cpp

示例6: generic_command_response

//
// Currently Command_Service messages are handled by a default local
// user. If this MIHF is the destination of the message, check for a
// pending transaction and forward the message.
//
bool command_service::generic_command_response(const char *recv_msg,
					       const char *send_msg,
					       meta_message_ptr &in,
					       meta_message_ptr &out)
{
	log(1, recv_msg, in->source().to_string());

	if(utils::this_mihf_is_destination(in)) {
		//
		// Kick this message to default MIH User as an indication
		//
		log(1, send_msg);
		in->opcode(mih::operation::confirm);
		in->destination(mih::id("user"));
		//
		// source identifier is the remote MIHF
		//
		_transmit(in);

		return false;
	} else {
		utils::forward_request(in, _lpool, _transmit);
		return false;
	}

}
开发者ID:shtrom,项目名称:odtone,代码行数:31,代码来源:command_service.cpp

示例7: sac_process_message

/**
 * Check if there's a handler for this message and call it, else
 * discard message.
 *
 * @param in The input message.
 * @param out The output message.
 */
bool sac_process_message(meta_message_ptr& in, meta_message_ptr& out)
{
	// discard messages that this MIHF broadcasted to itself
	// discard messages that are not destined to this MIHF or if
	// multicast messages are not supported
	if(in->source() == mihfid) {
		ODTONE_LOG(1, "(sac) Discarding message! Reason: ",
					  "message was broadcasted to itself");
		return false;
	}

	if(!utils::this_mihf_is_destination(in) && !utils::is_multicast(in)) {
		ODTONE_LOG(1, "(sac) Discarding message! Reason: ",
					  "this is not the message destination");
		return false;
	}

	/** __no__ authentication at this point */

	uint mid = in->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;

		bool rsp;

		try {

			rsp = process_message(in, out);

		} catch(mih::bad_tlv) {
			ODTONE_LOG(1, "Discarding malformed message.");
			return false;
		}

		// set ip and port of response message
		out->ip(in->ip());
		out->scope(in->scope());
		out->port(in->port());

		// response message must have the same tid
		out->tid(in->tid());

		return rsp;
	} else {
		ODTONE_LOG(1, "(sac) (warning) message with mid: ", mid,
		    " unknown, discarding.");
	}

	return false;
}
开发者ID:ATNoG,项目名称:ODTONE,代码行数:65,代码来源:service_access_controller.cpp

示例8: piggyback_capabilities

/**
 * Piggyback local MIHF Capabilities in request message.
 *
 * @param in input message.
 * @param out output message.
 */
void service_management::piggyback_capabilities(meta_message_ptr& in,
												meta_message_ptr& out)
{
	// Get local capabilities
	address_entry mihf_cap = _abook.get(mihfid_t::instance()->to_string());

	*out << mih::request(mih::request::capability_discover)
			& mih::tlv_net_type_addr_list(mihf_cap.capabilities_list_net_type_addr)
			& mih::tlv_event_list(mihf_cap.capabilities_event_list)
			& mih::tlv_command_list(mihf_cap.capabilities_cmd_list)
			& mih::tlv_query_type_list(mihf_cap.capabilities_query_type)
			& mih::tlv_transport_option_list(mihf_cap.capabilities_trans_list)
			& mih::tlv_mbb_ho_supp_list(mihf_cap.capabilities_mbb_ho_supp);

	out->tid(in->tid());
	out->source(in->source());
	out->destination(in->destination());
}
开发者ID:ATNoG,项目名称:ODTONE,代码行数:24,代码来源:service_management.cpp

示例9: link_down_indication

// log received message type, and forward it
bool event_service::link_down_indication(meta_message_ptr &in, meta_message_ptr&)
{
	// if(in->payload().size() == 0)
	// 	return false;
	log(1, "(mies) received Link_Down.indication from ",
	    in->source().to_string());

	link_event_forward(in, mih::link_down);

	return false;
}
开发者ID:shtrom,项目名称:odtone,代码行数:12,代码来源:event_service.cpp

示例10: link_actions_response

// Check if there's a pending transaction and forward the message in
// case there is.
bool command_service::link_actions_response(meta_message_ptr &in,
					    meta_message_ptr &out)
{
	log(1, "(mics) received Link_Actions.response from ",
	    in->source().to_string());

	if(!_lpool.set_user_tid(in))
		{
			log(1, "(mics) no local pending transaction for this message, discarding");
			return false;
		}

	in->source(mihfid);

	log(1, "(mics) forwarding Link_Actions.response to ", in->destination().to_string());

	_transmit(in);

	return false;
}
开发者ID:shtrom,项目名称:odtone,代码行数:22,代码来源:command_service.cpp

示例11: link_configure_thresholds_response

// Check if there's a pending transaction and forward the message in
// case there is.
bool command_service::link_configure_thresholds_response(meta_message_ptr &in,
							 meta_message_ptr &out)
{
	log(1, "(mics) received Link_Configure_Thresholds.response from ",
	    in->source().to_string());

	if(!_lpool.set_user_tid(in)) {
		log(1, "(mics) warning: no local transaction for this msg ",
		    "discarding it");
		return false;
	}

	in->source(mihfid);

	log(1, "(mics) forwarding Link_Configure_Thresholds.response to ", in->destination().to_string());

	_transmit(in);

	return false;
}
开发者ID:shtrom,项目名称:odtone,代码行数:22,代码来源:command_service.cpp

示例12: link_pdu_transmit_status_indication

bool event_service::link_pdu_transmit_status_indication(meta_message_ptr &in,
							meta_message_ptr&)
{
	// if(in->payload().size() == 0)
	// 	return false;
	log(1, "(mies) received Link_PDU_Transmit_Status.indication from ",
	    in->source().to_string());

	link_event_forward(in, mih::link_pdu_transmit_status);

	return false;
}
开发者ID:shtrom,项目名称:odtone,代码行数:12,代码来源:event_service.cpp

示例13: local_event_unsubscribe_request

// This MIHF is the destination of the Event_Unsubscribe.request.
// Deserialize message, unsubscribe user and send a response
bool event_service::local_event_unsubscribe_request(meta_message_ptr &in,
						    meta_message_ptr &out)
{
	mih::status st;
	mih::link_tuple_id link;
	mih::event_list events;

	*in >> mih::request(mih::request::event_unsubscribe)
		& mih::tlv_link_identifier(link)
		& mih::tlv_event_list(events);

	st = unsubscribe(in->source(), link, events);

	*out << mih::response(mih::response::event_unsubscribe)
		& mih::tlv_status(st)
		& mih::tlv_link_identifier(link)
		& mih::tlv_event_list(events);

	out->tid(in->tid());
	out->destination(in->source());

	return true;
}
开发者ID:shtrom,项目名称:odtone,代码行数:25,代码来源:event_service.cpp

示例14: event_subscribe_request

// Check if this MIHF is the destination of the message or if it needs
// to forward the message to a peer MIHF.
bool event_service::event_subscribe_request(meta_message_ptr &in,
					    meta_message_ptr &out)
{
	log(1, "(mies) received Event_Subscribe.request from ",
	    in->source().to_string());

	if (utils::this_mihf_is_destination(in))  {
		return local_event_subscribe_request(in, out);
	} else {
		utils::forward_request(in, _lpool, _transmit);
		return false;
	}

	return false;
}
开发者ID:shtrom,项目名称:odtone,代码行数:17,代码来源:event_service.cpp

示例15: msg_forward

// send message for all users subscribed to event from link identifier
void event_service::msg_forward(meta_message_ptr &msg,
				mih::link_tuple_id &li,
				mih::event_list_enum event)
{
	std::list<event_registration_t>::iterator it;
	int i = 0; // for logging purposes

	msg->source(mihfid);
	for(it = _event_subscriptions.begin();
	    it != _event_subscriptions.end();
	    it++, i++) {
		if ((it->event == event)  &&(it->link == li)) {
			log(3, i, " (mies) found registration of user: ",
			    it->user, " for event type ", event);
			msg->destination(mih::id(it->user));
			_transmit(msg);
		}
	}
}
开发者ID:shtrom,项目名称:odtone,代码行数:20,代码来源:event_service.cpp


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