#ifndef _BPF_OBJ_H_ #define _BPF_OBJ_H_ #ifdef __cplusplus extern "C" { #endif #include struct bpf_obj_ctx; /* * queue_num : same as worker thread number * hash_mode : 2: hash with src/dst addr * 4: hash with src/dst addr and src/dst port * debug_log : 0 for disable(only use for debug, printf bpf debug log(cat /sys/kernel/debug/tracing/trace_pipe) */ struct bpf_obj_ctx *bpf_obj_load(const char *obj_file, uint32_t queue_num, uint32_t hash_mode, uint32_t debug_log); void bpf_obj_unload(struct bpf_obj_ctx *ctx); /* * return 0 : success * return -1 : error */ int bpf_obj_attach(struct bpf_obj_ctx *ctx, int fd); #ifdef __cplusplus } #endif #endif