FreeBSD kernel netgraph code
netgraph.h File Reference
#include <sys/queue.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/refcount.h>
Include dependency graph for netgraph.h:

Go to the source code of this file.

Data Structures

struct  ng_hook
 
struct  ng_queue
 
struct  ng_node
 
struct  ng_apply_info
 
struct  ng_item
 
struct  ng_cmdlist
 
struct  ng_type
 
struct  ng_tag_prio
 

Macros

#define NG_SEPARATE_MALLOC   /* make modules use their own malloc types */
 
#define _NG_ABI_VERSION   12
 
#define NG_ABI_VERSION   _NG_ABI_VERSION
 
#define HK_INVALID   0x0001 /* don't trust it! */
 
#define HK_QUEUE   0x0002 /* queue for later delivery */
 
#define HK_FORCE_WRITER   0x0004 /* Incoming data queued as a writer */
 
#define HK_DEAD   0x0008 /* This is the dead hook.. don't free */
 
#define HK_HI_STACK   0x0010 /* Hook has hi stack usage */
 
#define HK_TO_INBOUND   0x0020 /* Hook on ntw. stack inbound path. */
 
#define _NG_HOOK_REF(hook)   refcount_acquire(&(hook)->hk_refs)
 
#define _NG_HOOK_NAME(hook)   ((hook)->hk_name)
 
#define _NG_HOOK_UNREF(hook)   ng_unref_hook(hook)
 
#define _NG_HOOK_SET_PRIVATE(hook, val)   do {(hook)->hk_private = val;} while (0)
 
#define _NG_HOOK_SET_RCVMSG(hook, val)   do {(hook)->hk_rcvmsg = val;} while (0)
 
#define _NG_HOOK_SET_RCVDATA(hook, val)   do {(hook)->hk_rcvdata = val;} while (0)
 
#define _NG_HOOK_PRIVATE(hook)   ((hook)->hk_private)
 
#define _NG_HOOK_NOT_VALID(hook)   ((hook)->hk_flags & HK_INVALID)
 
#define _NG_HOOK_IS_VALID(hook)   (!((hook)->hk_flags & HK_INVALID))
 
#define _NG_HOOK_NODE(hook)   ((hook)->hk_node) /* only rvalue! */
 
#define _NG_HOOK_PEER(hook)   ((hook)->hk_peer) /* only rvalue! */
 
#define _NG_HOOK_FORCE_WRITER(hook)    do { hook->hk_flags |= HK_FORCE_WRITER; } while (0)
 
#define _NG_HOOK_FORCE_QUEUE(hook)   do { hook->hk_flags |= HK_QUEUE; } while (0)
 
#define _NG_HOOK_SET_TO_INBOUND(hook)    do { hook->hk_flags |= HK_TO_INBOUND; } while (0)
 
#define _NG_HOOK_HI_STACK(hook)   do { hook->hk_flags |= HK_HI_STACK; } while (0)
 
#define NG_PEER_NODE(hook)   NG_HOOK_NODE(NG_HOOK_PEER(hook))
 
#define NG_PEER_HOOK_NAME(hook)   NG_HOOK_NAME(NG_HOOK_PEER(hook))
 
#define NG_PEER_NODE_NAME(hook)   NG_NODE_NAME(NG_PEER_NODE(hook))
 
#define NG_HOOK_REF(hook)   _NG_HOOK_REF(hook)
 
#define NG_HOOK_NAME(hook)   _NG_HOOK_NAME(hook)
 
#define NG_HOOK_UNREF(hook)   _NG_HOOK_UNREF(hook)
 
#define NG_HOOK_SET_PRIVATE(hook, val)   _NG_HOOK_SET_PRIVATE(hook, val)
 
#define NG_HOOK_SET_RCVMSG(hook, val)   _NG_HOOK_SET_RCVMSG(hook, val)
 
#define NG_HOOK_SET_RCVDATA(hook, val)   _NG_HOOK_SET_RCVDATA(hook, val)
 
#define NG_HOOK_PRIVATE(hook)   _NG_HOOK_PRIVATE(hook)
 
#define NG_HOOK_NOT_VALID(hook)   _NG_HOOK_NOT_VALID(hook)
 
#define NG_HOOK_IS_VALID(hook)   _NG_HOOK_IS_VALID(hook)
 
#define NG_HOOK_NODE(hook)   _NG_HOOK_NODE(hook)
 
#define NG_HOOK_PEER(hook)   _NG_HOOK_PEER(hook)
 
#define NG_HOOK_FORCE_WRITER(hook)   _NG_HOOK_FORCE_WRITER(hook)
 
#define NG_HOOK_FORCE_QUEUE(hook)   _NG_HOOK_FORCE_QUEUE(hook)
 
#define NG_HOOK_SET_TO_INBOUND(hook)   _NG_HOOK_SET_TO_INBOUND(hook)
 
#define NG_HOOK_HI_STACK(hook)   _NG_HOOK_HI_STACK(hook)
 
#define NGF_INVALID   0x00000001 /* free when refs go to 0 */
 
#define NG_INVALID   NGF_INVALID /* compat for old code */
 
#define NGF_FORCE_WRITER   0x00000004 /* Never multithread this node */
 
#define NG_FORCE_WRITER   NGF_FORCE_WRITER /* compat for old code */
 
#define NGF_CLOSING   0x00000008 /* ng_rmnode() at work */
 
#define NG_CLOSING   NGF_CLOSING /* compat for old code */
 
#define NGF_REALLY_DIE   0x00000010 /* "persistent" node is unloading */
 
#define NG_REALLY_DIE   NGF_REALLY_DIE /* compat for old code */
 
#define NGF_HI_STACK   0x00000020 /* node has hi stack usage */
 
#define NGF_TYPE1   0x10000000 /* reserved for type specific storage */
 
#define NGF_TYPE2   0x20000000 /* reserved for type specific storage */
 
#define NGF_TYPE3   0x40000000 /* reserved for type specific storage */
 
#define NGF_TYPE4   0x80000000 /* reserved for type specific storage */
 
#define _NG_NODE_NAME(node)   ((node)->nd_name + 0)
 
#define _NG_NODE_HAS_NAME(node)   ((node)->nd_name[0] + 0)
 
#define _NG_NODE_ID(node)   ((node)->nd_ID + 0)
 
#define _NG_NODE_REF(node)   refcount_acquire(&(node)->nd_refs)
 
#define _NG_NODE_UNREF(node)   ng_unref_node(node)
 
#define _NG_NODE_SET_PRIVATE(node, val)   do {(node)->nd_private = val;} while (0)
 
#define _NG_NODE_PRIVATE(node)   ((node)->nd_private)
 
#define _NG_NODE_IS_VALID(node)   (!((node)->nd_flags & NGF_INVALID))
 
#define _NG_NODE_NOT_VALID(node)   ((node)->nd_flags & NGF_INVALID)
 
#define _NG_NODE_NUMHOOKS(node)   ((node)->nd_numhooks + 0) /* rvalue */
 
#define _NG_NODE_FORCE_WRITER(node)    do{ node->nd_flags |= NGF_FORCE_WRITER; }while (0)
 
#define _NG_NODE_HI_STACK(node)    do{ node->nd_flags |= NGF_HI_STACK; }while (0)
 
#define _NG_NODE_REALLY_DIE(node)    do{ node->nd_flags |= (NGF_REALLY_DIE|NGF_INVALID); }while (0)
 
#define _NG_NODE_REVIVE(node)    do { node->nd_flags &= ~NGF_INVALID; } while (0)
 
#define _NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)
 
#define NG_NODE_NAME(node)   _NG_NODE_NAME(node)
 
#define NG_NODE_HAS_NAME(node)   _NG_NODE_HAS_NAME(node)
 
#define NG_NODE_ID(node)   _NG_NODE_ID(node)
 
#define NG_NODE_REF(node)   _NG_NODE_REF(node)
 
#define NG_NODE_UNREF(node)   _NG_NODE_UNREF(node)
 
#define NG_NODE_SET_PRIVATE(node, val)   _NG_NODE_SET_PRIVATE(node, val)
 
