]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.h
Add a function to set the default white/blacklisting behaviour.
[meshlink] / src / meshlink.h
index 6a83f6c60b41772c8ea529675ed737e9f45fa6a9..75c4932715b6e23eaed4f373cc0b6e0c6c8dfb86 100644 (file)
@@ -180,6 +180,7 @@ extern bool meshlink_start(meshlink_handle_t *mesh);
  *  close all sockets, and shut down its own thread.
  *
  *  This function always succeeds. It is allowed to call meshlink_stop() even if MeshLink is already stopped or has never been started.
+ *  Channels that are still open will remain valid, but any communication via channels will stop as well.
  *
  *  @param mesh     A handle which represents an instance of MeshLink.
  */
@@ -187,7 +188,7 @@ extern void meshlink_stop(meshlink_handle_t *mesh);
 
 /// Close the MeshLink handle.
 /** This function calls meshlink_stop() if necessary,
- *  and frees the struct meshlink_handle and all associacted memory allocated by MeshLink.
+ *  and frees the struct meshlink_handle and all associacted memory allocated by MeshLink, including all channels.
  *  Afterwards, the handle and any pointers to a struct meshlink_node or struct meshlink_channel are invalid.
  *
  *  It is allowed to call this function at any time on a valid handle, except inside callback functions.
@@ -478,9 +479,21 @@ extern void meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *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 blacklisted.
+ *  @param node         A pointer to a meshlink_node_t describing the node to be whitelisted.
  */
-extern void meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *node);
+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.