aboutsummaryrefslogtreecommitdiff
path: root/network-handler/main.cpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-12 14:26:12 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-12 14:26:12 +0200
commit7bca48bc5b5e37a3a8b0b23e57b88d069fa50589 (patch)
tree47cd62512e631a064852015c65bb1965bc72414a /network-handler/main.cpp
parent0fb433690c0ca5f9561fe9e2e973e2cd61b873ba (diff)
downloadcmix-7bca48bc5b5e37a3a8b0b23e57b88d069fa50589.tar.gz
cmix-7bca48bc5b5e37a3a8b0b23e57b88d069fa50589.tar.bz2
cmix-7bca48bc5b5e37a3a8b0b23e57b88d069fa50589.zip
Major network rewrite.
One generic class has been introduced to handle all connection types. Typedefs provide Sender Receiver and SenderReceiver types, which limit the functionality of the types. As to not accidentally communicate with the wrong node about things.
Diffstat (limited to 'network-handler/main.cpp')
-rw-r--r--network-handler/main.cpp49
1 files changed, 0 insertions, 49 deletions
diff --git a/network-handler/main.cpp b/network-handler/main.cpp
deleted file mode 100644
index 84de894..0000000
--- a/network-handler/main.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-#include "networkhandler.hpp"
-#include "nodemanager.hpp"
-
-#include <boost/program_options.hpp>
-
-#include <string>
-#include <iostream>
-#include <cstdint>
-
-NodeManager key_exchange_phase();
-
-int main(int argc, char* argv[]) {
- namespace po = boost::program_options;
-
- po::options_description desc("Allowed options");
- desc.add_options()
- ("help,h", "produce help message.")
- ("port,p", po::value<uint16_t>()->default_value(9200), "Set listening port.")
- ("enable_v4", po::value<bool>()->default_value(true), "Enable/disable ipv4 accept support.")
- ("interface4,4", po::value<std::string>()->default_value("0.0.0.0"), "Set the ipv4 address to listen on.")
- ("enable_v6", po::value<bool>()->default_value(true), "Enable/disable ipv6 accept support.")
- ("interface6,6", po::value<std::string>()->default_value("::"), "Set the ipv6 address to listen on.")
- ("nodes,n", po::value<std::string>(), "Set the node addreses to use in the cmix network.")
- ;
-
- po::variables_map vm;
- po::store(po::parse_command_line(argc, argv, desc), vm);
- po::notify(vm);
-
- if (vm.count("help")) {
- std::cout << desc << "\n";
- return 0;
- }
-
- bool en4 = vm["enable_v4"].as<bool>();
- std::string if4 = vm["interface4"].as<std::string>();
- bool en6 = vm["enable_v6"].as<bool>();
- std::string if6 = vm["interface6"].as<std::string>();
- uint16_t port = vm["port"].as<uint16_t>();
-
- NodeManager node_manager({});
-
- ListenSettings lsettings{en4, if4, en6, if6, port};
-
- NetworkHandler handler(lsettings);
- handler.run();
-}
-