X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink%2B%2B.h;h=6374a86d3b3725920c4b464da91afb6dbfaa744c;hb=3fe7713c4f9d16f192271bc4fa8a2ffda6bb28fd;hp=74ec06e5a5bd37f80f8e9af866be525dd183cf2e;hpb=6bb60661aa20e6aa4a6a6c2244a3fb7df6cf2c4d;p=meshlink diff --git a/src/meshlink++.h b/src/meshlink++.h index 74ec06e5..6374a86d 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. * @@ -990,7 +1004,20 @@ public: * @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. */ - void set_dev_class_timeouts(dev_class_t devclass, int pinginterval, int pingtimeout); + void set_dev_class_timeouts(dev_class_t devclass, int pinginterval, int pingtimeout) { + meshlink_set_dev_class_timeouts(handle, devclass, pinginterval, 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. + * + * @param devclass The device class to update + * @param fast_retry_period The period during which fast connection retries are done. The default is 0. + */ + void set_dev_class_fast_retry_period(dev_class_t devclass, int fast_retry_period) { + meshlink_set_dev_class_fast_retry_period(handle, devclass, fast_retry_period); + } private: // non-copyable: