FreeBSD kernel netgraph code
ng_uni.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/syslog.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/callout.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 <netgraph/atm/ngatmbase.h>
#include <netnatm/saal/sscopdef.h>
#include <netnatm/saal/sscfudef.h>
#include <netgraph/atm/uni/ng_uni_cust.h>
#include <netnatm/sig/uni.h>
#include <netnatm/sig/unisig.h>
#include <netgraph/atm/ng_sscop.h>
#include <netgraph/atm/ng_sscfu.h>
#include <netgraph/atm/ng_uni.h>
Include dependency graph for ng_uni.c:

Go to the source code of this file.

Data Structures

struct  priv
 
struct  unimem_debug
 

Macros

#define D(S)   case S: printf("%s", #S); break
 
#define UNI_DEBUG_DEFINE(D)   [UNI_FAC_##D] = #D,
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_NG_UNI, "netgraph_uni_node", "netgraph uni node")
 
static MALLOC_DEFINE (M_UNI, "netgraph_uni_data", "uni protocol data")
 
 MODULE_DEPEND (ng_uni, ngatmbase, 1, 1, 1)
 
static int ng_uni_mod_event (module_t, int, void *)
 
 NETGRAPH_INIT (uni, &ng_uni_typestruct)
 
static void uni_uni_output (struct uni *, void *, enum uni_sig, u_int32_t, struct uni_msg *)
 
static void uni_saal_output (struct uni *, void *, enum saal_sig, struct uni_msg *)
 
