cpusched: Fix compiler warnings
[netsniff-ng.git] / bpf.h
blobd63205e98b15a892f9e58ddaeee90e230d59bbe6
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"
11 #include "config.h"
13 extern void bpf_dump_op_table(void);
14 extern void bpf_dump_all(struct sock_fprog *bpf);
15 extern int __bpf_validate(const struct sock_fprog *bpf);
16 extern uint32_t bpf_run_filter(const struct sock_fprog *bpf, uint8_t *packet,
17 size_t plen);
18 extern void bpf_attach_to_sock(int sock, struct sock_fprog *bpf);
19 extern void bpf_detach_from_sock(int sock);
20 extern int enable_kernel_bpf_jit_compiler(void);
21 extern void bpf_parse_rules(char *rulefile, struct sock_fprog *bpf, uint32_t link_type);
22 #if defined(HAVE_TCPDUMP_LIKE_FILTER) && defined(NEED_TCPDUMP_LIKE_FILTER)
23 extern void bpf_try_compile(const char *rulefile, struct sock_fprog *bpf,
24 uint32_t link_type);
25 #else
26 static inline void bpf_try_compile(const char *rulefile,
27 struct sock_fprog *bpf __maybe_unused,
28 uint32_t link_type __maybe_unused)
30 panic("Cannot open file %s!\n", rulefile);
32 #endif
33 static inline void bpf_release(struct sock_fprog *bpf)
35 free(bpf->filter);
38 #endif /* BPF_I_H */