Changeset View
Changeset View
Standalone View
Standalone View
share/man/man4/netgraph.4
Show First 20 Lines • Show All 836 Lines • ▼ Show 20 Lines | |||||
.Pa src/sys/netgraph/ng_sample.c | .Pa src/sys/netgraph/ng_sample.c | ||||
and should be used as a starting point for new node writers. | and should be used as a starting point for new node writers. | ||||
.El | .El | ||||
.Ss Netgraph Message Structure | .Ss Netgraph Message Structure | ||||
Control messages have the following structure: | Control messages have the following structure: | ||||
.Bd -literal | .Bd -literal | ||||
#define NG_CMDSTRSIZ 32 /* Max command string (including null) */ | #define NG_CMDSTRSIZ 32 /* Max command string (including null) */ | ||||
/* real structures can differ, these are the names which can be used */ | |||||
struct ng_mesg { | struct ng_mesg { | ||||
struct ng_msghdr { | struct ng_msghdr { | ||||
u_char version; /* Must equal NG_VERSION */ | u_char version; /* Must equal NG_VERSION */ | ||||
u_char spare; /* Pad to 4 bytes */ | uint16_t fragment; /* fragment counter */ | ||||
uint16_t spare2; | |||||
uint32_t arglen; /* Length of cmd/resp data */ | uint32_t arglen; /* Length of cmd/resp data */ | ||||
uint32_t cmd; /* Command identifier */ | uint32_t cmd; /* Command identifier */ | ||||
uint32_t flags; /* Message status flags */ | uint32_t flags; /* Message status flags */ | ||||
uint32_t token; /* Reply should have the same token */ | uint32_t token; /* Reply should have the same token */ | ||||
uint32_t typecookie; /* Node type understanding this message */ | uint32_t typecookie; /* Node type understanding this message */ | ||||
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 */ | ||||
}; | }; | ||||
#define NG_ABI_VERSION 12 /* Netgraph kernel ABI version */ | #define NG_ABI_VERSION 12 /* Netgraph kernel ABI version */ | ||||
#define NG_VERSION 8 /* Netgraph message version */ | #define NG_VERSION 8 /* Netgraph message version */ | ||||
#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_FRAGMENT 0x00000002 /* More fragments follow */ | |||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Control messages have the fixed header shown above, followed by a | Control messages have the fixed header shown above, followed by a | ||||
variable length data section which depends on the type cookie | variable length data section which depends on the type cookie | ||||
and the command. | and the command. | ||||
Each field is explained below: | Each field is explained below: | ||||
.Bl -tag -width indent | .Bl -tag -width indent | ||||
.It Va version | .It Va version | ||||
▲ Show 20 Lines • Show All 612 Lines • Show Last 20 Lines |