FreeBSD kernel netgraph code
ng_message.h File Reference

Go to the source code of this file.

Data Structures

struct  ng_mesg
 
struct  ng_mesg::ng_msghdr
 
struct  ngm_mkpeer
 
struct  ngm_connect
 
struct  ngm_name
 
struct  ngm_rmhook
 
struct  nodeinfo
 
struct  linkinfo
 
struct  hooklist
 
struct  namelist
 
struct  typeinfo
 
struct  typelist
 
struct  ngm_bandwidth
 
struct  ngm_queue_state
 
struct  flow_manager
 

Macros

#define NG_TYPESIZ   32 /* max type name len (including null) */
 
#define NG_HOOKSIZ   32 /* max hook name len (including null) */
 
#define NG_NODESIZ   32 /* max node name len (including null) */
 
#define NG_PATHSIZ   512 /* max path len (including null) */
 
#define NG_CMDSTRSIZ   32 /* max command string (including null) */
 
#define NG_TEXTRESPONSE   1024 /* allow this length for a text response */
 
#define NGM_READONLY   0x10000000
 
#define NGM_HASREPLY   0x20000000
 
#define NG_GENERIC_NG_MESG_INFO(dtype)
 
#define NG_VERSION   8
 
#define NGF_ORIG   0x00000000 /* the msg is the original request */
 
#define NGF_RESP   0x00000001 /* the message is a response */
 
#define ng_ID_t   uint32_t
 
#define NGM_GENERIC_COOKIE   1137070366
 
#define NGM_FLOW_COOKIE   851672669 /* temp for debugging */
 
#define NGM_LINK_IS_UP   32 /* e.g. carrier found - no data */
 
#define NGM_LINK_IS_DOWN   33 /* carrier lost, includes queue state */
 
#define NGM_HIGH_WATER_PASSED   34 /* includes queue state */
 
#define NGM_LOW_WATER_PASSED   35 /* includes queue state */
 
#define NGM_SYNC_QUEUE_STATE   36 /* sync response from sending packet */
 
#define NGM_DROP_LINK   41 /* drop DTR, etc. - stay in the graph */
 
#define NGM_RAISE_LINK   42 /* if you previously dropped it */
 
#define NGM_FLUSH_QUEUE   43 /* no data */
 
#define NGM_GET_BANDWIDTH   (44|NGM_READONLY) /* either real or measured */
 
#define NGM_SET_XMIT_Q_LIMITS   45 /* includes queue state */
 
#define NGM_GET_XMIT_Q_LIMITS   (46|NGM_READONLY) /* returns queue state */
 
#define NGM_MICROMANAGE
 
#define NGM_SET_FLOW_MANAGER   48 /* send flow control here */
 
#define NG_GENERIC_MKPEER_INFO()
 
#define NG_GENERIC_CONNECT_INFO()
 
#define NG_GENERIC_NAME_INFO()
 
#define NG_GENERIC_RMHOOK_INFO()
 
#define NG_GENERIC_NODEINFO_INFO()
 
#define NG_GENERIC_LINKINFO_INFO(nitype)
 
#define NG_GENERIC_HOOKLIST_INFO(nitype, litype)
 
#define NG_GENERIC_LISTNODES_INFO(niarraytype)
 
#define NG_GENERIC_TYPEINFO_INFO()
 
#define NG_GENERIC_TYPELIST_INFO(tiarraytype)
 
#define NG_GENERIC_BANDWIDTH_INFO()
 
#define NG_GENERIC_QUEUE_INFO()
 
#define NG_GENERIC_FLOW_MANAGER_INFO()
 
#define NGIOCGINFO   _IOR('N', 40, struct nodeinfo) /* get node info */
 
#define NGIOCSETNAME   _IOW('N', 41, struct ngm_name) /* set node name */
 
#define NG_MKMESSAGE(msg, cookie, cmdid, len, how)
 
#define NG_MKRESPONSE(rsp, msg, len, how)
 
