FreeBSD kernel netgraph code
ng_rfc1490.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/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_rfc1490.h>
Include dependency graph for ng_rfc1490.c:

Go to the source code of this file.

Data Structures

struct  ng_rfc1490_encap_t
 
struct  ng_rfc1490_private
 

Macros

#define HDLC_UI   0x03
 
#define NLPID_IP   0xCC
 
#define NLPID_PPP   0xCF
 
#define NLPID_SNAP   0x80
 
#define NLPID_Q933   0x08
 
#define NLPID_CLNP   0x81
 
#define NLPID_ESIS   0x82
 
#define NLPID_ISIS   0x83
 
#define ERROUT(x)   do { error = (x); goto done; } while (0)
 
#define MAX_ENCAPS_HDR   8
 
#define OUICMP(P, A, B, C)   ((P)[0]==(A) && (P)[1]==(B) && (P)[2]==(C))
 

Typedefs

typedef struct ng_rfc1490_privatepriv_p
 

Enumerations

enum  { NG_RFC1490_ENCAP_IETF_IP = 1 , NG_RFC1490_ENCAP_IETF_SNAP , NG_RFC1490_ENCAP_CISCO }
 

Functions

 NETGRAPH_INIT (rfc1490, &typestruct)
 
static int ng_rfc1490_constructor (node_p node)
 
static int ng_rfc1490_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_rfc1490_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_rfc1490_rcvdata (hook_p hook, item_p item)
 
static int ng_rfc1490_shutdown (node_p node)
 
static int ng_rfc1490_disconnect (hook_p hook)
 

Variables

static const struct ng_rfc1490_encap_t ng_rfc1490_encaps []
 
static ng_constructor_t ng_rfc1490_constructor
 
static ng_rcvmsg_t ng_rfc1490_rcvmsg
 
static ng_shutdown_t ng_rfc1490_shutdown
 
static ng_newhook_t ng_rfc1490_newhook
 
static ng_rcvdata_t ng_rfc1490_rcvdata
 
static ng_disconnect_t ng_rfc1490_disconnect
 
static const struct ng_cmdlist ng_rfc1490_cmds []
 
static struct ng_type typestruct
 

Macro Definition Documentation

◆ ERROUT

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

Definition at line 83 of file ng_rfc1490.c.

◆ HDLC_UI

#define HDLC_UI   0x03

Definition at line 73 of file ng_rfc1490.c.

◆ MAX_ENCAPS_HDR

#define MAX_ENCAPS_HDR   8

Definition at line 302 of file ng_rfc1490.c.

◆ NLPID_CLNP

#define NLPID_CLNP   0x81

Definition at line 79 of file ng_rfc1490.c.

◆ NLPID_ESIS

#define NLPID_ESIS   0x82

Definition at line 80 of file ng_rfc1490.c.

◆ NLPID_IP

#define NLPID_IP   0xCC

Definition at line 75 of file ng_rfc1490.c.

◆ NLPID_ISIS

#define NLPID_ISIS   0x83

Definition at line 81 of file ng_rfc1490.c.

◆ NLPID_PPP

#define NLPID_PPP   0xCF

Definition at line 76 of file ng_rfc1490.c.

◆ NLPID_Q933

#define NLPID_Q933   0x08

Definition at line 78 of file ng_rfc1490.c.

◆ NLPID_SNAP

#define NLPID_SNAP   0x80

Definition at line 77 of file ng_rfc1490.c.

◆ OUICMP

#define OUICMP (   P,
  A,
  B,
 
)    ((P)[0]==(A) && (P)[1]==(B) && (P)[2]==(C))

Definition at line 303 of file ng_rfc1490.c.

Typedef Documentation

◆ priv_p

typedef struct ng_rfc1490_private* priv_p

Definition at line 112 of file ng_rfc1490.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NG_RFC1490_ENCAP_IETF_IP 
NG_RFC1490_ENCAP_IETF_SNAP 
NG_RFC1490_ENCAP_CISCO 

Definition at line 86 of file ng_rfc1490.c.

Function Documentation

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( rfc1490  ,
typestruct 
)

◆ ng_rfc1490_constructor()

static int ng_rfc1490_constructor ( node_p  node)
static

Definition at line 163 of file ng_rfc1490.c.

References NG_NODE_SET_PRIVATE, and ng_rfc1490_encaps.

◆ ng_rfc1490_disconnect()

