예제 #1
0
static
void
master_link_rxmsg(dmsg_msg_t *msg)
{
	dmsg_state_t *state;
	dmsg_iocom_t *iocom;
	uint32_t cmd;

	/*
	 * If the message state has a function established we just
	 * call the function, otherwise we call the appropriate
	 * link-level protocol related to the original command and
	 * let it sort it out.
	 *
	 * Non-transactional one-off messages, on the otherhand,
	 * might have REPLY set.
	 */
	state = msg->state;
	iocom = state->iocom;
	cmd = (state != &iocom->state0) ? state->icmd : msg->any.head.cmd;

	if (state->func) {
		/*
		 * Call function or router
		 */
		assert(state != &iocom->state0);
		state->func(msg);
	} else {
		/*
		 * Top-level message
		 */
		switch(cmd & DMSGF_PROTOS) {
		case DMSG_PROTO_LNK:
			dmsg_msg_lnk(msg);
			break;
		case DMSG_PROTO_DBG:
			dmsg_msg_dbg(msg);
			break;
		default:
			iocom->usrmsg_callback(msg, 1);
			break;
		}
	}
}
예제 #2
0
static
void
master_link_rxmsg(dmsg_msg_t *msg)
{
	dmsg_state_t *state;
	uint32_t cmd;

	/*
	 * If the message state has a function established we just
	 * call the function, otherwise we call the appropriate
	 * link-level protocol related to the original command and
	 * let it sort it out.
	 *
	 * Non-transactional one-off messages, on the otherhand,
	 * might have REPLY set.
	 */
	state = msg->state;
	cmd = state ? state->icmd : msg->any.head.cmd;

	if (state && state->func) {
		assert(state->func != NULL);
		state->func(msg);
	} else {
		switch(cmd & DMSGF_PROTOS) {
		case DMSG_PROTO_LNK:
			dmsg_msg_lnk(msg);
			break;
		case DMSG_PROTO_DBG:
			dmsg_msg_dbg(msg);
			break;
		default:
			dmsg_msg_reply(msg, DMSG_ERR_NOSUPP);
			break;
		}
	}
}