root / lab4 / .minix-src / include / minix / bpf.h @ 14
History | View | Annotate | Download (1.43 KB)
1 | 13 | up20180614 | #ifndef _MINIX_BPF_H
|
---|---|---|---|
2 | #define _MINIX_BPF_H
|
||
3 | |||
4 | #include <net/bpf.h> |
||
5 | |||
6 | /*
|
||
7 | * MINIX3-specific extensions to the NetBSD Berkeley Packet Filter header.
|
||
8 | * These extensions are necessary because NetBSD BPF uses a few ioctl(2)
|
||
9 | * structure formats that contain pointers--something that MINIX3 has to avoid,
|
||
10 | * due to its memory granting mechanisms. Thus, those ioctl(2) calls have to
|
||
11 | * be converted from NetBSD to MINIX3 format. We currently do that in libc.
|
||
12 | * This header specifies the numbers and formats for the MINIX3 versions.
|
||
13 | *
|
||
14 | * See <minix/if.h> for details on how things work here.
|
||
15 | */
|
||
16 | |||
17 | /* BIOCSETF: set BPF filter program. */
|
||
18 | /*
|
||
19 | * This ioctl is an exception, as it is write-only, so we do not need the
|
||
20 | * original structure. Also, the size of this structure is currently slightly
|
||
21 | * over 4KB, which makes it too big for a regular ioctl call. Thus, we have to
|
||
22 | * use a big ioctl call. Note that future changes of BPF_MAXINSNS will
|
||
23 | * unfortunately (necessarily) change the ioctl call number.
|
||
24 | */
|
||
25 | struct minix_bpf_program {
|
||
26 | u_int mbf_len; |
||
27 | struct bpf_insn mbf_insns[BPF_MAXINSNS];
|
||
28 | }; |
||
29 | |||
30 | #define MINIX_BIOCSETF _IOW_BIG(2, struct minix_bpf_program) |
||
31 | |||
32 | /* BIOCGDLTLIST: retrieve list of possible data link types. */
|
||
33 | #define MINIX_BPF_MAXDLT 256 |
||
34 | |||
35 | struct minix_bpf_dltlist {
|
||
36 | struct bpf_dltlist mbfl_dltlist; /* MUST be first */ |
||
37 | u_int mbfl_list[MINIX_BPF_MAXDLT]; |
||
38 | }; |
||
39 | |||
40 | #define MINIX_BIOCGDLTLIST _IOWR('B', 119, struct minix_bpf_dltlist) |
||
41 | |||
42 | #endif /* !_MINIX_BPF_H */ |