Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netgraph/ng_bridge.h
Show All 39 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _NETGRAPH_NG_BRIDGE_H_ | #ifndef _NETGRAPH_NG_BRIDGE_H_ | ||||
#define _NETGRAPH_NG_BRIDGE_H_ | #define _NETGRAPH_NG_BRIDGE_H_ | ||||
/* Node type name and magic cookie */ | /* Node type name and magic cookie */ | ||||
#define NG_BRIDGE_NODE_TYPE "bridge" | #define NG_BRIDGE_NODE_TYPE "bridge" | ||||
#define NGM_BRIDGE_COOKIE 967239368 | #define NGM_BRIDGE_COOKIE 1569321993 | ||||
/* Hook names */ | /* Hook names */ | ||||
#define NG_BRIDGE_HOOK_LINK_PREFIX "link" /* append decimal integer */ | #define NG_BRIDGE_HOOK_LINK_PREFIX "link" /* append decimal integer */ | ||||
#define NG_BRIDGE_HOOK_LINK_FMT "link%d" /* for use with printf(3) */ | #define NG_BRIDGE_HOOK_LINK_FMT "link%d" /* for use with printf(3) */ | ||||
/* Maximum number of supported links */ | |||||
#define NG_BRIDGE_MAX_LINKS 32 | |||||
/* Node configuration structure */ | /* Node configuration structure */ | ||||
struct ng_bridge_config { | struct ng_bridge_config { | ||||
u_char ipfw[NG_BRIDGE_MAX_LINKS]; /* enable ipfw */ | |||||
u_char debugLevel; /* debug level */ | u_char debugLevel; /* debug level */ | ||||
u_int32_t loopTimeout; /* link loopback mute time */ | u_int32_t loopTimeout; /* link loopback mute time */ | ||||
u_int32_t maxStaleness; /* max host age before nuking */ | u_int32_t maxStaleness; /* max host age before nuking */ | ||||
u_int32_t minStableAge; /* min time for a stable host */ | u_int32_t minStableAge; /* min time for a stable host */ | ||||
}; | }; | ||||
/* Keep this in sync with the above structure definition */ | /* Keep this in sync with the above structure definition */ | ||||
#define NG_BRIDGE_CONFIG_TYPE_INFO(ainfo) { \ | #define NG_BRIDGE_CONFIG_TYPE_INFO { \ | ||||
{ "ipfw", (ainfo) }, \ | |||||
{ "debugLevel", &ng_parse_uint8_type }, \ | { "debugLevel", &ng_parse_uint8_type }, \ | ||||
{ "loopTimeout", &ng_parse_uint32_type }, \ | { "loopTimeout", &ng_parse_uint32_type }, \ | ||||
{ "maxStaleness", &ng_parse_uint32_type }, \ | { "maxStaleness", &ng_parse_uint32_type }, \ | ||||
{ "minStableAge", &ng_parse_uint32_type }, \ | { "minStableAge", &ng_parse_uint32_type }, \ | ||||
{ NULL } \ | { NULL } \ | ||||
} | } | ||||
/* Statistics structure (one for each link) */ | /* Statistics structure (one for each link) */ | ||||
Show All 28 Lines | #define NG_BRIDGE_STATS_TYPE_INFO { \ | ||||
{ "xmitMulticasts", &ng_parse_uint64_type }, \ | { "xmitMulticasts", &ng_parse_uint64_type }, \ | ||||
{ "xmitBroadcasts", &ng_parse_uint64_type }, \ | { "xmitBroadcasts", &ng_parse_uint64_type }, \ | ||||
{ "loopDrops", &ng_parse_uint64_type }, \ | { "loopDrops", &ng_parse_uint64_type }, \ | ||||
{ "loopDetects", &ng_parse_uint64_type }, \ | { "loopDetects", &ng_parse_uint64_type }, \ | ||||
{ "memoryFailures", &ng_parse_uint64_type }, \ | { "memoryFailures", &ng_parse_uint64_type }, \ | ||||
{ NULL } \ | { NULL } \ | ||||
} | } | ||||
struct ng_bridge_link; | |||||
typedef struct ng_bridge_link *link_p; | |||||
/* Structure describing a single host */ | /* Structure describing a single host */ | ||||
struct ng_bridge_host { | struct ng_bridge_host { | ||||
u_char addr[6]; /* ethernet address */ | u_char addr[6]; /* ethernet address */ | ||||
u_int16_t linkNum; /* link where addr can be found */ | link_p link; /* link where addr can be found */ | ||||
u_int16_t age; /* seconds ago entry was created */ | u_int16_t age; /* seconds ago entry was created */ | ||||
u_int16_t staleness; /* seconds ago host last heard from */ | u_int16_t staleness; /* seconds ago host last heard from */ | ||||
}; | }; | ||||
/* external representation of the host */ | |||||
struct ng_bridge_hostent { | |||||
u_char addr[6]; /* ethernet address */ | |||||
char hook[NG_HOOKSIZ]; /* link where addr can be found */ | |||||
u_int16_t age; /* seconds ago entry was created */ | |||||
u_int16_t staleness; /* seconds ago host last heard from */ | |||||
}; | |||||
/* Keep this in sync with the above structure definition */ | /* Keep this in sync with the above structure definition */ | ||||
#define NG_BRIDGE_HOST_TYPE_INFO(entype) { \ | #define NG_BRIDGE_HOST_TYPE_INFO(entype) { \ | ||||
{ "addr", (entype) }, \ | { "addr", (entype) }, \ | ||||
{ "linkNum", &ng_parse_uint16_type }, \ | { "hook", &ng_parse_hookbuf_type }, \ | ||||
{ "age", &ng_parse_uint16_type }, \ | { "age", &ng_parse_uint16_type }, \ | ||||
{ "staleness", &ng_parse_uint16_type }, \ | { "staleness", &ng_parse_uint16_type }, \ | ||||
{ NULL } \ | { NULL } \ | ||||
} | } | ||||
/* Structure returned by NGM_BRIDGE_GET_TABLE */ | /* Structure returned by NGM_BRIDGE_GET_TABLE */ | ||||
struct ng_bridge_host_ary { | struct ng_bridge_host_ary { | ||||
u_int32_t numHosts; | u_int32_t numHosts; | ||||
struct ng_bridge_host hosts[]; | struct ng_bridge_hostent hosts[]; | ||||
}; | }; | ||||
/* Keep this in sync with the above structure definition */ | /* Keep this in sync with the above structure definition */ | ||||
#define NG_BRIDGE_HOST_ARY_TYPE_INFO(harytype) { \ | #define NG_BRIDGE_HOST_ARY_TYPE_INFO(harytype) { \ | ||||
{ "numHosts", &ng_parse_uint32_type }, \ | { "numHosts", &ng_parse_uint32_type }, \ | ||||
{ "hosts", (harytype) }, \ | { "hosts", (harytype) }, \ | ||||
{ NULL } \ | { NULL } \ | ||||
} | } | ||||
Show All 15 Lines |