FreeBSD kernel netgraph code
ng_ccatm.c File Reference
#include <sys/cdefs.h>
#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/socket.h>
#include <sys/socketvar.h>
#include <sys/sbuf.h>
#include <machine/stdarg.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
#include <netnatm/unimsg.h>
#include <netnatm/msg/unistruct.h>
#include <netnatm/api/unisap.h>
#include <netnatm/sig/unidef.h>
#include <netgraph/atm/ngatmbase.h>
#include <netgraph/atm/ng_uni.h>
#include <netnatm/api/atmapi.h>
#include <netgraph/atm/ng_ccatm.h>
#include <netnatm/api/ccatm.h>
Include dependency graph for ng_ccatm.c:

Go to the source code of this file.

Data Structures

struct  ccnode
 
struct  cchook
 

Functions

 __FBSDID ("$FreeBSD$")
 
 MODULE_DEPEND (ng_ccatm, ngatmbase, 1, 1, 1)
 
 MALLOC_DEFINE (M_NG_CCATM, "ng_ccatm", "netgraph uni api node")
 
static int ng_ccatm_addr_req_array_getlen (const struct ng_parse_type *type, const u_char *start, const u_char *buf)
 
static int ng_ccatm_port_array_getlen (const struct ng_parse_type *type, const u_char *start, const u_char *buf)
 
static int ng_ccatm_mod_event (module_t, int, void *)
 
 NETGRAPH_INIT (ccatm, &ng_ccatm_typestruct)
 
static void ng_ccatm_send_user (struct ccuser *, void *, u_int, void *, size_t)
 
static void ng_ccatm_respond_user (struct ccuser *, void *, int, u_int, void *, size_t)
 
static void ng_ccatm_send_uni (struct ccconn *, void *, u_int, u_int, struct uni_msg *)
 
static void ng_ccatm_send_uni_glob (struct ccport *, void *, u_int, u_int, struct uni_msg *)
 
static void ng_ccatm_log (const char *,...)
 
static int ng_ccatm_constructor (node_p node)
 
static int ng_ccatm_shutdown (node_p node)
 
static int ng_ccatm_get_addresses (node_p node, uint32_t portno, struct ng_mesg *msg, struct ng_mesg **resp)
 
static int send_dump (struct ccdata *data, void *uarg, const char *buf)
 
static int ng_ccatm_dump (node_p node)
 
static int ng_ccatm_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_ccatm_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_ccatm_disconnect (hook_p hook)
 
static int ng_ccatm_rcvdata (hook_p hook, item_p item)
 
static struct mbuf * pack_buf (void *h, size_t hlen, void *t, size_t tlen)
 
static int ng_ccatm_rcvuni (hook_p hook, item_p item)
 
static int ng_ccatm_rcvmanage (hook_p hook, item_p item)
 
static int ng_ccatm_rcvdump (hook_p hook, item_p item)
 

Variables

static const struct ng_parse_fixedarray_info ng_ccatm_esi_type_info
 
static const struct ng_parse_type ng_ccatm_esi_type
 
static const struct ng_parse_struct_field ng_ccatm_atm_port_type_info []
 
static const struct ng_parse_type ng_ccatm_atm_port_type
 
static const struct ng_parse_struct_field ng_ccatm_port_type_info []
 
static const struct ng_parse_type ng_ccatm_port_type
 
static const struct ng_parse_fixedarray_info ng_ccatm_addr_array_type_info
 
static const struct ng_parse_type ng_ccatm_addr_array_type
 
static const struct ng_parse_struct_field ng_ccatm_uni_addr_type_info []
 
static const struct ng_parse_type ng_ccatm_uni_addr_type
 
static const struct ng_parse_struct_field ng_ccatm_addr_req_type_info []
 
static const struct ng_parse_type ng_ccatm_addr_req_type
 
static const struct ng_parse_array_info ng_ccatm_addr_req_array_type_info
 
static const struct ng_parse_type ng_ccatm_addr_req_array_type
 
static const struct ng_parse_struct_field ng_ccatm_get_addresses_type_info []
 
static const struct ng_parse_type ng_ccatm_get_addresses_type
 
static const struct ng_parse_array_info ng_ccatm_port_array_type_info
 
