FreeBSD kernel netgraph code
ng_tag.c File Reference
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/stddef.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_tag.h>
Include dependency graph for ng_tag.c:

Go to the source code of this file.

Data Structures

struct  ng_tag_hookinfo
 

Macros

#define M_NETGRAPH_TAG   M_NETGRAPH
 
#define ERROUT(x)   do { error = (x); goto done; } while (0)
 

Typedefs

typedef struct ng_tag_hookinfohinfo_p
 

Functions

static int ng_tag_setdata_in (hook_p hook, const struct ng_tag_hookin *hp)
 
static int ng_tag_setdata_out (hook_p hook, const struct ng_tag_hookout *hp)
 
static int ng_tag_hookinary_getLength (const struct ng_parse_type *type, const u_char *start, const u_char *buf)
 
static int ng_tag_hookoutary_getLength (const struct ng_parse_type *type, const u_char *start, const u_char *buf)
 
 NETGRAPH_INIT (tag, &typestruct)
 
static int ng_tag_constructor (node_p node)
 
static int ng_tag_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_tag_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_tag_rcvdata (hook_p hook, item_p item)
 
static int ng_tag_shutdown (node_p node)
 
static int ng_tag_disconnect (hook_p hook)
 

Variables

static ng_constructor_t ng_tag_constructor
 
static ng_rcvmsg_t ng_tag_rcvmsg
 
static ng_shutdown_t ng_tag_shutdown
 
static ng_newhook_t ng_tag_newhook
 
static ng_rcvdata_t ng_tag_rcvdata
 
static ng_disconnect_t ng_tag_disconnect
 
static const struct ng_parse_type ng_tag_hookinary_type
 
static const struct ng_parse_type ng_tag_hookoutary_type
 
static const struct ng_parse_struct_field ng_tag_hookin_type_fields [] = NG_TAG_HOOKIN_TYPE_INFO(&ng_tag_hookinary_type)
 
static const struct ng_parse_type ng_tag_hookin_type
 
static const struct ng_parse_struct_field ng_tag_hookout_type_fields [] = NG_TAG_HOOKOUT_TYPE_INFO(&ng_tag_hookoutary_type)
 
static const struct ng_parse_type ng_tag_hookout_type
 
static const struct ng_cmdlist ng_tag_cmdlist []
 
static struct ng_type typestruct
 
static const struct ng_tag_hookin ng_tag_default_in
 
static const struct ng_tag_hookout ng_tag_default_out
 

Macro Definition Documentation

◆ ERROUT

#define ERROUT (   x)    do { error = (x); goto done; } while (0)

Definition at line 79 of file ng_tag.c.

◆ M_NETGRAPH_TAG

#define M_NETGRAPH_TAG   M_NETGRAPH

Definition at line 76 of file ng_tag.c.

Typedef Documentation

◆ hinfo_p

typedef struct ng_tag_hookinfo* hinfo_p

Definition at line 114 of file ng_tag.c.

Function Documentation

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( tag  ,
typestruct 
)

◆ ng_tag_constructor()

static int ng_tag_constructor ( node_p  node)
static

Definition at line 293 of file ng_tag.c.

◆ ng_tag_disconnect()

static int ng_tag_disconnect ( hook_p  hook)
static

Definition at line 608 of file ng_tag.c.

References M_NETGRAPH_TAG, NG_HOOK_NODE, NG_HOOK_PRIVATE, NG_HOOK_SET_PRIVATE, NG_NODE_IS_VALID, NG_NODE_NUMHOOKS, and ng_rmnode_self().

Here is the call graph for this function:

◆ ng_tag_hookinary_getLength()

static int ng_tag_hookinary_getLength ( const struct ng_parse_type type,
const u_char *  start,
const u_char *  buf 
)
static

Definition at line 130 of file ng_tag.c.

References ng_tag_hookin::tag_data, and ng_tag_hookin::tag_len.

◆ ng_tag_hookoutary_getLength()

static int ng_tag_hookoutary_getLength ( const struct ng_parse_type type,
const u_char *  start,
const u_char *  buf 
)
static

Definition at line 141 of file ng_tag.c.

References ng_tag_hookout::tag_data, and ng_tag_hookout::tag_len.

◆ ng_tag_newhook()

static int ng_tag_newhook ( node_p  node,
hook_p  hook,
const char *  name 
)
static

Definition at line 302 of file ng_tag.c.

References M_NETGRAPH_TAG, name, NG_HOOK_SET_PRIVATE, ng_tag_default_in, ng_tag_default_out, ng_tag_setdata_in(), and ng_tag_setdata_out().

Here is the call graph for this function:

◆ ng_tag_rcvdata()

◆ ng_tag_rcvmsg()

◆ ng_tag_setdata_in()

static int ng_tag_setdata_in ( hook_p  hook,
const struct ng_tag_hookin hp 
)
static

Definition at line 644 of file ng_tag.c.

References M_NETGRAPH_TAG, ng_findhook(), NG_HOOK_NODE, NG_HOOK_PRIVATE, NG_TAG_HOOKIN_SIZE, and ng_tag_hookin::tag_len.

Referenced by ng_tag_newhook(), and ng_tag_rcvmsg().

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

