ioexact: make mayexit a bool
[netsniff-ng.git] / bpf.h
blob1f6b21c453171193247b3248db0a90c1864bded2
1 #ifndef BPF_I_H
2 #define BPF_I_H
4 #include <linux/filter.h>
5 #include <stdint.h>
6 #include <stdlib.h>
8 #include "xmalloc.h"
9 #include "bpf_insns.h"
10 #include "bpf_ext.h"
12 extern void bpf_dump_op_table(void);
13 extern void bpf_dump_all(struct sock_fprog *bpf);
14 extern int __bpf_validate(const struct sock_fprog *bpf);
15 extern uint32_t bpf_run_filter(const struct sock_fprog *bpf, uint8_t *packet,
16 size_t plen);
17 extern void bpf_attach_to_sock(int sock, struct sock_fprog *bpf);
18 extern void bpf_detach_from_sock(int sock);
19 extern int enable_kernel_bpf_jit_compiler(void);
20 extern void bpf_parse_rules(char *rulefile, struct sock_fprog *bpf, uint32_t link_type);
21 #ifdef __WITH_TCPDUMP_LIKE_FILTER
22 extern void bpf_try_compile(const char *rulefile, struct sock_fprog *bpf,
23 uint32_t link_type);
24 #else
25 static inline void bpf_try_compile(const char *rulefile,
26 struct sock_fprog *bpf __maybe_unused,
27 uint32_t link_type __maybe_unused)
29 panic("Cannot open file %s!\n", rulefile);
31 #endif
32 static inline void bpf_release(struct sock_fprog *bpf)
34 free(bpf->filter);
37 #endif /* BPF_I_H */