X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink%2B%2B.h;h=4d900448baae145a0b91616190d09c8e5766328e;hb=1ab9403c5eb08bcb47e8e1599764b5465c79795b;hp=3599cc55f44c7b59a64f66eab4aece32479ba6ff;hpb=529b8fab8c21e7ae5af91d742ff202eab38e51f3;p=meshlink diff --git a/src/meshlink++.h b/src/meshlink++.h index 3599cc55..4d900448 100644 --- a/src/meshlink++.h +++ b/src/meshlink++.h @@ -388,6 +388,20 @@ public: return (node *)meshlink_get_node(handle, name); } + /// 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. + * + * @param node A pointer to a 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. + * @param last_unreachable A pointer to a time_t variable that will be filled in with the last time the node became unreachable. + * + * @return This function returns true if the node is currently reachable, false otherwise. + */ + bool get_node_reachability(node *node, time_t *last_reachable = NULL, time_t *last_unreachable = NULL) { + return meshlink_get_node_reachability(handle, node, last_reachable, last_unreachable); + } + /// Get a handle for a specific submesh. /** This function returns a handle for the submesh with the given name. * @@ -1005,6 +1019,17 @@ public: meshlink_set_dev_class_fast_retry_period(handle, devclass, 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. + * + * @param inviter_commits_first If true, then the node that invited a peer will commit data to disk first. + */ + void set_inviter_commits_first(bool inviter_commits_first) { + meshlink_set_inviter_commits_first(handle, inviter_commits_first); + } + private: // non-copyable: mesh(const mesh &) /* TODO: C++11: = delete */;