Catch errors.

This commit is contained in:
Nicolás Ortega Froysa
2017-09-25 13:01:13 +02:00
parent b4544a79fe
commit 18ca002ef6
2 changed files with 35 additions and 5 deletions

View File

@ -44,7 +44,6 @@ struct user {
struct message {
const char *msg; ///< The text message.
time_t sent; ///< The time it was sent.
time_t received; ///< The time it was received.
struct user from; ///< Info on the peer who sent the message.
};
@ -53,8 +52,11 @@ struct message {
* number will be used.
*
* @param port The port for the node to listen on.
*
* @return 1 upon success, 0 upon failure. Use NeoComm_get_last_error for a
* text description of the error.
*/
void NeoComm_init(const unsigned short port);
int NeoComm_init(const unsigned short port);
/**
* @brief Deinitialize the local node.
@ -129,6 +131,17 @@ struct message *NeoComm_get_next_message(const char *channel_name);
*/
void NeoComm_free_message(struct message *msg);
/**
* @brief Send a message to a channel.
*
* @param channel_name Name of the channel to send the message to.
* @param message A message to send to the channel.
*
* @return 1 upon success, 0 upon failure. Use NeoComm_get_last_error for a
* text description of the error.
*/
int NeoComm_send_message(const char *channel_name, const char *message);
/**
* @brief Get the last error that occurred in text.
*