#define NG_NODE_PRIVATE(node)   _NG_NODE_PRIVATE(node)
 
#define NG_NODE_IS_VALID(node)   _NG_NODE_IS_VALID(node)
 
#define NG_NODE_NOT_VALID(node)   _NG_NODE_NOT_VALID(node)
 
#define NG_NODE_FORCE_WRITER(node)   _NG_NODE_FORCE_WRITER(node)
 
#define NG_NODE_HI_STACK(node)   _NG_NODE_HI_STACK(node)
 
#define NG_NODE_REALLY_DIE(node)   _NG_NODE_REALLY_DIE(node)
 
#define NG_NODE_NUMHOOKS(node)   _NG_NODE_NUMHOOKS(node)
 
#define NG_NODE_REVIVE(node)   _NG_NODE_REVIVE(node)
 
#define NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)    _NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)
 
#define NGQF_TYPE   0x03 /* MASK of content definition */
 
#define NGQF_MESG   0x00 /* the queue element is a message */
 
#define NGQF_DATA   0x01 /* the queue element is data */
 
#define NGQF_FN   0x02 /* the queue element is a function */
 
#define NGQF_FN2   0x03 /* the queue element is a new function */
 
#define NGQF_RW   0x04 /* MASK for wanted queue mode */
 
#define NGQF_READER   0x04 /* wants to be a reader */
 
#define NGQF_WRITER   0x00 /* wants to be a writer */
 
#define NGQF_QMODE   0x08 /* MASK for how it was queued */
 
#define NGQF_QREADER   0x08 /* was queued as a reader */
 
#define NGQF_QWRITER   0x00 /* was queued as a writer */
 
#define _NGI_M(i)   ((i)->body.da_m)
 
#define _NGI_MSG(i)   ((i)->body.msg.msg_msg)
 
#define _NGI_RETADDR(i)   ((i)->body.msg.msg_retaddr)
 
#define _NGI_FN(i)   ((i)->body.fn.fn_fn.fn_fn)
 
#define _NGI_FN2(i)   ((i)->body.fn.fn_fn.fn_fn2)
 
#define _NGI_ARG1(i)   ((i)->body.fn.fn_arg1)
 
#define _NGI_ARG2(i)   ((i)->body.fn.fn_arg2)
 
#define _NGI_NODE(i)   ((i)->el_dest)
 
#define _NGI_HOOK(i)   ((i)->el_hook)
 
#define _NGI_SET_HOOK(i, h)   do { _NGI_HOOK(i) = h; h = NULL;} while (0)
 
#define _NGI_CLR_HOOK(i)
 
#define _NGI_SET_NODE(i, n)   do { _NGI_NODE(i) = n; n = NULL;} while (0)
 
#define _NGI_CLR_NODE(i)
 
#define NGI_M(i)   _NGI_M(i)
 
#define NGI_MSG(i)   _NGI_MSG(i)
 
#define NGI_RETADDR(i)   _NGI_RETADDR(i)
 
#define NGI_FN(i)   _NGI_FN(i)
 
#define NGI_FN2(i)   _NGI_FN2(i)
 
#define NGI_ARG1(i)   _NGI_ARG1(i)
 
#define NGI_ARG2(i)   _NGI_ARG2(i)
 
#define NGI_NODE(i)   _NGI_NODE(i)
 
#define NGI_HOOK(i)   _NGI_HOOK(i)
 
#define NGI_SET_HOOK(i, h)   _NGI_SET_HOOK(i,h)
 
#define NGI_CLR_HOOK(i)   _NGI_CLR_HOOK(i)
 
#define NGI_SET_NODE(i, n)   _NGI_SET_NODE(i,n)
 
#define NGI_CLR_NODE(i)   _NGI_CLR_NODE(i)
 
#define NG_FREE_ITEM(item)   ng_free_item((item))
 
#define SAVE_LINE(item)   do {} while (0)
 
#define NGI_GET_M(i, m)
 
#define NGI_GET_MSG(i, m)
 
#define NGI_GET_NODE(i, n)
 
#define NGI_GET_HOOK(i, h)
 
#define NGI_SET_WRITER(i)   ((i)->el_flags &= ~NGQF_QMODE)
 
#define NGI_SET_READER(i)   ((i)->el_flags |= NGQF_QREADER)
 
#define NGI_QUEUED_READER(i)   ((i)->el_flags & NGQF_QREADER)
 
#define NGI_QUEUED_WRITER(i)   (((i)->el_flags & NGQF_QMODE) == NGQF_QWRITER)
 
#define NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags)
 
#define NG_FWD_ITEM_HOOK(error, item, hook)    NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, NG_NOFLAGS)
 
#define NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, flags)
 
#define NG_FWD_NEW_DATA(error, item, hook, m)    NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, NG_NOFLAGS)
 
#define NG_SEND_DATA_FLAGS(error, hook, m, flags)
 
#define NG_SEND_DATA_ONLY(error, hook, m)    NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)
 
#define NG_SEND_DATA(error, hook, m, x)    NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)
 
#define NG_FREE_MSG(msg)
 
#define NG_FREE_M(m)
 
#define NG_SEND_MSG_HOOK(error, here, msg, hook, retaddr)
 
#define NG_SEND_MSG_PATH(error, here, msg, path, retaddr)
 
#define NG_SEND_MSG_ID(error, here, msg, ID, retaddr)
 
#define NG_FWD_MSG_HOOK(error, here, item, hook, retaddr)
 
#define NG_RESPOND_MSG(error, here, item, resp)
 
#define NETGRAPH_INIT_ORDERED(typename, typestructp, sub, order)
 
#define NETGRAPH_INIT(tn, tp)    NETGRAPH_INIT_ORDERED(tn, tp, SI_SUB_PSEUDO, SI_ORDER_MIDDLE)
 
#define ng_callout_init(c)   callout_init(c, 1)
 
#define NG_NOFLAGS   0x00000000 /* no special options */
 
#define NG_QUEUE   0x00000001 /* enqueue item, don't dispatch */
 
#define NG_WAITOK   0x00000002 /* use M_WAITOK, etc. */
 
#define NG_PROGRESS   0x00000004 /* return EINPROGRESS if queued */
 
#define NG_REUSE_ITEM   0x00000008 /* supplied item should be reused */
 
#define NG_TAG_PRIO   1
 
#define NG_PRIO_CUTOFF   32
 
#define NG_PRIO_LINKSTATE   64
 
#define _NGI_META(i)   NULL
 
#define NGI_META(i)   NULL
 
#define NG_FREE_META(meta)
 
#define NGI_GET_META(i, m)
 
#define ng_copy_meta(meta)   NULL
 
#define NG_OUTBOUND_THREAD_REF()    curthread->td_ng_outbound++
 
#define NG_OUTBOUND_THREAD_UNREF()
 

Typedefs

typedef struct ng_itemitem_p
 
typedef struct ng_nodenode_p
 
typedef struct ng_hookhook_p
 
typedef struct ng_item const * item_cp
 
typedef struct ng_hook const * hook_cp
 
typedef struct ng_node const * node_cp
 
typedef int ng_constructor_t(node_p node)
 
typedef int ng_close_t(node_p node)
 
typedef int ng_shutdown_t(node_p node)
 
typedef int ng_newhook_t(node_p node, hook_p hook, const char *name)
 
typedef hook_p ng_findhook_t(node_p node, const char *name)
 
typedef int ng_connect_t(hook_p hook)
 
typedef int ng_rcvmsg_t(node_p node, item_p item, hook_p lasthook)
 
typedef int ng_rcvdata_t(hook_p hook, item_p item)
 
typedef int ng_disconnect_t(hook_p hook)
 
typedef int ng_rcvitem(node_p node, hook_p hook, item_p item)
 
typedef int ng_fn_eachhook(hook_p hook, void *arg)
 
typedef void ng_item_fn(node_p node, hook_p hook, void *arg1, int arg2)
 
typedef int ng_item_fn2(node_p node, struct ng_item *item, hook_p hook)
 
typedef void ng_apply_t(void *context, int error)
 