#define NG_COPYMESSAGE(copy, msg, how)
 

Enumerations

enum  {
  NGM_SHUTDOWN = 1 , NGM_MKPEER = 2 , NGM_CONNECT = 3 , NGM_NAME = 4 ,
  NGM_RMHOOK = 5 , NGM_NODEINFO = (6|NGM_READONLY|NGM_HASREPLY) , NGM_LISTHOOKS = (7|NGM_READONLY|NGM_HASREPLY) , NGM_LISTNAMES = (8|NGM_READONLY|NGM_HASREPLY) ,
  NGM_LISTNODES = (9|NGM_READONLY|NGM_HASREPLY) , NGM_LISTTYPES = (10|NGM_READONLY|NGM_HASREPLY) , NGM_TEXT_STATUS = (11|NGM_READONLY|NGM_HASREPLY) , NGM_BINARY2ASCII = (12|NGM_READONLY|NGM_HASREPLY) ,
  NGM_ASCII2BINARY = (13|NGM_READONLY|NGM_HASREPLY) , NGM_TEXT_CONFIG = 14
}
 

Macro Definition Documentation

◆ NG_CMDSTRSIZ

#define NG_CMDSTRSIZ   32 /* max command string (including null) */

Definition at line 52 of file ng_message.h.

◆ NG_COPYMESSAGE

#define NG_COPYMESSAGE (   copy,
  msg,
  how 
)
Value:
do { \
(copy) = malloc(sizeof(struct ng_mesg) \
+ (msg)->header.arglen, M_NETGRAPH_MSG, (how) | M_ZERO); \
if ((copy) == NULL) \
break; \
(copy)->header.version = NG_VERSION; \
(copy)->header.arglen = (msg)->header.arglen; \
(copy)->header.token = (msg)->header.token; \
(copy)->header.typecookie = (msg)->header.typecookie; \
(copy)->header.cmd = (msg)->header.cmd; \
(copy)->header.flags = (msg)->header.flags; \
bcopy((msg)->header.cmdstr, (copy)->header.cmdstr, \
sizeof((copy)->header.cmdstr)); \
if ((msg)->header.arglen > 0) \
bcopy((msg)->data, (copy)->data, (msg)->header.arglen); \
} while (0)
#define NG_VERSION
Definition: ng_message.h:97
struct ubt_hci_evhdr header
Definition: ng_ubt_var.h:0
uint8_t data[]
Definition: ng_ubt_var.h:2

Definition at line 415 of file ng_message.h.

◆ NG_GENERIC_BANDWIDTH_INFO

#define NG_GENERIC_BANDWIDTH_INFO ( )
Value:
{ \
{ "nominal_in", &ng_parse_uint64_type }, \
{ "seen_in", &ng_parse_uint64_type }, \
{ "nominal_out", &ng_parse_uint64_type }, \
{ "seen_out", &ng_parse_uint64_type }, \
{ NULL } \
}
const struct ng_parse_type ng_parse_uint64_type
Definition: ng_parse.c:703

Definition at line 312 of file ng_message.h.

◆ NG_GENERIC_CONNECT_INFO

#define NG_GENERIC_CONNECT_INFO ( )
Value:
{ \
{ "path", &ng_parse_pathbuf_type }, \
{ "ourhook", &ng_parse_hookbuf_type }, \
{ "peerhook", &ng_parse_hookbuf_type }, \
{ NULL } \
}
const struct ng_parse_type ng_parse_pathbuf_type
Definition: ng_parse.c:859
const struct ng_parse_type ng_parse_hookbuf_type
Definition: ng_parse.c:851

Definition at line 193 of file ng_message.h.

◆ NG_GENERIC_FLOW_MANAGER_INFO

#define NG_GENERIC_FLOW_MANAGER_INFO ( )
Value:
{ \
{ "id", &ng_parse_hint32_type }, \
{ NULL } \
}
const struct ng_parse_type ng_parse_hint32_type
Definition: ng_parse.c:613

