Eunomia
0.1.0
A lightweight eBPF-based CloudNative Monitor tool for Container Security and Observability
ipc.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2
*
3
* Copyright (c) 2022, 郑昱笙,濮雯旭,张典典(牛校牛子队)
4
* All rights reserved.
5
*/
6
7
#ifndef IPC_CMD_H
8
#define IPC_CMD_H
9
10
#include "
libbpf_print.h
"
11
#include "
model/tracker.h
"
12
#include "
prometheus_server.h
"
13
14
extern
"C"
{
15
#include <ipc/ipc_tracker.h>
16
}
17
19
struct
ipc_tracker
:
public
tracker_with_config
<ipc_env, ipc_event> {
20
21
ipc_tracker
(
config_data
config
);
22
23
// create a tracker with deafult config
24
static
std::unique_ptr<ipc_tracker>
create_tracker_with_default_env
(
tracker_event_handler
handler);
25
static
std::unique_ptr<ipc_tracker>
create_tracker_with_args
(
26
tracker_event_handler
handler,
27
const
std::vector<std::string> &args)
28
{
29
return
create_tracker_with_default_env
(handler);
30
}
31
32
void
start_tracker
();
33
34
// convert event to json
35
struct
json_event_handler
:
public
event_handler
<ipc_event>
36
{
37
std::string
to_json
(
const
struct
ipc_event &e);
38
};
39
40
// used for json exporter, inherits from json_event_handler
41
struct
json_event_printer
:
public
json_event_handler
42
{
43
void
handle
(
tracker_event<ipc_event>
&e);
44
};
45
46
struct
plain_text_event_printer
:
public
event_handler
<ipc_event>
47
{
48
void
handle
(
tracker_event<ipc_event>
&e);
49
};
50
51
struct
csv_event_printer
:
public
event_handler
<ipc_event>
52
{
53
void
handle
(
tracker_event<ipc_event>
&e);
54
};
55
};
56
57
#endif
tracker.h
ipc_tracker::json_event_printer
Definition:
ipc.h:41
ipc_tracker::plain_text_event_printer
Definition:
ipc.h:46
ipc_tracker::json_event_handler
Definition:
ipc.h:35
ipc_tracker::start_tracker
void start_tracker()
start the tracker thread
Definition:
ipc.cpp:32
ipc_tracker::plain_text_event_printer::handle
void handle(tracker_event< ipc_event > &e)
implement this function to handle the event
Definition:
ipc.cpp:60
event_handler
the event handler for single type
Definition:
event_handler.h:52
tracker_with_config< ipc_env, ipc_event >::config_data
tracker_config< ipc_env, ipc_event > config_data
type alias for env and config
Definition:
tracker.h:65
ipc_tracker::csv_event_printer
Definition:
ipc.h:51
tracker_with_config
tracker template with env and data
Definition:
tracker.h:59
ipc_tracker::create_tracker_with_default_env
static std::unique_ptr< ipc_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition:
ipc.cpp:23
ipc_tracker::create_tracker_with_args
static std::unique_ptr< ipc_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition:
ipc.h:25
prometheus_server.h
tracker_event
the basic event type
Definition:
event_handler.h:31
ipc_tracker::ipc_tracker
ipc_tracker(config_data config)
Definition:
ipc.cpp:17
ipc_tracker::json_event_handler::to_json
std::string to_json(const struct ipc_event &e)
Definition:
ipc.cpp:38
libbpf_print.h
ipc_tracker::json_event_printer::handle
void handle(tracker_event< ipc_event > &e)
implement this function to handle the event
Definition:
ipc.cpp:55
ipc_tracker
ebpf LSM ipc tracker
Definition:
ipc.h:19
tracker_with_config< ipc_env, ipc_event >::tracker_event_handler
std::shared_ptr< event_handler< ipc_event > > tracker_event_handler
type alias for event handler
Definition:
tracker.h:67
config
seccomp_config config
Definition:
seccomp_test.cpp:13
ipc_tracker::csv_event_printer::handle
void handle(tracker_event< ipc_event > &e)
implement this function to handle the event
Definition:
ipc.cpp:72
include
eunomia
ipc.h
Generated by
1.8.17