FreeBSD kernel netgraph code
ng_etf.c File Reference
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/ctype.h>
#include <sys/errno.h>
#include <sys/queue.h>
#include <sys/syslog.h>
#include <net/ethernet.h>
#include <netgraph/ng_message.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_etf.h>
#include <netgraph/netgraph.h>
Include dependency graph for ng_etf.c:

Go to the source code of this file.

Data Structures

struct  ETF_hookinfo
 
struct  filter
 
struct  ETF
 

Macros

#define M_NETGRAPH_ETF   M_NETGRAPH
 
#define HASHSIZE   16 /* Dont change this without changing HASH() */
 
#define HASH(et)   ((((et)>>12)+((et)>>8)+((et)>>4)+(et)) & 0x0f)
 

Typedefs

typedef struct ETFetf_p
 

Functions

 NETGRAPH_INIT (etf, &typestruct)
 
 LIST_HEAD (filterhead, filter)
 
static struct filterng_etf_findentry (etf_p etfp, u_int16_t ethertype)
 
static int ng_etf_constructor (node_p node)
 
static int ng_etf_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_etf_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_etf_rcvdata (hook_p hook, item_p item)
 
static int ng_etf_shutdown (node_p node)
 
static int ng_etf_disconnect (hook_p hook)
 

Variables

static ng_constructor_t ng_etf_constructor
 
static ng_rcvmsg_t ng_etf_rcvmsg
 
static ng_shutdown_t ng_etf_shutdown
 
static ng_newhook_t ng_etf_newhook
 
static ng_rcvdata_t ng_etf_rcvdata
 
static ng_disconnect_t ng_etf_disconnect
 
static const struct ng_parse_struct_field ng_etf_stat_type_fields [] = NG_ETF_STATS_TYPE_INFO
 
static const struct ng_parse_type ng_etf_stat_type
 
static const struct ng_parse_struct_field ng_etf_filter_type_fields [] = NG_ETF_FILTER_TYPE_INFO
 
static const struct ng_parse_type ng_etf_filter_type
 
static const struct ng_cmdlist ng_etf_cmdlist []
 
static struct ng_type typestruct
 

Macro Definition Documentation

◆ HASH

#define HASH (   et)    ((((et)>>12)+((et)>>8)+((et)>>4)+(et)) & 0x0f)

Definition at line 142 of file ng_etf.c.

◆ HASHSIZE

#define HASHSIZE   16 /* Dont change this without changing HASH() */

Definition at line 141 of file ng_etf.c.

◆ M_NETGRAPH_ETF

#define M_NETGRAPH_ETF   M_NETGRAPH

Definition at line 60 of file ng_etf.c.

Typedef Documentation

◆ etf_p

typedef struct ETF* etf_p

Definition at line 155 of file ng_etf.c.

Function Documentation

◆ LIST_HEAD()

LIST_HEAD ( filterhead  ,
filter   
)

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( etf  ,
typestruct 
)

◆ ng_etf_constructor()

static int ng_etf_constructor ( node_p  node)
static

Definition at line 177 of file ng_etf.c.

References HASHSIZE, M_NETGRAPH_ETF, NG_NODE_SET_PRIVATE, and privdata::node.

◆ ng_etf_disconnect()

static int ng_etf_disconnect ( hook_p  hook)
static

◆ ng_etf_findentry()

static struct filter * ng_etf_findentry ( etf_p  etfp,
u_int16_t  ethertype 
)
static

Definition at line 158 of file ng_etf.c.

References HASH, and ETF::hashtable.

Referenced by ng_etf_rcvdata(), and ng_etf_rcvmsg().

Here is the caller graph for this function:

◆ ng_etf_newhook()

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

◆ ng_etf_rcvdata()

static int ng_etf_rcvdata ( hook_p  hook,
item_p  item 
)
static

◆ ng_etf_rcvmsg()

◆ ng_etf_shutdown()

