forked from eunomia-bpf/bpftime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattach_private_data.hpp
34 lines (33 loc) · 985 Bytes
/
attach_private_data.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
#ifndef _BPFTIME_ATTACH_PRIVATE_DATA_HPP
#define _BPFTIME_ATTACH_PRIVATE_DATA_HPP
#include <string>
#include <string_view>
#include "spdlog/spdlog.h"
#include <stdexcept>
namespace bpftime
{
namespace attach
{
// A base class for all attach-independent private data
struct attach_private_data {
virtual ~attach_private_data(){};
// Initialize this private data structure from a string.
// This function should be implemented by things like
// `uprobe_attach_private_data` or `syscall_attach_private_data` or
// other ones. In this way, we provide a unified interface to create
// private data for different attaches.
virtual int initialize_from_string(const std::string_view &sv)
{
SPDLOG_ERROR(
"Not implemented: attach_private_data::initialize_from_string");
throw std::runtime_error(
"attach_private_data::initialize_from_string");
}
virtual std::string to_string()
{
return "<Not implemented yet>";
}
};
} // namespace attach
} // namespace bpftime
#endif