Added some documentation.
This commit is contained in:
parent
feb96d7e0b
commit
39c319c1b6
@ -24,10 +24,13 @@
|
|||||||
|
|
||||||
namespace neocomm {
|
namespace neocomm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Object to contain channel information.
|
||||||
|
*/
|
||||||
struct channel {
|
struct channel {
|
||||||
dht::InfoHash key;
|
dht::InfoHash key; //!< The sha1 hash of the channel name.
|
||||||
std::future<size_t> token;
|
std::future<size_t> token; //!< Token used to leave channel.
|
||||||
std::list<std::string> messages;
|
std::list<std::string> messages; //!< Messages received by channel.
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,54 @@
|
|||||||
|
|
||||||
namespace neocomm {
|
namespace neocomm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Node object of the network model.
|
||||||
|
*/
|
||||||
class node {
|
class node {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Initalize the node.
|
||||||
|
*
|
||||||
|
* @param port Local port to bind to.
|
||||||
|
*/
|
||||||
node(const unsigned short port = 31133);
|
node(const unsigned short port = 31133);
|
||||||
~node();
|
~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,
|
inline void connect(const std::string &address,
|
||||||
const std::string &port) {
|
const std::string &port) {
|
||||||
network.bootstrap(address, 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
|
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
|
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);
|
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);
|
void leave_channel(const std::string &name);
|
||||||
private:
|
private:
|
||||||
inline struct channel *get_channel(
|
inline struct channel *get_channel(
|
||||||
|
Loading…
Reference in New Issue
Block a user