static int ng_etf_shutdown ( node_p  node)
static

Variable Documentation

◆ ng_etf_cmdlist

const struct ng_cmdlist ng_etf_cmdlist[]
static
Initial value:
= {
{
"getstatus",
NULL,
},
{
"setflag",
NULL
},
{
"setfilter",
NULL
},
{ 0 }
}
static const struct ng_parse_type ng_etf_stat_type
Definition: ng_etf.c:78
static const struct ng_parse_type ng_etf_filter_type
Definition: ng_etf.c:85
@ NGM_ETF_SET_FILTER
Definition: ng_etf.h:58
@ NGM_ETF_SET_FLAG
Definition: ng_etf.h:56
@ NGM_ETF_GET_STATUS
Definition: ng_etf.h:57
#define NGM_ETF_COOKIE
Definition: ng_etf.h:48
const struct ng_parse_type ng_parse_int32_type
Definition: ng_parse.c:598

Definition at line 91 of file ng_etf.c.

◆ ng_etf_constructor

ng_constructor_t ng_etf_constructor
static

Definition at line 68 of file ng_etf.c.

◆ ng_etf_disconnect

ng_disconnect_t ng_etf_disconnect
static

Definition at line 73 of file ng_etf.c.

◆ ng_etf_filter_type

const struct ng_parse_type ng_etf_filter_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_etf_filter_type_fields[]
Definition: ng_etf.c:84
const struct ng_parse_type ng_parse_struct_type
Definition: ng_parse.c:222

Definition at line 85 of file ng_etf.c.

◆ ng_etf_filter_type_fields

const struct ng_parse_struct_field ng_etf_filter_type_fields[] = NG_ETF_FILTER_TYPE_INFO
static

Definition at line 83 of file ng_etf.c.

◆ ng_etf_newhook

ng_newhook_t ng_etf_newhook
static

Definition at line 71 of file ng_etf.c.

◆ ng_etf_rcvdata

ng_rcvdata_t ng_etf_rcvdata
static

Definition at line 72 of file ng_etf.c.

◆ ng_etf_rcvmsg

ng_rcvmsg_t ng_etf_rcvmsg
static

Definition at line 69 of file ng_etf.c.

◆ ng_etf_shutdown

ng_shutdown_t ng_etf_shutdown
static

Definition at line 70 of file ng_etf.c.

◆ ng_etf_stat_type

const struct ng_parse_type ng_etf_stat_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_etf_stat_type_fields[]
Definition: ng_etf.c:77

Definition at line 78 of file ng_etf.c.

◆ ng_etf_stat_type_fields

const struct ng_parse_struct_field ng_etf_stat_type_fields[] = NG_ETF_STATS_TYPE_INFO
static

Definition at line 76 of file ng_etf.c.

◆ typestruct

struct ng_type typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.constructor = ng_etf_constructor,
.rcvmsg = ng_etf_rcvmsg,
.shutdown = ng_etf_shutdown,
.newhook = ng_etf_newhook,
.rcvdata = ng_etf_rcvdata,
.disconnect = ng_etf_disconnect,
.cmdlist = ng_etf_cmdlist,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static ng_disconnect_t ng_etf_disconnect
Definition: ng_etf.c:73
static ng_shutdown_t ng_etf_shutdown
Definition: ng_etf.c:70
static ng_rcvmsg_t ng_etf_rcvmsg
Definition: ng_etf.c:69
static ng_rcvdata_t ng_etf_rcvdata
Definition: ng_etf.c:72
static ng_newhook_t ng_etf_newhook
Definition: ng_etf.c:71
static const struct ng_cmdlist ng_etf_cmdlist[]
Definition: ng_etf.c:91
static ng_constructor_t ng_etf_constructor
Definition: ng_etf.c:68
#define NG_ETF_NODE_TYPE
Definition: ng_etf.h:42

Definition at line 117 of file ng_etf.c.