static const struct ng_parse_type ng_ccatm_port_array_type
 
static const struct ng_parse_struct_field ng_ccatm_portlist_type_info []
 
static const struct ng_parse_type ng_ccatm_portlist_type
 
static const struct ng_cmdlist ng_ccatm_cmdlist []
 
static ng_constructor_t ng_ccatm_constructor
 
static ng_rcvmsg_t ng_ccatm_rcvmsg
 
static ng_shutdown_t ng_ccatm_shutdown
 
static ng_newhook_t ng_ccatm_newhook
 
static ng_rcvdata_t ng_ccatm_rcvdata
 
static ng_disconnect_t ng_ccatm_disconnect
 
static struct ng_type ng_ccatm_typestruct
 
static ng_rcvdata_t ng_ccatm_rcvuni
 
static ng_rcvdata_t ng_ccatm_rcvdump
 
static ng_rcvdata_t ng_ccatm_rcvmanage
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

MALLOC_DEFINE ( M_NG_CCATM  ,
"ng_ccatm"  ,
"netgraph uni api node"   
)

◆ MODULE_DEPEND()

MODULE_DEPEND ( ng_ccatm  ,
ngatmbase  ,
,
,
 
)

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( ccatm  ,
ng_ccatm_typestruct 
)

◆ ng_ccatm_addr_req_array_getlen()

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

Definition at line 123 of file ng_ccatm.c.

References ngm_ccatm_get_addresses::addr, and ngm_ccatm_get_addresses::count.

◆ ng_ccatm_constructor()

static int ng_ccatm_constructor ( node_p  node)
static

Definition at line 347 of file ng_ccatm.c.

References NG_NODE_SET_PRIVATE, and ccnode::node.

◆ ng_ccatm_disconnect()

static int ng_ccatm_disconnect ( hook_p  hook)
static

◆ ng_ccatm_dump()

static int ng_ccatm_dump ( node_p  node)
static

Definition at line 462 of file ng_ccatm.c.

References NG_NODE_PRIVATE, NG_SEND_DATA_ONLY, ccnode::node, and send_dump().

Referenced by ng_ccatm_rcvmsg().

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

◆ ng_ccatm_get_addresses()

static int ng_ccatm_get_addresses ( node_p  node,
uint32_t  portno,
struct ng_mesg msg,
struct ng_mesg **  resp 
)
static

Definition at line 391 of file ng_ccatm.c.

References ngm_ccatm_addr_req::addr, ngm_ccatm_get_addresses::addr, ngm_ccatm_get_addresses::count, count, NG_MKRESPONSE, NG_NODE_PRIVATE, ccnode::node, and ngm_ccatm_addr_req::port.

Referenced by ng_ccatm_rcvmsg().

Here is the caller graph for this function:

◆ ng_ccatm_log()

static void ng_ccatm_log ( const char *  fmt,
  ... 
)
static

Definition at line 332 of file ng_ccatm.c.

References ng_ccatm_log(), ng_ccatm_respond_user(), ng_ccatm_send_uni(), ng_ccatm_send_uni_glob(), and ng_ccatm_send_user().

Referenced by ng_ccatm_log().

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

◆ ng_ccatm_mod_event()

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

Definition at line 1175 of file ng_ccatm.c.

References event.

◆ ng_ccatm_newhook()

◆ ng_ccatm_port_array_getlen()

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

Definition at line 149 of file ng_ccatm.c.

References ngm_ccatm_portlist::nports, and ngm_ccatm_portlist::ports.

◆ ng_ccatm_rcvdata()

static int ng_ccatm_rcvdata ( hook_p  hook,
item_p  item 
)
static

Definition at line 915 of file ng_ccatm.c.

References ccnode::data, cchook::hook, cchook::inst, NG_FREE_ITEM, NG_HOOK_PRIVATE, NGI_GET_M, cchook::node, ccatm_op::op, uni_msg_destroy(), and uni_msg_unpack_mbuf().

Here is the call graph for this function:

◆ ng_ccatm_rcvdump()

static int ng_ccatm_rcvdump ( hook_p  hook,
item_p  item 
)
static

Definition at line 1154 of file ng_ccatm.c.

References NG_FREE_ITEM.

