aboutsummaryrefslogtreecommitdiff
path: root/network-handler
diff options
context:
space:
mode:
Diffstat (limited to 'network-handler')
-rw-r--r--network-handler/networkhandler.hpp31
-rw-r--r--network-handler/nodemanager.cpp2
-rw-r--r--network-handler/nodemanager.hpp35
-rw-r--r--network-handler/userclient.hpp26
4 files changed, 91 insertions, 3 deletions
diff --git a/network-handler/networkhandler.hpp b/network-handler/networkhandler.hpp
index dfa31f1..e9bb7fa 100644
--- a/network-handler/networkhandler.hpp
+++ b/network-handler/networkhandler.hpp
@@ -7,16 +7,45 @@
#include <list>
+/*!
+ * \file
+ */
+
+/*!
+ * \brief The NetworkHandler class
+ */
class NetworkHandler
{
+ /*!
+ * \brief io_service
+ */
boost::asio::io_service io_service;
+
+ /*!
+ * \brief server
+ */
Server server;
+
+ /*!
+ * \brief clients
+ */
std::list<UserClient> clients;
-
+
+ /*!
+ * \brief accept_handler
+ * \param socket
+ */
void accept_handler(boost::asio::ip::tcp::socket&& socket);
public:
+ /*!
+ * \brief NetworkHandler
+ * \param listen_settings
+ */
NetworkHandler(ListenSettings const& listen_settings);
+ /*!
+ * \brief run
+ */
void run();
};
diff --git a/network-handler/nodemanager.cpp b/network-handler/nodemanager.cpp
index 179f239..165cb3b 100644
--- a/network-handler/nodemanager.cpp
+++ b/network-handler/nodemanager.cpp
@@ -9,6 +9,6 @@ NodeManager::NodeManager(std::vector<ConnectionInfo> connections)
, nodes()
{
for(auto&& ci : connections) {
- nodes.emplace_back(connect(ci.host, io_service));
+ nodes.emplace_back(connect(ci.host, ci.port, io_service));
}
}
diff --git a/network-handler/nodemanager.hpp b/network-handler/nodemanager.hpp
index 8f6e7af..91d7160 100644
--- a/network-handler/nodemanager.hpp
+++ b/network-handler/nodemanager.hpp
@@ -6,17 +6,50 @@
#include <list>
+/*!
+ * \file
+ */
+
+/*!
+ * \brief The ConnectionInfo struct
+ */
struct ConnectionInfo {
- std::string host;
+ std::string host; ///< The host
+ std::string port; ///< The port
};
+/*!
+ * \brief The NodeManager class
+ *
+ * This class will probably never be fleshed out.
+ */
class NodeManager
{
+ /*!
+ * \brief io_service
+ */
boost::asio::io_service io_service;
+
+ /*!
+ * \brief api
+ */
Api api;
+
+ /*!
+ * \brief key_pair
+ */
KeyPair key_pair;
+
+ /*!
+ * \brief nodes
+ */
std::list<NodeClient> nodes;
public:
+
+ /*!
+ * \brief NodeManager
+ * \param connections
+ */
NodeManager(std::vector<ConnectionInfo> connections);
diff --git a/network-handler/userclient.hpp b/network-handler/userclient.hpp
index 5734dd2..af810a7 100644
--- a/network-handler/userclient.hpp
+++ b/network-handler/userclient.hpp
@@ -4,17 +4,43 @@
#include "client.hpp"
+/*!
+ * \file
+ */
+
+/*!
+ * \brief The UserClient class
+ */
class UserClient
{
+ /*!
+ * \brief client
+ */
Client client;
+
+ /*!
+ * \brief handle_message
+ * \param message
+ */
void handle_message(std::vector<uint8_t> message);
public:
+ /*!
+ * \brief UserClient
+ * \param socket
+ */
UserClient(boost::asio::ip::tcp::socket&& socket);
virtual ~UserClient() = default;
+ /*!
+ * \brief receive
+ */
void receive();
+ /*!
+ * \brief on_done
+ * \param done
+ */
void on_done(Client::OnDoneFT done);
};