typedef void * meta_p
 

Functions

void ng_unref_hook (hook_p hook)
 
void ng_unref_node (node_p node)
 
 MALLOC_DECLARE (M_NETGRAPH)
 
 MALLOC_DECLARE (M_NETGRAPH_MSG)
 
int ng_address_ID (node_p here, item_p item, ng_ID_t ID, ng_ID_t retaddr)
 
int ng_address_hook (node_p here, item_p item, hook_p hook, ng_ID_t retaddr)
 
int ng_address_path (node_p here, item_p item, const char *address, ng_ID_t raddr)
 
int ng_bypass (hook_p hook1, hook_p hook2)
 
hook_p ng_findhook (node_p node, const char *name)
 
struct ng_typeng_findtype (const char *type)
 
int ng_make_node_common (struct ng_type *typep, node_p *nodep)
 
int ng_name_node (node_p node, const char *name)
 
node_p ng_name2noderef (node_p node, const char *name)
 
int ng_newtype (struct ng_type *tp)
 
ng_ID_t ng_node2ID (node_cp node)
 
item_p ng_package_data (struct mbuf *m, int flags)
 
item_p ng_package_msg (struct ng_mesg *msg, int flags)
 
item_p ng_package_msg_self (node_p here, hook_p hook, struct ng_mesg *msg)
 
void ng_replace_retaddr (node_p here, item_p item, ng_ID_t retaddr)
 
int ng_rmhook_self (hook_p hook)
 
int ng_rmnode_self (node_p here)
 
int ng_rmtype (struct ng_type *tp)
 
int ng_snd_item (item_p item, int queue)
 
int ng_send_fn (node_p node, hook_p hook, ng_item_fn *fn, void *arg1, int arg2)
 
int ng_send_fn1 (node_p node, hook_p hook, ng_item_fn *fn, void *arg1, int arg2, int flags)
 
int ng_send_fn2 (node_p node, hook_p hook, item_p pitem, ng_item_fn2 *fn, void *arg1, int arg2, int flags)
 
int ng_uncallout (struct callout *c, node_p node)
 
int ng_uncallout_drain (struct callout *c, node_p node)
 
int ng_callout (struct callout *c, node_p node, hook_p hook, int ticks, ng_item_fn *fn, void *arg1, int arg2)
 
void ng_free_item (item_p item)
 
int ng_mod_event (module_t mod, int what, void *arg)
 

Macro Definition Documentation

◆ _NG_ABI_VERSION

#define _NG_ABI_VERSION   12

Definition at line 73 of file netgraph.h.

◆ _NG_HOOK_FORCE_QUEUE

#define _NG_HOOK_FORCE_QUEUE (   hook)    do { hook->hk_flags |= HK_QUEUE; } while (0)

Definition at line 161 of file netgraph.h.

◆ _NG_HOOK_FORCE_WRITER

#define _NG_HOOK_FORCE_WRITER (   hook)     do { hook->hk_flags |= HK_FORCE_WRITER; } while (0)

Definition at line 159 of file netgraph.h.

◆ _NG_HOOK_HI_STACK

#define _NG_HOOK_HI_STACK (   hook)    do { hook->hk_flags |= HK_HI_STACK; } while (0)

Definition at line 164 of file netgraph.h.

◆ _NG_HOOK_IS_VALID

#define _NG_HOOK_IS_VALID (   hook)    (!((hook)->hk_flags & HK_INVALID))

Definition at line 156 of file netgraph.h.

◆ _NG_HOOK_NAME

#define _NG_HOOK_NAME (   hook)    ((hook)->hk_name)

Definition at line 149 of file netgraph.h.

◆ _NG_HOOK_NODE

#define _NG_HOOK_NODE (   hook)    ((hook)->hk_node) /* only rvalue! */

Definition at line 157 of file netgraph.h.

◆ _NG_HOOK_NOT_VALID

#define _NG_HOOK_NOT_VALID (   hook)    ((hook)->hk_flags & HK_INVALID)

Definition at line 155 of file netgraph.h.

◆ _NG_HOOK_PEER

#define _NG_HOOK_PEER (   hook)    ((hook)->hk_peer) /* only rvalue! */

Definition at line 158 of file netgraph.h.

◆ _NG_HOOK_PRIVATE

#define _NG_HOOK_PRIVATE (   hook)    ((hook)->hk_private)

Definition at line 154 of file netgraph.h.

◆ _NG_HOOK_REF

#define _NG_HOOK_REF (   hook)    refcount_acquire(&(hook)->hk_refs)

Definition at line 148 of file netgraph.h.

◆ _NG_HOOK_SET_PRIVATE

#define _NG_HOOK_SET_PRIVATE (   hook,
  val 
)    do {(hook)->hk_private = val;} while (0)

Definition at line 151 of file netgraph.h.

◆ _NG_HOOK_SET_RCVDATA

#define _NG_HOOK_SET_RCVDATA (   hook,
  val 
)    do {(hook)->hk_rcvdata = val;} while (0)

Definition at line 153 of file netgraph.h.

◆ _NG_HOOK_SET_RCVMSG

#define _NG_HOOK_SET_RCVMSG (   hook,
  val 
)    do {(hook)->hk_rcvmsg = val;} while (0)

Definition at line 152 of file netgraph.h.

◆ _NG_HOOK_SET_TO_INBOUND

#define _NG_HOOK_SET_TO_INBOUND (   hook)     do { hook->hk_flags |= HK_TO_INBOUND; } while (0)

Definition at line 162 of file netgraph.h.

◆ _NG_HOOK_UNREF

#define _NG_HOOK_UNREF (   hook)    ng_unref_hook(hook)

Definition at line 150 of file netgraph.h.

◆ _NG_NODE_FORCE_WRITER

#define _NG_NODE_FORCE_WRITER (   node)     do{ node->nd_flags |= NGF_FORCE_WRITER; }while (0)

Definition at line 417 of file netgraph.h.

◆ _NG_NODE_FOREACH_HOOK

#define _NG_NODE_FOREACH_HOOK (   node,
  fn,
  arg,
  rethook 
)
Value:
do { \
hook_p _hook; \
(rethook) = NULL; \
LIST_FOREACH(_hook, &((node)->nd_hooks), hk_hooks) { \
if ((fn)(_hook, arg) == 0) { \
(rethook) = _hook; \
break; \
} \
} \
} while (0)
ng_rcvdata_t * fn
Definition: ng_ppp.c:262

Definition at line 432 of file netgraph.h.

◆ _NG_NODE_HAS_NAME

#define _NG_NODE_HAS_NAME (   node)    ((node)->nd_name[0] + 0)

Definition at line 408 of file netgraph.h.

◆ _NG_NODE_HI_STACK

#define _NG_NODE_HI_STACK (   node)     do{ node->nd_flags |= NGF_HI_STACK; }while (0)

Definition at line 419 of file netgraph.h.

◆ _NG_NODE_ID

#define _NG_NODE_ID (   node)    ((node)->nd_ID + 0)

Definition at line 409 of file netgraph.h.

◆ _NG_NODE_IS_VALID

#define _NG_NODE_IS_VALID (   node)    (!((node)->nd_flags & NGF_INVALID))

Definition at line 414 of file netgraph.h.

◆ _NG_NODE_NAME

#define _NG_NODE_NAME (   node)    ((node)->nd_name + 0)

Definition at line 407 of file netgraph.h.

◆ _NG_NODE_NOT_VALID

#define _NG_NODE_NOT_VALID (   node)    ((node)->nd_flags & NGF_INVALID)

Definition at line 415 of file netgraph.h.

◆ _NG_NODE_NUMHOOKS

#define _NG_NODE_NUMHOOKS (   node)    ((node)->nd_numhooks + 0) /* rvalue */

Definition at line 416 of file netgraph.h.

◆ _NG_NODE_PRIVATE

#define _NG_NODE_PRIVATE (   node)    ((node)->nd_private)

Definition at line 413 of file netgraph.h.

◆ _NG_NODE_REALLY_DIE

