X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink.h;h=385c12cec44b17f5a5609e62d5ad42b6607ba507;hb=d65ff28f38ba779fbd6f970fb3c84b0ed98daa28;hp=98a34bd651d72f9a25a9a6b6aadc4eb9b2b49bc9;hpb=42cef01039177f3c762001439c8fb6bbdcd6e159;p=meshlink diff --git a/src/meshlink.h b/src/meshlink.h index 98a34bd6..385c12ce 100644 --- a/src/meshlink.h +++ b/src/meshlink.h @@ -173,7 +173,7 @@ extern void meshlink_open_params_free(meshlink_open_params_t *params); * @param params A pointer to a meshlink_open_params_t which must have been created earlier with meshlink_open_params_init(). * @param netns A filedescriptor that must point to a valid network namespace, or -1 to have MeshLink use the same namespace as the calling thread. * - * @return This function will return true if the open parameters have been succesfully updated, false otherwise. + * @return This function will return true if the open parameters have been successfully updated, false otherwise. */ extern bool meshlink_open_params_set_netns(meshlink_open_params_t *params, int netns) __attribute__((__warn_unused_result__)); @@ -184,7 +184,7 @@ extern bool meshlink_open_params_set_netns(meshlink_open_params_t *params, int n * @param key A pointer to a key, or NULL in case no encryption should be used. * @param keylen The length of the given key, or 0 in case no encryption should be used. * - * @return This function will return true if the open parameters have been succesfully updated, false otherwise. + * @return This function will return true if the open parameters have been successfully updated, false otherwise. */ extern bool meshlink_open_params_set_storage_key(meshlink_open_params_t *params, const void *key, size_t keylen) __attribute__((__warn_unused_result__)); @@ -514,7 +514,7 @@ extern void meshlink_set_log_cb(struct meshlink_handle *mesh, meshlink_log_level /// A callback for receiving error conditions encountered by the MeshLink thread. /** @param mesh A handle which represents an instance of MeshLink, or NULL. - * @param errno The error code describing what kind of error occured. + * @param errno The error code describing what kind of error occurred. */ typedef void (*meshlink_error_cb_t)(struct meshlink_handle *mesh, meshlink_errno_t meshlink_errno); @@ -758,6 +758,22 @@ extern dev_class_t meshlink_get_node_dev_class(struct meshlink_handle *mesh, str */ extern struct meshlink_submesh *meshlink_get_node_submesh(struct meshlink_handle *mesh, struct meshlink_node *node) __attribute__((__warn_unused_result__)); +/// Get a node's reachability status. +/** This function returns the current reachability of a given node, and the times of the last state changes. + * If a given state change never happened, the time returned will be 0. + * + * \memberof meshlink_node + * @param mesh A handle which represents an instance of MeshLink. + * @param node A pointer to a struct meshlink_node describing the node. + * @param last_reachable A pointer to a time_t variable that will be filled in with the last time the node became reachable. + * Pass NULL to not have anything written. + * @param last_unreachable A pointer to a time_t variable that will be filled in with the last time the node became unreachable. + * Pass NULL to not have anything written. + * + * @return This function returns true if the node is currently reachable, false otherwise. + */ +extern bool meshlink_get_node_reachability(struct meshlink_handle *mesh, struct meshlink_node *node, time_t *last_reachable, time_t *last_unreachable); + /// Verify the signature generated by another node of a piece of data. /** This function verifies the signature that another node generated for a piece of data. * @@ -1524,6 +1540,28 @@ extern bool meshlink_encrypted_key_rotate(struct meshlink_handle *mesh, const vo */ extern void meshlink_set_dev_class_timeouts(struct meshlink_handle *mesh, dev_class_t devclass, int pinginterval, int pingtimeout); +/// Set device class fast retry period +/** This sets the fast retry period for a given device class. + * During this period after the last time the mesh becomes unreachable, connections are tried once a second. + * + * \memberof meshlink_handle + * @param mesh A handle which represents an instance of MeshLink. + * @param devclass The device class to update + * @param fast_retry_period The period during which fast connection retries are done. The default is 0. + */ +extern void meshlink_set_dev_class_fast_retry_period(struct meshlink_handle *mesh, dev_class_t devclass, int fast_retry_period); + +/// Set which order invitations are committed +/** This determines in which order configuration files are written to disk during an invitation. + * By default, the invitee saves the configuration to disk first, then the inviter. + * By calling this function with @a inviter_commits_first set to true, the order is reversed. + * + * \memberof meshlink_handle + * @param mesh A handle which represents an instance of MeshLink. + * @param inviter_commits_first If true, then the node that invited a peer will commit data to disk first. + */ +extern void meshlink_set_inviter_commits_first(struct meshlink_handle *mesh, bool inviter_commits_first); + #ifdef __cplusplus } #endif