X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink%2B%2B.h;h=551913d4ba2a94ceb4df51852dd8595ce563a28d;hb=a23ddd4f4e273b2ed68fe173b4faa69aadc98756;hp=c155086558ee4d77b25f95d2920b9133431a157a;hpb=001cbb9549f17153536ee6a01a783eb85bf54962;p=meshlink diff --git a/src/meshlink++.h b/src/meshlink++.h index c1550865..551913d4 100644 --- a/src/meshlink++.h +++ b/src/meshlink++.h @@ -274,6 +274,12 @@ public: (void)meshlink_errno; } + /// This functions is called whenever MeshLink is blacklisted by another node. + virtual void blacklisted(node *peer) { + /* do nothing */ + (void)peer; + } + /// This functions is called whenever MeshLink a meta-connection attempt is made. virtual void connection_try(node *peer) { /* do nothing */ @@ -374,6 +380,7 @@ public: 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); + meshlink_set_blacklisted_cb(handle, &blacklisted_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); @@ -479,6 +486,7 @@ public: /// Get a list of all nodes by blacklist status. /** This function returns a list with handles for all the nodes who were either blacklisted or whitelisted. * + * @param blacklisted If true, a list of blacklisted nodes will be returned, otherwise whitelisted nodes. * @param nodes A pointer to an array of pointers to meshlink::node, which should be allocated by the application. * @param nmemb The maximum number of pointers that can be stored in the nodes array. * @@ -544,7 +552,6 @@ public: /// Clear the canonical Address for a node. /** This function clears the canonical Address for a node. * - * @param mesh A handle which represents an instance of MeshLink. * @param node A pointer to a struct meshlink_node describing the node. * * @return This function returns true if the address was removed, false otherwise. @@ -1208,6 +1215,15 @@ private: that->error(meshlink_errno); } + static void blacklisted_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer) { + if(!(handle->priv)) { + return; + } + + meshlink::mesh *that = static_cast(handle->priv); + that->blacklisted(static_cast(peer)); + } + static void connection_try_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer) { if(!(handle->priv)) { return;