diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-28 13:18:18 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-28 13:18:18 +0200 |
| commit | 3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375 (patch) | |
| tree | 345583aaf457ce5076d0d5f7c158628dfd971360 /node | |
| parent | 85d25eebd38bb278ad598a291a007938854945a4 (diff) | |
| download | cmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.tar.gz cmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.tar.bz2 cmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.zip | |
Finally made a initial doxygen documentation pass over all files.
Diffstat (limited to 'node')
| -rw-r--r-- | node/nextnode.hpp | 26 | ||||
| -rw-r--r-- | node/node.cpp | 4 | ||||
| -rw-r--r-- | node/node.hpp | 28 |
3 files changed, 52 insertions, 6 deletions
diff --git a/node/nextnode.hpp b/node/nextnode.hpp index 42206bb..24b93c4 100644 --- a/node/nextnode.hpp +++ b/node/nextnode.hpp @@ -4,13 +4,39 @@ #include <boost/asio/ip/tcp.hpp> +/*! + * \file + */ + +/*! + * \brief The NextNode class represents the next node in the network, will only be sent to. + */ class NextNode : public Client { public: + /*! + * \brief NextNode + * \param socket an rvalue reference to the socket it takes ownership and uses to communicate with the next node in the network. + */ NextNode(boost::asio::ip::tcp::socket&& socket); + /*! + * \brief send + * \param message is the string that is send to the next node. + */ void send(std::string message); + + /*! + * \brief connect + * \param next_host The host of the next node. + * \param next_port The port of the next node. + * \param on_connect The callback to call when the connect was succesfull. + */ void connect(std::string next_host, std::string next_port, std::function<void()> on_connect); + + /*! + * \brief close This function closes the underlying socket connection. + */ void close(); }; diff --git a/node/node.cpp b/node/node.cpp index b33f8a5..958990a 100644 --- a/node/node.cpp +++ b/node/node.cpp @@ -28,6 +28,10 @@ Node::~Node() { api.free_key_pair(keypair); } +void Node::run() { + io_service.run(); +} + void Node::accept_handler(boost::asio::ip::tcp::socket&& socket) { clients.emplace_back(std::move(socket)); diff --git a/node/node.hpp b/node/node.hpp index 5668dec..ef9e43c 100644 --- a/node/node.hpp +++ b/node/node.hpp @@ -13,12 +13,22 @@ #include <list> +/*! + * \file + */ + +/*! + * \brief The NodeNetworkSettings struct + */ struct NodeNetworkSettings { - bool is_first; - std::string next_host; - std::string next_port; + bool is_first; ///< Are we the first node in the network. + std::string next_host; ///< Next nodes host. + std::string next_port; ///< Next nodes port. }; +/*! + * \brief The Node class + */ class Node { boost::asio::io_service io_service; @@ -39,11 +49,17 @@ class Node void start_initialisation(); public: + /*! + * \brief Node + * \param listen_settings The listen settings for the accepter. + * \param network_settings The network settings containing if we are first and who is the next node. + */ Node(ListenSettings const& listen_settings, NodeNetworkSettings network_settings); ~Node(); - void run() { - io_service.run(); - } + /*! + * \brief run Starts the underlying io_service + */ + void run(); }; |
