DEV_CLASS_STATIONARY = 1,
DEV_CLASS_PORTABLE = 2,
DEV_CLASS_UNKNOWN = 3,
- _DEV_CLASS_MAX = 3
+ DEV_CLASS_COUNT
} dev_class_t;
/// Invitation flags
*/
extern void meshlink_set_node_status_cb(meshlink_handle_t *mesh, meshlink_node_status_cb_t cb);
+/// A callback reporting node path MTU changes.
+/** @param mesh A handle which represents an instance of MeshLink.
+ * @param node A pointer to a meshlink_node_t describing the node whose status changed.
+ * This pointer is valid until meshlink_close() is called.
+ * @param pmtu The current path MTU to the node, or 0 if UDP communication is not (yet) possible.
+ */
+typedef void (*meshlink_node_pmtu_cb_t)(meshlink_handle_t *mesh, meshlink_node_t *node, uint16_t pmtu);
+
+/// Set the node extended status callback.
+/** This functions sets the callback that is called whenever certain connectivity parameters for a node change.
+ * 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 another node's extended status changes.
+ * If a NULL pointer is given, the callback will be disabled.
+ */
+extern void meshlink_set_node_pmtu_cb(meshlink_handle_t *mesh, meshlink_node_pmtu_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.
extern void meshlink_hint_address(meshlink_handle_t *mesh, meshlink_node_t *node, const struct sockaddr *addr);
/// Enable or disable zeroconf discovery of local peers
-
/** This controls whether zeroconf discovery using the Catta library will be
* enabled to search for peers on the local network. By default, it is enabled.
*
extern void meshlink_enable_discovery(meshlink_handle_t *mesh, bool enable);
/// Performs key rotation for an encrypted storage
-
/** This rotates the (master) key for an encrypted storage and discards the old key
* if the call succeeded. This is an atomic call.
*
*/
extern bool meshlink_encrypted_key_rotate(meshlink_handle_t *mesh, const void *new_key, size_t new_keylen);
+/// Set device class timeouts
+/** This sets the ping interval and timeout for a given device class.
+ *
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param devclass The device class to update
+ * @param pinginterval The interval between keepalive packets, in seconds. The default is 60.
+ * @param pingtimeout The required time within which a peer should respond, in seconds. The default is 5.
+ * The timeout must be smaller than the interval.
+ */
+extern void meshlink_set_dev_class_timeouts(meshlink_handle_t *mesh, dev_class_t devclass, int pinginterval, int pingtimeout);
+
#ifdef __cplusplus
}
#endif