aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirvote.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-06-03 03:05:10 +0000
committerNick Mathewson <nickm@torproject.org>2007-06-03 03:05:10 +0000
commitf4ce7f9c9b43aacf307b83e086dfe6605b320bb2 (patch)
tree6449f09b1ab475202c8efb10f77b6fca22f7511e /src/or/dirvote.c
parente0d828299a65062ed6985fa46c2fb53901234f06 (diff)
downloadtor-f4ce7f9c9b43aacf307b83e086dfe6605b320bb2.tar
tor-f4ce7f9c9b43aacf307b83e086dfe6605b320bb2.tar.gz
r13166@catbus: nickm | 2007-06-02 23:02:40 -0400
First cut at code to parse and validate v3 networkstatus votes. svn:r10461
Diffstat (limited to 'src/or/dirvote.c')
-rw-r--r--src/or/dirvote.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
new file mode 100644
index 000000000..413cc9364
--- /dev/null
+++ b/src/or/dirvote.c
@@ -0,0 +1,48 @@
+/* Copyright 2001-2004 Roger Dingledine.
+ * Copyright 2004-2007 Roger Dingledine, Nick Mathewson. */
+/* See LICENSE for licensing information */
+/* $Id$ */
+const char dirvote_c_id[] =
+ "$Id$";
+
+#include "or.h"
+
+/**
+ * \file dirvote.c
+ **/
+
+/** DOCDOC */
+void
+networkstatus_vote_free(networkstatus_vote_t *ns)
+{
+ int i;
+ if (!ns)
+ return;
+
+ tor_free(ns->client_versions);
+ tor_free(ns->server_versions);
+ if (ns->known_flags) {
+ for (i=0; ns->known_flags[i]; ++i)
+ tor_free(ns->known_flags[i]);
+ tor_free(ns->known_flags);
+ }
+ tor_free(ns->nickname);
+ tor_free(ns->address);
+ tor_free(ns->contact);
+ if (ns->cert)
+ authority_cert_free(ns->cert);
+
+ if (ns->routerstatus_list) {
+ SMARTLIST_FOREACH(ns->routerstatus_list, vote_routerstatus_t *, rs,
+ {
+ tor_free(rs->version);
+ tor_free(rs);
+ });
+
+ smartlist_free(ns->routerstatus_list);
+ }
+
+ memset(ns, 11, sizeof(*ns));
+ tor_free(ns);
+}
+