FreeBSD kernel netgraph code
ng_gif.c File Reference
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/route.h>
#include <net/if_types.h>
#include <net/if_var.h>
#include <net/if_gif.h>
#include <net/vnet.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_gif.h>
Include dependency graph for ng_gif.c:

Go to the source code of this file.

Data Structures

struct  private
 

Macros

#define IFP2NG(ifp)   ((struct ng_node *)((struct gif_softc *)(ifp->if_softc))->gif_netgraph)
 
#define IFP2NG_SET(ifp, val)   (((struct gif_softc *)(ifp->if_softc))->gif_netgraph = (val))
 

Typedefs

typedef struct privatepriv_p
 

Functions

static void ng_gif_input (struct ifnet *ifp, struct mbuf **mp, int af)
 
static void ng_gif_input_orphan (struct ifnet *ifp, struct mbuf *m, int af)
 
static void ng_gif_attach (struct ifnet *ifp)
 
static void ng_gif_detach (struct ifnet *ifp)
 
static void ng_gif_input2 (node_p node, struct mbuf **mp, int af)
 
static int ng_gif_glue_af (struct mbuf **mp, int af)
 
static int ng_gif_rcv_lower (node_p node, struct mbuf *m)
 
static int ng_gif_mod_event (module_t mod, int event, void *data)
 
 MODULE_DEPEND (ng_gif, if_gif, 1, 1, 1)
 
 NETGRAPH_INIT (gif, &ng_gif_typestruct)
 
static int ng_gif_constructor (node_p node)
 
static int ng_gif_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_gif_connect (hook_p hook)
 
static int ng_gif_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_gif_rcvdata (hook_p hook, item_p item)
 
static int ng_gif_shutdown (node_p node)
 
static int ng_gif_disconnect (hook_p hook)
 

Variables

static ng_constructor_t ng_gif_constructor
 
static ng_rcvmsg_t ng_gif_rcvmsg
 
static ng_shutdown_t ng_gif_shutdown
 
static ng_newhook_t ng_gif_newhook
 
static ng_connect_t ng_gif_connect
 
static ng_rcvdata_t ng_gif_rcvdata
 
static ng_disconnect_t ng_gif_disconnect
 
static const struct ng_cmdlist ng_gif_cmdlist []
 
static struct ng_type ng_gif_typestruct
 

Macro Definition Documentation

◆ IFP2NG

#define IFP2NG (   ifp)    ((struct ng_node *)((struct gif_softc *)(ifp->if_softc))->gif_netgraph)

Definition at line 94 of file ng_gif.c.

◆ IFP2NG_SET

#define IFP2NG_SET (   ifp,
  val 
)    (((struct gif_softc *)(ifp->if_softc))->gif_netgraph = (val))

Definition at line 95 of file ng_gif.c.

Typedef Documentation

◆ priv_p

typedef struct private* priv_p

Definition at line 103 of file ng_gif.c.

Function Documentation

◆ MODULE_DEPEND()

MODULE_DEPEND ( ng_gif  ,
if_gif  ,
,
,
 
)

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( gif  ,
ng_gif_typestruct 
)

◆ ng_gif_attach()

static void ng_gif_attach ( struct ifnet *  ifp)
static

Definition at line 225 of file ng_gif.c.

References IFP2NG, IFP2NG_SET, ng_gif_typestruct, ng_make_node_common(), ng_name_node(), NG_NODE_SET_PRIVATE, and NG_NODE_UNREF.

Referenced by ng_gif_mod_event().

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

◆ ng_gif_connect()

static int ng_gif_connect ( hook_p  hook)
static

Definition at line 382 of file ng_gif.c.

References NG_HOOK_FORCE_QUEUE, and NG_HOOK_PEER.

◆ ng_gif_constructor()

static int ng_gif_constructor ( node_p  node)
static

Definition at line 337 of file ng_gif.c.

◆ ng_gif_detach()

static void ng_gif_detach ( struct ifnet *  ifp)
static

Definition at line 262 of file ng_gif.c.

References IFP2NG, IFP2NG_SET, NG_NODE_PRIVATE, NG_NODE_REALLY_DIE, and ng_rmnode_self().

Referenced by ng_gif_mod_event().

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

◆ ng_gif_disconnect()

static int ng_gif_disconnect ( hook_p  hook)
static

Definition at line 513 of file ng_gif.c.

References priv::lower, NG_HOOK_NODE, NG_NODE_IS_VALID, NG_NODE_NUMHOOKS, NG_NODE_PRIVATE, and ng_rmnode_self().

Here is the call graph for this function:

◆ ng_gif_glue_af()

static int ng_gif_glue_af ( struct mbuf **  mp,
int  af 
)
static

Definition at line 286 of file ng_gif.c.

Referenced by ng_gif_input2().

Here is the caller graph for this function:

◆ ng_gif_input()

static void ng_gif_input ( struct ifnet *  ifp,
struct mbuf **  mp,
int  af 
)
static

Definition at line 170 of file ng_gif.c.

References IFP2NG, priv::lower, ng_gif_input2(), and NG_NODE_PRIVATE.