#define _NG_NODE_REALLY_DIE (   node)     do{ node->nd_flags |= (NGF_REALLY_DIE|NGF_INVALID); }while (0)

Definition at line 421 of file netgraph.h.

◆ _NG_NODE_REF

#define _NG_NODE_REF (   node)    refcount_acquire(&(node)->nd_refs)

Definition at line 410 of file netgraph.h.

◆ _NG_NODE_REVIVE

#define _NG_NODE_REVIVE (   node)     do { node->nd_flags &= ~NGF_INVALID; } while (0)

Definition at line 423 of file netgraph.h.

◆ _NG_NODE_SET_PRIVATE

#define _NG_NODE_SET_PRIVATE (   node,
  val 
)    do {(node)->nd_private = val;} while (0)

Definition at line 412 of file netgraph.h.

◆ _NG_NODE_UNREF

#define _NG_NODE_UNREF (   node)    ng_unref_node(node)

Definition at line 411 of file netgraph.h.

◆ _NGI_ARG1

#define _NGI_ARG1 (   i)    ((i)->body.fn.fn_arg1)

Definition at line 697 of file netgraph.h.

◆ _NGI_ARG2

#define _NGI_ARG2 (   i)    ((i)->body.fn.fn_arg2)

Definition at line 698 of file netgraph.h.

◆ _NGI_CLR_HOOK

#define _NGI_CLR_HOOK (   i)
Value:
do { \
hook_p _hook = _NGI_HOOK(i); \
if (_hook) { \
_NG_HOOK_UNREF(_hook); \
_NGI_HOOK(i) = NULL; \
} \
} while (0)
#define _NGI_HOOK(i)
Definition: netgraph.h:700

Definition at line 702 of file netgraph.h.

◆ _NGI_CLR_NODE

#define _NGI_CLR_NODE (   i)
Value:
do { \
node_p _node = _NGI_NODE(i); \
if (_node) { \
_NG_NODE_UNREF(_node); \
_NGI_NODE(i) = NULL; \
} \
} while (0)
#define _NGI_NODE(i)
Definition: netgraph.h:699

Definition at line 710 of file netgraph.h.

◆ _NGI_FN

#define _NGI_FN (   i)    ((i)->body.fn.fn_fn.fn_fn)

Definition at line 695 of file netgraph.h.

◆ _NGI_FN2

#define _NGI_FN2 (   i)    ((i)->body.fn.fn_fn.fn_fn2)

Definition at line 696 of file netgraph.h.

◆ _NGI_HOOK

#define _NGI_HOOK (   i)    ((i)->el_hook)

Definition at line 700 of file netgraph.h.

◆ _NGI_M

#define _NGI_M (   i)    ((i)->body.da_m)

Definition at line 692 of file netgraph.h.

◆ _NGI_META

#define _NGI_META (   i)    NULL

Definition at line 1203 of file netgraph.h.

◆ _NGI_MSG

#define _NGI_MSG (   i)    ((i)->body.msg.msg_msg)

Definition at line 693 of file netgraph.h.

◆ _NGI_NODE

#define _NGI_NODE (   i)    ((i)->el_dest)

Definition at line 699 of file netgraph.h.

◆ _NGI_RETADDR

#define _NGI_RETADDR (   i)    ((i)->body.msg.msg_retaddr)

Definition at line 694 of file netgraph.h.

◆ _NGI_SET_HOOK

#define _NGI_SET_HOOK (   i,
 
)    do { _NGI_HOOK(i) = h; h = NULL;} while (0)

Definition at line 701 of file netgraph.h.

◆ _NGI_SET_NODE

#define _NGI_SET_NODE (   i,
 
)    do { _NGI_NODE(i) = n; n = NULL;} while (0)

Definition at line 709 of file netgraph.h.

◆ HK_DEAD

#define HK_DEAD   0x0008 /* This is the dead hook.. don't free */

Definition at line 139 of file netgraph.h.

◆ HK_FORCE_WRITER

#define HK_FORCE_WRITER   0x0004 /* Incoming data queued as a writer */

Definition at line 138 of file netgraph.h.

◆ HK_HI_STACK

#define HK_HI_STACK   0x0010 /* Hook has hi stack usage */

Definition at line 140 of file netgraph.h.

◆ HK_INVALID

#define HK_INVALID   0x0001 /* don't trust it! */

Definition at line 136 of file netgraph.h.

◆ HK_QUEUE

#define HK_QUEUE   0x0002 /* queue for later delivery */

Definition at line 137 of file netgraph.h.

◆ HK_TO_INBOUND

#define HK_TO_INBOUND   0x0020 /* Hook on ntw. stack inbound path. */

Definition at line 141 of file netgraph.h.

◆ NETGRAPH_INIT

#define NETGRAPH_INIT (   tn,
  tp 
)     NETGRAPH_INIT_ORDERED(tn, tp, SI_SUB_PSEUDO, SI_ORDER_MIDDLE)

Definition at line 1120 of file netgraph.h.

◆ NETGRAPH_INIT_ORDERED

#define NETGRAPH_INIT_ORDERED (   typename,
  typestructp,
  sub,
  order 
)
Value:
static moduledata_t ng_##typename##_mod = { \
"ng_" #typename, \
ng_mod_event, \
(typestructp) \
}; \
DECLARE_MODULE(ng_##typename, ng_##typename##_mod, sub, order); \
MODULE_DEPEND(ng_##typename, netgraph, NG_ABI_VERSION, \
#define NG_ABI_VERSION
Definition: netgraph.h:77

Definition at line 1109 of file netgraph.h.

◆ NG_ABI_VERSION

#define NG_ABI_VERSION   _NG_ABI_VERSION

Definition at line 77 of file netgraph.h.

◆ ng_callout_init

#define ng_callout_init (   c)    callout_init(c, 1)

Definition at line 1168 of file netgraph.h.

◆ NG_CLOSING

#define NG_CLOSING   NGF_CLOSING /* compat for old code */

Definition at line 393 of file netgraph.h.

◆ ng_copy_meta

#define ng_copy_meta (   meta)    NULL

Definition at line 1207 of file netgraph.h.

◆ NG_FORCE_WRITER

#define NG_FORCE_WRITER   NGF_FORCE_WRITER /* compat for old code */

Definition at line 391 of file netgraph.h.

◆ NG_FREE_ITEM

#define NG_FREE_ITEM (   item)    ng_free_item((item))

Definition at line 847 of file netgraph.h.

◆ NG_FREE_M

#define NG_FREE_M (   m)
Value:
do { \
if ((m)) { \
m_freem((m)); \
(m) = NULL; \
} \
} while (0)

Definition at line 946 of file netgraph.h.

◆ NG_FREE_META

#define NG_FREE_META (   meta)

Definition at line 1205 of file netgraph.h.

◆ NG_FREE_MSG

#define NG_FREE_MSG (   msg)
Value:
do { \
if ((msg)) { \
free((msg), M_NETGRAPH_MSG); \
(msg) = NULL; \
} \
} while (0)

Definition at line 938 of file netgraph.h.

◆ NG_FWD_ITEM_HOOK

#define NG_FWD_ITEM_HOOK (   error,
  item,
  hook 
)     NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, NG_NOFLAGS)

Definition at line 898 of file netgraph.h.

◆ NG_FWD_ITEM_HOOK_FLAGS

#define NG_FWD_ITEM_HOOK_FLAGS (   error,
  item,
  hook,
  flags 
)
Value:
do { \
(error) = \
ng_address_hook(NULL, (item), (hook), NG_NOFLAGS); \
if (error == 0) { \
SAVE_LINE(item); \
(error) = ng_snd_item((item), (flags)); \
} \
(item) = NULL; \
} while (0)
uint8_t flags
Definition: netflow.h:14
#define NG_NOFLAGS
Definition: netgraph.h:1171
int ng_snd_item(item_p item, int queue)
Definition: ng_base.c:2227
int ng_address_hook(node_p here, item_p item, hook_p hook, ng_ID_t retaddr)
Definition: ng_base.c:3580

Definition at line 888 of file netgraph.h.

◆ NG_FWD_MSG_HOOK

