New GETINFO consensus/packages to expose package information from consensus

This commit is contained in:
Nick Mathewson
2015-01-27 16:40:32 -05:00
parent 1e61b45251
commit 9c4328c038
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -2165,6 +2165,8 @@ static const getinfo_item_t getinfo_items[] = {
"Brief summary of router status by nickname (v2 directory format)."),
PREFIX("ns/purpose/", networkstatus,
"Brief summary of router status by purpose (v2 directory format)."),
PREFIX("consensus/", networkstatus,
"Information abour and from the ns consensus."),
ITEM("network-status", dir,
"Brief summary of router status (v1 directory format)"),
ITEM("circuit-status", events, "List of current circuits originating here."),
+5
View File
@@ -1913,6 +1913,11 @@ getinfo_helper_networkstatus(control_connection_t *conn,
} else if (!strcmpstart(question, "ns/purpose/")) {
*answer = networkstatus_getinfo_by_purpose(question+11, time(NULL));
return *answer ? 0 : -1;
} else if (!strcmpstart(question, "consensus/packages")) {
const networkstatus_t *ns = networkstatus_get_latest_consensus();
if (ns->package_lines)
*answer = smartlist_join_strings(ns->package_lines, "\n", 1, NULL);
return *answer ? 0 : -1;
} else {
return 0;
}