summaryrefslogtreecommitdiffstats
path: root/lib/socket.h
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2004-05-31 23:48:19 +0200
committerMartin Mares <mj@ucw.cz>2004-05-31 23:48:19 +0200
commit38a608c55af7654f23c9a16129ab6211aac3b7ab (patch)
treeebe43e728b3e7fcbb7679ae4d52ba5deab9fdeae /lib/socket.h
parent206f59dfa8e59e32f4aef12dacb0804581b9f602 (diff)
downloadbird-38a608c55af7654f23c9a16129ab6211aac3b7ab.tar
bird-38a608c55af7654f23c9a16129ab6211aac3b7ab.zip
Rewritten the I/O loop. All socket operations are now safe, meaning that
you can delete the socket from anywhere in the hooks and nothing should break. Also, the receive/transmit buffers are now regular xmalloc()'ed buffers, not separate resources which would need shuffling around between pools. sk_close() is gone, use rfree() instead.
Diffstat (limited to 'lib/socket.h')
-rw-r--r--lib/socket.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/socket.h b/lib/socket.h
index 147e5ce..bc4525f 100644
--- a/lib/socket.h
+++ b/lib/socket.h
@@ -1,7 +1,7 @@
/*
* BIRD Socket Interface
*
- * (c) 1998--1999 Martin Mares <mj@ucw.cz>
+ * (c) 1998--2004 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
@@ -13,7 +13,7 @@
typedef struct birdsock {
resource r;
- pool *pool; /* Pool for socket data */
+ pool *pool; /* Pool where incoming connections should be allocated (for SK_xxx_PASSIVE) */
int type; /* Socket type */
void *data; /* User data */
ip_addr saddr, daddr; /* IPA_NONE = unspecified */
@@ -38,12 +38,11 @@ typedef struct birdsock {
int fd; /* System-dependent data */
node n;
- int entered;
+ void *rbuf_alloc, *tbuf_alloc;
} sock;
sock *sk_new(pool *); /* Allocate new socket */
int sk_open(sock *); /* Open socket */
-void sk_close(sock *); /* Safe close of socket even from socket hook */
int sk_send(sock *, unsigned len); /* Send data, <0=err, >0=ok, 0=sleep */
int sk_send_to(sock *, unsigned len, ip_addr to, unsigned port); /* sk_send to given destination */
void sk_dump_all(void);
@@ -68,7 +67,6 @@ sk_send_buffer_empty(sock *sk)
#define SK_MAGIC 7 /* Internal use by sysdep code */
#define SK_UNIX_PASSIVE 8
#define SK_UNIX 9
-#define SK_DELETED 10 /* Internal use by sk_close */
/*
* Multicast sockets are slightly different from the other ones: