--- a/src/sock_tcp.h Sun Feb 22 08:48:21 2009 +0200
+++ b/src/sock_tcp.h Sun Feb 22 10:16:28 2009 +0200
@@ -15,6 +15,9 @@
/* The OS file descriptor */
int fd;
+
+ /* The libevent struct */
+ struct event *ev;
};
#define SOCK_TCP_BASE(sock_ptr) (&(sock_ptr)->base)
@@ -31,11 +34,22 @@
err_t sock_tcp_init_fd (struct sock_tcp *sock, int fd);
/*
+ * Initialize sock_tcp.ev to use the socket's fd with the given callback. By default, this is created with EV_READ
+ * flags, but is not added.
+ */
+err_t sock_tcp_init_ev (struct sock_tcp *sock, void (*ev_cb) (evutil_socket_t, short, void *), void *arg);
+
+/*
* Initialize a blank sock_tcp by connecting
*/
err_t sock_tcp_init_connect (struct sock_tcp *sock, const char *hostname, const char *service);
/*
+ * Set the socket's nonblock mode
+ */
+err_t sock_tcp_set_nonblock (struct sock_tcp *sock, int nonblock);
+
+/*
* Release a non-connected sock_tcp
*/
void sock_tcp_release (struct sock_tcp *sock);