Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netgraph/ng_bridge.h
Show All 37 Lines | |||||
* Author: Archie Cobbs <archie@freebsd.org> | * Author: Archie Cobbs <archie@freebsd.org> | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _NETGRAPH_NG_BRIDGE_H_ | #ifndef _NETGRAPH_NG_BRIDGE_H_ | ||||
#define _NETGRAPH_NG_BRIDGE_H_ | #define _NETGRAPH_NG_BRIDGE_H_ | ||||
/* | |||||
* Support the older ABI based on fixed size tables. | |||||
* ABI is deprecated, to be removed in releases > 12 | |||||
* Please note: There is no API support! | |||||
* You canno create new messages using the old API but messages conforming the | |||||
* old ABI are understood. | |||||
*/ | |||||
#define NGM_BRIDGE_TABLE_ABI | |||||
/* 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 1569321993 | #define NGM_BRIDGE_COOKIE 1569321993 | ||||
#ifdef NGM_BRIDGE_TABLE_ABI | |||||
#define NGM_BRIDGE_COOKIE_TBL 967239368 | |||||
#define NG_BRIDGE_MAX_LINKS 32 | |||||
#endif /* NGM_BRIDGE_TABLE_ABI */ | |||||
/* 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) */ | ||||
/* Node configuration structure */ | /* Node configuration structure */ | ||||
struct ng_bridge_config { | struct ng_bridge_config { | ||||
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 */ | ||||
}; | }; | ||||
#ifdef NGM_BRIDGE_TABLE_ABI | |||||
struct ng_bridge_config_tbl { | |||||
u_char ipfw[NG_BRIDGE_MAX_LINKS]; | |||||
struct ng_bridge_config cfg; | |||||
}; | |||||
#endif /* NGM_BRIDGE_TABLE_ABI */ | |||||
/* Keep this in sync with the above structure definition */ | /* Keep this in sync with the above structure definition */ | ||||
#define NG_BRIDGE_CONFIG_TYPE_INFO { \ | #define NG_BRIDGE_CONFIG_TYPE_INFO { \ | ||||
{ "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 } \ | ||||
} | } | ||||
Show All 40 Lines | |||||
/* 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 */ | ||||
link_p link; /* 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 */ | ||||
}; | }; | ||||
#ifdef NGM_BRIDGE_TABLE_ABI | |||||
struct ng_bridge_host_tbl { | |||||
u_char addr[6]; /* ethernet address */ | |||||
u_int16_t linkNum; /* 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 */ | |||||
}; | |||||
#endif /* NGM_BRIDGE_TABLE_ABI */ | |||||
/* external representation of the host */ | /* external representation of the host */ | ||||
struct ng_bridge_hostent { | struct ng_bridge_hostent { | ||||
u_char addr[6]; /* ethernet address */ | u_char addr[6]; /* ethernet address */ | ||||
char hook[NG_HOOKSIZ]; /* link where addr can be found */ | char hook[NG_HOOKSIZ]; /* 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 */ | ||||
}; | }; | ||||
Show All 13 Lines | |||||
}; | }; | ||||
/* 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 } \ | ||||
} | } | ||||
#ifdef NGM_BRIDGE_TABLE_ABI | |||||
struct ng_bridge_hostent_tbl { | |||||
u_char addr[6]; /* ethernet address */ | |||||
u_int16_t linkNum; /* 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 */ | |||||
}; | |||||
struct ng_bridge_host_tbl_ary { | |||||
u_int32_t numHosts; | |||||
struct ng_bridge_hostent_tbl hosts[]; | |||||
}; | |||||
#endif /* NGM_BRIDGE_TABLE_ABI */ | |||||
/* Netgraph control messages */ | /* Netgraph control messages */ | ||||
enum { | enum { | ||||
NGM_BRIDGE_SET_CONFIG = 1, /* set node configuration */ | NGM_BRIDGE_SET_CONFIG = 1, /* set node configuration */ | ||||
NGM_BRIDGE_GET_CONFIG, /* get node configuration */ | NGM_BRIDGE_GET_CONFIG, /* get node configuration */ | ||||
NGM_BRIDGE_RESET, /* reset (forget) all information */ | NGM_BRIDGE_RESET, /* reset (forget) all information */ | ||||
NGM_BRIDGE_GET_STATS, /* get link stats */ | NGM_BRIDGE_GET_STATS, /* get link stats */ | ||||
NGM_BRIDGE_CLR_STATS, /* clear link stats */ | NGM_BRIDGE_CLR_STATS, /* clear link stats */ | ||||
NGM_BRIDGE_GETCLR_STATS, /* atomically get & clear link stats */ | NGM_BRIDGE_GETCLR_STATS, /* atomically get & clear link stats */ | ||||
NGM_BRIDGE_GET_TABLE, /* get link table */ | NGM_BRIDGE_GET_TABLE, /* get link table */ | ||||
NGM_BRIDGE_SET_PERSISTENT, /* set persistent mode */ | NGM_BRIDGE_SET_PERSISTENT, /* set persistent mode */ | ||||
}; | }; | ||||
#endif /* _NETGRAPH_NG_BRIDGE_H_ */ | #endif /* _NETGRAPH_NG_BRIDGE_H_ */ | ||||