From: Guus Sliepen Date: Mon, 12 May 2014 17:49:25 +0000 (+0200) Subject: Implement meshlink_get_all_nodes(). X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=33fc9a1313bdc263c47ab8939b8555e679596452;p=meshlink Implement meshlink_get_all_nodes(). --- diff --git a/src/meshlink.c b/src/meshlink.c index 4aadaaa9..c88059b1 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -885,7 +885,15 @@ meshlink_node_t *meshlink_get_node(meshlink_handle_t *mesh, const char *name) { } size_t meshlink_get_all_nodes(meshlink_handle_t *mesh, meshlink_node_t **nodes, size_t nmemb) { - return 0; + size_t i = 0; + + for splay_each(node_t, n, mesh->nodes) { + if(i < nmemb) + nodes[i] = (meshlink_node_t *)n; + i++; + } + + return i; } char *meshlink_sign(meshlink_handle_t *mesh, const char *data, size_t len) {