New interfaces for statistics.
This commit is contained in:
		@@ -112,6 +112,13 @@ int NeoComm_export_nodes(const char *node_file);
 | 
			
		||||
 */
 | 
			
		||||
const char *NeoComm_get_node_stats();
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Get the number of nodes connected.
 | 
			
		||||
 *
 | 
			
		||||
 * @return A number of the known nodes.
 | 
			
		||||
 */
 | 
			
		||||
unsigned int NeoComm_count_connected_nodes();
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Join a channel.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								src/node.cpp
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/node.cpp
									
									
									
									
									
								
							@@ -113,6 +113,24 @@ int NeoComm_export_nodes(const char *node_file) {
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *NeoComm_get_node_stats() {
 | 
			
		||||
	return node.getNodesStats(AF_UNSPEC).toString().c_str();
 | 
			
		||||
unsigned int NeoComm_count_connected_nodes() {
 | 
			
		||||
	return node.getNodesStats(AF_UNSPEC).getKnownNodes();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *NeoComm_get_node_stats() {
 | 
			
		||||
	unsigned int good, dubious, cached, incoming, total;
 | 
			
		||||
	total = node.getNodesStats(
 | 
			
		||||
			AF_UNSPEC,
 | 
			
		||||
			&good,
 | 
			
		||||
			&dubious,
 | 
			
		||||
			&cached,
 | 
			
		||||
			&incoming);
 | 
			
		||||
	std::string stats;
 | 
			
		||||
	stats += "Good: " + good + std::string("\n");
 | 
			
		||||
	stats += "Dubious: " + dubious + std::string("\n");
 | 
			
		||||
	stats += "Cached: " + cached + std::string("\n");
 | 
			
		||||
	stats += "Incoming: " + incoming + std::string("\n");
 | 
			
		||||
	stats += "Total: " + total + std::string("\n");
 | 
			
		||||
 | 
			
		||||
	return stats.c_str();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user