Eunomia  0.1.0
A lightweight eBPF-based CloudNative Monitor tool for Container Security and Observability
eunomia_core.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 EUNOMIA_TRACKER_FACTORY_H
8 #define EUNOMIA_TRACKER_FACTORY_H
9 
10 #include <optional>
11 
12 #include "config.h"
13 #include "eunomia/config.h"
15 #include "eunomia/files.h"
16 #include "eunomia/ipc.h"
17 #include "eunomia/myseccomp.h"
18 #include "eunomia/process.h"
20 #include "eunomia/sec_analyzer.h"
21 #include "eunomia/tcp.h"
23 
25 
29 {
30  private:
32  eunomia_config_data core_config;
33 
35  tracker_manager core_tracker_manager;
37  container_manager core_container_manager;
39  prometheus_server core_prometheus_server;
40 
42  std::shared_ptr<sec_analyzer> core_sec_analyzer;
43 
45 
47  template<tracker_concept TRACKER>
48  TRACKER::tracker_event_handler create_tracker_event_handler(const handler_config_data& config);
50  template<tracker_concept TRACKER>
51  TRACKER::tracker_event_handler create_tracker_event_handlers(const std::vector<handler_config_data>& handler_configs);
52 
54  template<tracker_concept TRACKER>
55  TRACKER::tracker_event_handler create_print_event_handler(const TRACKER* tracker_ptr);
56 
57  template<tracker_concept TRACKER>
58  std::unique_ptr<TRACKER> create_default_tracker(const tracker_config_data& base);
59 
61  template<tracker_concept TRACKER>
62  std::unique_ptr<TRACKER> create_default_tracker_with_handler(
63  const tracker_config_data& base,
64  TRACKER::tracker_event_handler);
65 
67  template<tracker_concept TRACKER, typename SEC_ANALYZER_HANDLER>
68  std::unique_ptr<TRACKER> create_default_tracker_with_sec_analyzer(const tracker_config_data& base);
69 
71  std::unique_ptr<process_tracker> create_process_tracker_with_container_tracking(const tracker_config_data& base);
72 
74  void start_trackers(void);
76  void check_auto_exit(void);
78  void start_prometheus_server(void);
80  void start_container_manager(void);
82  void start_sec_analyzer(void);
83 
84  public:
87  int start_eunomia(void);
89  std::optional<std::size_t> start_tracker(const tracker_config_data& config);
91  std::vector<std::tuple<int, std::string>> list_all_trackers(void);
93  void stop_tracker(std::size_t tracker_id);
94 };
95 
96 #endif
myseccomp.h
eunomia_core::eunomia_core
eunomia_core(eunomia_config_data &config)
Definition: eunomia_core.cpp:17
container_manager.h
process.h
container_manager
manager all container or k8s info
Definition: container_manager.h:21
tracker_manager
tracker manager for owning and managing tracker instances
Definition: tracker_manager.h:21
ipc.h
eunomia_config_data
config for eunomia
Definition: config.h:71
prometheus_server.h
eunomia_core::stop_tracker
void stop_tracker(std::size_t tracker_id)
stop a tracker by id
Definition: eunomia_core.cpp:149
handler_config_data
handler config data
Definition: config.h:31
eunomia_core::list_all_trackers
std::vector< std::tuple< int, std::string > > list_all_trackers(void)
list all trackers
Definition: eunomia_core.cpp:144
tcp.h
eunomia_core
core for building tracker
Definition: eunomia_core.h:28
config.h
prometheus_server
Definition: prometheus_server.h:22
tracker_manager.h
files.h
eunomia_core::start_tracker
std::optional< std::size_t > start_tracker(const tracker_config_data &config)
start a single tracker base on config
Definition: eunomia_core.cpp:154
config
seccomp_config config
Definition: seccomp_test.cpp:13
eunomia_core::start_eunomia
int start_eunomia(void)
start the core
Definition: eunomia_core.cpp:310
tracker_config_data
tracker config data
Definition: config.h:38
sec_analyzer.h