return meshlink_get_node_blacklisted(handle, node);
}
+ /// Get the node's tiny status.
+ /** This function returns true if the given node is a tiny node.
+ * Note that the tiny status of a node will only be known if the node has been reachable at least once.
+ *
+ * @param node A pointer to a meshlink::node describing the node.
+ *
+ * @return This function returns true if the node is a tiny node.
+ */
+ bool get_node_tiny(node *node) {
+ return meshlink_get_node_tiny(handle, node);
+ }
+
/// Get a handle for a specific submesh.
/** This function returns a handle for the submesh with the given name.
*
return devclass;
}
+bool meshlink_get_node_tiny(meshlink_handle_t *mesh, meshlink_node_t *node) {
+ if(!mesh || !node) {
+ meshlink_errno = MESHLINK_EINVAL;
+ return -1;
+ }
+
+ bool tiny;
+
+ if(pthread_mutex_lock(&mesh->mutex) != 0) {
+ abort();
+ }
+
+ tiny = ((node_t *)node)->status.tiny;
+
+ pthread_mutex_unlock(&mesh->mutex);
+
+ return tiny;
+}
+
bool meshlink_get_node_blacklisted(meshlink_handle_t *mesh, meshlink_node_t *node) {
if(!mesh) {
meshlink_errno = MESHLINK_EINVAL;
*/
dev_class_t meshlink_get_node_dev_class(struct meshlink_handle *mesh, struct meshlink_node *node) __attribute__((__warn_unused_result__));
+/// Get the node's tiny status.
+/** This function returns true if the given node is a tiny node.
+ * Note that the tiny status of a node will only be known if the node has been reachable at least once.
+ *
+ * \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.
+ *
+ * @return This function returns true if the node is a tiny node.
+ */
+bool meshlink_get_node_tiny(struct meshlink_handle *mesh, struct meshlink_node *node) __attribute__((__warn_unused_result__));
+
/// Get the node's blacklist status.
/** This function returns the given node is blacklisted.
*
meshlink_get_node_dev_class
meshlink_get_node_reachability
meshlink_get_node_submesh
+meshlink_get_node_tiny
meshlink_get_pmtu
meshlink_get_port
meshlink_get_self
uint16_t duplicate: 1; /* 1 if the node is duplicate, ie. multiple nodes using the same Name are online */
uint16_t dirty: 1; /* 1 if the configuration of the node is dirty and needs to be written out */
uint16_t want_udp: 1; /* 1 if we want working UDP because we have data to send */
+ uint16_t tiny: 1; /* 1 if this is a tiny node */
} node_status_t;
#define MAX_RECENT 5
n->devclass = devclass;
n->status.dirty = true;
+ n->status.tiny = c->flags & PROTOCOL_TINY;
n->last_successfull_connection = mesh->loop.now.tv_sec;