multiple times: the values from multiple lines are spliced together. When
this is set then **VersioningAuthoritativeDirectory** should be set too.
+[[RecommendedPackageVersions]] **RecommendedPackageVersions** __PACKAGENAME__ __VERSION__ __URL__ __DIGESTTYPE__**=**__DIGEST__ ::
+ Adds "package" line to the directory authority's vote. This information
+ is used to vote on the correct URL and digest for the released versions
+ of different Tor-related packages, so that the consensus can certify
+ them. This line may appear any number of times.
+
[[RecommendedClientVersions]] **RecommendedClientVersions** __STRING__::
STRING is a comma-separated list of Tor versions currently believed to be
safe for clients to use. This information is included in version 2
return smartlist_get_most_frequent(sl, compare_string_ptrs_);
}
-/** Return the most frequent string in the sorted list <b>sl</b> */
+/** Return the most frequent string in the sorted list <b>sl</b>.
+ * If <b>count_out</b> is provided, set <b>count_out</b> to the
+ * number of times that string appears.
+ */
char *
smartlist_get_most_frequent_string_(smartlist_t *sl, int *count_out)
{
return result;
}
-/** DOCDOC */
+/** Given a list of networkstatus_t for each vote, return a newly allocated
+ * string containing the "package" lines for the vote. */
STATIC char *
compute_consensus_package_lines(smartlist_t *votes)
{
const int n_votes = smartlist_len(votes);
+
+ /* This will be a map from "packagename version" strings to arrays
+ * of const char *, with the i'th member of the array corresponding to the
+ * package line from the i'th vote.
+ */
strmap_t *package_status = strmap_new();
- smartlist_t *result_list = smartlist_new();
SMARTLIST_FOREACH_BEGIN(votes, networkstatus_t *, v) {
if (! v->package_lines)
if (! validate_recommended_package_line(line))
continue;
+ /* Skip 'cp' to the second space in the line. */
const char *cp = strchr(line, ' ');
if (!cp) continue;
++cp;
} SMARTLIST_FOREACH_END(line);
} SMARTLIST_FOREACH_END(v);
- smartlist_t *entries = smartlist_new();
+ smartlist_t *entries = smartlist_new(); /* temporary */
+ smartlist_t *result_list = smartlist_new(); /* output */
STRMAP_FOREACH(package_status, key, const char **, values) {
int i, count=-1;
for (i = 0; i < n_votes; ++i) {