X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fmeshlink.h;h=15fb6e6965cedd6569f6de89c30afc00d85eaef3;hp=37eeac81ed0b74a43ebb1ae981bffb2042c46c79;hb=f712fdc0b3de22566cdf06954256c62f46f25542;hpb=2610a548bbeef7a10172889f8aa41d8bfa797c71 diff --git a/src/meshlink.h b/src/meshlink.h index 37eeac81..15fb6e69 100644 --- a/src/meshlink.h +++ b/src/meshlink.h @@ -242,6 +242,26 @@ typedef void (*meshlink_node_status_cb_t)(meshlink_handle_t *mesh, meshlink_node */ extern void meshlink_set_node_status_cb(meshlink_handle_t *mesh, meshlink_node_status_cb_t cb); +/// A callback reporting duplicate node detection. +/** @param mesh A handle which represents an instance of MeshLink. + * @param node A pointer to a meshlink_node_t describing the node which is duplicate. + * This pointer is valid until meshlink_close() is called. + */ +typedef void (*meshlink_node_duplicate_cb_t)(meshlink_handle_t *mesh, meshlink_node_t *node); + +/// Set the node duplicate callback. +/** This functions sets the callback that is called whenever a duplicate node is detected. + * The callback is run in MeshLink's own thread. + * It is therefore important that the callback uses apprioriate methods (queues, pipes, locking, etc.) + * to hand the data over to the application's thread. + * The callback should also not block itself and return as quickly as possible. + * + * @param mesh A handle which represents an instance of MeshLink. + * @param cb A pointer to the function which will be called when a duplicate node is detected. + * If a NULL pointer is given, the callback will be disabled. + */ +extern void meshlink_set_node_duplicate_cb(meshlink_handle_t *mesh, meshlink_node_duplicate_cb_t cb); + /// Severity of log messages generated by MeshLink. typedef enum { MESHLINK_DEBUG, ///< Internal debugging messages. Only useful during application development.