summaryrefslogtreecommitdiff
path: root/bpf/bpf_obj.h
blob: e5de40aeb8fae1746c042cb3eb20e6f41573e6c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _BPF_OBJ_H_
#define _BPF_OBJ_H_

#ifdef __cpluscplus
extern "C"
{
#endif

#include <stdint.h>

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 __cpluscplus
}
#endif

#endif