Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_macfilter.h
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
svn:keywords | null | FreeBSD=%H \ No newline at end of property |
svn:mime-type | null | text/plain \ No newline at end of property |
/* | |||||
* ng_macfilter.h | |||||
* | |||||
* Copyright (c) 2002 Ericsson Research & Pekka Nikander | |||||
* Look at the file COPYRIGHT for the terms. | |||||
afedorov: Hmm, there is no COPYRIGHT file. May you add standard BSD license here? | |||||
* | |||||
* Author: Pekka Nikander <pnr@iki.fi> | |||||
* | |||||
* Modified by Nick Hibma, Retina b.v. | |||||
* Modifications copyright 2019 (c) Retina b.v. | |||||
* | |||||
* $Id: ng_macfilter.h,v 1.3 2003/01/13 12:47:57 pnr Exp $ | |||||
* $FreeBSD$ | |||||
*/ | |||||
#ifndef _NETGRAPH_MACFILTER_H_ | |||||
#define _NETGRAPH_MACFILTER_H_ | |||||
/* Node type name. This should be unique among all netgraph node types */ | |||||
afedorovUnsubmitted Done Inline ActionsI think this is a useless comment. afedorov: I think this is a useless comment. | |||||
#define NG_MACFILTER_NODE_TYPE "macfilter" | |||||
/* Node type cookie. Should also be unique. This value MUST change whenever | |||||
afedorovUnsubmitted Done Inline ActionsDitto. afedorov: Ditto. | |||||
an incompatible change is made to this header file, to insure consistency. | |||||
The de facto method for generating cookies is to take the output of the | |||||
date command: date -u +'%s' */ | |||||
#define NGM_MACFILTER_COOKIE 1042445461 | |||||
/* Maximum number of upper hooks */ | |||||
#ifndef NG_MACFILTER_UPPER_NUM | |||||
#define NG_MACFILTER_UPPER_NUM 10 | |||||
#endif | |||||
/* Hook names */ | |||||
#define NG_MACFILTER_HOOK_ETHER "ether" /* connected to ether:lower */ | |||||
#define NG_MACFILTER_HOOK_DEFAULT "default" /* connected to ether:upper; upper[0] */ | |||||
/* Other hooks may be named freely connected to ether:upper; upper[1..n]*/ | |||||
#define NG_MACFILTER_HOOK_DEFAULT_ID 0 | |||||
/* Netgraph commands understood/sent by this node type */ | |||||
enum { | |||||
NGM_MACFILTER_RESET = 1, | |||||
NGM_MACFILTER_DIRECT = 2, | |||||
NGM_MACFILTER_DIRECT_HOOKID = 3, | |||||
NGM_MACFILTER_GET_MACS = 4, | |||||
NGM_MACFILTER_GETCLR_MACS = 5, | |||||
NGM_MACFILTER_CLR_MACS = 6, | |||||
NGM_MACFILTER_GET_HOOKS = 7 | |||||
}; | |||||
/* This structure is supplied with the NGM_MACFILTER_DIRECT command */ | |||||
struct ngm_macfilter_direct { | |||||
u_char ether[ETHER_ADDR_LEN]; /* MAC address */ | |||||
u_char hookname[NG_HOOKSIZ]; /* Upper hook name*/ | |||||
}; | |||||
#define NGM_MACFILTER_DIRECT_FIELDS { \ | |||||
{ "ether", &ng_parse_enaddr_type }, \ | |||||
{ "hookname", &ng_parse_hookbuf_type }, \ | |||||
{ NULL } \ | |||||
} | |||||
/* This structure is supplied with the NGM_MACFILTER_DIRECT_HOOKID command */ | |||||
struct ngm_macfilter_direct_hookid { | |||||
u_char ether[ETHER_ADDR_LEN]; /* MAC address */ | |||||
u_int16_t hookid; /* Upper hook hookid */ | |||||
}; | |||||
#define NGM_MACFILTER_DIRECT_NDX_FIELDS { \ | |||||
{ "ether", &ng_parse_enaddr_type }, \ | |||||
{ "hookid", &ng_parse_uint16_type }, \ | |||||
{ NULL } \ | |||||
} | |||||
/* This structure is returned in the array by the NGM_MACFILTER_GET(CLR)_MACS commands */ | |||||
struct ngm_macfilter_mac { | |||||
u_char ether[ETHER_ADDR_LEN]; /* MAC address */ | |||||
u_int16_t hookid; /* Upper hook hookid */ | |||||
u_int32_t packets_in; /* packets in from downstream */ | |||||
u_int64_t bytes_in; /* bytes in from upstream */ | |||||
u_int32_t packets_out; /* packets out towards downstream */ | |||||
u_int64_t bytes_out; /* bytes out towards downstream */ | |||||
}; | |||||
#define NGM_MACFILTER_MAC_FIELDS { \ | |||||
{ "ether", &ng_parse_enaddr_type }, \ | |||||
{ "hookid", &ng_parse_uint16_type }, \ | |||||
{ "packets_in", &ng_parse_uint32_type }, \ | |||||
{ "bytes_in", &ng_parse_uint64_type }, \ | |||||
{ "packets_out", &ng_parse_uint32_type }, \ | |||||
{ "bytes_out", &ng_parse_uint64_type }, \ | |||||
{ NULL } \ | |||||
Done Inline ActionsI see no reason why this field should be of type uint32_t. Today we have millions of packets per second, so it overflows in a few hours. afedorov: I see no reason why this field should be of type uint32_t. Today we have millions of packets… | |||||
} | |||||
/* This structure is returned by the NGM_MACFILTER_GET(CLR)_MACS commands */ | |||||
Done Inline ActionsSame. afedorov: Same. | |||||
struct ngm_macfilter_macs { | |||||
u_int32_t n; /* Number of entries in macs */ | |||||
Done Inline Actionsng_parse_uint32_type -> g_parse_uint64_type afedorov: ng_parse_uint32_type -> g_parse_uint64_type | |||||
struct ngm_macfilter_mac macs[]; /* Macs table */ | |||||
}; | |||||
Done Inline ActionsDitto. afedorov: Ditto. | |||||
#define NGM_MACFILTER_MACS_FIELDS { \ | |||||
{ "n", &ng_parse_uint32_type }, \ | |||||
{ "macs", &ng_macfilter_macs_array_type },\ | |||||
{ NULL } \ | |||||
} | |||||
/* This structure is returned in an array by the NGM_MACFILTER_GET_HOOKS command */ | |||||
struct ngm_macfilter_hook { | |||||
u_char hookname[NG_HOOKSIZ]; /* Upper hook name*/ | |||||
u_int16_t hookid; /* Upper hook hookid */ | |||||
u_int32_t maccnt; /* Number of mac addresses associated with hook */ | |||||
}; | |||||
#define NGM_MACFILTER_HOOK_FIELDS { \ | |||||
{ "hookname", &ng_parse_hookbuf_type }, \ | |||||
{ "hookid", &ng_parse_uint16_type }, \ | |||||
{ "maccnt", &ng_parse_uint32_type }, \ | |||||
{ NULL } \ | |||||
} | |||||
#endif /* _NETGRAPH_MACFILTER_H_ */ |
Hmm, there is no COPYRIGHT file. May you add standard BSD license here?