FreeBSD/sys/netgraph/atm/uni/ng_uni.c
/*
 * Receive signal from USER.
 *
 * Repackage the data into one large buffer.
 */
Receive signal from USER.
Repackage the data into one large buffer.
Receive signal from USER . Repackage the data into one large buffer .
static int
ng_uni_rcvupper(hook_p hook, item_p item)
{
	node_p node = NG_HOOK_NODE(hook);
	struct priv *priv = NG_NODE_PRIVATE(node);
	struct mbuf *m;
	struct uni_arg arg;
	struct uni_msg *msg;
	int error;
	if (!priv->enabled) {
		NG_FREE_ITEM(item);
		return (ENOTCONN);
	}
	NGI_GET_M(item, m);
	NG_FREE_ITEM(item);
	if ((error = uni_msg_unpack_mbuf(m, &msg)) != 0) {
		m_freem(m);
		return (error);
	}
	m_freem(m);
	if (uni_msg_len(msg) < sizeof(arg)) {
		printf("%s: packet too short\n", __func__);
		uni_msg_destroy(msg);
		return (EINVAL);
	}
	bcopy(msg->b_rptr, &arg, sizeof(arg));
	msg->b_rptr += sizeof(arg);
	if (arg.sig >= UNIAPI_MAXSIG) {
		printf("%s: bogus signal\n", __func__);
		uni_msg_destroy(msg);
		return (EINVAL);
	}
	uni_uni_input(priv->uni, arg.sig, arg.cookie, msg);
	uni_work(priv->uni);
	return (0);
}
static int ng_uni_rcvupper ( hook_p hook , item_p item ) { node_p node = NG_HOOK_NODE ( hook ) ; struct priv * priv = NG_NODE_PRIVATE ( node ) ; struct mbuf * m ; struct uni_arg arg ; struct uni_msg * msg ; int error ; if ( ! priv -> enabled ) { NG_FREE_ITEM ( item ) ; return ( ENOTCONN ) ; } NGI_GET_M ( item , m ) ; NG_FREE_ITEM ( item ) ; if ( ( error = uni_msg_unpack_mbuf ( m , & msg ) ) != 0 ) { m_freem ( m ) ; return ( error ) ; } m_freem ( m ) ; if ( uni_msg_len ( msg ) < sizeof ( arg ) ) { printf ( " \n " , __func__ ) ; uni_msg_destroy ( msg ) ; return ( EINVAL ) ; } bcopy ( msg -> b_rptr , & arg , sizeof ( arg ) ) ; msg -> b_rptr += sizeof ( arg ) ; if ( arg . sig >= UNIAPI_MAXSIG ) { printf ( " \n " , __func__ ) ; uni_msg_destroy ( msg ) ; return ( EINVAL ) ; } uni_uni_input ( priv -> uni , arg . sig , arg . cookie , msg ) ; uni_work ( priv -> uni ) ; return ( 0 ) ; }
Receive signal from USER.
Receive signal from USER .