#define NG_FWD_MSG_HOOK (   error,
  here,
  item,
  hook,
  retaddr 
)
Value:
do { \
if (((error) = ng_address_hook((here), (item), \
(hook), (retaddr))) == 0) { \
SAVE_LINE(item); \
(error) = ng_snd_item((item), 0); \
} \
(item) = NULL; \
} while (0)

Definition at line 1011 of file netgraph.h.

◆ NG_FWD_NEW_DATA

#define NG_FWD_NEW_DATA (   error,
  item,
  hook,
 
)     NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, NG_NOFLAGS)

Definition at line 914 of file netgraph.h.

◆ NG_FWD_NEW_DATA_FLAGS

#define NG_FWD_NEW_DATA_FLAGS (   error,
  item,
  hook,
  m,
  flags 
)
Value:
do { \
NGI_M(item) = (m); \
(m) = NULL; \
NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags); \
} while (0)

Definition at line 908 of file netgraph.h.

◆ NG_HOOK_FORCE_QUEUE

#define NG_HOOK_FORCE_QUEUE (   hook)    _NG_HOOK_FORCE_QUEUE(hook)

Definition at line 342 of file netgraph.h.

◆ NG_HOOK_FORCE_WRITER

#define NG_HOOK_FORCE_WRITER (   hook)    _NG_HOOK_FORCE_WRITER(hook)

Definition at line 341 of file netgraph.h.

◆ NG_HOOK_HI_STACK

#define NG_HOOK_HI_STACK (   hook)    _NG_HOOK_HI_STACK(hook)

Definition at line 344 of file netgraph.h.

◆ NG_HOOK_IS_VALID

#define NG_HOOK_IS_VALID (   hook)    _NG_HOOK_IS_VALID(hook)

Definition at line 338 of file netgraph.h.

◆ NG_HOOK_NAME

#define NG_HOOK_NAME (   hook)    _NG_HOOK_NAME(hook)

Definition at line 331 of file netgraph.h.

◆ NG_HOOK_NODE

#define NG_HOOK_NODE (   hook)    _NG_HOOK_NODE(hook)

Definition at line 339 of file netgraph.h.

◆ NG_HOOK_NOT_VALID

#define NG_HOOK_NOT_VALID (   hook)    _NG_HOOK_NOT_VALID(hook)

Definition at line 337 of file netgraph.h.

◆ NG_HOOK_PEER

#define NG_HOOK_PEER (   hook)    _NG_HOOK_PEER(hook)

Definition at line 340 of file netgraph.h.

◆ NG_HOOK_PRIVATE

#define NG_HOOK_PRIVATE (   hook)    _NG_HOOK_PRIVATE(hook)

Definition at line 336 of file netgraph.h.

◆ NG_HOOK_REF

#define NG_HOOK_REF (   hook)    _NG_HOOK_REF(hook)

Definition at line 330 of file netgraph.h.

◆ NG_HOOK_SET_PRIVATE

#define NG_HOOK_SET_PRIVATE (   hook,
  val 
)    _NG_HOOK_SET_PRIVATE(hook, val)

Definition at line 333 of file netgraph.h.

◆ NG_HOOK_SET_RCVDATA

#define NG_HOOK_SET_RCVDATA (   hook,
  val 
)    _NG_HOOK_SET_RCVDATA(hook, val)

Definition at line 335 of file netgraph.h.

◆ NG_HOOK_SET_RCVMSG

#define NG_HOOK_SET_RCVMSG (   hook,
  val 
)    _NG_HOOK_SET_RCVMSG(hook, val)

Definition at line 334 of file netgraph.h.

◆ NG_HOOK_SET_TO_INBOUND

#define NG_HOOK_SET_TO_INBOUND (   hook)    _NG_HOOK_SET_TO_INBOUND(hook)

Definition at line 343 of file netgraph.h.

◆ NG_HOOK_UNREF

#define NG_HOOK_UNREF (   hook)    _NG_HOOK_UNREF(hook)

Definition at line 332 of file netgraph.h.

◆ NG_INVALID

#define NG_INVALID   NGF_INVALID /* compat for old code */

Definition at line 389 of file netgraph.h.

◆ NG_NODE_FORCE_WRITER

#define NG_NODE_FORCE_WRITER (   node)    _NG_NODE_FORCE_WRITER(node)

Definition at line 612 of file netgraph.h.

◆ NG_NODE_FOREACH_HOOK

#define NG_NODE_FOREACH_HOOK (   node,
  fn,
  arg,
  rethook 
)     _NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)

Definition at line 617 of file netgraph.h.

◆ NG_NODE_HAS_NAME

#define NG_NODE_HAS_NAME (   node)    _NG_NODE_HAS_NAME(node)

Definition at line 604 of file netgraph.h.

◆ NG_NODE_HI_STACK

#define NG_NODE_HI_STACK (   node)    _NG_NODE_HI_STACK(node)

Definition at line 613 of file netgraph.h.

◆ NG_NODE_ID

#define NG_NODE_ID (   node)    _NG_NODE_ID(node)

Definition at line 605 of file netgraph.h.

◆ NG_NODE_IS_VALID

#define NG_NODE_IS_VALID (   node)    _NG_NODE_IS_VALID(node)

Definition at line 610 of file netgraph.h.

◆ NG_NODE_NAME

#define NG_NODE_NAME (   node)    _NG_NODE_NAME(node)

Definition at line 603 of file netgraph.h.

◆ NG_NODE_NOT_VALID

#define NG_NODE_NOT_VALID (   node)    _NG_NODE_NOT_VALID(node)

Definition at line 611 of file netgraph.h.

◆ NG_NODE_NUMHOOKS

#define NG_NODE_NUMHOOKS (   node)    _NG_NODE_NUMHOOKS(node)

Definition at line 615 of file netgraph.h.

◆ NG_NODE_PRIVATE

#define NG_NODE_PRIVATE (   node)    _NG_NODE_PRIVATE(node)

Definition at line 609 of file netgraph.h.

◆ NG_NODE_REALLY_DIE

#define NG_NODE_REALLY_DIE (   node)    _NG_NODE_REALLY_DIE(node)

Definition at line 614 of file netgraph.h.

◆ NG_NODE_REF

#define NG_NODE_REF (   node)    _NG_NODE_REF(node)

Definition at line 606 of file netgraph.h.

◆ NG_NODE_REVIVE

#define NG_NODE_REVIVE (   node)    _NG_NODE_REVIVE(node)

Definition at line 616 of file netgraph.h.

◆ NG_NODE_SET_PRIVATE

#define NG_NODE_SET_PRIVATE (   node,
  val 
)    _NG_NODE_SET_PRIVATE(node, val)

Definition at line 608 of file netgraph.h.

◆ NG_NODE_UNREF

#define NG_NODE_UNREF (   node)    _NG_NODE_UNREF(node)

Definition at line 607 of file netgraph.h.

◆ NG_NOFLAGS

#define NG_NOFLAGS   0x00000000 /* no special options */

Definition at line 1171 of file netgraph.h.

◆ NG_OUTBOUND_THREAD_REF

#define NG_OUTBOUND_THREAD_REF ( )     curthread->td_ng_outbound++

Definition at line 1214 of file netgraph.h.

◆ NG_OUTBOUND_THREAD_UNREF

#define NG_OUTBOUND_THREAD_UNREF ( )
Value:
do { \
curthread->td_ng_outbound--; \
KASSERT(curthread->td_ng_outbound >= 0, \
("%s: negative td_ng_outbound", __func__)); \
} while (0)

Definition at line 1216 of file netgraph.h.

◆ NG_PEER_HOOK_NAME

#define NG_PEER_HOOK_NAME (   hook)    NG_HOOK_NAME(NG_HOOK_PEER(hook))

Definition at line 168 of file netgraph.h.

◆ NG_PEER_NODE

#define NG_PEER_NODE (   hook)    NG_HOOK_NODE(NG_HOOK_PEER(hook))

Definition at line 167 of file netgraph.h.

◆ NG_PEER_NODE_NAME

