aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-09-27 20:46:30 +0000
committerNick Mathewson <nickm@torproject.org>2007-09-27 20:46:30 +0000
commitb5c8a8ae53c141c14651485794999910d0168be8 (patch)
tree5a698b0cdf8502c9c945cd9f70cb00e1a96d9625 /src/or/router.c
parent2050b31bb90861c6cbf8cfc54299f5a7f10609a2 (diff)
downloadtor-b5c8a8ae53c141c14651485794999910d0168be8.tar
tor-b5c8a8ae53c141c14651485794999910d0168be8.tar.gz
r15422@catbus: nickm | 2007-09-27 16:42:35 -0400
Use descriptor annotations to record the source, download t time, and purpose of every descriptor we add to the store. The remaining to-do item is to stop setting do_not_cache on bridges. svn:r11680
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c
index f3aa25299..b73d420fa 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1773,6 +1773,35 @@ router_reset_warnings(void)
}
}
+/** DOCDOC */
+const char *
+router_purpose_to_string(uint8_t p)
+{
+ switch (p)
+ {
+ case ROUTER_PURPOSE_GENERAL: return "general";
+ case ROUTER_PURPOSE_BRIDGE: return "bridge";
+ case ROUTER_PURPOSE_CONTROLLER: return "controller";
+ default:
+ tor_assert(0);
+ }
+ return NULL;
+}
+
+/** DOCDOC */
+uint8_t
+router_purpose_from_string(const char *s)
+{
+ if (!strcmp(s, "general"))
+ return ROUTER_PURPOSE_GENERAL;
+ else if (!strcmp(s, "bridge"))
+ return ROUTER_PURPOSE_BRIDGE;
+ else if (!strcmp(s, "controller"))
+ return ROUTER_PURPOSE_CONTROLLER;
+ else
+ return ROUTER_PURPOSE_UNKNOWN;
+}
+
/** Release all static resources held in router.c */
void
router_free_all(void)