From 39c319c1b629fecc658186d0b689711a21ff6648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Sat, 1 Sep 2018 21:32:14 +0200 Subject: [PATCH] Added some documentation. --- include/neocomm/channel.hpp | 9 ++++++--- include/neocomm/node.hpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/include/neocomm/channel.hpp b/include/neocomm/channel.hpp index d45c107..f34f8ad 100644 --- a/include/neocomm/channel.hpp +++ b/include/neocomm/channel.hpp @@ -24,10 +24,13 @@ namespace neocomm { +/** + * @brief Object to contain channel information. + */ struct channel { - dht::InfoHash key; - std::future token; - std::list messages; + dht::InfoHash key; //!< The sha1 hash of the channel name. + std::future token; //!< Token used to leave channel. + std::list messages; //!< Messages received by channel. }; } diff --git a/include/neocomm/node.hpp b/include/neocomm/node.hpp index 1d92a86..7fd3916 100644 --- a/include/neocomm/node.hpp +++ b/include/neocomm/node.hpp @@ -25,19 +25,54 @@ namespace neocomm { +/** + * @brief Node object of the network model. + */ class node { public: + /** + * @brief Initalize the node. + * + * @param port Local port to bind to. + */ node(const unsigned short port = 31133); ~node(); + /** + * @brief Bootstrap to a given node within the network. + * + * @param address DNS/IP of the node. + * @param port Port of the node. + */ inline void connect(const std::string &address, const std::string &port) { network.bootstrap(address, port); } + /** + * @brief Import a list of nodes to connect to. + * + * @param file_path The path to the node file. + */ void import_nodes(const std::string &file_path); // TODO + /** + * @brief Export the list of nodes to which our node is currently + * connected to into a file. + * + * @param file_path Path to the node file. + */ void export_nodes(const std::string &file_path); // TODO + /** + * @brief Join a channel. + * + * @param name The name of the channel to join. + */ void join_channel(const std::string &name); + /** + * @brief Leave an already joined channel. + * + * @param name Name of the channel. + */ void leave_channel(const std::string &name); private: inline struct channel *get_channel(