Myra Canyon  v0.0.1-768
network control
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Myra::Server Class Referencefinal

Class used to setup the entire Myra Canyon server framework. More...

#include "Server.hpp"

Collaboration diagram for Myra::Server:

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 Serverget (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

Myra::Server::Server ( void  )

Constructor.

Myra::Server::~Server ( void  )

Destructor.

Member Function Documentation

void Myra::Server::async_process_netfilterqueue_packet ( Pkt pkt)

Here is the call graph for this function:

void Myra::Server::async_read_from_tap_interface ( Myra::Pkt pkt)

Read (asynchronously) from the TAP network interface.

Here is the call graph for this function:

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  )
Todo:
REMOVE THIS TEMP CODE!

Here is the call graph for this function:

void Myra::Server::flow_rollup_thread ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

Myra::Server & Myra::Server::get ( void  )
static

Get the server instance.

Here is the caller graph for this function:

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  )

Here is the call graph for this function:

Here is the caller graph for this function:

void Myra::Server::raise_tap_interface ( void  )

Raise the TAP network interface through which the Myra server receives packets to be inspected.

Here is the call graph for this function:

void Myra::Server::recover_previous_flows ( Myra::DB db)

Here is the call graph for this function:

void Myra::Server::release_nfq ( void  )

Close or shutdown our access to netfilter queues.

int Myra::Server::run ( void  )

Start the Myra server.

Here is the call graph for this function:

Here is the caller graph for this function:

void Myra::Server::setup_nfq ( void  )

Open and/or initialize what we need to use netfilter queues.

Todo:
IPv6 is not yet tested. Likely broken in many places. Leave it disabled until it is time.
Todo:
ARP wont work. Iptables is just for IPv4 and IPv6. Instead, use ebtables for ARP. Though it looks like ebtables doesn't yet support the NFQUEUE jump target, so not much we can do.

Here is the call graph for this function:

void Myra::Server::setup_signal_handling ( void  )

Setup some signal handlers.

Todo:
define our own error category derived from error_category

Here is the call graph for this function:

void Myra::Server::start_flow_rollup_timer ( void  )

Here is the call graph for this function:

void Myra::Server::start_inside_host_timer ( void  )

Here is the call graph for this function:

Member Data Documentation

Config Myra::Server::config

Configuration for the Myra Canyon server.

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.


The documentation for this class was generated from the following files: