diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-06-19 12:40:23 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-06-19 12:40:23 -0400 |
commit | 015189b5df17d3572d27e850336e9d1c9dc83c6d (patch) | |
tree | cd09a5933e8b78da2657a2973ca6cab5dbc4acdf /src/or/reasons.c | |
parent | 75472c19c3fdcda913eb8117c917ddfd445b2b77 (diff) | |
download | tor-015189b5df17d3572d27e850336e9d1c9dc83c6d.tar.gz tor-015189b5df17d3572d27e850336e9d1c9dc83c6d.zip |
Move SOCKS reason-decoding switches into reasons.c
Diffstat (limited to 'src/or/reasons.c')
-rw-r--r-- | src/or/reasons.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/or/reasons.c b/src/or/reasons.c index a252f83198..5efb08bb41 100644 --- a/src/or/reasons.c +++ b/src/or/reasons.c @@ -326,3 +326,46 @@ circuit_end_reason_to_control_string(int reason) } } +const char * +socks4_response_code_to_string(uint8_t code) +{ + switch (code) { + case 0x5a: + return "connection accepted"; + case 0x5b: + return "server rejected connection"; + case 0x5c: + return "server cannot connect to identd on this client"; + case 0x5d: + return "user id does not match identd"; + default: + return "invalid SOCKS 4 response code"; + } +} + +const char * +socks5_response_code_to_string(uint8_t code) +{ + switch (code) { + case 0x00: + return "connection accepted"; + case 0x01: + return "general SOCKS server failure"; + case 0x02: + return "connection not allowed by ruleset"; + case 0x03: + return "Network unreachable"; + case 0x04: + return "Host unreachable"; + case 0x05: + return "Connection refused"; + case 0x06: + return "TTL expired"; + case 0x07: + return "Command not supported"; + case 0x08: + return "Address type not supported"; + default: + return "unknown reason"; + } +} |