Referenced by ng_gif_mod_event().

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

◆ ng_gif_input2()

static void ng_gif_input2 ( node_p  node,
struct mbuf **  mp,
int  af 
)
static

Definition at line 206 of file ng_gif.c.

References priv::lower, ng_gif_glue_af(), NG_NODE_PRIVATE, and NG_SEND_DATA_ONLY.

Referenced by ng_gif_input(), and ng_gif_input_orphan().

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

◆ ng_gif_input_orphan()

static void ng_gif_input_orphan ( struct ifnet *  ifp,
struct mbuf *  m,
int  af 
)
static

Definition at line 186 of file ng_gif.c.

References IFP2NG, priv::lower, ng_gif_input2(), and NG_NODE_PRIVATE.

Referenced by ng_gif_mod_event().

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

◆ ng_gif_mod_event()

static int ng_gif_mod_event ( module_t  mod,
int  event,
void *  data 
)
static

Definition at line 537 of file ng_gif.c.

References event, ng_gif_attach(), ng_gif_detach(), ng_gif_input(), and ng_gif_input_orphan().

Here is the call graph for this function:

◆ ng_gif_newhook()

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

◆ ng_gif_rcv_lower()

static int ng_gif_rcv_lower ( node_p  node,
struct mbuf *  m 
)
static

Definition at line 455 of file ng_gif.c.

References NG_FREE_M, and NG_NODE_PRIVATE.

Referenced by ng_gif_rcvdata().

Here is the caller graph for this function:

◆ ng_gif_rcvdata()

static int ng_gif_rcvdata ( hook_p  hook,
item_p  item 
)
static

Definition at line 437 of file ng_gif.c.

References priv::lower, NG_FREE_ITEM, ng_gif_rcv_lower(), NG_HOOK_NODE, NG_NODE_PRIVATE, and NGI_GET_M.

Here is the call graph for this function:

◆ ng_gif_rcvmsg()

◆ ng_gif_shutdown()

static int ng_gif_shutdown ( node_p  node)
static

Variable Documentation

◆ ng_gif_cmdlist

const struct ng_cmdlist ng_gif_cmdlist[]
static
Initial value:
= {
{
"getifname",
NULL,
},
{
"getifindex",
NULL,
},
{ 0 }
}
#define NGM_GIF_COOKIE
Definition: ng_gif.h:75
@ NGM_GIF_GET_IFNAME
Definition: ng_gif.h:84
@ NGM_GIF_GET_IFINDEX
Definition: ng_gif.h:85
const struct ng_parse_type ng_parse_int32_type
Definition: ng_parse.c:598
const struct ng_parse_type ng_parse_string_type
Definition: ng_parse.c:766

Definition at line 127 of file ng_gif.c.

◆ ng_gif_connect

ng_connect_t ng_gif_connect
static

Definition at line 121 of file ng_gif.c.

◆ ng_gif_constructor

ng_constructor_t ng_gif_constructor
static

Definition at line 117 of file ng_gif.c.

◆ ng_gif_disconnect

ng_disconnect_t ng_gif_disconnect
static

Definition at line 123 of file ng_gif.c.

◆ ng_gif_newhook

ng_newhook_t ng_gif_newhook
static

Definition at line 120 of file ng_gif.c.

◆ ng_gif_rcvdata

ng_rcvdata_t ng_gif_rcvdata
static

Definition at line 122 of file ng_gif.c.

◆ ng_gif_rcvmsg

ng_rcvmsg_t ng_gif_rcvmsg
static

Definition at line 118 of file ng_gif.c.

◆ ng_gif_shutdown

ng_shutdown_t ng_gif_shutdown
static

Definition at line 119 of file ng_gif.c.

◆ ng_gif_typestruct

struct ng_type ng_gif_typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.mod_event = ng_gif_mod_event,
.constructor = ng_gif_constructor,
.rcvmsg = ng_gif_rcvmsg,
.shutdown = ng_gif_shutdown,
.newhook = ng_gif_newhook,
.connect = ng_gif_connect,
.rcvdata = ng_gif_rcvdata,
.disconnect = ng_gif_disconnect,
.cmdlist = ng_gif_cmdlist,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static int ng_gif_mod_event(module_t mod, int event, void *data)
Definition: ng_gif.c:537
static ng_newhook_t ng_gif_newhook
Definition: ng_gif.c:120
static ng_shutdown_t ng_gif_shutdown
Definition: ng_gif.c:119
static ng_connect_t ng_gif_connect
Definition: ng_gif.c:121
static ng_disconnect_t ng_gif_disconnect
Definition: ng_gif.c:123
static ng_rcvmsg_t ng_gif_rcvmsg
Definition: ng_gif.c:118
static ng_constructor_t ng_gif_constructor
Definition: ng_gif.c:117
static ng_rcvdata_t ng_gif_rcvdata
Definition: ng_gif.c:122
static const struct ng_cmdlist ng_gif_cmdlist[]
Definition: ng_gif.c:127
#define NG_GIF_NODE_TYPE
Definition: ng_gif.h:74

Definition at line 145 of file ng_gif.c.

Referenced by ng_gif_attach().