Definition at line 355 of file ng_message.h.

◆ NG_GENERIC_HOOKLIST_INFO

#define NG_GENERIC_HOOKLIST_INFO (   nitype,
  litype 
)
Value:
{ \
{ "nodeinfo", (nitype) }, \
{ "linkinfo", (litype) }, \
{ NULL } \
}

Definition at line 260 of file ng_message.h.

◆ NG_GENERIC_LINKINFO_INFO

#define NG_GENERIC_LINKINFO_INFO (   nitype)
Value:
{ \
{ "ourhook", &ng_parse_hookbuf_type }, \
{ "peerhook", &ng_parse_hookbuf_type }, \
{ "nodeinfo", (nitype) }, \
{ NULL } \
}

Definition at line 247 of file ng_message.h.

◆ NG_GENERIC_LISTNODES_INFO

#define NG_GENERIC_LISTNODES_INFO (   niarraytype)
Value:
{ \
{ "numnames", &ng_parse_uint32_type }, \
{ "nodeinfo", (niarraytype) }, \
{ NULL } \
}
const struct ng_parse_type ng_parse_uint32_type
Definition: ng_parse.c:608

Definition at line 273 of file ng_message.h.

◆ NG_GENERIC_MKPEER_INFO

#define NG_GENERIC_MKPEER_INFO ( )
Value:
{ \
{ "type", &ng_parse_typebuf_type }, \
{ "ourhook", &ng_parse_hookbuf_type }, \
{ "peerhook", &ng_parse_hookbuf_type }, \
{ NULL } \
}
const struct ng_parse_type ng_parse_typebuf_type
Definition: ng_parse.c:867

Definition at line 178 of file ng_message.h.

◆ NG_GENERIC_NAME_INFO

#define NG_GENERIC_NAME_INFO ( )
Value:
{ \
{ "name", &ng_parse_nodebuf_type }, \
{ NULL } \
}
const struct ng_parse_type ng_parse_nodebuf_type
Definition: ng_parse.c:843

Definition at line 206 of file ng_message.h.

◆ NG_GENERIC_NG_MESG_INFO

#define NG_GENERIC_NG_MESG_INFO (   dtype)
Value:
{ \
{ "version", &ng_parse_uint8_type }, \
{ "spare", &ng_parse_uint8_type }, \
{ "spare2", &ng_parse_uint16_type }, \
{ "arglen", &ng_parse_uint32_type }, \
{ "cmd", &ng_parse_uint32_type }, \
{ "flags", &ng_parse_hint32_type }, \
{ "token", &ng_parse_uint32_type }, \
{ "typecookie", &ng_parse_uint32_type }, \
{ "cmdstr", &ng_parse_cmdbuf_type }, \
{ "data", (dtype) }, \
{ NULL } \
}
const struct ng_parse_type ng_parse_uint16_type
Definition: ng_parse.c:509
const struct ng_parse_type ng_parse_cmdbuf_type
Definition: ng_parse.c:875
const struct ng_parse_type ng_parse_uint8_type
Definition: ng_parse.c:413

Definition at line 78 of file ng_message.h.

◆ NG_GENERIC_NODEINFO_INFO

#define NG_GENERIC_NODEINFO_INFO ( )
Value:
{ \
{ "name", &ng_parse_nodebuf_type }, \
{ "type", &ng_parse_typebuf_type }, \
{ "id", &ng_parse_hint32_type }, \
{ "hooks", &ng_parse_uint32_type }, \
{ NULL } \
}

Definition at line 231 of file ng_message.h.

◆ NG_GENERIC_QUEUE_INFO

#define NG_GENERIC_QUEUE_INFO ( )
Value:
{ \
{ "max_queuelen_bytes", &ng_parse_uint_type }, \
{ "max_queuelen_packets", &ng_parse_uint_type }, \
{ "high_watermark", &ng_parse_uint_type }, \
{ "low_watermark", &ng_parse_uint_type }, \
{ "current", &ng_parse_uint_type }, \
{ NULL } \
}