#define NG_PEER_NODE_NAME (   hook)    NG_NODE_NAME(NG_PEER_NODE(hook))

Definition at line 169 of file netgraph.h.

◆ NG_PRIO_CUTOFF

#define NG_PRIO_CUTOFF   32

Definition at line 1196 of file netgraph.h.

◆ NG_PRIO_LINKSTATE

#define NG_PRIO_LINKSTATE   64

Definition at line 1197 of file netgraph.h.

◆ NG_PROGRESS

#define NG_PROGRESS   0x00000004 /* return EINPROGRESS if queued */

Definition at line 1175 of file netgraph.h.

◆ NG_QUEUE

#define NG_QUEUE   0x00000001 /* enqueue item, don't dispatch */

Definition at line 1172 of file netgraph.h.

◆ NG_REALLY_DIE

#define NG_REALLY_DIE   NGF_REALLY_DIE /* compat for old code */

Definition at line 395 of file netgraph.h.

◆ NG_RESPOND_MSG

#define NG_RESPOND_MSG (   error,
  here,
  item,
  resp 
)
Value:
do { \
if (resp) { \
ng_ID_t _dest = NGI_RETADDR(item); \
NGI_RETADDR(item) = 0; \
NGI_MSG(item) = resp; \
if ((error = ng_address_ID((here), (item), \
_dest, 0)) == 0) { \
SAVE_LINE(item); \
(error) = ng_snd_item((item), NG_QUEUE);\
} \
NG_FREE_ITEM(item); \
(item) = NULL; \
} while (0)
#define NG_QUEUE
Definition: netgraph.h:1172
#define NGI_RETADDR(i)
Definition: netgraph.h:835
int ng_address_ID(node_p here, item_p item, ng_ID_t ID, ng_ID_t retaddr)
Definition: ng_base.c:3641
#define NG_FREE_ITEM(item)
Definition: netgraph.h:847

Definition at line 1025 of file netgraph.h.

◆ NG_REUSE_ITEM

#define NG_REUSE_ITEM   0x00000008 /* supplied item should be reused */

Definition at line 1176 of file netgraph.h.

◆ NG_SEND_DATA

#define NG_SEND_DATA (   error,
  hook,
  m,
 
)     NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)

Definition at line 935 of file netgraph.h.

◆ NG_SEND_DATA_FLAGS

#define NG_SEND_DATA_FLAGS (   error,
  hook,
  m,
  flags 
)
Value:
do { \
item_p _item; \
if ((_item = ng_package_data((m), flags))) { \
NG_FWD_ITEM_HOOK_FLAGS(error, _item, hook, flags);\
} else { \
(error) = ENOMEM; \
} \
(m) = NULL; \
} while (0)
item_p ng_package_data(struct mbuf *m, int flags)
Definition: ng_base.c:3520

Definition at line 921 of file netgraph.h.

◆ NG_SEND_DATA_ONLY

#define NG_SEND_DATA_ONLY (   error,
  hook,
 
)     NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)

Definition at line 932 of file netgraph.h.

◆ NG_SEND_MSG_HOOK

#define NG_SEND_MSG_HOOK (   error,
  here,
  msg,
  hook,
  retaddr 
)
Value:
do { \
item_p _item; \
if ((_item = ng_package_msg(msg, NG_NOFLAGS)) == NULL) {\
(msg) = NULL; \
(error) = ENOMEM; \
break; \
} \
if (((error) = ng_address_hook((here), (_item), \
(hook), (retaddr))) == 0) { \
SAVE_LINE(_item); \
(error) = ng_snd_item((_item), 0); \
} \
(msg) = NULL; \
} while (0)
item_p ng_package_msg(struct ng_mesg *msg, int flags)
Definition: ng_base.c:3542

Definition at line 958 of file netgraph.h.

◆ NG_SEND_MSG_ID

#define NG_SEND_MSG_ID (   error,
  here,
  msg,
  ID,
  retaddr 
)
Value:
do { \
item_p _item; \
if ((_item = ng_package_msg(msg, NG_NOFLAGS)) == NULL) {\
(msg) = NULL; \
(error) = ENOMEM; \
break; \
} \
if (((error) = ng_address_ID((here), (_item), \
(ID), (retaddr))) == 0) { \
SAVE_LINE(_item); \
(error) = ng_snd_item((_item), 0); \
} \
(msg) = NULL; \
} while (0)

Definition at line 990 of file netgraph.h.

◆ NG_SEND_MSG_PATH

#define NG_SEND_MSG_PATH (   error,
  here,
  msg,
  path,
  retaddr 
)
Value:
do { \
item_p _item; \
if ((_item = ng_package_msg(msg, NG_NOFLAGS)) == NULL) {\
(msg) = NULL; \
(error) = ENOMEM; \
break; \
} \
if (((error) = ng_address_path((here), (_item), \
(path), (retaddr))) == 0) { \
SAVE_LINE(_item); \
(error) = ng_snd_item((_item), 0); \
} \
(msg) = NULL; \
} while (0)
int ng_address_path(node_p here, item_p item, const char *address, ng_ID_t raddr)
Definition: ng_base.c:3616

Definition at line 974 of file netgraph.h.

◆ NG_SEPARATE_MALLOC

#define NG_SEPARATE_MALLOC   /* make modules use their own malloc types */

Definition at line 64 of file netgraph.h.

◆ NG_TAG_PRIO

#define NG_TAG_PRIO   1

Definition at line 1188 of file netgraph.h.

◆ NG_WAITOK

#define NG_WAITOK   0x00000002 /* use M_WAITOK, etc. */

Definition at line 1173 of file netgraph.h.

◆ NGF_CLOSING

#define NGF_CLOSING   0x00000008 /* ng_rmnode() at work */

Definition at line 392 of file netgraph.h.

◆ NGF_FORCE_WRITER

#define NGF_FORCE_WRITER   0x00000004 /* Never multithread this node */

Definition at line 390 of file netgraph.h.

◆ NGF_HI_STACK

#define NGF_HI_STACK   0x00000020 /* node has hi stack usage */

Definition at line 396 of file netgraph.h.

◆ NGF_INVALID

#define NGF_INVALID   0x00000001 /* free when refs go to 0 */

Definition at line 388 of file netgraph.h.

◆ NGF_REALLY_DIE

#define NGF_REALLY_DIE   0x00000010 /* "persistent" node is unloading */

Definition at line 394 of file netgraph.h.

◆ NGF_TYPE1

#define NGF_TYPE1   0x10000000 /* reserved for type specific storage */

Definition at line 397 of file netgraph.h.

◆ NGF_TYPE2

#define NGF_TYPE2   0x20000000 /* reserved for type specific storage */

Definition at line 398 of file netgraph.h.

◆ NGF_TYPE3

#define NGF_TYPE3   0x40000000 /* reserved for type specific storage */

Definition at line 399 of file netgraph.h.

◆ NGF_TYPE4

#define NGF_TYPE4   0x80000000 /* reserved for type specific storage */

Definition at line 400 of file netgraph.h.

◆ NGI_ARG1

#define NGI_ARG1 (   i)    _NGI_ARG1(i)

Definition at line 838 of file netgraph.h.

◆ NGI_ARG2

#define NGI_ARG2 (   i)    _NGI_ARG2(i)

Definition at line 839 of file netgraph.h.

◆ NGI_CLR_HOOK

#define NGI_CLR_HOOK (   i)    _NGI_CLR_HOOK(i)

Definition at line 843 of file netgraph.h.

◆ NGI_CLR_NODE

#define NGI_CLR_NODE (   i)    _NGI_CLR_NODE(i)

Definition at line 845 of file netgraph.h.

◆ NGI_FN

#define NGI_FN (   i)    _NGI_FN(i)

Definition at line 836 of file netgraph.h.

◆ NGI_FN2

#define NGI_FN2 (   i)    _NGI_FN2(i)

Definition at line 837 of file netgraph.h.

◆ NGI_GET_HOOK

#define NGI_GET_HOOK (   i,
 
)
Value:
do { \
(h) = NGI_HOOK(i); \
_NGI_HOOK(i) = NULL; \
} while (0)
#define NGI_HOOK(i)
Definition: netgraph.h:841