◆ ng_tag_setdata_out()

static int ng_tag_setdata_out ( hook_p  hook,
const struct ng_tag_hookout hp 
)
static

Definition at line 694 of file ng_tag.c.

References M_NETGRAPH_TAG, NG_HOOK_PRIVATE, NG_TAG_HOOKOUT_SIZE, and ng_tag_hookout::tag_len.

Referenced by ng_tag_newhook(), and ng_tag_rcvmsg().

Here is the caller graph for this function:

◆ ng_tag_shutdown()

static int ng_tag_shutdown ( node_p  node)
static

Definition at line 596 of file ng_tag.c.

References NG_NODE_UNREF.

Variable Documentation

◆ ng_tag_cmdlist

const struct ng_cmdlist ng_tag_cmdlist[]
static

Definition at line 188 of file ng_tag.c.

◆ ng_tag_constructor

ng_constructor_t ng_tag_constructor
static

Definition at line 117 of file ng_tag.c.

◆ ng_tag_default_in

const struct ng_tag_hookin ng_tag_default_in
static
Initial value:
= {
{ '\0' },
{ '\0' },
{ '\0' },
0,
0,
0,
0
}

Definition at line 269 of file ng_tag.c.

Referenced by ng_tag_newhook().

◆ ng_tag_default_out

const struct ng_tag_hookout ng_tag_default_out
static
Initial value:
= {
{ '\0' },
0,
0,
0
}

Definition at line 280 of file ng_tag.c.

Referenced by ng_tag_newhook().

◆ ng_tag_disconnect

ng_disconnect_t ng_tag_disconnect
static

Definition at line 122 of file ng_tag.c.

◆ ng_tag_hookin_type

const struct ng_parse_type ng_tag_hookin_type
static
Initial value:
= {
}
const struct ng_parse_type ng_parse_struct_type
Definition: ng_parse.c:222
static const struct ng_parse_struct_field ng_tag_hookin_type_fields[]
Definition: ng_tag.c:163

Definition at line 164 of file ng_tag.c.

◆ ng_tag_hookin_type_fields

const struct ng_parse_struct_field ng_tag_hookin_type_fields[] = NG_TAG_HOOKIN_TYPE_INFO(&ng_tag_hookinary_type)
static

Definition at line 162 of file ng_tag.c.

◆ ng_tag_hookinary_type

const struct ng_parse_type ng_tag_hookinary_type
static
Initial value:
= {
}
const struct ng_parse_type ng_parse_bytearray_type
Definition: ng_parse.c:1153
static int ng_tag_hookinary_getLength(const struct ng_parse_type *type, const u_char *start, const u_char *buf)
Definition: ng_tag.c:130

Definition at line 151 of file ng_tag.c.

◆ ng_tag_hookout_type

const struct ng_parse_type ng_tag_hookout_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_tag_hookout_type_fields[]
Definition: ng_tag.c:171

Definition at line 172 of file ng_tag.c.

◆ ng_tag_hookout_type_fields

const struct ng_parse_struct_field ng_tag_hookout_type_fields[] = NG_TAG_HOOKOUT_TYPE_INFO(&ng_tag_hookoutary_type)
static

Definition at line 170 of file ng_tag.c.

◆ ng_tag_hookoutary_type

const struct ng_parse_type ng_tag_hookoutary_type
static
Initial value:
= {
}
static int ng_tag_hookoutary_getLength(const struct ng_parse_type *type, const u_char *start, const u_char *buf)
Definition: ng_tag.c:141

Definition at line 156 of file ng_tag.c.

◆ ng_tag_newhook

ng_newhook_t ng_tag_newhook
static

Definition at line 120 of file ng_tag.c.

◆ ng_tag_rcvdata

ng_rcvdata_t ng_tag_rcvdata
static

Definition at line 121 of file ng_tag.c.

◆ ng_tag_rcvmsg

ng_rcvmsg_t ng_tag_rcvmsg
static

Definition at line 118 of file ng_tag.c.

◆ ng_tag_shutdown

ng_shutdown_t ng_tag_shutdown
static

Definition at line 119 of file ng_tag.c.

◆ typestruct

struct ng_type typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.constructor = ng_tag_constructor,
.rcvmsg = ng_tag_rcvmsg,
.shutdown = ng_tag_shutdown,
.newhook = ng_tag_newhook,
.rcvdata = ng_tag_rcvdata,
.disconnect = ng_tag_disconnect,
.cmdlist = ng_tag_cmdlist,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static ng_newhook_t ng_tag_newhook
Definition: ng_tag.c:120
static const struct ng_cmdlist ng_tag_cmdlist[]
Definition: ng_tag.c:188
static ng_shutdown_t ng_tag_shutdown
Definition: ng_tag.c:119
static ng_rcvdata_t ng_tag_rcvdata
Definition: ng_tag.c:121
static ng_disconnect_t ng_tag_disconnect
Definition: ng_tag.c:122
static ng_constructor_t ng_tag_constructor
Definition: ng_tag.c:117
static ng_rcvmsg_t ng_tag_rcvmsg
Definition: ng_tag.c:118
#define NG_TAG_NODE_TYPE
Definition: ng_tag.h:36

Definition at line 244 of file ng_tag.c.