]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.h
Ensure Catta gets a valid service name.
[meshlink] / src / meshlink.h
index 06f8791334d67ec8378aa45c15fec9ad4baac1be..40ed38f50d7f1eece92883e4231353b0b6f68050 100644 (file)
@@ -79,7 +79,7 @@ typedef enum {
        DEV_CLASS_STATIONARY = 1,
        DEV_CLASS_PORTABLE = 2,
        DEV_CLASS_UNKNOWN = 3,
-       _DEV_CLASS_MAX = 3
+       DEV_CLASS_COUNT
 } dev_class_t;
 
 /// Invitation flags
@@ -1279,7 +1279,6 @@ extern size_t meshlink_channel_get_recvq(meshlink_handle_t *mesh, meshlink_chann
 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.
  *
@@ -1289,7 +1288,6 @@ extern void meshlink_hint_address(meshlink_handle_t *mesh, meshlink_node_t *node
 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.
  *
@@ -1301,6 +1299,17 @@ extern void meshlink_enable_discovery(meshlink_handle_t *mesh, bool enable);
  */
 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