static void uni_verbose (struct uni *, static void uni_do_status(struct uni void *, u_int, static void uni_do_status(struct uni const char *,...)
 
static int ng_uni_constructor (node_p node)
 
static int ng_uni_shutdown (node_p node)
 
static void uni_do_status (struct uni *uni, void *uarg, void *sbuf, const char *fmt,...)
 
static int text_status (node_p node, struct priv *priv, char *buf, u_int len)
 
static int ng_uni_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_uni_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_uni_disconnect (hook_p hook)
 
static int ng_uni_rcvupper (hook_p hook, item_p item)
 
static void dump_uni_msg (struct uni_msg *msg)
 
static void dump_saal_signal (node_p node, enum saal_sig sig, struct uni_msg *msg, int to)
 
static int ng_uni_rcvlower (hook_p hook __unused, item_p item)
 
static void uni_verbose (struct uni *uni, void *varg, u_int fac, const char *fmt,...)
 
 LIST_HEAD (unimem_debug_list, unimem_debug)
 
static void uni_init (void)
 
static void uni_fini (void)
 
void * ng_uni_malloc (enum unimem type, const char *file, u_int lno)
 
void ng_uni_free (enum unimem type, void *ptr, const char *file, u_int lno)
 

Variables

static const struct ng_parse_struct_field ng_uni_config_mask_type_info []
 
static const struct ng_parse_type ng_uni_config_mask_type
 
static const struct ng_parse_struct_field ng_uni_config_type_info []
 
static const struct ng_parse_type ng_uni_config_type
 
static const struct ng_parse_struct_field ng_uni_set_config_type_info []
 
static const struct ng_parse_type ng_uni_set_config_type
 
static const struct ng_parse_fixedarray_info ng_uni_debuglevel_type_info
 
static const struct ng_parse_type ng_uni_debuglevel_type
 
static const struct ng_parse_struct_field ng_uni_debug_type_info []
 
static const struct ng_parse_type ng_uni_debug_type
 
static const struct ng_cmdlist ng_uni_cmdlist []
 
static ng_constructor_t ng_uni_constructor
 
static ng_shutdown_t ng_uni_shutdown
 
static ng_rcvmsg_t ng_uni_rcvmsg
 
static ng_newhook_t ng_uni_newhook
 
static ng_disconnect_t ng_uni_disconnect
 
static ng_rcvdata_t ng_uni_rcvlower
 
static ng_rcvdata_t ng_uni_rcvupper
 
static struct ng_type ng_uni_typestruct
 
static struct unimem_debug_list nguni_freemem [UNIMEM_TYPES]
 
static struct unimem_debug_list nguni_usedmem [UNIMEM_TYPES]
 
static struct mtx nguni_unilist_mtx
 
static const char * unimem_names [UNIMEM_TYPES]
 

Macro Definition Documentation

◆ D

#define D (   S)    case S: printf("%s", #S); break

◆ UNI_DEBUG_DEFINE

#define UNI_DEBUG_DEFINE (   D)    [UNI_FAC_##D] = #D,

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ dump_saal_signal()

static void dump_saal_signal ( node_p  node,
enum saal_sig  sig,
struct uni_msg *  msg,
int  to 
)
static

Definition at line 615 of file ng_uni.c.

References D, dump_uni_msg(), NG_NODE_PRIVATE, and priv::uni.

Referenced by ng_uni_rcvlower(), and uni_saal_output().

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

◆ dump_uni_msg()

static void dump_uni_msg ( struct uni_msg *  msg)
static

Definition at line 594 of file ng_uni.c.

Referenced by dump_saal_signal().

Here is the caller graph for this function:

◆ LIST_HEAD()

LIST_HEAD ( unimem_debug_list  ,
unimem_debug   
)

◆ MALLOC_DEFINE() [1/2]

static MALLOC_DEFINE ( M_NG_UNI  ,
"netgraph_uni_node"  ,
"netgraph uni node"   
)
static

◆ MALLOC_DEFINE() [2/2]

static MALLOC_DEFINE ( M_UNI  ,
"netgraph_uni_data"  ,
"uni protocol data  
)
static

◆ MODULE_DEPEND()

MODULE_DEPEND ( ng_uni  ,
ngatmbase  ,
,
,
 
)

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( uni  ,
ng_uni_typestruct 
)

◆ ng_uni_constructor()

static int ng_uni_constructor ( node_p  node)
static

Definition at line 224 of file ng_uni.c.

References NG_NODE_FORCE_WRITER, NG_NODE_SET_PRIVATE, and priv::uni.

◆ ng_uni_disconnect()

static int ng_uni_disconnect ( hook_p  hook)
static

Definition at line 490 of file ng_uni.c.

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

Here is the call graph for this function:

◆ ng_uni_free()

void ng_uni_free ( enum unimem  type,
void *  ptr,
const char *  file,
u_int  lno 
)

◆ ng_uni_malloc()

void * ng_uni_malloc ( enum unimem  type,
const char *  file,
u_int  lno 
)

◆ ng_uni_mod_event()

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

Definition at line 902 of file ng_uni.c.

References event, uni_fini(), and uni_init().

Here is the call graph for this function:

◆ ng_uni_newhook()

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

Definition at line 474 of file ng_uni.c.

References priv::lower, name, NG_HOOK_SET_RCVDATA, NG_NODE_PRIVATE, ng_uni_rcvupper, and priv::upper.

◆ ng_uni_rcvlower()

static int ng_uni_rcvlower ( hook_p hook  __unused,
item_p  item 
)
static

Definition at line 655 of file ng_uni.c.

References dump_saal_signal(), priv::enabled, NG_FREE_ITEM, NG_HOOK_NODE, NG_NODE_PRIVATE, NGI_GET_M, sscfu_arg::sig, priv::uni, uni_msg_destroy(), and uni_msg_unpack_mbuf().

Here is the call graph for this function:

◆ ng_uni_rcvmsg()

◆ ng_uni_rcvupper()

static int ng_uni_rcvupper ( hook_p  hook,
item_p  item 
)
static

Definition at line 520 of file ng_uni.c.

References uni_arg::cookie, priv::enabled, NG_FREE_ITEM, NG_HOOK_NODE, NG_NODE_PRIVATE, NGI_GET_M, uni_arg::sig, priv::uni, uni_msg_destroy(), and uni_msg_unpack_mbuf().

Here is the call graph for this function:

◆ ng_uni_shutdown()

static int ng_uni_shutdown ( node_p  node)
static

Definition at line 242 of file ng_uni.c.

References NG_NODE_PRIVATE, NG_NODE_SET_PRIVATE, NG_NODE_UNREF, and priv::uni.

◆ text_status()

static int text_status ( node_p  node,
struct priv priv,
char *  buf,
u_int  len 
)
static

Definition at line 271 of file ng_uni.c.

References priv::lower, NG_HOOK_NAME, NG_HOOK_NODE, NG_HOOK_PEER, NG_NODE_NAME, priv::uni, and priv::upper.

Referenced by ng_uni_rcvmsg().

Here is the caller graph for this function:

◆ uni_do_status()

static void uni_do_status ( struct uni *  uni,
void *  uarg,
void *  sbuf,
const char *  fmt,
  ... 
)
static

Definition at line 261 of file ng_uni.c.

Referenced by uni_verbose().

Here is the caller graph for this function:

◆ uni_fini()

static void uni_fini ( void  )
static

Definition at line 799 of file ng_uni.c.

References unimem_debug::file, unimem_debug::lno, nguni_freemem, nguni_unilist_mtx, nguni_usedmem, type, unimem_names, and UNIMEM_TYPES.

Referenced by ng_uni_mod_event().

Here is the caller graph for this function:

◆ uni_init()

static void uni_init ( void  )
static

Definition at line 792 of file ng_uni.c.

References nguni_unilist_mtx.

Referenced by ng_uni_mod_event().

Here is the caller graph for this function:

◆ uni_saal_output()

static void uni_saal_output ( struct uni *  uni,
void *  varg,
enum saal_sig  sig,
struct uni_msg *  msg 
)
static

Definition at line 706 of file ng_uni.c.

References dump_saal_signal(), priv::lower, NG_NODE_PRIVATE, NG_SEND_DATA_ONLY, sscfu_arg::sig, priv::uni, uni_msg_destroy(), and uni_msg_pack_mbuf().

Referenced by uni_verbose().

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

◆ uni_uni_output()

static void uni_uni_output ( struct uni *  uni,
void *  varg,
enum uni_sig  sig,
u_int32_t  cookie,
struct uni_msg *  msg 
)
static

Definition at line 567 of file ng_uni.c.

References uni_arg::cookie, NG_NODE_PRIVATE, NG_SEND_DATA_ONLY, uni_arg::sig, uni_msg_destroy(), uni_msg_pack_mbuf(), and priv::upper.

Referenced by uni_verbose().

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

◆ uni_verbose() [1/2]

static void uni_verbose ( struct uni *  ,
static void uni_do_status(struct uni  void *,
u_int  ,
static void uni_do_status(struct uni  const char *,
  ... 
)
static

Definition at line 207 of file ng_uni.c.

References uni_do_status(), uni_saal_output(), uni_uni_output(), and uni_verbose().

Referenced by uni_verbose().

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

◆ uni_verbose() [2/2]

static void uni_verbose ( struct uni *  uni,
void *  varg,
u_int  fac,
const char *  fmt,
  ... 
)
static

Definition at line 735 of file ng_uni.c.

Variable Documentation

◆ ng_uni_cmdlist

const struct ng_cmdlist ng_uni_cmdlist[]
static

Definition at line 123 of file ng_uni.c.

◆ ng_uni_config_mask_type

const struct ng_parse_type ng_uni_config_mask_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_uni_config_mask_type_info[]
Definition: ng_uni.c:81

Definition at line 83 of file ng_uni.c.

◆ ng_uni_config_mask_type_info

const struct ng_parse_struct_field ng_uni_config_mask_type_info[]
static
Initial value:
=
#define NGM_UNI_CONFIG_MASK_INFO
Definition: ng_uni.h:93

Definition at line 81 of file ng_uni.c.

◆ ng_uni_config_type

const struct ng_parse_type ng_uni_config_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_uni_config_type_info[]
Definition: ng_uni.c:89

Definition at line 91 of file ng_uni.c.

◆ ng_uni_config_type_info

const struct ng_parse_struct_field ng_uni_config_type_info[]
static
Initial value:
=
#define NGM_UNI_CONFIG_INFO
Definition: ng_uni.h:64

Definition at line 89 of file ng_uni.c.

◆ ng_uni_constructor

ng_constructor_t ng_uni_constructor
static

Definition at line 179 of file ng_uni.c.

◆ ng_uni_debug_type

const struct ng_parse_type ng_uni_debug_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_uni_debug_type_info[]
Definition: ng_uni.c:113

Definition at line 115 of file ng_uni.c.

◆ ng_uni_debug_type_info

const struct ng_parse_struct_field ng_uni_debug_type_info[]
static
Initial value:
=
#define NGM_UNI_DEBUG_INFO
Definition: ng_uni.h:58

Definition at line 113 of file ng_uni.c.

◆ ng_uni_debuglevel_type

const struct ng_parse_type ng_uni_debuglevel_type
static
Initial value:
= {
}
const struct ng_parse_type ng_parse_fixedarray_type
Definition: ng_parse.c:271
static const struct ng_parse_fixedarray_info ng_uni_debuglevel_type_info
Definition: ng_uni.c:107

Definition at line 109 of file ng_uni.c.

◆ ng_uni_debuglevel_type_info

const struct ng_parse_fixedarray_info ng_uni_debuglevel_type_info
static
Initial value:
=
#define NGM_UNI_DEBUGLEVEL_INFO
Definition: ng_uni.h:54

Definition at line 107 of file ng_uni.c.

◆ ng_uni_disconnect

ng_disconnect_t ng_uni_disconnect
static

Definition at line 183 of file ng_uni.c.

◆ ng_uni_newhook

ng_newhook_t ng_uni_newhook
static

Definition at line 182 of file ng_uni.c.

◆ ng_uni_rcvlower

ng_rcvdata_t ng_uni_rcvlower
static

Definition at line 184 of file ng_uni.c.

◆ ng_uni_rcvmsg

ng_rcvmsg_t ng_uni_rcvmsg
static

Definition at line 181 of file ng_uni.c.

◆ ng_uni_rcvupper

ng_rcvdata_t ng_uni_rcvupper
static

Definition at line 185 of file ng_uni.c.

Referenced by ng_uni_newhook().

◆ ng_uni_set_config_type

const struct ng_parse_type ng_uni_set_config_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_uni_set_config_type_info[]
Definition: ng_uni.c:97

Definition at line 99 of file ng_uni.c.

◆ ng_uni_set_config_type_info

const struct ng_parse_struct_field ng_uni_set_config_type_info[]
static
Initial value:
=
#define NGM_UNI_SET_CONFIG_INFO
Definition: ng_uni.h:105

Definition at line 97 of file ng_uni.c.

◆ ng_uni_shutdown

ng_shutdown_t ng_uni_shutdown
static

Definition at line 180 of file ng_uni.c.

◆ ng_uni_typestruct

struct ng_type ng_uni_typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.mod_event = ng_uni_mod_event,
.constructor = ng_uni_constructor,
.rcvmsg = ng_uni_rcvmsg,
.shutdown = ng_uni_shutdown,
.newhook = ng_uni_newhook,
.rcvdata = ng_uni_rcvlower,
.disconnect = ng_uni_disconnect,
.cmdlist = ng_uni_cmdlist,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static int ng_uni_mod_event(module_t, int, void *)
Definition: ng_uni.c:902
static ng_rcvmsg_t ng_uni_rcvmsg
Definition: ng_uni.c:181
static ng_newhook_t ng_uni_newhook
Definition: ng_uni.c:182
static ng_rcvdata_t ng_uni_rcvlower
Definition: ng_uni.c:184
static const struct ng_cmdlist ng_uni_cmdlist[]
Definition: ng_uni.c:123
static ng_constructor_t ng_uni_constructor
Definition: ng_uni.c:179
static ng_shutdown_t ng_uni_shutdown
Definition: ng_uni.c:180
static ng_disconnect_t ng_uni_disconnect
Definition: ng_uni.c:183
#define NG_UNI_NODE_TYPE
Definition: ng_uni.h:38

Definition at line 189 of file ng_uni.c.

◆ nguni_freemem

struct unimem_debug_list nguni_freemem[UNIMEM_TYPES]
static
Initial value:
= {
LIST_HEAD_INITIALIZER(nguni_freemem[0]),
LIST_HEAD_INITIALIZER(nguni_freemem[1]),
LIST_HEAD_INITIALIZER(nguni_freemem[2]),
LIST_HEAD_INITIALIZER(nguni_freemem[3]),
LIST_HEAD_INITIALIZER(nguni_freemem[4]),
}
static struct unimem_debug_list nguni_freemem[UNIMEM_TYPES]
Definition: ng_uni.c:766

Definition at line 766 of file ng_uni.c.

Referenced by ng_uni_free(), ng_uni_malloc(), and uni_fini().

◆ nguni_unilist_mtx

struct mtx nguni_unilist_mtx
static

Definition at line 781 of file ng_uni.c.

Referenced by ng_uni_free(), ng_uni_malloc(), uni_fini(), and uni_init().

◆ nguni_usedmem

struct unimem_debug_list nguni_usedmem[UNIMEM_TYPES]
static
Initial value:
= {
LIST_HEAD_INITIALIZER(nguni_usedmem[0]),
LIST_HEAD_INITIALIZER(nguni_usedmem[1]),
LIST_HEAD_INITIALIZER(nguni_usedmem[2]),
LIST_HEAD_INITIALIZER(nguni_usedmem[3]),
LIST_HEAD_INITIALIZER(nguni_usedmem[4]),
}
static struct unimem_debug_list nguni_usedmem[UNIMEM_TYPES]
Definition: ng_uni.c:773

Definition at line 773 of file ng_uni.c.

Referenced by ng_uni_free(), ng_uni_malloc(), and uni_fini().

◆ unimem_names

const char* unimem_names[UNIMEM_TYPES]
static
Initial value:
= {
"instance",
"all",
"signal",
"call",
"party"
}

Definition at line 783 of file ng_uni.c.

Referenced by ng_uni_free(), and uni_fini().