X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmeshlink%2B%2B.h;h=9e97fc820d846b29e9570da08bbc1fb47b65e4bd;hb=1bd5703bb40828fd6a4dc76eeeccd2884de8decb;hp=25fd34f3f2c1530c14ad99db328e646d8c81a2ed;hpb=39f2e20489cbc3e924547b684340bf722a0df028;p=meshlink diff --git a/src/meshlink++.h b/src/meshlink++.h index 25fd34f3..9e97fc82 100644 --- a/src/meshlink++.h +++ b/src/meshlink++.h @@ -280,6 +280,12 @@ public: (void)peer; } + /// This functions is called whenever the MeshLink thread status changes. + virtual void thread_status(bool status) { + /* do nothing */ + (void)status; + } + /// This functions is called whenever MeshLink a meta-connection attempt is made. virtual void connection_try(node *peer) { /* do nothing */ @@ -381,6 +387,7 @@ public: meshlink_set_log_cb(handle, MESHLINK_DEBUG, &log_trampoline); meshlink_set_error_cb(handle, &error_trampoline); meshlink_set_blacklisted_cb(handle, &blacklisted_trampoline); + meshlink_set_thread_status_cb(handle, &thread_status_trampoline); meshlink_set_channel_listen_cb(handle, &channel_listen_trampoline); meshlink_set_channel_accept_cb(handle, &channel_accept_trampoline); meshlink_set_connection_try_cb(handle, &connection_try_trampoline); @@ -449,6 +456,18 @@ public: return meshlink_get_node_blacklisted(handle, node); } + /// Get the node's tiny status. + /** This function returns true if the given node is a tiny node. + * Note that the tiny status of a node will only be known if the node has been reachable at least once. + * + * @param node A pointer to a meshlink::node describing the node. + * + * @return This function returns true if the node is a tiny node. + */ + bool get_node_tiny(node *node) { + return meshlink_get_node_tiny(handle, node); + } + /// Get a handle for a specific submesh. /** This function returns a handle for the submesh with the given name. * @@ -1301,6 +1320,15 @@ private: that->blacklisted(static_cast(peer)); } + static void thread_status_trampoline(meshlink_handle_t *handle, bool status) { + if(!(handle->priv)) { + return; + } + + meshlink::mesh *that = static_cast(handle->priv); + that->thread_status(status); + } + static void connection_try_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer) { if(!(handle->priv)) { return;