From 5e816cf60194cc97f36a7884231d8f99e9547567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Wed, 8 Nov 2017 02:00:33 +0100 Subject: [PATCH] Node stat function. --- include/neocomm.h | 7 +++++++ src/node.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/include/neocomm.h b/include/neocomm.h index 3564cce..f205ac7 100644 --- a/include/neocomm.h +++ b/include/neocomm.h @@ -105,6 +105,13 @@ int NeoComm_import_nodes(const char *node_file); */ int NeoComm_export_nodes(const char *node_file); +/** + * @brief Retrieve statistics about the local node. + * + * @return A text description of the local node's status. + */ +const char *NeoComm_get_node_stats(); + /** * @brief Join a channel. * diff --git a/src/node.cpp b/src/node.cpp index 7ae15e6..c5de95d 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -112,3 +112,7 @@ int NeoComm_export_nodes(const char *node_file) { msgpack::pack(export_file, node.exportNodes()); return 1; } + +const char *NeoComm_get_node_stats() { + return node.getNodesStats(AF_UNSPEC).toString().c_str(); +}