diff libnnchat.h @ 354:c01e42fc9adb

More work on SOCKS proxy support, should work now.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 23 Jun 2011 08:26:48 +0300
parents b54c8545dcb0
children b465a17ffa47
line wrap: on
line diff
--- a/libnnchat.h	Thu Jun 23 06:31:34 2011 +0300
+++ b/libnnchat.h	Thu Jun 23 08:26:48 2011 +0300
@@ -68,14 +68,18 @@
 
 typedef struct _nn_conn_t {
     struct {
+        char *host;
+        struct hostent *hst;
         int type;
         int port;
         struct in_addr addr;
     } proxy;
 
     char *host;
+    struct hostent *hst;
+    int port;
+
     int socket;
-    int port;
     struct in_addr addr;
     fd_set sockfds;
 
@@ -95,11 +99,13 @@
 BOOL        nn_network_init();
 void        nn_network_close(void);
 
-nn_conn_t * nn_conn_open(
-        void (*errfunc)(struct _nn_conn_t *conn, const char *fmt, va_list ap),
-        void (*msgfunc)(struct _nn_conn_t *conn, const char *fmt, va_list ap),
-        int ptype, int pport, struct in_addr *paddr,
-        struct in_addr *addr, const int port, const char *host);
+struct hostent *nn_resolve_host(nn_conn_t *conn, const char *name);
+nn_conn_t * nn_conn_new(
+        void (*errfunc)(nn_conn_t *conn, const char *fmt, va_list ap),
+        void (*msgfunc)(nn_conn_t *conn, const char *fmt, va_list ap));
+
+int         nn_conn_set_proxy(nn_conn_t *conn, int type, int port, const char *host);
+int         nn_conn_open(nn_conn_t *conn, const int port, const char *host);
 void        nn_conn_close(nn_conn_t *);
 int         nn_conn_pull(nn_conn_t *);
 BOOL        nn_conn_send_buf(nn_conn_t *, const char *buf, const size_t len);