class mesh;
class node;
class channel;
-class submesh;
/// Severity of log messages generated by MeshLink.
typedef meshlink_log_level_t log_level_t;
*/
typedef void (*node_status_cb_t)(mesh *mesh, node *node, bool reachable);
-/// A callback reporting node path MTU changes.
-/** @param mesh A handle which represents an instance of MeshLink.
- * @param node A pointer to a meshlink_node_t describing the node whose status changed.
- * This pointer is valid until meshlink_close() is called.
- * @param pmtu The current path MTU to the node, or 0 if UDP communication is not (yet) possible.
- */
-typedef void (*node_pmtu_cb_t)(mesh *mesh, node *node, uint16_t pmtu);
-
/// A callback reporting duplicate node detection.
/** @param mesh A handle which represents an instance of MeshLink.
* @param node A pointer to a meshlink_node_t describing the node which is duplicate.
class node: public meshlink_node_t {
};
-/// A class describing a MeshLink Sub-Mesh.
-class submesh: public meshlink_submesh_t {
-};
-
/// A class describing a MeshLink channel.
class channel: public meshlink_channel_t {
public:
(void)reachable;
}
- /// This functions is called whenever another node's path MTU changes.
- virtual void node_pmtu(node *peer, uint16_t pmtu) {
- /* do nothing */
- (void)peer;
- (void)pmtu;
- }
-
/// This functions is called whenever a duplicate node is detected.
virtual void node_duplicate(node *peer) {
/* do nothing */
bool start() {
meshlink_set_receive_cb(handle, &receive_trampoline);
meshlink_set_node_status_cb(handle, &node_status_trampoline);
- meshlink_set_node_pmtu_cb(handle, &node_pmtu_trampoline);
meshlink_set_node_duplicate_cb(handle, &node_duplicate_trampoline);
meshlink_set_log_cb(handle, MESHLINK_DEBUG, &log_trampoline);
meshlink_set_error_cb(handle, &error_trampoline);
return meshlink_get_node_reachability(handle, node, last_reachable, last_unreachable);
}
- /// Get a handle for a specific submesh.
- /** This function returns a handle for the submesh with the given name.
- *
- * @param name The name of the submesh for which a handle is requested.
- *
- * @return A pointer to a meshlink::submesh which represents the requested submesh,
- * or NULL if the requested submesh does not exist.
- */
- submesh *get_submesh(const char *name) {
- return (submesh *)meshlink_get_submesh(handle, name);
- }
-
/// Get a handle for our own node.
/** This function returns a handle for the local node.
*
that->node_status(static_cast<node *>(peer), reachable);
}
- static void node_pmtu_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer, uint16_t pmtu) {
- if(!(handle->priv)) {
- return;
- }
-
- meshlink::mesh *that = static_cast<mesh *>(handle->priv);
- that->node_pmtu(static_cast<node *>(peer), pmtu);
- }
-
static void node_duplicate_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer) {
if(!(handle->priv)) {
return;