-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathbpf_wrapper.hpp
52 lines (37 loc) · 935 Bytes
/
bpf_wrapper.hpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include <string>
#include <memory>
#include <spdlog/spdlog.h>
class bpf_wrapper_ring {
public:
bpf_wrapper_ring(
const int p_fd,
const std::function<void(void *const , const int)> p_cb
);
~bpf_wrapper_ring();
void poll(const int p_timeout_ms);
void consume();
int get_fd();
private:
class impl;
const std::unique_ptr<impl> m_impl;
};
class bpf_wrapper_object {
public:
bpf_wrapper_object(
std::shared_ptr<spdlog::logger> p_log,
const std::string &p_object
);
~bpf_wrapper_object();
void
attach_kprobe(
const std::string &p_in_bfp_name,
const std::string &p_in_kernel_name,
const bool p_is_ret_probe
);
int
lookup_map_fd_by_name(const std::string &p_name);
private:
class impl;
const std::unique_ptr<impl> m_impl;
};