Class used to setup the entire Myra Canyon server framework. More...
#include "Server.hpp"
Public Member Functions | |
Server (void) | |
Constructor. More... | |
~Server (void) | |
Destructor. More... | |
int | run (void) |
Start the Myra server. More... | |
void | setup_signal_handling (void) |
Setup some signal handlers. More... | |
void | raise_tap_interface (void) |
Raise the TAP network interface through which the Myra server receives packets to be inspected. More... | |
void | async_read_from_tap_interface (Pkt &pkt) |
Read (asynchronously) from the TAP network interface. More... | |
void | setup_nfq (void) |
Open and/or initialize what we need to use netfilter queues. More... | |
void | release_nfq (void) |
Close or shutdown our access to netfilter queues. More... | |
uint32_t | get_verdict_for_queue_packet (const uint32_t id, const uint8_t *payload_data, const std::size_t payload_len) |
void | async_process_netfilterqueue_packet (Pkt &pkt) |
void | start_flow_rollup_timer (void) |
void | flow_rollup_thread (void) |
void | start_inside_host_timer (void) |
void | inside_host_thread (void) |
void | recover_previous_flows (Myra::DB &db) |
void | async_write_to_tap_interface (Pkt &pkt) |
Write (asynchronously) to the TAP network interface. More... | |
void | async_write_to_tap_interface (void) |
Static Public Member Functions | |
static Server & | get (void) |
Get the server instance. More... | |
Public Attributes | |
const TP | start_time |
The time when the server started running. More... | |
Config | config |
Configuration for the Myra Canyon server. More... | |
FD | tap_fd |
File descriptor for TAP interface. More... | |
std::string | tap_name |
Name assigned to TAP interface. More... | |
std::atomic< bool > | done |
Determine whether the server is finished running. More... | |
EC | ec |
boost system error code More... | |
ASIO_IO_SERVICE | io_service |
boost::asio's link to the operating system's I/O services. More... | |
ASIO_SIGNAL_SET | signal_set |
boost::asio's signal handling More... | |
ASIO_STREAM | tap_stream |
boost::asio's POSIX stream to read from and write to the TAP interface. More... | |
ASIO_TIMER | flow_timer |
boost::asio's timer for flow rollup More... | |
ASIO_TIMER | inside_timer |
boost::asio's timer for inside host information More... | |
Packet_Queue | outgoing_packet_queue |
A queue to hold outgoing (processed) packets. More... | |
std::recursive_mutex | outgoing_packet_queue_mutex |
Access to the outgoing packet queue must be synchronized between threads. More... | |
FlowMap | flow_map |
Map of predicted/expected flows and the corresponding "parent" flow. More... | |
FlowExpectation | flow_expectation |
struct nfq_handle * | netfilterqueue_handle |
Netfilter Queue. More... | |
struct nfq_q_handle * | netfilterqueue_queue |
Netfilter Queue. More... | |
FD | netfilterqueue_fd |
Netfilter Queue. More... | |
ASIO_STREAM | netfilterqueue_stream |
Netfilter Queue. More... | |
Class used to setup the entire Myra Canyon server framework.
This eventually will open the tap/tun interface, ensure packets are inspected, and decides if a packet should be manipulated.
Myra::Server::Server | ( | void | ) |
Constructor.
Myra::Server::~Server | ( | void | ) |
Destructor.
void Myra::Server::async_process_netfilterqueue_packet | ( | Pkt & | pkt | ) |
void Myra::Server::async_read_from_tap_interface | ( | Myra::Pkt & | pkt | ) |
Read (asynchronously) from the TAP network interface.
void Myra::Server::async_write_to_tap_interface | ( | Myra::Pkt & | pkt | ) |
Write (asynchronously) to the TAP network interface.
This method actually just queues up the packet to be written. Once it is queued, the other method async_write_to_tap_interface(void) is called to perform the asynchronous write if there are no previous packets pending to be written. Note that only 1 packet can be written at a time using the asynchronous interface.
void Myra::Server::async_write_to_tap_interface | ( | void | ) |
void Myra::Server::flow_rollup_thread | ( | void | ) |
|
static |
Get the server instance.
uint32_t Myra::Server::get_verdict_for_queue_packet | ( | const uint32_t | id, |
const uint8_t * | payload_data, | ||
const std::size_t | payload_len | ||
) |
currently unused method
void Myra::Server::inside_host_thread | ( | void | ) |
void Myra::Server::raise_tap_interface | ( | void | ) |
Raise the TAP network interface through which the Myra server receives packets to be inspected.
void Myra::Server::recover_previous_flows | ( | Myra::DB & | db | ) |
void Myra::Server::release_nfq | ( | void | ) |
Close or shutdown our access to netfilter queues.
int Myra::Server::run | ( | void | ) |
Start the Myra server.
void Myra::Server::setup_nfq | ( | void | ) |
Open and/or initialize what we need to use netfilter queues.
void Myra::Server::setup_signal_handling | ( | void | ) |
Setup some signal handlers.
void Myra::Server::start_flow_rollup_timer | ( | void | ) |
void Myra::Server::start_inside_host_timer | ( | void | ) |
std::atomic<bool> Myra::Server::done |
Determine whether the server is finished running.
EC Myra::Server::ec |
boost system error code
FlowExpectation Myra::Server::flow_expectation |
FlowMap Myra::Server::flow_map |
Map of predicted/expected flows and the corresponding "parent" flow.
ASIO_TIMER Myra::Server::flow_timer |
boost::asio's timer for flow rollup
ASIO_TIMER Myra::Server::inside_timer |
boost::asio's timer for inside host information
ASIO_IO_SERVICE Myra::Server::io_service |
boost::asio's link to the operating system's I/O services.
FD Myra::Server::netfilterqueue_fd |
Netfilter Queue.
struct nfq_handle* Myra::Server::netfilterqueue_handle |
Netfilter Queue.
struct nfq_q_handle* Myra::Server::netfilterqueue_queue |
Netfilter Queue.
ASIO_STREAM Myra::Server::netfilterqueue_stream |
Netfilter Queue.
Packet_Queue Myra::Server::outgoing_packet_queue |
A queue to hold outgoing (processed) packets.
std::recursive_mutex Myra::Server::outgoing_packet_queue_mutex |
Access to the outgoing packet queue must be synchronized between threads.
Map of all the flows Myra knows about.
ASIO_SIGNAL_SET Myra::Server::signal_set |
boost::asio's signal handling
const TP Myra::Server::start_time |
The time when the server started running.
FD Myra::Server::tap_fd |
File descriptor for TAP interface.
std::string Myra::Server::tap_name |
Name assigned to TAP interface.
ASIO_STREAM Myra::Server::tap_stream |
boost::asio's POSIX stream to read from and write to the TAP interface.