]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.h
Add meshlink_get_self().
[meshlink] / src / meshlink.h
index 1f4bb7262e6b3780e9fac55cea784fde8dd1bca1..651f05c8bd355f54002c90881322f029d303337d 100644 (file)
@@ -196,6 +196,18 @@ extern void meshlink_stop(meshlink_handle_t *mesh);
  */
 extern void meshlink_close(meshlink_handle_t *mesh);
 
+/// Destroy a MeshLink instance.
+/** This function remove all configuration files of a MeshLink instance. It should only be called when the application
+ *  does not have an open handle to this instance. Afterwards, a call to meshlink_open() will create a completely
+ *  new instance.
+ *
+ *  @param confbase The directory in which MeshLink stores its configuration files.
+ *                  After the function returns, the application is free to overwrite or free @a confbase @a.
+ *
+ *  @return         This function will return true if the MeshLink instance was succesfully destroyed, false otherwise.
+ */
+extern bool meshlink_destroy(const char *confbase);
+
 /// A callback for receiving data from the mesh.
 /** @param mesh      A handle which represents an instance of MeshLink.
  *  @param source    A pointer to a meshlink_node_t describing the source of the data.
@@ -317,6 +329,16 @@ extern bool meshlink_send(meshlink_handle_t *mesh, meshlink_node_t *destination,
  */
 extern ssize_t meshlink_get_pmtu(meshlink_handle_t *mesh, meshlink_node_t *destination);
 
+/// Get a handle for our own node.
+/** This function returns a handle for the local node.
+ *
+ *  @param mesh         A handle which represents an instance of MeshLink.
+ *
+ *  @return             A pointer to a meshlink_node_t which represents the local node.
+ *                      The pointer is guaranteed to be valid until meshlink_close() is called.
+ */
+extern meshlink_node_t *meshlink_get_self(meshlink_handle_t *mesh);
+
 /// Get a handle for a specific node.
 /** This function returns a handle for the node with the given name.
  *