Definition at line 340 of file ng_message.h.

◆ NG_GENERIC_RMHOOK_INFO

#define NG_GENERIC_RMHOOK_INFO ( )
Value:
{ \
{ "hook", &ng_parse_hookbuf_type }, \
{ NULL } \
}

Definition at line 217 of file ng_message.h.

◆ NG_GENERIC_TYPEINFO_INFO

#define NG_GENERIC_TYPEINFO_INFO ( )
Value:
{ \
{ "typename", &ng_parse_typebuf_type }, \
{ "numnodes", &ng_parse_uint32_type }, \
{ NULL } \
}

Definition at line 286 of file ng_message.h.

◆ NG_GENERIC_TYPELIST_INFO

#define NG_GENERIC_TYPELIST_INFO (   tiarraytype)
Value:
{ \
{ "numtypes", &ng_parse_uint32_type }, \
{ "typeinfo", (tiarraytype) }, \
{ NULL } \
}

Definition at line 298 of file ng_message.h.

◆ NG_HOOKSIZ

#define NG_HOOKSIZ   32 /* max hook name len (including null) */

Definition at line 49 of file ng_message.h.

◆ ng_ID_t

#define ng_ID_t   uint32_t

Definition at line 104 of file ng_message.h.

◆ NG_MKMESSAGE

#define NG_MKMESSAGE (   msg,
  cookie,
  cmdid,
  len,
  how 
)
Value:
do { \
(msg) = malloc(sizeof(struct ng_mesg) \
+ (len), M_NETGRAPH_MSG, (how) | M_ZERO); \
if ((msg) == NULL) \
break; \
(msg)->header.version = NG_VERSION; \
(msg)->header.typecookie = (cookie); \
(msg)->header.cmd = (cmdid); \
(msg)->header.arglen = (len); \
strncpy((msg)->header.cmdstr, #cmdid, \
sizeof((msg)->header.cmdstr) - 1); \
} while (0)

Definition at line 378 of file ng_message.h.

◆ NG_MKRESPONSE

#define NG_MKRESPONSE (   rsp,
  msg,
  len,
  how 
)
Value:
do { \
(rsp) = malloc(sizeof(struct ng_mesg) \
+ (len), M_NETGRAPH_MSG, (how) | M_ZERO); \
if ((rsp) == NULL) \
break; \
(rsp)->header.version = NG_VERSION; \
(rsp)->header.arglen = (len); \
(rsp)->header.token = (msg)->header.token; \
(rsp)->header.typecookie = (msg)->header.typecookie; \
(rsp)->header.cmd = (msg)->header.cmd; \
bcopy((msg)->header.cmdstr, (rsp)->header.cmdstr, \
sizeof((rsp)->header.cmdstr)); \
(rsp)->header.flags |= NGF_RESP; \
} while (0)
#define NGF_RESP
Definition: ng_message.h:101

Definition at line 396 of file ng_message.h.

◆ NG_NODESIZ

#define NG_NODESIZ   32 /* max node name len (including null) */

Definition at line 50 of file ng_message.h.

◆ NG_PATHSIZ

#define NG_PATHSIZ   512 /* max path len (including null) */

Definition at line 51 of file ng_message.h.

◆ NG_TEXTRESPONSE

#define NG_TEXTRESPONSE   1024 /* allow this length for a text response */

Definition at line 54 of file ng_message.h.

◆ NG_TYPESIZ

#define NG_TYPESIZ   32 /* max type name len (including null) */

Definition at line 48 of file ng_message.h.

◆ NG_VERSION

#define NG_VERSION   8

Definition at line 97 of file ng_message.h.

◆ NGF_ORIG

#define NGF_ORIG   0x00000000 /* the msg is the original request */

Definition at line 100 of file ng_message.h.