◆ ng_ccatm_rcvmanage()

static int ng_ccatm_rcvmanage ( hook_p  hook,
item_p  item 
)
static

Definition at line 1147 of file ng_ccatm.c.

References NG_FREE_ITEM.

◆ ng_ccatm_rcvmsg()

◆ ng_ccatm_rcvuni()

static int ng_ccatm_rcvuni ( hook_p  hook,
item_p  item 
)
static

Definition at line 1049 of file ng_ccatm.c.

References uni_arg::cookie, ccnode::data, cchook::hook, cchook::inst, NG_FREE_ITEM, NG_HOOK_PRIVATE, NGI_GET_M, cchook::node, uni_arg::sig, uni_msg_destroy(), and uni_msg_unpack_mbuf().

Here is the call graph for this function:

◆ ng_ccatm_respond_user()

static void ng_ccatm_respond_user ( struct ccuser *  user,
void *  uarg,
int  err,
u_int  data,
void *  val,
size_t  len 
)
static

Definition at line 1022 of file ng_ccatm.c.

References data, cchook::hook, NG_SEND_DATA_ONLY, ccatm_op::op, and pack_buf().

Referenced by ng_ccatm_log().

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

◆ ng_ccatm_send_uni()

static void ng_ccatm_send_uni ( struct ccconn *  conn,
void *  uarg,
u_int  op,
u_int  cookie,
struct uni_msg *  msg 
)
static

Definition at line 1097 of file ng_ccatm.c.

References uni_arg::cookie, cchook::hook, NG_SEND_DATA_ONLY, uni_arg::sig, uni_msg_destroy(), and uni_msg_pack_mbuf().

Referenced by ng_ccatm_log().

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

◆ ng_ccatm_send_uni_glob()

static void ng_ccatm_send_uni_glob ( struct ccport *  port,
void *  uarg,
u_int  op,
u_int  cookie,
struct uni_msg *  msg 
)
static

Definition at line 1122 of file ng_ccatm.c.

References uni_arg::cookie, cchook::hook, NG_SEND_DATA_ONLY, uni_arg::sig, uni_msg_destroy(), and uni_msg_pack_mbuf().

Referenced by ng_ccatm_log().

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

◆ ng_ccatm_send_user()

static void ng_ccatm_send_user ( struct ccuser *  user,
void *  uarg,
u_int  op,
void *  val,
size_t  len 
)
static

Definition at line 1000 of file ng_ccatm.c.

References cchook::hook, NG_SEND_DATA_ONLY, ccatm_op::op, and pack_buf().

Referenced by ng_ccatm_log().

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

◆ ng_ccatm_shutdown()

static int ng_ccatm_shutdown ( node_p  node)
static

Definition at line 372 of file ng_ccatm.c.

References NG_NODE_PRIVATE, NG_NODE_SET_PRIVATE, NG_NODE_UNREF, and ccnode::node.

◆ pack_buf()

static struct mbuf * pack_buf ( void *  h,
size_t  hlen,
void *  t,
size_t  tlen 
)
static

Definition at line 950 of file ng_ccatm.c.

References last.

Referenced by ng_ccatm_respond_user(), and ng_ccatm_send_user().

Here is the caller graph for this function:

◆ send_dump()

static int send_dump ( struct ccdata *  data,
void *  uarg,
const char *  buf 
)
static

Definition at line 431 of file ng_ccatm.c.

Referenced by ng_ccatm_dump().

Here is the caller graph for this function:

Variable Documentation

◆ ng_ccatm_addr_array_type

const struct ng_parse_type ng_ccatm_addr_array_type
static
Initial value:
= {
}
static const struct ng_parse_fixedarray_info ng_ccatm_addr_array_type_info
Definition: ng_ccatm.c:98
const struct ng_parse_type ng_parse_fixedarray_type
Definition: ng_parse.c:271

Definition at line 100 of file ng_ccatm.c.

◆ ng_ccatm_addr_array_type_info

const struct ng_parse_fixedarray_info ng_ccatm_addr_array_type_info
static
Initial value:
=
#define NGM_CCATM_ADDR_ARRAY_INFO
Definition: ng_ccatm.h:65

Definition at line 98 of file ng_ccatm.c.

◆ ng_ccatm_addr_req_array_type

