1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #if HAVE_LIBBPF
5 
6 #include <bpf/bpf.h>
7 #include <bpf/libbpf.h>
8 
9 extern struct bpf_link* (*sym_bpf_program__attach_cgroup)(struct bpf_program *, int);
10 extern struct bpf_link* (*sym_bpf_program__attach_lsm)(struct bpf_program *);
11 extern long (*sym_libbpf_get_error)(const void *);
12 extern int (*sym_bpf_link__fd)(const struct bpf_link *);
13 extern int (*sym_bpf_link__destroy)(struct bpf_link *);
14 extern int (*sym_bpf_map__fd)(const struct bpf_map *);
15 extern const char* (*sym_bpf_map__name)(const struct bpf_map *);
16 extern int (*sym_bpf_create_map)(enum bpf_map_type, int key_size, int value_size, int max_entries, __u32 map_flags);
17 extern int (*sym_bpf_map__resize)(struct bpf_map *, __u32);
18 extern int (*sym_bpf_map_update_elem)(int, const void *, const void *, __u64);
19 extern int (*sym_bpf_map_delete_elem)(int, const void *);
20 extern int (*sym_bpf_map__set_inner_map_fd)(struct bpf_map *, int);
21 /* The *_skeleton APIs are autogenerated by bpftool, the targets can be found
22  * in ./build/src/core/bpf/socket_bind/socket-bind.skel.h */
23 extern int (*sym_bpf_object__open_skeleton)(struct bpf_object_skeleton *, const struct bpf_object_open_opts *);
24 extern int (*sym_bpf_object__load_skeleton)(struct bpf_object_skeleton *);
25 extern int (*sym_bpf_object__attach_skeleton)(struct bpf_object_skeleton *);
26 extern void (*sym_bpf_object__detach_skeleton)(struct bpf_object_skeleton *);
27 extern void (*sym_bpf_object__destroy_skeleton)(struct bpf_object_skeleton *);
28 extern bool (*sym_bpf_probe_prog_type)(enum bpf_prog_type, __u32);
29 extern const char* (*sym_bpf_program__name)(const struct bpf_program *);
30 
31 #endif
32 
33 int dlopen_bpf(void);
34