2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Add isc_socket_sendto2() and isc_socket_recv2(). These versions take

a partially constructed event and flags.  The flags can include
ISC_SOCKFLAG_IMMEDIATE, which means that if the operation completes, the
event is filled in and not sent.
This commit is contained in:
Brian Wellington
2001-02-12 21:43:17 +00:00
parent 2ba06bbf5a
commit 1f7f8d5c07
2 changed files with 144 additions and 61 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.h,v 1.52 2001/01/26 23:17:25 bwelling Exp $ */
/* $Id: socket.h,v 1.53 2001/02/12 21:43:17 bwelling Exp $ */
#ifndef ISC_SOCKET_H
#define ISC_SOCKET_H 1
@@ -163,6 +163,11 @@ typedef enum {
#define ISC_SOCKCANCEL_CONNECT 0x00000008 /* cancel connect */
#define ISC_SOCKCANCEL_ALL 0x0000000f /* cancel everything */
/*
* Flags for isc_socket_send() and isc_socket_recv() calls.
*/
#define ISC_SOCKFLAG_IMMEDIATE 0x00000001 /* send event only if needed */
/***
*** Socket and Socket Manager Functions
***
@@ -441,6 +446,12 @@ isc_result_t
isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
unsigned int minimum,
isc_task_t *task, isc_taskaction_t action, const void *arg);
isc_result_t
isc_socket_recv2(isc_socket_t *sock, isc_region_t *region,
unsigned int minimum, isc_task_t *task,
isc_socketevent_t *event, unsigned int flags);
/*
* Receive from 'socket', storing the results in region.
*
@@ -469,6 +480,18 @@ isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
* all buffers will be returned in the done event's 'bufferlist'
* member. On error return, '*buflist' will be unchanged.
*
* For isc_socket_recv2():
* 'event' is not NULL, and the non-socket specific fields are
* expected to be initialized.
*
* For isc_socket_recv2():
* The only defined value for 'flags' is ISC_SOCKFLAG_IMMEDIATE. If
* set and the operation completes, the return value will be
* ISC_R_SUCCESS and the event will be filled in and not sent. If the
* operation does not complete, the return value will be
* ISC_R_INPROGRESS and the event will be sent when the operation
* completes.
*
* Requires:
*
* 'socket' is a valid, bound socket.
@@ -481,11 +504,16 @@ isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
*
* 'task' is a valid task
*
* For isc_socket_recv() and isc_socket_recvv():
* action != NULL and is a valid action
*
* For isc_socket_recv2():
* event != NULL
*
* Returns:
*
* ISC_R_SUCCESS
* ISC_R_INPROGRESS
* ISC_R_NOMEMORY
* ISC_R_UNEXPECTED
*
@@ -510,6 +538,12 @@ isc_result_t
isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
isc_task_t *task, isc_taskaction_t action, const void *arg,
isc_sockaddr_t *address, struct in6_pktinfo *pktinfo);
isc_result_t
isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region,
isc_task_t *task,
isc_sockaddr_t *address, struct in6_pktinfo *pktinfo,
isc_socketevent_t *event, unsigned int flags);
/*
* Send the contents of 'region' to the socket's peer.
*
@@ -530,6 +564,18 @@ isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
* all buffers will be returned in the done event's 'bufferlist'
* member. On error return, '*buflist' will be unchanged.
*
* For isc_socket_sendto2():
* 'event' is not NULL, and the non-socket specific fields are
* expected to be initialized.
*
* For isc_socket_sendto2():
* The only defined value for 'flags' is ISC_SOCKFLAG_IMMEDIATE. If
* set and the operation completes, the return value will be
* ISC_R_SUCCESS and the event will be filled in and not sent. If the
* operation does not complete, the return value will be
* ISC_R_INPROGRESS and the event will be sent when the operation
* completes.
*
* Requires:
*
* 'socket' is a valid, bound socket.
@@ -542,11 +588,17 @@ isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
*
* 'task' is a valid task
*
* For isc_socket_sendv(), isc_socket_sendtov(), isc_socket_send(), and
* isc_socket_sendto():
* action == NULL or is a valid action
*
* For isc_socket_sendto2():
* event != NULL
*
* Returns:
*
* ISC_R_SUCCESS
* ISC_R_INPROGRESS
* ISC_R_NOMEMORY
* ISC_R_UNEXPECTED
*