Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_message.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
#define NG_PATHSIZ 512 /* max path len (including null) */ | #define NG_PATHSIZ 512 /* max path len (including null) */ | ||||
#define NG_CMDSTRSIZ 32 /* max command string (including null) */ | #define NG_CMDSTRSIZ 32 /* max command string (including null) */ | ||||
#define NG_TEXTRESPONSE 1024 /* allow this length for a text response */ | #define NG_TEXTRESPONSE 1024 /* allow this length for a text response */ | ||||
/* A netgraph message */ | /* A netgraph message */ | ||||
struct ng_mesg { | struct ng_mesg { | ||||
struct ng_msghdr { | struct ng_msghdr { | ||||
u_char version; /* == NGM_VERSION */ | u_char version; /* == NG_VERSION */ | ||||
u_char spare; /* pad to 4 bytes */ | u_char spare; /* pad */ | ||||
u_int16_t spare2; | u_int16_t fragment; /* fragment counter */ | ||||
u_int32_t arglen; /* length of data */ | u_int32_t arglen; /* length of data */ | ||||
u_int32_t cmd; /* command identifier */ | u_int32_t cmd; /* command identifier */ | ||||
u_int32_t flags; /* message status */ | u_int32_t flags; /* message status */ | ||||
u_int32_t token; /* match with reply */ | u_int32_t token; /* match with reply */ | ||||
u_int32_t typecookie; /* node's type cookie */ | u_int32_t typecookie; /* node's type cookie */ | ||||
u_char cmdstr[NG_CMDSTRSIZ]; /* cmd string + \0 */ | u_char cmdstr[NG_CMDSTRSIZ]; /* cmd string + \0 */ | ||||
} header; | } header; | ||||
char data[]; /* placeholder for actual data */ | char data[]; /* placeholder for actual data */ | ||||
}; | }; | ||||
/* This command is guaranteed to not alter data (or'd into the command). */ | /* This command is guaranteed to not alter data (or'd into the command). */ | ||||
#define NGM_READONLY 0x10000000 | #define NGM_READONLY 0x10000000 | ||||
/* This command is guaranteed to have a reply (or'd into the command). */ | /* This command is guaranteed to have a reply (or'd into the command). */ | ||||
#define NGM_HASREPLY 0x20000000 | #define NGM_HASREPLY 0x20000000 | ||||
/* Keep this in sync with the above structure definition */ | /* Keep this in sync with the above structure definition */ | ||||
#define NG_GENERIC_NG_MESG_INFO(dtype) { \ | #define NG_GENERIC_NG_MESG_INFO(dtype) { \ | ||||
{ "version", &ng_parse_uint8_type }, \ | { "version", &ng_parse_uint8_type }, \ | ||||
{ "spare", &ng_parse_uint8_type }, \ | { "spare", &ng_parse_uint8_type }, \ | ||||
{ "spare2", &ng_parse_uint16_type }, \ | { "fragment", &ng_parse_uint16_type }, \ | ||||
{ "arglen", &ng_parse_uint32_type }, \ | { "arglen", &ng_parse_uint32_type }, \ | ||||
{ "cmd", &ng_parse_uint32_type }, \ | { "cmd", &ng_parse_uint32_type }, \ | ||||
{ "flags", &ng_parse_hint32_type }, \ | { "flags", &ng_parse_hint32_type }, \ | ||||
{ "token", &ng_parse_uint32_type }, \ | { "token", &ng_parse_uint32_type }, \ | ||||
{ "typecookie", &ng_parse_uint32_type }, \ | { "typecookie", &ng_parse_uint32_type }, \ | ||||
{ "cmdstr", &ng_parse_cmdbuf_type }, \ | { "cmdstr", &ng_parse_cmdbuf_type }, \ | ||||
{ "data", (dtype) }, \ | { "data", (dtype) }, \ | ||||
{ NULL } \ | { NULL } \ | ||||
} | } | ||||
/* | /* | ||||
* Netgraph message header compatibility field | * Netgraph message header compatibility field | ||||
* Interfaces within the kernel are defined by a different | * Interfaces within the kernel are defined by a different | ||||
* value (see NG_ABI_VERSION in netgraph.h) | * value (see NG_ABI_VERSION in netgraph.h) | ||||
* | |||||
* Support both NG_VERSION and NG_VERSION2 as long as needed. | |||||
*/ | */ | ||||
#define NG_VERSION 8 | #define NG_VERSION 8 | ||||
#define NG_VERSION2 9 | |||||
/* Flags field flags */ | /* Flags field flags */ | ||||
#define NGF_ORIG 0x00000000 /* the msg is the original request */ | |||||
#define NGF_RESP 0x00000001 /* the message is a response */ | #define NGF_RESP 0x00000001 /* the message is a response */ | ||||
#define NGF_FRAG 0x00000002 /* more fragments (NG_VERSION2 only) */ | |||||
/* Type of a unique node ID. */ | /* Type of a unique node ID. */ | ||||
#define ng_ID_t uint32_t | #define ng_ID_t uint32_t | ||||
/* | /* | ||||
* Here we describe the "generic" messages that all nodes inherently | * Here we describe the "generic" messages that all nodes inherently | ||||
* understand. With the exception of NGM_TEXT_STATUS, these are handled | * understand. With the exception of NGM_TEXT_STATUS, these are handled | ||||
* automatically by the base netgraph code. | * automatically by the base netgraph code. | ||||
▲ Show 20 Lines • Show All 327 Lines • Show Last 20 Lines |