Server hull. More...
#include "ServerHull.hpp"
Public Member Functions | |
ServerHull (int argc, char *argv[]) | |
Constructor. More... | |
virtual | ~ServerHull (void) |
Destructor. More... | |
virtual void | run_second_stage (void) |
Run EPS server. More... | |
void | setup_address_pool (void) |
Setup the IPv4 address pool from which we assign an address to each client. More... | |
void | start_graphviz_network_diagram_timer (void) |
Begin the async timer that eventually calls generate_network_diagram(). This is triggered every 60 seconds. More... | |
void | generate_network_diagram (void) |
Generate a Graphviz-format network diagram. More... | |
virtual void | connection_failed (const EPS::TConnPtr &connection) |
Callback when a connection has failed and needs to be cleaned up. More... | |
virtual void | processComm (const EPS::TConnPtr &connection, EPS::NetBuffer *nb, const EPS::CommHeader1 *header, const EPS::ECommType type) |
Called when a communication command is received. More... | |
void | stop_asio (void) |
Attempt to cleanly shutdown/close all ASIO activity. More... | |
void | start_signal_handling (void) |
Start/initialize the signal handling for the hull. More... | |
void | get_uuid (void) |
Get the UUID from the configuration file, or generate a new one if necessary. More... | |
void | save_uuid (void) |
Save the UUID into the configuration file. More... | |
void | write_blank_configuration_file (void) |
Create a new blank configuration file template with helpful comments. More... | |
void | read_configuration_file (void) |
Read, parse, and store the configuration file. More... | |
void | parse_options (void) |
Parse command-line options. More... | |
void | run_first_stage (void) |
Called by main() to setup exception handling and calls run_second_stage(). More... | |
void | setup_encryption_and_decryption (void) |
Initialize what we need for OpenSSL encryption/decryption. More... | |
void | readComm (const EPS::TConnPtr &connection) |
Read (async) a communication command from the peer and act on it. More... | |
virtual void | processComm (const EPS::TConnPtr &connection, EPS::NetBuffer *nb) |
Process a communication command that has already been read by readComm(). More... | |
void | start_connect_timer (void) |
See if we have peers to which we want to connect. More... | |
void | send_stats (void) |
Send the latest statistics to the server. More... | |
void | start_stats_timer (void) |
Start an asynchronous wait on the stats timer. More... | |
void | setup_listener (void) |
Setup socket listener. More... | |
void | start_async_accept (void) |
Make the necessary calls to asynchronously accept a new TCP beam. More... | |
void | setup_UPnP (void) |
Setup UPNP (port forwarding). More... | |
void | reset_UPnP (void) |
Reset UPNP. More... | |
void | read_UPnP_mappings (void) |
Parse and identify relevant UPnP mappings. More... | |
void | renew_UPnP_mappings (void) |
Renew the UPnP mappings. More... | |
bool | delete_UPnP_mapping (const std::string &protocol) |
Delete UPNP port mapping. More... | |
bool | create_UPnP_mapping (const std::string &protocol) |
Create UPNP port mapping. More... | |
virtual void | connection_failed (EPS::TCPConnection *connection) |
Callback when a connection has failed and needs to be cleaned up. More... | |
void | validate_new_connection (const EPS::TConnPtr &connection) |
Exchange information and validate connection to peer. More... | |
void | validate_new_connection (EPS::TCPConnection *connection) |
Exchange information and validate connection to peer. More... | |
void | async_write (const EPS::TConnPtr &connection, EPS::NetBuffer *nb) |
Asynchronous write of the buffer. More... | |
void | async_write (const EPS::TConnPtr &connection) |
Exchange information and validate connection to peer. More... | |
Static Public Member Functions | |
static Hull & | get (void) |
Returns the single instance of Hull, which is at time necessary since the asio service_io is part of the hull. More... | |
Public Attributes | |
boost::asio::system_timer | graphviz_network_diagram_timer |
timer triggered every 60 seconds to generate a graphviz network diagram More... | |
MUuidStats | uuid_stats |
individual statistics, stored in a map by UUID More... | |
MUuidMesh | uuid_mesh |
individual mesh connections, stored in a map by UUID More... | |
const EPS::EMode | mode |
client or server mode More... | |
const std::string | mode_string |
client or server mode string More... | |
bool | done |
EPS will exit when this is set to TRUE More... | |
int | signal_number |
set by the signal handler for logging purposes if a fatal signal is raised More... | |
int | ac |
argc More... | |
char ** | av |
argv More... | |
const std::chrono::seconds | seconds_between_retries |
EC | ec |
boost error code More... | |
EPS::StrMap | configuration |
the content of the configuration file More... | |
UUID | uuid |
uuid for this EPS instance More... | |
boost::asio::io_service | io_service |
boost::asio's link to the operating system's I/O services More... | |
boost::asio::signal_set | signal_set |
register (through asio) for signal handling More... | |
boost::asio::ip::tcp::resolver | tcp_resolver |
tcp resolver for async name resolution More... | |
boost::asio::ip::tcp::acceptor | acceptor |
accept incoming client connections More... | |
EPS::IPv4 | address |
EPS address, e.g. 192.168.43.12. More... | |
EPS::IPv4 | network |
EPS network, e.g. 192.168.43.0. More... | |
EPS::IPv4 | netmask |
EPS netmask, e.g. 255.255.255.0. More... | |
EPS::Tracker | tracker |
keep track of all clients, uuids, and ip addresses More... | |
EPS::IPv4Set | local_addresses |
set of all interesting local addresses More... | |
boost::asio::system_timer | connect_timer |
see if we have new connections to establish to create the mesh More... | |
boost::asio::system_timer | stats_timer |
statistics timer which is triggered every 60 seconds More... | |
EPS::Stats | stats |
statistics are updated every minute when stats_timer expires More... | |
IPv4Vec | ipv4_pool |
pool of available addresses to give to clients More... | |
EPS::UUIDSet | pending_uuids |
set of UUIDs to which we'd like to connect More... | |
EPS::TCPConns | server_conns |
server connections More... | |
time_t | start_time |
when EPS was started More... | |
boost::asio::system_timer | upnp_renew_timer |
UPnP information. More... | |
EPS::IPv4 | upnp_lan_address |
LAN ip address according to UPnP. More... | |
EPS::IPv4 | upnp_wan_address |
WAN ip address according to UPnP. More... | |
uint16_t | upnp_wan_port |
port opened up on WAN side of UPnP device More... | |
UPNPDev * | upnp_dev |
structure used by libminiupnpc More... | |
UPNPUrls | upnp_urls |
structure used by libminiupnpc More... | |
IGDdatas | upnp_data |
structure used by libminiupnpc More... | |
Static Public Attributes | |
static std::string | addr = "" |
Configuration item read from CLI or eps.conf file. More... | |
static uint16_t | port = 0 |
TCP/UDP port to which we'll connect. More... | |
static std::string | network_str = "" |
network (with optional mask) to create for the EPS conduit network More... | |
static std::string | scorecard = "" |
filename of the scorecard where stats are written More... | |
static bool | sequential = false |
should IP addresses be assigned in a sequential manner to new clients More... | |
static std::string | conf_filename = "/etc/eps.conf" |
name of the configuration file More... | |
static std::string | log_filename = "" |
name of the file to which log entries will be written More... | |
static std::string | gv_filename = "" |
name of the graphviz network diagram file More... | |
static bool | upnp_enabled = false |
whether UPnP is enabled/disabled More... | |
static int | upnp_timeout = 1000 |
number of seconds to wait for UPnP (or -1 to disable) More... | |
Server hull.
EPS::ServerHull::ServerHull | ( | int | argc, |
char * | argv[] | ||
) |
Constructor.
|
virtual |
Destructor.
|
inherited |
|
inherited |
Exchange information and validate connection to peer.
|
virtual |
Callback when a connection has failed and needs to be cleaned up.
Implements EPS::Hull.
|
virtualinherited |
Callback when a connection has failed and needs to be cleaned up.
bool EPS::ServerHull::create_UPnP_mapping | ( | const std::string & | protocol | ) |
Create UPNP port mapping.
bool EPS::ServerHull::delete_UPnP_mapping | ( | const std::string & | protocol | ) |
Delete UPNP port mapping.
void EPS::ServerHull::generate_network_diagram | ( | void | ) |
Generate a Graphviz-format network diagram.
|
staticinherited |
Returns the single instance of Hull, which is at time necessary since the asio service_io is part of the hull.
|
inherited |
Get the UUID from the configuration file, or generate a new one if necessary.
|
inherited |
Parse command-line options.
For historical reasons, not all of the configuration settings are read/parsed using boost::program_options. For example, see the UUID values as well as cipher_iv and cipher_key in EPS::Hull::read_configuration_file().
|
virtual |
Called when a communication command is received.
Implements EPS::Hull.
|
virtualinherited |
Process a communication command that has already been read by readComm().
|
inherited |
Read, parse, and store the configuration file.
void EPS::ServerHull::read_UPnP_mappings | ( | void | ) |
Parse and identify relevant UPnP mappings.
|
inherited |
Read (async) a communication command from the peer and act on it.
void EPS::ServerHull::renew_UPnP_mappings | ( | void | ) |
Renew the UPnP mappings.
void EPS::ServerHull::reset_UPnP | ( | void | ) |
Reset UPNP.
|
inherited |
Called by main() to setup exception handling and calls run_second_stage().
|
virtual |
|
inherited |
Save the UUID into the configuration file.
|
inherited |
Send the latest statistics to the server.
void EPS::ServerHull::setup_address_pool | ( | void | ) |
Setup the IPv4 address pool from which we assign an address to each client.
|
inherited |
Initialize what we need for OpenSSL encryption/decryption.
|
inherited |
Setup socket listener.
void EPS::ServerHull::setup_UPnP | ( | void | ) |
Setup UPNP (port forwarding).
|
inherited |
Make the necessary calls to asynchronously accept a new TCP beam.
|
inherited |
See if we have peers to which we want to connect.
void EPS::ServerHull::start_graphviz_network_diagram_timer | ( | void | ) |
Begin the async timer that eventually calls generate_network_diagram(). This is triggered every 60 seconds.
|
inherited |
Start/initialize the signal handling for the hull.
|
inherited |
Start an asynchronous wait on the stats timer.
|
inherited |
Attempt to cleanly shutdown/close all ASIO activity.
|
inherited |
Exchange information and validate connection to peer.
|
inherited |
Exchange information and validate connection to peer.
|
inherited |
Create a new blank configuration file template with helpful comments.
|
inherited |
argc
|
inherited |
accept incoming client connections
|
staticinherited |
Configuration item read from CLI or eps.conf file.
name or ip address to which the client will connect
|
inherited |
argv
|
staticinherited |
name of the configuration file
|
inherited |
the content of the configuration file
|
inherited |
see if we have new connections to establish to create the mesh
|
inherited |
EPS will exit when this is set to TRUE
|
inherited |
boost error code
boost::asio::system_timer EPS::ServerHull::graphviz_network_diagram_timer |
timer triggered every 60 seconds to generate a graphviz network diagram
|
staticinherited |
name of the graphviz network diagram file
|
inherited |
boost::asio's link to the operating system's I/O services
|
inherited |
pool of available addresses to give to clients
|
inherited |
set of all interesting local addresses
|
staticinherited |
name of the file to which log entries will be written
|
inherited |
client or server mode
|
inherited |
client or server mode string
|
staticinherited |
network (with optional mask) to create for the EPS conduit network
|
inherited |
set of UUIDs to which we'd like to connect
|
staticinherited |
TCP/UDP port to which we'll connect.
|
staticinherited |
filename of the scorecard where stats are written
|
inherited |
|
staticinherited |
should IP addresses be assigned in a sequential manner to new clients
|
inherited |
server connections
|
inherited |
set by the signal handler for logging purposes if a fatal signal is raised
|
inherited |
register (through asio) for signal handling
|
inherited |
when EPS was started
|
inherited |
statistics are updated every minute when stats_timer expires
|
inherited |
statistics timer which is triggered every 60 seconds
|
inherited |
tcp resolver for async name resolution
|
inherited |
keep track of all clients, uuids, and ip addresses
|
inherited |
structure used by libminiupnpc
|
inherited |
structure used by libminiupnpc
|
staticinherited |
whether UPnP is enabled/disabled
|
inherited |
LAN ip address according to UPnP.
|
inherited |
UPnP information.
timer used to regularly attempt to renew any UPnP port mappings
|
staticinherited |
|
inherited |
structure used by libminiupnpc
|
inherited |
WAN ip address according to UPnP.
|
inherited |
port opened up on WAN side of UPnP device
|
inherited |
uuid for this EPS instance
MUuidMesh EPS::ServerHull::uuid_mesh |
individual mesh connections, stored in a map by UUID
MUuidStats EPS::ServerHull::uuid_stats |
individual statistics, stored in a map by UUID