summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-07-23 04:22:56 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-07-23 04:26:59 +0200
commit4b86fb2d9d4c04be4ab6539664d9c5999fa98c2b (patch)
treefa0bb9c9b228f4bb25df83a5a9c54cd702e54c70 /common.c
parent9686e552151a9382238ab01b3632f5ce3402ee3a (diff)
downloadxK-4b86fb2d9d4c04be4ab6539664d9c5999fa98c2b.tar.gz
xK-4b86fb2d9d4c04be4ab6539664d9c5999fa98c2b.tar.xz
xK-4b86fb2d9d4c04be4ab6539664d9c5999fa98c2b.zip
SOCKS: add socks_protocol_to_string()
Diffstat (limited to 'common.c')
-rw-r--r--common.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/common.c b/common.c
index 7a9d2cc..d30ef30 100644
--- a/common.c
+++ b/common.c
@@ -376,6 +376,17 @@ enum socks_protocol
SOCKS_MAX ///< End of protocol
};
+static inline const char *
+socks_protocol_to_string (enum socks_protocol self)
+{
+ switch (self)
+ {
+ case SOCKS_5: return "SOCKS5";
+ case SOCKS_4A: return "SOCKS4A";
+ default: return NULL;
+ }
+}
+
struct socks_connector
{
struct connector *connector; ///< Proxy server iterator (effectively)
@@ -828,7 +839,7 @@ socks_connector_on_connecting (void *user_data, const char *via)
char *address = format_host_port_pair (target->address_str, port);
free (port);
self->on_connecting (self->user_data, address, via,
- self->protocol_iter ? "SOCKS4A" : "SOCKS5");
+ socks_protocol_to_string (self->protocol_iter));
free (address);
}