Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/bind9/isc
File: socket.h
/*
[0] Fix | Delete
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
[1] Fix | Delete
*
[2] Fix | Delete
* This Source Code Form is subject to the terms of the Mozilla Public
[3] Fix | Delete
* License, v. 2.0. If a copy of the MPL was not distributed with this
[4] Fix | Delete
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
[5] Fix | Delete
*
[6] Fix | Delete
* See the COPYRIGHT file distributed with this work for additional
[7] Fix | Delete
* information regarding copyright ownership.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
#ifndef ISC_SOCKET_H
[11] Fix | Delete
#define ISC_SOCKET_H 1
[12] Fix | Delete
[13] Fix | Delete
/*****
[14] Fix | Delete
***** Module Info
[15] Fix | Delete
*****/
[16] Fix | Delete
[17] Fix | Delete
/*! \file isc/socket.h
[18] Fix | Delete
* \brief Provides TCP and UDP sockets for network I/O. The sockets are event
[19] Fix | Delete
* sources in the task system.
[20] Fix | Delete
*
[21] Fix | Delete
* When I/O completes, a completion event for the socket is posted to the
[22] Fix | Delete
* event queue of the task which requested the I/O.
[23] Fix | Delete
*
[24] Fix | Delete
* \li MP:
[25] Fix | Delete
* The module ensures appropriate synchronization of data structures it
[26] Fix | Delete
* creates and manipulates.
[27] Fix | Delete
* Clients of this module must not be holding a socket's task's lock when
[28] Fix | Delete
* making a call that affects that socket. Failure to follow this rule
[29] Fix | Delete
* can result in deadlock.
[30] Fix | Delete
* The caller must ensure that isc_socketmgr_destroy() is called only
[31] Fix | Delete
* once for a given manager.
[32] Fix | Delete
*
[33] Fix | Delete
* \li Reliability:
[34] Fix | Delete
* No anticipated impact.
[35] Fix | Delete
*
[36] Fix | Delete
* \li Resources:
[37] Fix | Delete
* TBS
[38] Fix | Delete
*
[39] Fix | Delete
* \li Security:
[40] Fix | Delete
* No anticipated impact.
[41] Fix | Delete
*
[42] Fix | Delete
* \li Standards:
[43] Fix | Delete
* None.
[44] Fix | Delete
*/
[45] Fix | Delete
[46] Fix | Delete
/***
[47] Fix | Delete
*** Imports
[48] Fix | Delete
***/
[49] Fix | Delete
[50] Fix | Delete
#include <inttypes.h>
[51] Fix | Delete
#include <stdbool.h>
[52] Fix | Delete
[53] Fix | Delete
#include <isc/event.h>
[54] Fix | Delete
#include <isc/eventclass.h>
[55] Fix | Delete
#include <isc/lang.h>
[56] Fix | Delete
#include <isc/json.h>
[57] Fix | Delete
#include <isc/region.h>
[58] Fix | Delete
#include <isc/sockaddr.h>
[59] Fix | Delete
#include <isc/time.h>
[60] Fix | Delete
#include <isc/types.h>
[61] Fix | Delete
#include <isc/xml.h>
[62] Fix | Delete
[63] Fix | Delete
#ifdef WIN32
[64] Fix | Delete
[65] Fix | Delete
/* from the old namespace.h */
[66] Fix | Delete
[67] Fix | Delete
#define isc_socket_create isc__socket_create
[68] Fix | Delete
#define isc_socket_dup isc__socket_dup
[69] Fix | Delete
#define isc_socket_attach isc__socket_attach
[70] Fix | Delete
#define isc_socket_detach isc__socket_detach
[71] Fix | Delete
#define isc_socketmgr_create isc__socketmgr_create
[72] Fix | Delete
#define isc_socketmgr_create2 isc__socketmgr_create2
[73] Fix | Delete
#define isc_socketmgr_destroy isc__socketmgr_destroy
[74] Fix | Delete
#define isc_socket_open isc__socket_open
[75] Fix | Delete
#define isc_socket_close isc__socket_close
[76] Fix | Delete
#define isc_socket_recvv isc__socket_recvv
[77] Fix | Delete
#define isc_socket_recv isc__socket_recv
[78] Fix | Delete
#define isc_socket_recv2 isc__socket_recv2
[79] Fix | Delete
#define isc_socket_send isc__socket_send
[80] Fix | Delete
#define isc_socket_sendto isc__socket_sendto
[81] Fix | Delete
#define isc_socket_sendv isc__socket_sendv
[82] Fix | Delete
#define isc_socket_sendtov isc__socket_sendtov
[83] Fix | Delete
#define isc_socket_sendtov2 isc__socket_sendtov2
[84] Fix | Delete
#define isc_socket_sendto2 isc__socket_sendto2
[85] Fix | Delete
#define isc_socket_cleanunix isc__socket_cleanunix
[86] Fix | Delete
#define isc_socket_permunix isc__socket_permunix
[87] Fix | Delete
#define isc_socket_bind isc__socket_bind
[88] Fix | Delete
#define isc_socket_filter isc__socket_filter
[89] Fix | Delete
#define isc_socket_listen isc__socket_listen
[90] Fix | Delete
#define isc_socket_accept isc__socket_accept
[91] Fix | Delete
#define isc_socket_connect isc__socket_connect
[92] Fix | Delete
#define isc_socket_getfd isc__socket_getfd
[93] Fix | Delete
#define isc_socket_getname isc__socket_getname
[94] Fix | Delete
#define isc_socket_gettag isc__socket_gettag
[95] Fix | Delete
#define isc_socket_getpeername isc__socket_getpeername
[96] Fix | Delete
#define isc_socket_getsockname isc__socket_getsockname
[97] Fix | Delete
#define isc_socket_cancel isc__socket_cancel
[98] Fix | Delete
#define isc_socket_gettype isc__socket_gettype
[99] Fix | Delete
#define isc_socket_isbound isc__socket_isbound
[100] Fix | Delete
#define isc_socket_ipv6only isc__socket_ipv6only
[101] Fix | Delete
#define isc_socket_setname isc__socket_setname
[102] Fix | Delete
#define isc_socketmgr_getmaxsockets isc__socketmgr_getmaxsockets
[103] Fix | Delete
#define isc_socketmgr_setstats isc__socketmgr_setstats
[104] Fix | Delete
#define isc_socketmgr_setreserved isc__socketmgr_setreserved
[105] Fix | Delete
#define isc__socketmgr_maxudp isc___socketmgr_maxudp
[106] Fix | Delete
#define isc_socket_fdwatchcreate isc__socket_fdwatchcreate
[107] Fix | Delete
#define isc_socket_fdwatchpoke isc__socket_fdwatchpoke
[108] Fix | Delete
#define isc_socket_dscp isc__socket_dscp
[109] Fix | Delete
[110] Fix | Delete
#endif
[111] Fix | Delete
[112] Fix | Delete
ISC_LANG_BEGINDECLS
[113] Fix | Delete
[114] Fix | Delete
/***
[115] Fix | Delete
*** Constants
[116] Fix | Delete
***/
[117] Fix | Delete
[118] Fix | Delete
/*%
[119] Fix | Delete
* Maximum number of buffers in a scatter/gather read/write. The operating
[120] Fix | Delete
* system in use must support at least this number (plus one on some.)
[121] Fix | Delete
*/
[122] Fix | Delete
#define ISC_SOCKET_MAXSCATTERGATHER 8
[123] Fix | Delete
[124] Fix | Delete
/*%
[125] Fix | Delete
* In isc_socket_bind() set socket option SO_REUSEADDR prior to calling
[126] Fix | Delete
* bind() if a non zero port is specified (AF_INET and AF_INET6).
[127] Fix | Delete
*/
[128] Fix | Delete
#define ISC_SOCKET_REUSEADDRESS 0x01U
[129] Fix | Delete
[130] Fix | Delete
/*%
[131] Fix | Delete
* Statistics counters. Used as isc_statscounter_t values.
[132] Fix | Delete
*/
[133] Fix | Delete
enum {
[134] Fix | Delete
isc_sockstatscounter_udp4open = 0,
[135] Fix | Delete
isc_sockstatscounter_udp6open = 1,
[136] Fix | Delete
isc_sockstatscounter_tcp4open = 2,
[137] Fix | Delete
isc_sockstatscounter_tcp6open = 3,
[138] Fix | Delete
isc_sockstatscounter_unixopen = 4,
[139] Fix | Delete
[140] Fix | Delete
isc_sockstatscounter_udp4openfail = 5,
[141] Fix | Delete
isc_sockstatscounter_udp6openfail = 6,
[142] Fix | Delete
isc_sockstatscounter_tcp4openfail = 7,
[143] Fix | Delete
isc_sockstatscounter_tcp6openfail = 8,
[144] Fix | Delete
isc_sockstatscounter_unixopenfail = 9,
[145] Fix | Delete
[146] Fix | Delete
isc_sockstatscounter_udp4close = 10,
[147] Fix | Delete
isc_sockstatscounter_udp6close = 11,
[148] Fix | Delete
isc_sockstatscounter_tcp4close = 12,
[149] Fix | Delete
isc_sockstatscounter_tcp6close = 13,
[150] Fix | Delete
isc_sockstatscounter_unixclose = 14,
[151] Fix | Delete
isc_sockstatscounter_fdwatchclose = 15,
[152] Fix | Delete
[153] Fix | Delete
isc_sockstatscounter_udp4bindfail = 16,
[154] Fix | Delete
isc_sockstatscounter_udp6bindfail = 17,
[155] Fix | Delete
isc_sockstatscounter_tcp4bindfail = 18,
[156] Fix | Delete
isc_sockstatscounter_tcp6bindfail = 19,
[157] Fix | Delete
isc_sockstatscounter_unixbindfail = 20,
[158] Fix | Delete
isc_sockstatscounter_fdwatchbindfail = 21,
[159] Fix | Delete
[160] Fix | Delete
isc_sockstatscounter_udp4connect = 22,
[161] Fix | Delete
isc_sockstatscounter_udp6connect = 23,
[162] Fix | Delete
isc_sockstatscounter_tcp4connect = 24,
[163] Fix | Delete
isc_sockstatscounter_tcp6connect = 25,
[164] Fix | Delete
isc_sockstatscounter_unixconnect = 26,
[165] Fix | Delete
isc_sockstatscounter_fdwatchconnect = 27,
[166] Fix | Delete
[167] Fix | Delete
isc_sockstatscounter_udp4connectfail = 28,
[168] Fix | Delete
isc_sockstatscounter_udp6connectfail = 29,
[169] Fix | Delete
isc_sockstatscounter_tcp4connectfail = 30,
[170] Fix | Delete
isc_sockstatscounter_tcp6connectfail = 31,
[171] Fix | Delete
isc_sockstatscounter_unixconnectfail = 32,
[172] Fix | Delete
isc_sockstatscounter_fdwatchconnectfail = 33,
[173] Fix | Delete
[174] Fix | Delete
isc_sockstatscounter_tcp4accept = 34,
[175] Fix | Delete
isc_sockstatscounter_tcp6accept = 35,
[176] Fix | Delete
isc_sockstatscounter_unixaccept = 36,
[177] Fix | Delete
[178] Fix | Delete
isc_sockstatscounter_tcp4acceptfail = 37,
[179] Fix | Delete
isc_sockstatscounter_tcp6acceptfail = 38,
[180] Fix | Delete
isc_sockstatscounter_unixacceptfail = 39,
[181] Fix | Delete
[182] Fix | Delete
isc_sockstatscounter_udp4sendfail = 40,
[183] Fix | Delete
isc_sockstatscounter_udp6sendfail = 41,
[184] Fix | Delete
isc_sockstatscounter_tcp4sendfail = 42,
[185] Fix | Delete
isc_sockstatscounter_tcp6sendfail = 43,
[186] Fix | Delete
isc_sockstatscounter_unixsendfail = 44,
[187] Fix | Delete
isc_sockstatscounter_fdwatchsendfail = 45,
[188] Fix | Delete
[189] Fix | Delete
isc_sockstatscounter_udp4recvfail = 46,
[190] Fix | Delete
isc_sockstatscounter_udp6recvfail = 47,
[191] Fix | Delete
isc_sockstatscounter_tcp4recvfail = 48,
[192] Fix | Delete
isc_sockstatscounter_tcp6recvfail = 49,
[193] Fix | Delete
isc_sockstatscounter_unixrecvfail = 50,
[194] Fix | Delete
isc_sockstatscounter_fdwatchrecvfail = 51,
[195] Fix | Delete
[196] Fix | Delete
isc_sockstatscounter_udp4active = 52,
[197] Fix | Delete
isc_sockstatscounter_udp6active = 53,
[198] Fix | Delete
isc_sockstatscounter_tcp4active = 54,
[199] Fix | Delete
isc_sockstatscounter_tcp6active = 55,
[200] Fix | Delete
isc_sockstatscounter_unixactive = 56,
[201] Fix | Delete
[202] Fix | Delete
isc_sockstatscounter_rawopen = 57,
[203] Fix | Delete
isc_sockstatscounter_rawopenfail = 58,
[204] Fix | Delete
isc_sockstatscounter_rawclose = 59,
[205] Fix | Delete
isc_sockstatscounter_rawrecvfail = 60,
[206] Fix | Delete
isc_sockstatscounter_rawactive = 61,
[207] Fix | Delete
[208] Fix | Delete
isc_sockstatscounter_max = 62
[209] Fix | Delete
};
[210] Fix | Delete
[211] Fix | Delete
/***
[212] Fix | Delete
*** Types
[213] Fix | Delete
***/
[214] Fix | Delete
[215] Fix | Delete
struct isc_socketevent {
[216] Fix | Delete
ISC_EVENT_COMMON(isc_socketevent_t);
[217] Fix | Delete
isc_result_t result; /*%< OK, EOF, whatever else */
[218] Fix | Delete
unsigned int minimum; /*%< minimum i/o for event */
[219] Fix | Delete
unsigned int n; /*%< bytes read or written */
[220] Fix | Delete
unsigned int offset; /*%< offset into buffer list */
[221] Fix | Delete
isc_region_t region; /*%< for single-buffer i/o */
[222] Fix | Delete
isc_bufferlist_t bufferlist; /*%< list of buffers */
[223] Fix | Delete
isc_sockaddr_t address; /*%< source address */
[224] Fix | Delete
isc_time_t timestamp; /*%< timestamp of packet recv */
[225] Fix | Delete
struct in6_pktinfo pktinfo; /*%< ipv6 pktinfo */
[226] Fix | Delete
uint32_t attributes; /*%< see below */
[227] Fix | Delete
isc_eventdestructor_t destroy; /*%< original destructor */
[228] Fix | Delete
unsigned int dscp; /*%< UDP dscp value */
[229] Fix | Delete
};
[230] Fix | Delete
[231] Fix | Delete
typedef struct isc_socket_newconnev isc_socket_newconnev_t;
[232] Fix | Delete
struct isc_socket_newconnev {
[233] Fix | Delete
ISC_EVENT_COMMON(isc_socket_newconnev_t);
[234] Fix | Delete
isc_socket_t * newsocket;
[235] Fix | Delete
isc_result_t result; /*%< OK, EOF, whatever else */
[236] Fix | Delete
isc_sockaddr_t address; /*%< source address */
[237] Fix | Delete
};
[238] Fix | Delete
[239] Fix | Delete
typedef struct isc_socket_connev isc_socket_connev_t;
[240] Fix | Delete
struct isc_socket_connev {
[241] Fix | Delete
ISC_EVENT_COMMON(isc_socket_connev_t);
[242] Fix | Delete
isc_result_t result; /*%< OK, EOF, whatever else */
[243] Fix | Delete
};
[244] Fix | Delete
[245] Fix | Delete
/*@{*/
[246] Fix | Delete
/*!
[247] Fix | Delete
* _ATTACHED: Internal use only.
[248] Fix | Delete
* _TRUNC: Packet was truncated on receive.
[249] Fix | Delete
* _CTRUNC: Packet control information was truncated. This can
[250] Fix | Delete
* indicate that the packet is not complete, even though
[251] Fix | Delete
* all the data is valid.
[252] Fix | Delete
* _TIMESTAMP: The timestamp member is valid.
[253] Fix | Delete
* _PKTINFO: The pktinfo member is valid.
[254] Fix | Delete
* _MULTICAST: The UDP packet was received via a multicast transmission.
[255] Fix | Delete
* _DSCP: The UDP DSCP value is valid.
[256] Fix | Delete
* _USEMINMTU: Set the per packet IPV6_USE_MIN_MTU flag.
[257] Fix | Delete
*/
[258] Fix | Delete
#define ISC_SOCKEVENTATTR_ATTACHED 0x10000000U /* internal */
[259] Fix | Delete
#define ISC_SOCKEVENTATTR_TRUNC 0x00800000U /* public */
[260] Fix | Delete
#define ISC_SOCKEVENTATTR_CTRUNC 0x00400000U /* public */
[261] Fix | Delete
#define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */
[262] Fix | Delete
#define ISC_SOCKEVENTATTR_PKTINFO 0x00100000U /* public */
[263] Fix | Delete
#define ISC_SOCKEVENTATTR_MULTICAST 0x00080000U /* public */
[264] Fix | Delete
#define ISC_SOCKEVENTATTR_DSCP 0x00040000U /* public */
[265] Fix | Delete
#define ISC_SOCKEVENTATTR_USEMINMTU 0x00020000U /* public */
[266] Fix | Delete
/*@}*/
[267] Fix | Delete
[268] Fix | Delete
#define ISC_SOCKEVENT_ANYEVENT (0)
[269] Fix | Delete
#define ISC_SOCKEVENT_RECVDONE (ISC_EVENTCLASS_SOCKET + 1)
[270] Fix | Delete
#define ISC_SOCKEVENT_SENDDONE (ISC_EVENTCLASS_SOCKET + 2)
[271] Fix | Delete
#define ISC_SOCKEVENT_NEWCONN (ISC_EVENTCLASS_SOCKET + 3)
[272] Fix | Delete
#define ISC_SOCKEVENT_CONNECT (ISC_EVENTCLASS_SOCKET + 4)
[273] Fix | Delete
[274] Fix | Delete
/*
[275] Fix | Delete
* Internal events.
[276] Fix | Delete
*/
[277] Fix | Delete
#define ISC_SOCKEVENT_INTR (ISC_EVENTCLASS_SOCKET + 256)
[278] Fix | Delete
#define ISC_SOCKEVENT_INTW (ISC_EVENTCLASS_SOCKET + 257)
[279] Fix | Delete
[280] Fix | Delete
typedef enum {
[281] Fix | Delete
isc_sockettype_udp = 1,
[282] Fix | Delete
isc_sockettype_tcp = 2,
[283] Fix | Delete
isc_sockettype_unix = 3,
[284] Fix | Delete
isc_sockettype_fdwatch = 4,
[285] Fix | Delete
isc_sockettype_raw = 5
[286] Fix | Delete
} isc_sockettype_t;
[287] Fix | Delete
[288] Fix | Delete
/*@{*/
[289] Fix | Delete
/*!
[290] Fix | Delete
* How a socket should be shutdown in isc_socket_shutdown() calls.
[291] Fix | Delete
*/
[292] Fix | Delete
#define ISC_SOCKSHUT_RECV 0x00000001 /*%< close read side */
[293] Fix | Delete
#define ISC_SOCKSHUT_SEND 0x00000002 /*%< close write side */
[294] Fix | Delete
#define ISC_SOCKSHUT_ALL 0x00000003 /*%< close them all */
[295] Fix | Delete
/*@}*/
[296] Fix | Delete
[297] Fix | Delete
/*@{*/
[298] Fix | Delete
/*!
[299] Fix | Delete
* What I/O events to cancel in isc_socket_cancel() calls.
[300] Fix | Delete
*/
[301] Fix | Delete
#define ISC_SOCKCANCEL_RECV 0x00000001 /*%< cancel recv */
[302] Fix | Delete
#define ISC_SOCKCANCEL_SEND 0x00000002 /*%< cancel send */
[303] Fix | Delete
#define ISC_SOCKCANCEL_ACCEPT 0x00000004 /*%< cancel accept */
[304] Fix | Delete
#define ISC_SOCKCANCEL_CONNECT 0x00000008 /*%< cancel connect */
[305] Fix | Delete
#define ISC_SOCKCANCEL_ALL 0x0000000f /*%< cancel everything */
[306] Fix | Delete
/*@}*/
[307] Fix | Delete
[308] Fix | Delete
/*@{*/
[309] Fix | Delete
/*!
[310] Fix | Delete
* Flags for isc_socket_send() and isc_socket_recv() calls.
[311] Fix | Delete
*/
[312] Fix | Delete
#define ISC_SOCKFLAG_IMMEDIATE 0x00000001 /*%< send event only if needed */
[313] Fix | Delete
#define ISC_SOCKFLAG_NORETRY 0x00000002 /*%< drop failed UDP sends */
[314] Fix | Delete
/*@}*/
[315] Fix | Delete
[316] Fix | Delete
/*@{*/
[317] Fix | Delete
/*!
[318] Fix | Delete
* Flags for fdwatchcreate.
[319] Fix | Delete
*/
[320] Fix | Delete
#define ISC_SOCKFDWATCH_READ 0x00000001 /*%< watch for readable */
[321] Fix | Delete
#define ISC_SOCKFDWATCH_WRITE 0x00000002 /*%< watch for writable */
[322] Fix | Delete
/*@}*/
[323] Fix | Delete
[324] Fix | Delete
/*% Socket and socket manager methods */
[325] Fix | Delete
typedef struct isc_socketmgrmethods {
[326] Fix | Delete
void (*destroy)(isc_socketmgr_t **managerp);
[327] Fix | Delete
isc_result_t (*socketcreate)(isc_socketmgr_t *manager, int pf,
[328] Fix | Delete
isc_sockettype_t type,
[329] Fix | Delete
isc_socket_t **socketp);
[330] Fix | Delete
isc_result_t (*fdwatchcreate)(isc_socketmgr_t *manager, int fd,
[331] Fix | Delete
int flags,
[332] Fix | Delete
isc_sockfdwatch_t callback,
[333] Fix | Delete
void *cbarg, isc_task_t *task,
[334] Fix | Delete
isc_socket_t **socketp);
[335] Fix | Delete
} isc_socketmgrmethods_t;
[336] Fix | Delete
[337] Fix | Delete
typedef struct isc_socketmethods {
[338] Fix | Delete
void (*attach)(isc_socket_t *socket,
[339] Fix | Delete
isc_socket_t **socketp);
[340] Fix | Delete
void (*detach)(isc_socket_t **socketp);
[341] Fix | Delete
isc_result_t (*bind)(isc_socket_t *sock, isc_sockaddr_t *sockaddr,
[342] Fix | Delete
unsigned int options);
[343] Fix | Delete
isc_result_t (*sendto)(isc_socket_t *sock, isc_region_t *region,
[344] Fix | Delete
isc_task_t *task, isc_taskaction_t action,
[345] Fix | Delete
void *arg, isc_sockaddr_t *address,
[346] Fix | Delete
struct in6_pktinfo *pktinfo);
[347] Fix | Delete
isc_result_t (*sendto2)(isc_socket_t *sock, isc_region_t *region,
[348] Fix | Delete
isc_task_t *task, isc_sockaddr_t *address,
[349] Fix | Delete
struct in6_pktinfo *pktinfo,
[350] Fix | Delete
isc_socketevent_t *event,
[351] Fix | Delete
unsigned int flags);
[352] Fix | Delete
isc_result_t (*connect)(isc_socket_t *sock, isc_sockaddr_t *addr,
[353] Fix | Delete
isc_task_t *task, isc_taskaction_t action,
[354] Fix | Delete
void *arg);
[355] Fix | Delete
isc_result_t (*recv)(isc_socket_t *sock, isc_region_t *region,
[356] Fix | Delete
unsigned int minimum, isc_task_t *task,
[357] Fix | Delete
isc_taskaction_t action, void *arg);
[358] Fix | Delete
isc_result_t (*recv2)(isc_socket_t *sock, isc_region_t *region,
[359] Fix | Delete
unsigned int minimum, isc_task_t *task,
[360] Fix | Delete
isc_socketevent_t *event, unsigned int flags);
[361] Fix | Delete
void (*cancel)(isc_socket_t *sock, isc_task_t *task,
[362] Fix | Delete
unsigned int how);
[363] Fix | Delete
isc_result_t (*getsockname)(isc_socket_t *sock,
[364] Fix | Delete
isc_sockaddr_t *addressp);
[365] Fix | Delete
isc_sockettype_t (*gettype)(isc_socket_t *sock);
[366] Fix | Delete
void (*ipv6only)(isc_socket_t *sock, bool yes);
[367] Fix | Delete
isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags);
[368] Fix | Delete
isc_result_t (*dup)(isc_socket_t *socket,
[369] Fix | Delete
isc_socket_t **socketp);
[370] Fix | Delete
int (*getfd)(isc_socket_t *socket);
[371] Fix | Delete
void (*dscp)(isc_socket_t *socket, isc_dscp_t dscp);
[372] Fix | Delete
} isc_socketmethods_t;
[373] Fix | Delete
[374] Fix | Delete
/*%
[375] Fix | Delete
* This structure is actually just the common prefix of a socket manager
[376] Fix | Delete
* object implementation's version of an isc_socketmgr_t.
[377] Fix | Delete
* \brief
[378] Fix | Delete
* Direct use of this structure by clients is forbidden. socket implementations
[379] Fix | Delete
* may change the structure. 'magic' must be ISCAPI_SOCKETMGR_MAGIC for any
[380] Fix | Delete
* of the isc_socket_ routines to work. socket implementations must maintain
[381] Fix | Delete
* all socket invariants.
[382] Fix | Delete
* In effect, this definition is used only for non-BIND9 version ("export")
[383] Fix | Delete
* of the library, and the export version does not work for win32. So, to avoid
[384] Fix | Delete
* the definition conflict with win32/socket.c, we enable this definition only
[385] Fix | Delete
* for non-Win32 (i.e. Unix) platforms.
[386] Fix | Delete
*/
[387] Fix | Delete
#ifndef WIN32
[388] Fix | Delete
struct isc_socketmgr {
[389] Fix | Delete
unsigned int impmagic;
[390] Fix | Delete
unsigned int magic;
[391] Fix | Delete
isc_socketmgrmethods_t *methods;
[392] Fix | Delete
};
[393] Fix | Delete
#endif
[394] Fix | Delete
[395] Fix | Delete
#define ISCAPI_SOCKETMGR_MAGIC ISC_MAGIC('A','s','m','g')
[396] Fix | Delete
#define ISCAPI_SOCKETMGR_VALID(m) ((m) != NULL && \
[397] Fix | Delete
(m)->magic == ISCAPI_SOCKETMGR_MAGIC)
[398] Fix | Delete
[399] Fix | Delete
/*%
[400] Fix | Delete
* This is the common prefix of a socket object. The same note as
[401] Fix | Delete
* that for the socketmgr structure applies.
[402] Fix | Delete
*/
[403] Fix | Delete
#ifndef WIN32
[404] Fix | Delete
struct isc_socket {
[405] Fix | Delete
unsigned int impmagic;
[406] Fix | Delete
unsigned int magic;
[407] Fix | Delete
isc_socketmethods_t *methods;
[408] Fix | Delete
};
[409] Fix | Delete
#endif
[410] Fix | Delete
[411] Fix | Delete
#define ISCAPI_SOCKET_MAGIC ISC_MAGIC('A','s','c','t')
[412] Fix | Delete
#define ISCAPI_SOCKET_VALID(s) ((s) != NULL && \
[413] Fix | Delete
(s)->magic == ISCAPI_SOCKET_MAGIC)
[414] Fix | Delete
[415] Fix | Delete
/***
[416] Fix | Delete
*** Socket and Socket Manager Functions
[417] Fix | Delete
***
[418] Fix | Delete
*** Note: all Ensures conditions apply only if the result is success for
[419] Fix | Delete
*** those functions which return an isc_result.
[420] Fix | Delete
***/
[421] Fix | Delete
[422] Fix | Delete
isc_result_t
[423] Fix | Delete
isc_socket_fdwatchcreate(isc_socketmgr_t *manager,
[424] Fix | Delete
int fd,
[425] Fix | Delete
int flags,
[426] Fix | Delete
isc_sockfdwatch_t callback,
[427] Fix | Delete
void *cbarg,
[428] Fix | Delete
isc_task_t *task,
[429] Fix | Delete
isc_socket_t **socketp);
[430] Fix | Delete
/*%<
[431] Fix | Delete
* Create a new file descriptor watch socket managed by 'manager'.
[432] Fix | Delete
*
[433] Fix | Delete
* Note:
[434] Fix | Delete
*
[435] Fix | Delete
*\li 'fd' is the already-opened file descriptor (must be less
[436] Fix | Delete
* than maxsockets).
[437] Fix | Delete
*\li This function is not available on Windows.
[438] Fix | Delete
*\li The callback function is called "in-line" - this means the function
[439] Fix | Delete
* needs to return as fast as possible, as all other I/O will be suspended
[440] Fix | Delete
* until the callback completes.
[441] Fix | Delete
*
[442] Fix | Delete
* Requires:
[443] Fix | Delete
*
[444] Fix | Delete
*\li 'manager' is a valid manager
[445] Fix | Delete
*
[446] Fix | Delete
*\li 'socketp' is a valid pointer, and *socketp == NULL
[447] Fix | Delete
*
[448] Fix | Delete
*\li 'fd' be opened.
[449] Fix | Delete
*
[450] Fix | Delete
* Ensures:
[451] Fix | Delete
*
[452] Fix | Delete
* '*socketp' is attached to the newly created fdwatch socket
[453] Fix | Delete
*
[454] Fix | Delete
* Returns:
[455] Fix | Delete
*
[456] Fix | Delete
*\li #ISC_R_SUCCESS
[457] Fix | Delete
*\li #ISC_R_NOMEMORY
[458] Fix | Delete
*\li #ISC_R_NORESOURCES
[459] Fix | Delete
*\li #ISC_R_UNEXPECTED
[460] Fix | Delete
*\li #ISC_R_RANGE
[461] Fix | Delete
*/
[462] Fix | Delete
[463] Fix | Delete
isc_result_t
[464] Fix | Delete
isc_socket_fdwatchpoke(isc_socket_t *sock,
[465] Fix | Delete
int flags);
[466] Fix | Delete
/*%<
[467] Fix | Delete
* Poke a file descriptor watch socket informing the manager that it
[468] Fix | Delete
* should restart watching the socket
[469] Fix | Delete
*
[470] Fix | Delete
* Note:
[471] Fix | Delete
*
[472] Fix | Delete
*\li 'sock' is the socket returned by isc_socket_fdwatchcreate
[473] Fix | Delete
*
[474] Fix | Delete
*\li 'flags' indicates what the manager should watch for on the socket
[475] Fix | Delete
* in addition to what it may already be watching. It can be one or
[476] Fix | Delete
* both of ISC_SOCKFDWATCH_READ and ISC_SOCKFDWATCH_WRITE. To
[477] Fix | Delete
* temporarily disable watching on a socket the value indicating
[478] Fix | Delete
* no more data should be returned from the call back routine.
[479] Fix | Delete
*
[480] Fix | Delete
*\li This function is not available on Windows.
[481] Fix | Delete
*
[482] Fix | Delete
* Requires:
[483] Fix | Delete
*
[484] Fix | Delete
*\li 'sock' is a valid isc socket
[485] Fix | Delete
*
[486] Fix | Delete
*
[487] Fix | Delete
* Returns:
[488] Fix | Delete
*
[489] Fix | Delete
*\li #ISC_R_SUCCESS
[490] Fix | Delete
*/
[491] Fix | Delete
[492] Fix | Delete
isc_result_t
[493] Fix | Delete
isc_socket_create(isc_socketmgr_t *manager,
[494] Fix | Delete
int pf,
[495] Fix | Delete
isc_sockettype_t type,
[496] Fix | Delete
isc_socket_t **socketp);
[497] Fix | Delete
/*%<
[498] Fix | Delete
* Create a new 'type' socket managed by 'manager'.
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function