const struct ng_parse_type ng_ccatm_addr_req_array_type
static
Initial value:
= {
}
static const struct ng_parse_array_info ng_ccatm_addr_req_array_type_info
Definition: ng_ccatm.c:132
const struct ng_parse_type ng_parse_array_type
Definition: ng_parse.c:318

Definition at line 134 of file ng_ccatm.c.

◆ ng_ccatm_addr_req_array_type_info

const struct ng_parse_array_info ng_ccatm_addr_req_array_type_info
static
Initial value:
=
#define NGM_CCATM_ADDR_REQ_ARRAY_INFO
Definition: ng_ccatm.h:101

Definition at line 132 of file ng_ccatm.c.

◆ ng_ccatm_addr_req_type

const struct ng_parse_type ng_ccatm_addr_req_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_ccatm_addr_req_type_info[]
Definition: ng_ccatm.c:114
const struct ng_parse_type ng_parse_struct_type
Definition: ng_parse.c:222

Definition at line 116 of file ng_ccatm.c.

◆ ng_ccatm_addr_req_type_info

const struct ng_parse_struct_field ng_ccatm_addr_req_type_info[]
static
Initial value:
=
#define NGM_CCATM_ADDR_REQ_INFO
Definition: ng_ccatm.h:87

Definition at line 114 of file ng_ccatm.c.

◆ ng_ccatm_atm_port_type

const struct ng_parse_type ng_ccatm_atm_port_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_ccatm_atm_port_type_info[]
Definition: ng_ccatm.c:82

Definition at line 84 of file ng_ccatm.c.

◆ ng_ccatm_atm_port_type_info

const struct ng_parse_struct_field ng_ccatm_atm_port_type_info[]
static
Initial value:
=
#define NGM_CCATM_ATM_PORT_INFO
Definition: ng_ccatm.h:134

Definition at line 82 of file ng_ccatm.c.

◆ ng_ccatm_cmdlist

const struct ng_cmdlist ng_ccatm_cmdlist[]
static

Definition at line 176 of file ng_ccatm.c.

◆ ng_ccatm_constructor

ng_constructor_t ng_ccatm_constructor
static

Definition at line 274 of file ng_ccatm.c.

◆ ng_ccatm_disconnect

ng_disconnect_t ng_ccatm_disconnect
static

Definition at line 279 of file ng_ccatm.c.

◆ ng_ccatm_esi_type

const struct ng_parse_type ng_ccatm_esi_type
static
Initial value:
= {
}
static const struct ng_parse_fixedarray_info ng_ccatm_esi_type_info
Definition: ng_ccatm.c:74

Definition at line 76 of file ng_ccatm.c.

◆ ng_ccatm_esi_type_info

const struct ng_parse_fixedarray_info ng_ccatm_esi_type_info
static
Initial value:
=
#define NGM_CCATM_ESI_INFO
Definition: ng_ccatm.h:129

Definition at line 74 of file ng_ccatm.c.

◆ ng_ccatm_get_addresses_type

const struct ng_parse_type ng_ccatm_get_addresses_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_ccatm_get_addresses_type_info[]
Definition: ng_ccatm.c:140

Definition at line 142 of file ng_ccatm.c.

◆ ng_ccatm_get_addresses_type_info

const struct ng_parse_struct_field ng_ccatm_get_addresses_type_info[]
static
Initial value:
=
#define NGM_CCATM_GET_ADDRESSES_INFO
Definition: ng_ccatm.h:106

Definition at line 140 of file ng_ccatm.c.

◆ ng_ccatm_newhook

ng_newhook_t ng_ccatm_newhook
static

Definition at line 277 of file ng_ccatm.c.

◆ ng_ccatm_port_array_type

const struct ng_parse_type ng_ccatm_port_array_type
static
Initial value:
= {
}
static const struct ng_parse_array_info ng_ccatm_port_array_type_info
Definition: ng_ccatm.c:158

Definition at line 160 of file ng_ccatm.c.

◆ ng_ccatm_port_array_type_info

const struct ng_parse_array_info ng_ccatm_port_array_type_info
static
Initial value:
=
#define NGM_CCATM_PORT_ARRAY_INFO
Definition: ng_ccatm.h:155