◆ NGF_RESP

#define NGF_RESP   0x00000001 /* the message is a response */

Definition at line 101 of file ng_message.h.

◆ NGIOCGINFO

#define NGIOCGINFO   _IOR('N', 40, struct nodeinfo) /* get node info */

Definition at line 369 of file ng_message.h.

◆ NGIOCSETNAME

#define NGIOCSETNAME   _IOW('N', 41, struct ngm_name) /* set node name */

Definition at line 370 of file ng_message.h.

◆ NGM_DROP_LINK

#define NGM_DROP_LINK   41 /* drop DTR, etc. - stay in the graph */

Definition at line 162 of file ng_message.h.

◆ NGM_FLOW_COOKIE

#define NGM_FLOW_COOKIE   851672669 /* temp for debugging */

Definition at line 152 of file ng_message.h.

◆ NGM_FLUSH_QUEUE

#define NGM_FLUSH_QUEUE   43 /* no data */

Definition at line 164 of file ng_message.h.

◆ NGM_GENERIC_COOKIE

#define NGM_GENERIC_COOKIE   1137070366

Definition at line 113 of file ng_message.h.

◆ NGM_GET_BANDWIDTH

#define NGM_GET_BANDWIDTH   (44|NGM_READONLY) /* either real or measured */

Definition at line 165 of file ng_message.h.

◆ NGM_GET_XMIT_Q_LIMITS

#define NGM_GET_XMIT_Q_LIMITS   (46|NGM_READONLY) /* returns queue state */

Definition at line 167 of file ng_message.h.

◆ NGM_HASREPLY

#define NGM_HASREPLY   0x20000000

Definition at line 75 of file ng_message.h.

◆ NGM_HIGH_WATER_PASSED

#define NGM_HIGH_WATER_PASSED   34 /* includes queue state */

Definition at line 157 of file ng_message.h.

◆ NGM_LINK_IS_DOWN

#define NGM_LINK_IS_DOWN   33 /* carrier lost, includes queue state */

Definition at line 156 of file ng_message.h.

◆ NGM_LINK_IS_UP

#define NGM_LINK_IS_UP   32 /* e.g. carrier found - no data */

Definition at line 155 of file ng_message.h.

◆ NGM_LOW_WATER_PASSED

#define NGM_LOW_WATER_PASSED   35 /* includes queue state */

Definition at line 158 of file ng_message.h.

◆ NGM_MICROMANAGE

#define NGM_MICROMANAGE
Value:
47 /* We want sync. queue state
reply for each packet sent */

Definition at line 168 of file ng_message.h.

◆ NGM_RAISE_LINK

#define NGM_RAISE_LINK   42 /* if you previously dropped it */

Definition at line 163 of file ng_message.h.

◆ NGM_READONLY

#define NGM_READONLY   0x10000000

Definition at line 73 of file ng_message.h.

◆ NGM_SET_FLOW_MANAGER

#define NGM_SET_FLOW_MANAGER   48 /* send flow control here */

Definition at line 169 of file ng_message.h.

◆ NGM_SET_XMIT_Q_LIMITS

#define NGM_SET_XMIT_Q_LIMITS   45 /* includes queue state */

Definition at line 166 of file ng_message.h.

◆ NGM_SYNC_QUEUE_STATE

#define NGM_SYNC_QUEUE_STATE   36 /* sync response from sending packet */

Definition at line 159 of file ng_message.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NGM_SHUTDOWN 
NGM_MKPEER 
NGM_CONNECT 
NGM_NAME 
NGM_RMHOOK 
NGM_NODEINFO 
NGM_LISTHOOKS 
NGM_LISTNAMES 
NGM_LISTNODES 
NGM_LISTTYPES 
NGM_TEXT_STATUS 
NGM_BINARY2ASCII 
NGM_ASCII2BINARY 
NGM_TEXT_CONFIG 

Definition at line 116 of file ng_message.h.