+/// Whitelist a node on the mesh.
+/** This function causes the local node to whitelist a previously blacklisted node.
+ * The local node will allow connections to and from that node,
+ * and will send data to it and accept any data received from it.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param node A pointer to a meshlink_node_t describing the node to be whitelisted.
+ */
+extern void meshlink_whitelist(meshlink_handle_t *mesh, meshlink_node_t *node);
+
+/// Set whether new nodes are blacklisted by default.
+/** This function sets the blacklist behaviour for newly discovered nodes.
+ * If set to true, new nodes will be automatically blacklisted.
+ * If set to false, which is the default, new nodes are automatically whitelisted.
+ * The whitelist/blacklist status of a node may be changed afterwards with the
+ * meshlink_whitelist() and meshlink_blacklist() functions.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param blacklist True if new nodes are to be blacklisted, false if whitelisted.
+ */
+extern void meshlink_set_default_blacklist(meshlink_handle_t *mesh, bool blacklist);
+
+/// A callback for accepting incoming channels.
+/** This function is called whenever a remote node wants to open a channel to the local node.
+ * The application then has to decide whether to accept or reject this channel.
+ *
+ * The callback is run in MeshLink's own thread.
+ * It is therefore important that the callback return quickly and uses apprioriate methods (queues, pipes, locking, etc.)
+ * to hand any data over to the application's thread.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the incoming channel.
+ * If the application accepts the incoming channel by returning true,
+ * then this handle is valid until meshlink_channel_close() is called on it.
+ * If the application rejects the incoming channel by returning false,
+ * then this handle is invalid after the callback returns
+ * (the callback does not need to call meshlink_channel_close() itself in this case).
+ * @param port The port number the peer wishes to connect to.
+ * @param data A pointer to a buffer containing data already received, or NULL in case no data has been received yet. (Not yet used.)
+ * The pointer is only valid during the lifetime of the callback.
+ * The callback should mempcy() the data if it needs to be available outside the callback.
+ * @param len The length of the data, or 0 in case no data has been received yet. (Not yet used.)
+ *
+ * @return This function should return true if the application accepts the incoming channel, false otherwise.
+ * If returning false, the channel is invalid and may not be used anymore.
+ */
+typedef bool (*meshlink_channel_accept_cb_t)(meshlink_handle_t *mesh, meshlink_channel_t *channel, uint16_t port, const void *data, size_t len);
+
+/// A callback for receiving data from a channel.
+/** This function is called whenever data is received from a remote node on a channel.
+ *
+ * This function is also called in case the channel has been closed by the remote node, or when the channel is terminated abnormally.
+ * In both cases, @a data @a will be NULL and @a len @a will be 0, and meshlink_errno will be set.
+ * In any case, the @a channel @a handle will still be valid until the application calls meshlink_close().
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the channel.
+ * @param data A pointer to a buffer containing data sent by the source, or NULL in case of an error.
+ * The pointer is only valid during the lifetime of the callback.
+ * The callback should mempcy() the data if it needs to be available outside the callback.
+ * @param len The length of the data, or 0 in case of an error.
+ */
+typedef void (*meshlink_channel_receive_cb_t)(meshlink_handle_t *mesh, meshlink_channel_t *channel, const void *data, size_t len);
+
+/// A callback informing the application when data can be sent on a channel.
+/** This function is called whenever there is enough free buffer space so a call to meshlink_channel_send() will succeed.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the channel.
+ * @param len The maximum amount of data that is guaranteed to be accepted by meshlink_channel_send().
+ */
+typedef void (*meshlink_channel_poll_cb_t)(meshlink_handle_t *mesh, meshlink_channel_t *channel, size_t len);
+
+/// Set the accept callback.
+/** This functions sets the callback that is called whenever another node sends data to the local node.
+ * The callback is run in MeshLink's own thread.
+ * It is therefore important that the callback uses apprioriate methods (queues, pipes, locking, etc.)
+ * to hand the data over to the application's thread.
+ * The callback should also not block itself and return as quickly as possible.
+ *
+ * If no accept callback is set, incoming channels are rejected.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param cb A pointer to the function which will be called when another node sends data to the local node.
+ * If a NULL pointer is given, the callback will be disabled.
+ */
+extern void meshlink_set_channel_accept_cb(meshlink_handle_t *mesh, meshlink_channel_accept_cb_t cb);
+
+/// Set the receive callback.
+/** This functions sets the callback that is called whenever another node sends data to the local node.
+ * The callback is run in MeshLink's own thread.
+ * It is therefore important that the callback uses apprioriate methods (queues, pipes, locking, etc.)
+ * to hand the data over to the application's thread.
+ * The callback should also not block itself and return as quickly as possible.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the channel.
+ * @param cb A pointer to the function which will be called when another node sends data to the local node.
+ * If a NULL pointer is given, the callback will be disabled and incoming data is ignored.
+ */
+extern void meshlink_set_channel_receive_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, meshlink_channel_receive_cb_t cb);
+
+/// Set the poll callback.
+/** This functions sets the callback that is called whenever data can be sent to another node.
+ * The callback is run in MeshLink's own thread.
+ * It is therefore important that the callback uses apprioriate methods (queues, pipes, locking, etc.)
+ * to pass data to or from the application's thread.
+ * The callback should also not block itself and return as quickly as possible.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the channel.
+ * @param cb A pointer to the function which will be called when data can be sent to another node.
+ * If a NULL pointer is given, the callback will be disabled.
+ */
+extern void meshlink_set_channel_poll_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, meshlink_channel_poll_cb_t cb);
+
+/// Open a reliable stream channel to another node.
+/** This function is called whenever a remote node wants to open a channel to the local node.
+ * The application then has to decide whether to accept or reject this channel.
+ *
+ * This function returns a pointer to a struct meshlink_channel that will be allocated by MeshLink.
+ * When the application does no longer need to use this channel, it must call meshlink_close()
+ * to free its resources.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param node The node to which this channel is being initiated.
+ * @param port The port number the peer wishes to connect to.
+ * @param cb A pointer to the function which will be called when the remote node sends data to the local node.
+ * The pointer may be NULL, in which case incoming data is ignored.
+ * @param data A pointer to a buffer containing data to already queue for sending, or NULL if there is no data to send.
+ * After meshlink_send() returns, the application is free to overwrite or free this buffer.
+ * @param len The length of the data, or 0 if there is no data to send.
+ *
+ * @return A handle for the channel, or NULL in case of an error.
+ * The handle is valid until meshlink_channel_close() is called.
+ */
+extern meshlink_channel_t *meshlink_channel_open(meshlink_handle_t *mesh, meshlink_node_t *node, uint16_t port, meshlink_channel_receive_cb_t cb, const void *data, size_t len);
+
+/// Partially close a reliable stream channel.
+/** This shuts down the read or write side of a channel, or both, without closing the handle.
+ * It can be used to inform the remote node that the local node has finished sending all data on the channel,
+ * but still allows waiting for incoming data from the remote node.
+ *
+ * Shutting down the receive direction is also possible, and is equivalent to setting the receive callback to NULL.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the channel.
+ * @param direction Must be one of SHUT_RD, SHUT_WR or SHUT_RDWR, otherwise this call will not have any affect.
+ */
+extern void meshlink_channel_shutdown(meshlink_handle_t *mesh, meshlink_channel_t *channel, int direction);
+
+/// Close a reliable stream channel.
+/** This informs the remote node that the local node has finished sending all data on the channel.
+ * It also causes the local node to stop accepting incoming data from the remote node.
+ * It will free the struct meshlink_channel and all associated resources.
+ * Afterwards, the channel handle is invalid and must not be used any more.
+ *
+ * It is allowed to call this function at any time on a valid handle, even inside callback functions.
+ * If called with a valid handle, this function always succeeds, otherwise the result is undefined.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the channel.
+ */
+extern void meshlink_channel_close(meshlink_handle_t *mesh, meshlink_channel_t *channel);
+
+/// Transmit data on a channel
+/** This queues data to send to the remote node.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param channel A handle for the channel.
+ * @param data A pointer to a buffer containing data sent by the source, or NULL if there is no data to send.
+ * After meshlink_send() returns, the application is free to overwrite or free this buffer.
+ * @param len The length of the data, or 0 if there is no data to send.
+ *
+ * @return The amount of data that was queued, which can be less than len, or a negative value in case of an error.
+ */
+extern ssize_t meshlink_channel_send(meshlink_handle_t *mesh, meshlink_channel_t *channel, const void *data, size_t len);
+
+/// Hint that a hostname may be found at an address
+/** This function indicates to meshlink that the given hostname is likely found
+ * at the given IP address and port.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param hostname The hostname which can be found at the given address.
+ * The caller is free to overwrite or free this string
+ * once meshlink returns.
+ * @param addr The IP address and port which should be tried for the
+ * given hostname. The caller is free to overwrite or free
+ * this memory once meshlink returns.
+ */
+extern void meshlink_hint_address(meshlink_handle_t *mesh, meshlink_node_t *node, const struct sockaddr *addr);
+
+/// Get a list of edges.
+/** This function returns an array with copies of all known bidirectional edges.
+ * The edges are copied to capture the mesh state at call time, since edges
+ * mutate frequently. The nodes pointed to within the meshlink_edge_t type
+ * are not copies; these are the same pointers that one would get from a call
+ * to meshlink_get_all_nodes().
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param edges A pointer to a previously allocated array of pointers to
+ * meshlink_edge_t, or NULL in which case MeshLink will
+ * allocate a new array. The application CANNOT supply an
+ * array it allocated itself with malloc, but CAN use
+ * the return value from the previous call to this function
+ * (which is the preferred way).
+ * The pointers in the array are valid until meshlink_close() is called.
+ * ATTENTION: The pointers and values should never be modified
+ * by the application!!!
+ * @param nmemb A pointer to a variable holding the number of nodes that
+ * are stored in the array. In case the @a nodes @a
+ * argument is not NULL, MeshLink might call realloc()
+ * on the array to change its size.
+ * The contents of this variable will be changed to reflect
+ * the new size of the array.
+ * @return A pointer to an array containing pointers to all known
+ * edges, or NULL in case of an error.
+ * If the @a edges @a argument was not NULL, then the
+ * retun value can be either the same value or a different
+ * value. If the new values is NULL, then the old array
+ * will have been freed by Meshlink.
+ * The caller must call free() on each element of this
+ * array (but not the contents of said elements),
+ * as well as the array itself when it is finished.
+ * ATTENTION: The pointers and values should never be modified
+ * by the application!!!
+ */
+extern meshlink_edge_t **meshlink_get_all_edges_state(meshlink_handle_t *mesh, meshlink_edge_t **edges, size_t *nmemb);
+