summaryrefslogtreecommitdiff
path: root/include/device/net_status.h
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-04-27 00:56:34 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:37 +0200
commit1ca2a1632d7325ee26b2c701b38c1d2e2fcb6f80 (patch)
tree630990386066401f4ce5b9fc530078c8a128a822 /include/device/net_status.h
parenta9192e8b618990551fcb230941e87728d86864eb (diff)
2006-04-27 Richard Braun <syn@hurdfr.org>
Manuel Menal <mmenal@hurdfr.org> * device/if_hdr.h (struct ifnet): Added new members `if_snd_port_list' and `if_snd_port_list_lock'. * device/net_io.c: Reworked to improve BPF support. Filters can be applied to ingress packets, egress packets, or both. * device/subrs.c: Initialize the `if_snd_port_list' and `if_snd_port_list_lock'. * include/device/bpf.h [0]: Enable unconditionally. Include <sys/types.h>. (BPF_IN, BPF_OUT): New macros. * include/device/net_status.h (NETF_TYPE_MASK, NETF_IN, NETF_OUT): New macros. (struct net_rcv_msg): New member `sent'. * linux/dev/glue/net.c: Mark ingress packets as received and inject egress packets into the packet filters.
Diffstat (limited to 'include/device/net_status.h')
-rw-r--r--include/device/net_status.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/device/net_status.h b/include/device/net_status.h
index dbf5e39..5131ef5 100644
--- a/include/device/net_status.h
+++ b/include/device/net_status.h
@@ -98,6 +98,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 +117,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<<NETF_NBPA)
#define NETF_EQ (1<<NETF_NBPA)
@@ -131,7 +144,6 @@ typedef filter_t *filter_array_t;
#define NETF_RSH (15<<NETF_NBPA)
#define NETF_ADD (16<<NETF_NBPA)
#define NETF_SUB (17<<NETF_NBPA)
-#define NETF_BPF (((1 << NETF_NBPO) - 1) << NETF_NBPA)
/* stack arguments */
@@ -178,6 +190,7 @@ struct net_rcv_msg {
char header[NET_HDW_HDR_MAX];
mach_msg_type_t packet_type;
char packet[NET_RCV_MAX];
+ boolean_t sent;
};
typedef struct net_rcv_msg *net_rcv_msg_t;
#define net_rcv_msg_packet_count packet_type.msgt_number