--- Gnu-Mach/include/device/net_status.h 2020/09/02 04:43:06 1.1.1.2 +++ Gnu-Mach/include/device/net_status.h 2020/09/02 04:45:35 1.1.1.3 @@ -72,6 +72,7 @@ struct net_status { #define NET_DSTADDR (('n'<<16) + 3) +#define NET_FLAGS (('n'<<16) + 4) /* * Input packet filter definition @@ -98,6 +99,11 @@ struct net_status { * If the final value of the filter operation is true, then the packet is * accepted for the filter. * + * The first filter_t object is a header which allows to set flags for the + * filter code. Main flags concern the direction of packets. This header is + * split in the same way NETF words are : the 6 MSB bits indicate the type + * of filter while the 10 LSB bits are the flags. For native NETF filters, + * clear the 6 MSB bits (which is why there is no dedicated macro). */ typedef unsigned short filter_t; @@ -112,6 +118,14 @@ typedef filter_t *filter_array_t; #define NETF_ARG(word) ((word) & 0x3ff) #define NETF_OP(word) (((word)>>NETF_NBPA)&0x3f) +/* filter types */ +#define NETF_TYPE_MASK (((1 << NETF_NBPO) - 1) << NETF_NBPA) +#define NETF_BPF (1 << NETF_NBPA) + +/* flags */ +#define NETF_IN 0x1 +#define NETF_OUT 0x2 + /* binary operators */ #define NETF_NOP (0<