Skip to content
API Documentation
BastionGuard™
bsc::ebpf::EBPFMon Class Reference

#include <EBPFMon.hpp>

Public Member Functions

 EBPFMon ()
 ~EBPFMon ()
 EBPFMon (const EBPFMon &)=delete
EBPFMon & operator= (const EBPFMon &)=delete
bool start (const std::string &obj_path="/usr/lib/bastionguard-sc/bsc_ebpf.o")
void stop ()
std::vector< bsc::model::Connection > drain ()
bool active () const noexcept

Private Member Functions

void drain_loop ()

Private Attributes

std::atomic_bool active_ {false}
std::atomic_bool stop_ {false}
std::thread thread_
std::mutex buf_mutex_
std::vector< bsc::model::Connection > buf_
void * bpf_obj_ {nullptr}
void * ring_buf_ {nullptr}
std::vector< void * > links_

Friends

int ringbuf_callback (void *ctx, void *data, size_t size)

Detailed Description

Definition at line 76 of file EBPFMon.hpp.

Constructor & Destructor Documentation

◆ EBPFMon() [1/2]

bsc::ebpf::EBPFMon::EBPFMon ( )
default

References EBPFMon().

Referenced by EBPFMon(), EBPFMon(), and operator=().

◆ ~EBPFMon()

bsc::ebpf::EBPFMon::~EBPFMon ( )

Definition at line 73 of file EBPFMon.cpp.

73{ stop(); }

References stop().

◆ EBPFMon() [2/2]

bsc::ebpf::EBPFMon::EBPFMon ( const EBPFMon & )
delete

References EBPFMon().

Member Function Documentation

◆ active()

bool bsc::ebpf::EBPFMon::active ( ) const
inlinenoexcept

Definition at line 112 of file EBPFMon.hpp.

112{ return active_.load(); }
std::atomic_bool active_
Definition EBPFMon.hpp:120

References active_.

◆ drain()

◆ drain_loop()

void bsc::ebpf::EBPFMon::drain_loop ( )
private

Definition at line 288 of file EBPFMon.cpp.

288{}

◆ operator=()

EBPFMon & bsc::ebpf::EBPFMon::operator= ( const EBPFMon & )
delete

References drain(), EBPFMon(), start(), and stop().

◆ start()

bool bsc::ebpf::EBPFMon::start ( const std::string & obj_path = "/usr/lib/bastionguard-sc/bsc_ebpf.o")

Definition at line 277 of file EBPFMon.cpp.

278{
280 "EBPFMon: compilato senza libbpf — eBPF non disponibile");
281 return false;
282}
void info(const std::string &msg)
Definition Logger.cpp:21
static Logger & instance()
Definition Logger.cpp:11

References bsc::logging::Logger::info(), and bsc::logging::Logger::instance().

Referenced by operator=(), and bsc::net::SocketSnapshot::start_ebpf().

◆ stop()

void bsc::ebpf::EBPFMon::stop ( )

Definition at line 284 of file EBPFMon.cpp.

284{}

Referenced by operator=(), bsc::net::SocketSnapshot::stop_ebpf(), and ~EBPFMon().

◆ ringbuf_callback

int ringbuf_callback ( void * ctx,
void * data,
size_t size )
friend

Member Data Documentation

◆ active_

std::atomic_bool bsc::ebpf::EBPFMon::active_ {false}
private

Definition at line 120 of file EBPFMon.hpp.

Referenced by active().

◆ bpf_obj_

void* bsc::ebpf::EBPFMon::bpf_obj_ {nullptr}
private

Definition at line 129 of file EBPFMon.hpp.

◆ buf_

std::vector<bsc::model::Connection> bsc::ebpf::EBPFMon::buf_
private

Definition at line 125 of file EBPFMon.hpp.

◆ buf_mutex_

std::mutex bsc::ebpf::EBPFMon::buf_mutex_
mutableprivate

Definition at line 124 of file EBPFMon.hpp.

◆ links_

std::vector<void*> bsc::ebpf::EBPFMon::links_
private

Definition at line 134 of file EBPFMon.hpp.

◆ ring_buf_

void* bsc::ebpf::EBPFMon::ring_buf_ {nullptr}
private

Definition at line 130 of file EBPFMon.hpp.

◆ stop_

std::atomic_bool bsc::ebpf::EBPFMon::stop_ {false}
private

Definition at line 121 of file EBPFMon.hpp.

◆ thread_

std::thread bsc::ebpf::EBPFMon::thread_
private

Definition at line 122 of file EBPFMon.hpp.


The documentation for this class was generated from the following files:
  • BastionGuard/thirdparty/bastionguard-secure-connection/daemon/include/bsc/ebpf/EBPFMon.hpp
  • BastionGuard/thirdparty/bastionguard-secure-connection/daemon/src/ebpf/EBPFMon.cpp