Definition at line 870 of file netgraph.h.

◆ NGI_GET_M

#define NGI_GET_M (   i,
 
)
Value:
do { \
(m) = NGI_M(i); \
_NGI_M(i) = NULL; \
} while (0)
#define NGI_M(i)
Definition: netgraph.h:833

Definition at line 852 of file netgraph.h.

◆ NGI_GET_META

#define NGI_GET_META (   i,
 
)

Definition at line 1206 of file netgraph.h.

◆ NGI_GET_MSG

#define NGI_GET_MSG (   i,
 
)
Value:
do { \
(m) = NGI_MSG(i); \
_NGI_MSG(i) = NULL; \
} while (0)
#define NGI_MSG(i)
Definition: netgraph.h:834

Definition at line 858 of file netgraph.h.

◆ NGI_GET_NODE

#define NGI_GET_NODE (   i,
 
)
Value:
/* YOU NOW HAVE THE REFERENCE */ \
do { \
(n) = NGI_NODE(i); \
_NGI_NODE(i) = NULL; \
} while (0)
#define NGI_NODE(i)
Definition: netgraph.h:840

Definition at line 864 of file netgraph.h.

◆ NGI_HOOK

#define NGI_HOOK (   i)    _NGI_HOOK(i)

Definition at line 841 of file netgraph.h.

◆ NGI_M

#define NGI_M (   i)    _NGI_M(i)

Definition at line 833 of file netgraph.h.

◆ NGI_META

#define NGI_META (   i)    NULL

Definition at line 1204 of file netgraph.h.

◆ NGI_MSG

#define NGI_MSG (   i)    _NGI_MSG(i)

Definition at line 834 of file netgraph.h.

◆ NGI_NODE

#define NGI_NODE (   i)    _NGI_NODE(i)

Definition at line 840 of file netgraph.h.

◆ NGI_QUEUED_READER

#define NGI_QUEUED_READER (   i)    ((i)->el_flags & NGQF_QREADER)

Definition at line 879 of file netgraph.h.

◆ NGI_QUEUED_WRITER

#define NGI_QUEUED_WRITER (   i)    (((i)->el_flags & NGQF_QMODE) == NGQF_QWRITER)

Definition at line 880 of file netgraph.h.

◆ NGI_RETADDR

#define NGI_RETADDR (   i)    _NGI_RETADDR(i)

Definition at line 835 of file netgraph.h.

◆ NGI_SET_HOOK

#define NGI_SET_HOOK (   i,
 
)    _NGI_SET_HOOK(i,h)

Definition at line 842 of file netgraph.h.

◆ NGI_SET_NODE

#define NGI_SET_NODE (   i,
 
)    _NGI_SET_NODE(i,n)

Definition at line 844 of file netgraph.h.

◆ NGI_SET_READER

#define NGI_SET_READER (   i)    ((i)->el_flags |= NGQF_QREADER)

Definition at line 877 of file netgraph.h.

◆ NGI_SET_WRITER

#define NGI_SET_WRITER (   i)    ((i)->el_flags &= ~NGQF_QMODE)

Definition at line 876 of file netgraph.h.

◆ NGQF_DATA

#define NGQF_DATA   0x01 /* the queue element is data */

Definition at line 670 of file netgraph.h.

◆ NGQF_FN

#define NGQF_FN   0x02 /* the queue element is a function */

Definition at line 671 of file netgraph.h.

◆ NGQF_FN2

#define NGQF_FN2   0x03 /* the queue element is a new function */

Definition at line 672 of file netgraph.h.

◆ NGQF_MESG

#define NGQF_MESG   0x00 /* the queue element is a message */

Definition at line 669 of file netgraph.h.

◆ NGQF_QMODE

#define NGQF_QMODE   0x08 /* MASK for how it was queued */

Definition at line 678 of file netgraph.h.

◆ NGQF_QREADER

#define NGQF_QREADER   0x08 /* was queued as a reader */

Definition at line 679 of file netgraph.h.

◆ NGQF_QWRITER

#define NGQF_QWRITER   0x00 /* was queued as a writer */

Definition at line 680 of file netgraph.h.

◆ NGQF_READER

#define NGQF_READER   0x04 /* wants to be a reader */

Definition at line 675 of file netgraph.h.

◆ NGQF_RW

#define NGQF_RW   0x04 /* MASK for wanted queue mode */

Definition at line 674 of file netgraph.h.

◆ NGQF_TYPE

#define NGQF_TYPE   0x03 /* MASK of content definition */

Definition at line 668 of file netgraph.h.

◆ NGQF_WRITER

#define NGQF_WRITER   0x00 /* wants to be a writer */

Definition at line 676 of file netgraph.h.

◆ SAVE_LINE

#define SAVE_LINE (   item)    do {} while (0)

Definition at line 848 of file netgraph.h.

Typedef Documentation

◆ hook_cp

typedef struct ng_hook const* hook_cp

Definition at line 91 of file netgraph.h.

◆ hook_p

typedef struct ng_hook* hook_p

Definition at line 89 of file netgraph.h.

◆ item_cp

typedef struct ng_item const* item_cp

Definition at line 90 of file netgraph.h.

◆ item_p

typedef struct ng_item* item_p

Definition at line 87 of file netgraph.h.

◆ meta_p

typedef void* meta_p

Definition at line 1202 of file netgraph.h.

◆ ng_apply_t

typedef void ng_apply_t(void *context, int error)

Definition at line 628 of file netgraph.h.

◆ ng_close_t

typedef int ng_close_t(node_p node)

Definition at line 100 of file netgraph.h.

◆ ng_connect_t

typedef int ng_connect_t(hook_p hook)

Definition at line 104 of file netgraph.h.

◆ ng_constructor_t

typedef int ng_constructor_t(node_p node)

Definition at line 99 of file netgraph.h.

◆ ng_disconnect_t

typedef int ng_disconnect_t(hook_p hook)

Definition at line 107 of file netgraph.h.

◆ ng_findhook_t

typedef hook_p ng_findhook_t(node_p node, const char *name)

Definition at line 103 of file netgraph.h.

◆ ng_fn_eachhook

typedef int ng_fn_eachhook(hook_p hook, void *arg)

Definition at line 431 of file netgraph.h.

◆ ng_item_fn

typedef void ng_item_fn(node_p node, hook_p hook, void *arg1, int arg2)

Definition at line 626 of file netgraph.h.

◆ ng_item_fn2

typedef int ng_item_fn2(node_p node, struct ng_item *item, hook_p hook)

Definition at line 627 of file netgraph.h.

◆ ng_newhook_t

typedef int ng_newhook_t(node_p node, hook_p hook, const char *name)

Definition at line 102 of file netgraph.h.

◆ ng_rcvdata_t

typedef int ng_rcvdata_t(hook_p hook, item_p item)

Definition at line 106 of file netgraph.h.

◆ ng_rcvitem

typedef int ng_rcvitem(node_p node, hook_p hook, item_p item)

Definition at line 108 of file netgraph.h.

◆ ng_rcvmsg_t

typedef int ng_rcvmsg_t(node_p node, item_p item, hook_p lasthook)

Definition at line 105 of file netgraph.h.

◆ ng_shutdown_t

typedef int ng_shutdown_t(node_p node)

Definition at line 101 of file netgraph.h.

◆ node_cp

typedef struct ng_node const* node_cp

Definition at line 95 of file netgraph.h.

◆ node_p

typedef struct ng_node* node_p

Definition at line 88 of file netgraph.h.

Function Documentation

◆ MALLOC_DECLARE() [1/2]

MALLOC_DECLARE ( M_NETGRAPH  )

◆ MALLOC_DECLARE() [2/2]

MALLOC_DECLARE ( M_NETGRAPH_MSG  )

◆ ng_address_hook()

◆ ng_address_ID()

int ng_address_ID ( node_p  here,
item_p  item,
ng_ID_t  ID,
ng_ID_t  retaddr 
)

Definition at line 3641 of file ng_base.c.

◆ ng_address_path()