static int ng_rfc1490_disconnect ( hook_p  hook)
static

Definition at line 470 of file ng_rfc1490.c.

References 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_rfc1490_newhook()

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

◆ ng_rfc1490_rcvdata()

◆ ng_rfc1490_rcvmsg()

◆ ng_rfc1490_shutdown()

static int ng_rfc1490_shutdown ( node_p  node)
static

Definition at line 454 of file ng_rfc1490.c.

References NG_NODE_PRIVATE, NG_NODE_SET_PRIVATE, and NG_NODE_UNREF.

Variable Documentation

◆ ng_rfc1490_cmds

const struct ng_cmdlist ng_rfc1490_cmds[]
static
Initial value:
= {
{
"setencap",
NULL
},
{
"getencap",
NULL,
},
{ 0 }
}
const struct ng_parse_type ng_parse_string_type
Definition: ng_parse.c:766
@ NGM_RFC1490_SET_ENCAP
Definition: ng_rfc1490.h:59
@ NGM_RFC1490_GET_ENCAP
Definition: ng_rfc1490.h:60
#define NGM_RFC1490_COOKIE
Definition: ng_rfc1490.h:49

Definition at line 123 of file ng_rfc1490.c.

◆ ng_rfc1490_constructor

ng_constructor_t ng_rfc1490_constructor
static

Definition at line 115 of file ng_rfc1490.c.

◆ ng_rfc1490_disconnect

ng_disconnect_t ng_rfc1490_disconnect
static

Definition at line 120 of file ng_rfc1490.c.

◆ ng_rfc1490_encaps

const struct ng_rfc1490_encap_t ng_rfc1490_encaps[]
static
Initial value:
= {
{ NG_RFC1490_ENCAP_IETF_IP, "ietf-ip" },
{ NG_RFC1490_ENCAP_IETF_SNAP, "ietf-snap" },
{ NG_RFC1490_ENCAP_CISCO, "cisco" },
{ 0, NULL},
}
@ NG_RFC1490_ENCAP_IETF_SNAP
Definition: ng_rfc1490.c:88
@ NG_RFC1490_ENCAP_CISCO
Definition: ng_rfc1490.c:89
@ NG_RFC1490_ENCAP_IETF_IP
Definition: ng_rfc1490.c:87

Definition at line 97 of file ng_rfc1490.c.

Referenced by ng_rfc1490_constructor(), and ng_rfc1490_rcvmsg().

◆ ng_rfc1490_newhook

ng_newhook_t ng_rfc1490_newhook
static

Definition at line 118 of file ng_rfc1490.c.

◆ ng_rfc1490_rcvdata

ng_rcvdata_t ng_rfc1490_rcvdata
static

Definition at line 119 of file ng_rfc1490.c.

◆ ng_rfc1490_rcvmsg

ng_rcvmsg_t ng_rfc1490_rcvmsg
static

Definition at line 116 of file ng_rfc1490.c.

◆ ng_rfc1490_shutdown

ng_shutdown_t ng_rfc1490_shutdown
static

Definition at line 117 of file ng_rfc1490.c.

◆ typestruct

struct ng_type typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.constructor = ng_rfc1490_constructor,
.rcvmsg = ng_rfc1490_rcvmsg,
.shutdown = ng_rfc1490_shutdown,
.newhook = ng_rfc1490_newhook,
.rcvdata = ng_rfc1490_rcvdata,
.disconnect = ng_rfc1490_disconnect,
.cmdlist = ng_rfc1490_cmds,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static ng_constructor_t ng_rfc1490_constructor
Definition: ng_rfc1490.c:115
static ng_rcvdata_t ng_rfc1490_rcvdata
Definition: ng_rfc1490.c:119
static const struct ng_cmdlist ng_rfc1490_cmds[]
Definition: ng_rfc1490.c:123
static ng_newhook_t ng_rfc1490_newhook
Definition: ng_rfc1490.c:118
static ng_rcvmsg_t ng_rfc1490_rcvmsg
Definition: ng_rfc1490.c:116
static ng_disconnect_t ng_rfc1490_disconnect
Definition: ng_rfc1490.c:120
static ng_shutdown_t ng_rfc1490_shutdown
Definition: ng_rfc1490.c:117
#define NG_RFC1490_NODE_TYPE
Definition: ng_rfc1490.h:48

Definition at line 142 of file ng_rfc1490.c.