(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 */
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);
return meshlink_get_node_reachability(handle, node, last_reachable, last_unreachable);
}
+ /// Get a node's blacklist status.
+ /** This function returns the current blacklist status of a given node.
+ *
+ * @param node A pointer to a meshlink::node describing the node.
+ *
+ * @return This function returns true if the node is currently blacklisted, false otherwise.
+ */
+ bool get_node_blacklisted(node *node) {
+ return meshlink_get_node_blacklisted(handle, node);
+ }
+
/// Get a handle for a specific submesh.
/** This function returns a handle for the submesh with the given name.
*
return (node **)meshlink_get_all_nodes(handle, (meshlink_node_t **)nodes, nmemb);
}
+ /// 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.
+ *
+ * @return A pointer to an array containing pointers to all known nodes with the given blacklist status.
+ * If the @a nodes argument was not NULL, then the return value can either be the same value or a different value.
+ * If it is a new value, the old value of @a nodes should not be used anymore.
+ * If the new value is NULL, then the old array will have been freed by MeshLink.
+ */
+ node **get_all_nodes_by_blacklisted(bool blacklisted, node **nodes, size_t *nmemb) {
+ return (node **)meshlink_get_all_nodes_by_blacklisted(handle, blacklisted, (meshlink_node_t **)nodes, nmemb);
+ }
+
/// Sign data using the local node's MeshLink key.
/** This function signs data using the local node's MeshLink key.
* The generated signature can be securely verified by other nodes.
/// 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.
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<mesh *>(handle->priv);
+ that->blacklisted(static_cast<node *>(peer));
+ }
+
static void connection_try_trampoline(meshlink_handle_t *handle, meshlink_node_t *peer) {
if(!(handle->priv)) {
return;