aboutsummaryrefslogtreecommitdiff
path: root/src/or/command.c
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2013-10-28 11:30:49 +0100
committerKarsten Loesing <karsten.loesing@gmx.net>2013-10-28 12:09:42 +0100
commit2e0fad542cccddf9ad8b8dbaeba8b1e825c09ff4 (patch)
treef4639f6ed8b224087e665373ba147df1fd53144d /src/or/command.c
parent49278cd68a0d84727ae1131e677bc3481b3e2fc7 (diff)
parente46de82c97e694d3bfa399af48b9de9365e264bd (diff)
downloadtor-2e0fad542cccddf9ad8b8dbaeba8b1e825c09ff4.tar
tor-2e0fad542cccddf9ad8b8dbaeba8b1e825c09ff4.tar.gz
Merge branch 'morestats4' into morestats5
Conflicts: doc/tor.1.txt src/or/config.c src/or/connection.h src/or/control.c src/or/control.h src/or/or.h src/or/relay.c src/or/relay.h src/test/test.c
Diffstat (limited to 'src/or/command.c')
-rw-r--r--src/or/command.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/or/command.c b/src/or/command.c
index 699b02fb4..5a671183b 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -53,6 +53,33 @@ static void command_process_created_cell(cell_t *cell, channel_t *chan);
static void command_process_relay_cell(cell_t *cell, channel_t *chan);
static void command_process_destroy_cell(cell_t *cell, channel_t *chan);
+/** Convert the cell <b>command</b> into a lower-case, human-readable
+ * string. */
+const char *
+cell_command_to_string(uint8_t command)
+{
+ switch (command) {
+ case CELL_PADDING: return "padding";
+ case CELL_CREATE: return "create";
+ case CELL_CREATED: return "created";
+ case CELL_RELAY: return "relay";
+ case CELL_DESTROY: return "destroy";
+ case CELL_CREATE_FAST: return "create_fast";
+ case CELL_CREATED_FAST: return "created_fast";
+ case CELL_VERSIONS: return "versions";
+ case CELL_NETINFO: return "netinfo";
+ case CELL_RELAY_EARLY: return "relay_early";
+ case CELL_CREATE2: return "create2";
+ case CELL_CREATED2: return "created2";
+ case CELL_VPADDING: return "vpadding";
+ case CELL_CERTS: return "certs";
+ case CELL_AUTH_CHALLENGE: return "auth_challenge";
+ case CELL_AUTHENTICATE: return "authenticate";
+ case CELL_AUTHORIZE: return "authorize";
+ default: return "unrecognized";
+ }
+}
+
#ifdef KEEP_TIMING_STATS
/** This is a wrapper function around the actual function that processes the
* <b>cell</b> that just arrived on <b>conn</b>. Increment <b>*time</b>