Definition at line 158 of file ng_ccatm.c.

◆ ng_ccatm_port_type

const struct ng_parse_type ng_ccatm_port_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_ccatm_port_type_info[]
Definition: ng_ccatm.c:90

Definition at line 92 of file ng_ccatm.c.

◆ ng_ccatm_port_type_info

const struct ng_parse_struct_field ng_ccatm_port_type_info[]
static
Initial value:
=
#define NGM_CCATM_PORT_INFO
Definition: ng_ccatm.h:119

Definition at line 90 of file ng_ccatm.c.

◆ ng_ccatm_portlist_type

const struct ng_parse_type ng_ccatm_portlist_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_ccatm_portlist_type_info[]
Definition: ng_ccatm.c:166

Definition at line 168 of file ng_ccatm.c.

◆ ng_ccatm_portlist_type_info

const struct ng_parse_struct_field ng_ccatm_portlist_type_info[]
static
Initial value:
=
#define NGM_CCATM_PORTLIST_INFO
Definition: ng_ccatm.h:160

Definition at line 166 of file ng_ccatm.c.

◆ ng_ccatm_rcvdata

ng_rcvdata_t ng_ccatm_rcvdata
static

Definition at line 278 of file ng_ccatm.c.

◆ ng_ccatm_rcvdump

ng_rcvdata_t ng_ccatm_rcvdump
static

Definition at line 297 of file ng_ccatm.c.

Referenced by ng_ccatm_newhook().

◆ ng_ccatm_rcvmanage

ng_rcvdata_t ng_ccatm_rcvmanage
static

Definition at line 298 of file ng_ccatm.c.

Referenced by ng_ccatm_newhook().

◆ ng_ccatm_rcvmsg

ng_rcvmsg_t ng_ccatm_rcvmsg
static

Definition at line 275 of file ng_ccatm.c.

◆ ng_ccatm_rcvuni

ng_rcvdata_t ng_ccatm_rcvuni
static

Definition at line 296 of file ng_ccatm.c.

Referenced by ng_ccatm_newhook().

◆ ng_ccatm_shutdown

ng_shutdown_t ng_ccatm_shutdown
static

Definition at line 276 of file ng_ccatm.c.

◆ ng_ccatm_typestruct

struct ng_type ng_ccatm_typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.mod_event = ng_ccatm_mod_event,
.constructor = ng_ccatm_constructor,
.rcvmsg = ng_ccatm_rcvmsg,
.shutdown = ng_ccatm_shutdown,
.newhook = ng_ccatm_newhook,
.rcvdata = ng_ccatm_rcvdata,
.disconnect = ng_ccatm_disconnect,
.cmdlist = ng_ccatm_cmdlist,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static ng_shutdown_t ng_ccatm_shutdown
Definition: ng_ccatm.c:276
static ng_disconnect_t ng_ccatm_disconnect
Definition: ng_ccatm.c:279
static const struct ng_cmdlist ng_ccatm_cmdlist[]
Definition: ng_ccatm.c:176
static ng_rcvmsg_t ng_ccatm_rcvmsg
Definition: ng_ccatm.c:275
static ng_newhook_t ng_ccatm_newhook
Definition: ng_ccatm.c:277
static ng_rcvdata_t ng_ccatm_rcvdata
Definition: ng_ccatm.c:278
static ng_constructor_t ng_ccatm_constructor
Definition: ng_ccatm.c:274
static int ng_ccatm_mod_event(module_t, int, void *)
Definition: ng_ccatm.c:1175
#define NG_CCATM_NODE_TYPE
Definition: ng_ccatm.h:42

Definition at line 282 of file ng_ccatm.c.

◆ ng_ccatm_uni_addr_type

const struct ng_parse_type ng_ccatm_uni_addr_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_ccatm_uni_addr_type_info[]
Definition: ng_ccatm.c:106

Definition at line 108 of file ng_ccatm.c.

◆ ng_ccatm_uni_addr_type_info

const struct ng_parse_struct_field ng_ccatm_uni_addr_type_info[]
static
Initial value:
=
#define NGM_CCATM_UNI_ADDR_INFO
Definition: ng_ccatm.h:71

Definition at line 106 of file ng_ccatm.c.