26 #include <boost/asio.hpp> 27 #include <boost/program_options.hpp> 32 int main(
int argc,
char* argv[]) {
35 boost::program_options::options_description l_Description(
"Allowed options");
36 l_Description.add_options()
37 (
"help,h",
"produce this help message")
38 (
"version,v",
"show version information")
39 (
"port,p", boost::program_options::value<uint16_t>(),
40 "the TCP port to accept control connections on")
41 (
"trace,t",
"each relayed packet is dissected and printed")
45 boost::program_options::variables_map l_VariablesMap;
46 boost::program_options::store(boost::program_options::parse_command_line(argc, argv, l_Description), l_VariablesMap);
47 boost::program_options::notify(l_VariablesMap);
48 if (l_VariablesMap.count(
"version")) {
49 std::cerr <<
"s-net(r) satellite gateway version " << SATELLITE_GATEWAY_VERSION_MAJOR <<
"." << SATELLITE_GATEWAY_VERSION_MINOR
54 if (l_VariablesMap.count(
"help")) {
55 std::cout << l_Description << std::endl;
56 std::cout <<
"The satellite gateway software for the HDLC Daemon is Copyright (C) 2016, and GNU GPL'd, by Florian Evers." << std::endl;
57 std::cout <<
"Bug reports, feedback, admiration, abuse, etc, to: https://github.com/Strunzdesign/satellite-gateway" << std::endl;
61 if (!l_VariablesMap.count(
"port")) {
62 std::cout <<
"satellite-gateway: you have to specify the TCP listener port to accept control connections on" << std::endl;
63 std::cout <<
"satellite-gateway: Use --help for more information." << std::endl;
68 boost::asio::io_service l_IoService;
69 boost::asio::signal_set l_Signals(l_IoService);
70 l_Signals.add(SIGINT);
71 l_Signals.add(SIGTERM);
72 l_Signals.async_wait([&l_IoService](boost::system::error_code,
int){ l_IoService.stop(); });
75 auto l_ConfigServerHandlerCollection = std::make_shared<ConfigServerHandlerCollection>(l_IoService, l_VariablesMap[
"port"].as<uint16_t>());
76 auto l_GatewayClientHandlerCollection = std::make_shared<GatewayClientHandlerCollection>(l_IoService);
77 auto l_HdlcdClientHandlerCollection = std::make_shared<HdlcdClientHandlerCollection>(l_IoService);
78 l_ConfigServerHandlerCollection->Initialize (l_GatewayClientHandlerCollection, l_HdlcdClientHandlerCollection);
79 l_GatewayClientHandlerCollection->Initialize(l_ConfigServerHandlerCollection, l_HdlcdClientHandlerCollection);
80 l_HdlcdClientHandlerCollection->Initialize (l_ConfigServerHandlerCollection, l_GatewayClientHandlerCollection);
86 l_ConfigServerHandlerCollection->SystemShutdown();
87 l_GatewayClientHandlerCollection->SystemShutdown();
88 l_HdlcdClientHandlerCollection->SystemShutdown();
90 }
catch (std::exception& a_Error) {
91 std::cerr <<
"Exception: " << a_Error.what() <<
"\n";
#define HDLCD_DEVEL_VERSION_MINOR
#define SNET_DEVEL_VERSION_MAJOR
#define SNET_DEVEL_VERSION_MINOR
#define HDLCD_DEVEL_VERSION_MAJOR
int main(int argc, char *argv[])