Added some documentation.

This commit is contained in:
Nicolás Ortega Froysa 2018-09-01 21:32:14 +02:00
parent feb96d7e0b
commit 39c319c1b6
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
2 changed files with 41 additions and 3 deletions

View File

@ -24,10 +24,13 @@
namespace neocomm {
/**
* @brief Object to contain channel information.
*/
struct channel {
dht::InfoHash key;
std::future<size_t> token;
std::list<std::string> messages;
dht::InfoHash key; //!< The sha1 hash of the channel name.
std::future<size_t> token; //!< Token used to leave channel.
std::list<std::string> messages; //!< Messages received by channel.
};
}

View File

@ -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(