int ng_address_path ( node_p  here,
item_p  item,
const char *  address,
ng_ID_t  raddr 
)

Definition at line 3616 of file ng_base.c.

Referenced by ng_connect_data(), and ngc_send().

Here is the caller graph for this function:

◆ ng_bypass()

int ng_bypass ( hook_p  hook1,
hook_p  hook2 
)

Definition at line 1241 of file ng_base.c.

References ng_hook::hk_node, ng_hook::hk_peer, ng_deadhook, ng_destroy_hook(), NG_HOOK_NOT_VALID, NG_HOOK_UNREF, TOPOLOGY_WLOCK, TOPOLOGY_WUNLOCK, and TRAP_ERROR.

Referenced by ng_tee_close(), and ngp_shutdown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_callout()

◆ ng_findhook()

◆ ng_findtype()

struct ng_type * ng_findtype ( const char *  type)

Definition at line 1325 of file ng_base.c.

References type, TYPELIST_RLOCK, and TYPELIST_RUNLOCK.

Referenced by ng_make_node(), ng_make_node_common(), ng_newtype(), and ngc_send().

Here is the caller graph for this function:

◆ ng_free_item()

void ng_free_item ( item_p  item)

Definition at line 3012 of file ng_base.c.

References _NGI_ARG1, _NGI_ARG2, _NGI_CLR_HOOK, _NGI_CLR_NODE, _NGI_FN, _NGI_M, _NGI_MSG, _NGI_RETADDR, ng_item::el_flags, NG_FREE_M, NG_FREE_MSG, ng_qdzone, ng_qzone, NGQF_DATA, NGQF_FN, NGQF_FN2, NGQF_MESG, and NGQF_TYPE.

Referenced by ng_realloc_item().

Here is the caller graph for this function:

◆ ng_make_node_common()

◆ ng_mod_event()

int ng_mod_event ( module_t  mod,
int  what,
void *  arg 
)

Definition at line 3091 of file ng_base.c.

References data, event, ng_newtype(), type, TYPELIST_WLOCK, and TYPELIST_WUNLOCK.

Here is the call graph for this function:

◆ ng_name2noderef()

node_p ng_name2noderef ( node_p  node,
const char *  name 
)

Definition at line 913 of file ng_base.c.

References name, NAMEHASH_RLOCK, NAMEHASH_RUNLOCK, ng_decodeidname(), ng_ID2noderef(), ng_ID_t, NG_NODE_IS_VALID, NG_NODE_NAME, NG_NODE_REF, V_ng_name_hash, and V_ng_name_hmask.

Referenced by ng_ether_attach(), and ng_path2noderef().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_name_node()

◆ ng_newtype()

int ng_newtype ( struct ng_type tp)

Definition at line 1272 of file ng_base.c.

References ng_type::name, NG_ABI_VERSION, ng_findtype(), NG_TYPESIZ, ng_type::refs, TRAP_ERROR, TYPELIST_WLOCK, TYPELIST_WUNLOCK, and ng_type::version.

Referenced by ng_btsocket_hci_raw_init(), ng_btsocket_l2cap_init(), ng_btsocket_l2cap_raw_init(), ng_btsocket_sco_init(), ng_mod_event(), and ubt_modevent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_node2ID()

ng_ID_t ng_node2ID ( node_cp  node)

Definition at line 839 of file ng_base.c.

References NG_NODE_ID.

Referenced by ng_bridge_nodename(), ng_generic_msg(), ng_package_msg_self(), and ng_replace_retaddr().

Here is the caller graph for this function:

◆ ng_package_data()

item_p ng_package_data ( struct mbuf *  m,
int  flags 
)

Definition at line 3520 of file ng_base.c.

References ng_item::el_flags, flags, ITEM_DEBUG_CHECKS, ng_alloc_item(), NG_FREE_M, NGI_M, NGQF_DATA, and NGQF_READER.

Referenced by get_export9_dgram(), get_export_dgram(), ng_connect_data(), ng_ppp_frag_checkstale(), ng_ppp_frag_process(), ng_ppp_mp_xmit(), and ngd_send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_package_msg()

item_p ng_package_msg ( struct ng_mesg msg,
int  flags 
)

Definition at line 3542 of file ng_base.c.

References ng_mesg::ng_msghdr::cmd, ng_item::el_flags, flags, ng_mesg::header, ITEM_DEBUG_CHECKS, ng_alloc_item(), NG_FREE_MSG, NGI_MSG, NGI_RETADDR, NGM_READONLY, NGQF_MESG, NGQF_READER, and NGQF_WRITER.

Referenced by ngc_send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_package_msg_self()

item_p ng_package_msg_self ( node_p  here,
hook_p  hook,
struct ng_mesg msg 
)

Definition at line 3668 of file ng_base.c.

References ng_item::el_flags, ng_alloc_item(), NG_FREE_MSG, NG_HOOK_REF, ng_node2ID(), NG_NODE_REF, NG_NOFLAGS, NGI_MSG, NGI_RETADDR, NGI_SET_HOOK, NGI_SET_NODE, NGQF_MESG, and NGQF_WRITER.

Here is the call graph for this function:

◆ ng_replace_retaddr()

void ng_replace_retaddr ( node_p  here,
item_p  item,
ng_ID_t  retaddr 
)

Definition at line 3875 of file ng_base.c.

References ng_node2ID(), and NGI_RETADDR.

Here is the call graph for this function:

◆ ng_rmhook_self()

int ng_rmhook_self ( hook_p  hook)

Definition at line 1631 of file ng_base.c.

References ng_deadnode, NG_HOOK_NODE, ng_rmhook_part2(), and ng_send_fn().

Referenced by ng_destroy_hook(), ng_pppoe_rcvdata_ether(), ngp_shutdown(), and pppoe_ticker().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_rmnode_self()

◆ ng_rmtype()

int ng_rmtype ( struct ng_type tp)

Definition at line 1306 of file ng_base.c.

References ng_type::refs, TRAP_ERROR, TYPELIST_WLOCK, and TYPELIST_WUNLOCK.

Referenced by ubt_modevent().

Here is the caller graph for this function:

◆ ng_send_fn()

int ng_send_fn ( node_p  node,
hook_p  hook,
ng_item_fn fn,
void *  arg1,
int  arg2 
)

Definition at line 3700 of file ng_base.c.

Referenced by ng_btsocket_hci_raw_send(), ng_eiface_start(), ng_hci_connect(), ng_ksocket_connect(), ng_l2cap_connect(), ng_rmhook_self(), and ng_rmnode_self().

Here is the caller graph for this function:

◆ ng_send_fn1()

int ng_send_fn1 ( node_p  node,
hook_p  hook,
ng_item_fn fn,
void *  arg1,
int  arg2,
int  flags 
)

Definition at line 3707 of file ng_base.c.

Referenced by ng_ksocket_incoming().

Here is the caller graph for this function:

◆ ng_send_fn2()

int ng_send_fn2 ( node_p  node,
hook_p  hook,
item_p  pitem,
ng_item_fn2 fn,
void *  arg1,
int  arg2,
int  flags 
)

Definition at line 3737 of file ng_base.c.

References ng_item::apply, ng_item::el_flags, flags, fn, ng_alloc_item(), NG_HOOK_REF, NG_NODE_REF, ng_realloc_item(), NG_REUSE_ITEM, ng_snd_item(), NGI_ARG1, NGI_ARG2, NGI_FN2, NGI_SET_HOOK, NGI_SET_NODE, NGQF_FN2, and NGQF_WRITER.

Referenced by ng_con_nodes(), and ng_con_part2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_snd_item()

◆ ng_uncallout()

◆ ng_uncallout_drain()

int ng_uncallout_drain ( struct callout *  c,
node_p  node 
)

Definition at line 3860 of file ng_base.c.

◆ ng_unref_hook()

void ng_unref_hook ( hook_p  hook)

Definition at line 1050 of file ng_base.c.

References _NG_HOOK_NODE, _NG_NODE_UNREF, ng_hook::hk_refs, ng_deadhook, and NG_FREE_HOOK.

◆ ng_unref_node()