summaryrefslogtreecommitdiff
path: root/pflocal/connq.h
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2005-08-29 09:41:21 +0000
committerNeal H. Walfield <neal@gnu.org>2005-08-29 09:41:21 +0000
commit50f67f1c3ae5bb8e42fe839e6a6a9cb813a90c53 (patch)
tree9271130ef728ddec73ef031e9d13204f8cba6269 /pflocal/connq.h
parent1e5a9b2969616b26f7b0e5808e3281c611146fdc (diff)
Revery previous change. Was intended for ams-branch, not HEAD.
Diffstat (limited to 'pflocal/connq.h')
-rw-r--r--pflocal/connq.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/pflocal/connq.h b/pflocal/connq.h
index 17c88c0b..1039bff9 100644
--- a/pflocal/connq.h
+++ b/pflocal/connq.h
@@ -1,6 +1,6 @@
/* Connection queues
- Copyright (C) 1995, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -23,8 +23,9 @@
#include <errno.h>
-/* Forward. */
+/* Unknown types */
struct connq;
+struct connq_request;
struct sock;
/* Create a new listening queue, returning it in CQ. The resulting queue
@@ -35,26 +36,26 @@ error_t connq_create (struct connq **cq);
/* Destroy a queue. */
void connq_destroy (struct connq *cq);
-/* Return a connection request on CQ. If SOCK is NULL, the request is
- left in the queue. If NOBLOCK is true, EWOULDBLOCK is returned
- when there are no immediate connections available. */
-error_t connq_listen (struct connq *cq, int noblock, struct sock **sock);
+/* Wait for a connection attempt to be made on CQ, and return the connecting
+ socket in SOCK, and a request tag in REQ. If REQ is NULL, the request is
+ left in the queue, otherwise connq_request_complete must be called on REQ
+ to allow the requesting thread to continue. If NOBLOCK is true,
+ EWOULDBLOCK is returned when there are no immediate connections
+ available. CQ should be unlocked. */
+error_t connq_listen (struct connq *cq, int noblock,
+ struct connq_request **req, struct sock **sock);
-/* Try to connect SOCK with the socket listening on CQ. If NOBLOCK is
- true, then return EWOULDBLOCK if there are no connections
- immediately available. On success, this call must be followed up
- either connq_connect_complete or connq_connect_cancel. */
-error_t connq_connect (struct connq *cq, int noblock);
-
-/* Follow up to connq_connect. Completes the connection, SOCK is the
- new server socket. */
-void connq_connect_complete (struct connq *cq, struct sock *sock);
-
-/* Follow up to connq_connect. Cancel the connect. */
-void connq_connect_cancel (struct connq *cq);
+/* Return the error code ERR to the thread that made the listen request REQ,
+ returned from a previous connq_listen. */
+void connq_request_complete (struct connq_request *req, error_t err);
/* Set CQ's queue length to LENGTH. Any sockets already waiting for a
- connections that are past the new length remain. */
+ connections that are past the new length will fail with ECONNREFUSED. */
error_t connq_set_length (struct connq *cq, int length);
+/* Try to connect SOCK with the socket listening on CQ. If NOBLOCK is true,
+ then return EWOULDBLOCK immediately when there are no immediate
+ connections available. Neither SOCK nor CQ should be locked. */
+error_t connq_connect (struct connq *cq, int noblock, struct sock *sock);
+
#endif /* __CONNQ_H__ */