Mercurial > hg > nnchat
comparison network.c @ 414:ac4862a94cd1
Move some structures around.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 May 2012 06:45:23 +0300 |
parents | 14b685cdbd2c |
children | 8263cb88556a |
comparison
equal
deleted
inserted
replaced
413:14b685cdbd2c | 414:ac4862a94cd1 |
---|---|
3 * Written by Matti 'ccr' Hämäläinen | 3 * Written by Matti 'ccr' Hämäläinen |
4 * (C) Copyright 2008-2012 Tecnic Software productions (TNSP) | 4 * (C) Copyright 2008-2012 Tecnic Software productions (TNSP) |
5 */ | 5 */ |
6 #include "network.h" | 6 #include "network.h" |
7 | 7 |
8 static const char *nn_proxy_types[] = | |
9 { | |
10 "none", | |
11 "SOCKS 4", | |
12 "SOCKS 4a", | |
13 NULL | |
14 }; | |
8 | 15 |
9 | 16 |
10 #ifdef __WIN32 | 17 #ifdef __WIN32 |
11 const char *hstrerror(int err) | 18 const char *hstrerror(int err) |
12 { | 19 { |
77 conn->msgfunc(conn, fmt, ap); | 84 conn->msgfunc(conn, fmt, ap); |
78 va_end(ap); | 85 va_end(ap); |
79 } | 86 } |
80 } | 87 } |
81 | 88 |
89 | |
82 struct hostent *nn_resolve_host(nn_conn_t *conn, const char *name) | 90 struct hostent *nn_resolve_host(nn_conn_t *conn, const char *name) |
83 { | 91 { |
84 struct hostent *res = gethostbyname(name); | 92 struct hostent *res = gethostbyname(name); |
85 if (res == NULL) | 93 if (res == NULL) |
86 nn_conn_err(conn, "Could not resolve hostname: %s\n", strerror(h_errno)); | 94 nn_conn_err(conn, "Could not resolve hostname: %s\n", strerror(h_errno)); |
87 else | 95 else |
88 nn_conn_msg(conn, "True hostname for %s is %s\n", name, res->h_name); | 96 nn_conn_msg(conn, "True hostname for %s is %s\n", name, res->h_name); |
89 | 97 |
90 return res; | 98 return res; |
91 } | 99 } |
92 | |
93 static const char *nn_proxy_types[] = | |
94 { | |
95 "none", | |
96 "SOCKS 4", | |
97 "SOCKS 4a", | |
98 NULL | |
99 }; | |
100 | 100 |
101 | 101 |
102 nn_conn_t * nn_conn_new( | 102 nn_conn_t * nn_conn_new( |
103 void (*errfunc)(nn_conn_t *conn, const char *fmt, va_list ap), | 103 void (*errfunc)(nn_conn_t *conn, const char *fmt, va_list ap), |
104 void (*msgfunc)(nn_conn_t *conn, const char *fmt, va_list ap)) | 104 void (*msgfunc)(nn_conn_t *conn, const char *fmt, va_list ap)) |