mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
2660. [func] Add a new set of DNS libraries for non-BIND9
applications. See README.libdns. [RT #19369]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: socket.c,v 1.76 2009/07/17 06:25:44 each Exp $ */
|
||||
/* $Id: socket.c,v 1.77 2009/09/01 00:22:28 jinmei Exp $ */
|
||||
|
||||
/* This code uses functions which are only available on Server 2003 and
|
||||
* higher, and Windows XP and higher.
|
||||
@@ -1594,7 +1594,7 @@ free_socket(isc_socket_t **sockp, int lineno) {
|
||||
* in 'socketp'.
|
||||
*/
|
||||
isc_result_t
|
||||
isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
isc__socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
isc_socket_t **socketp) {
|
||||
isc_socket_t *sock = NULL;
|
||||
isc_result_t result;
|
||||
@@ -1774,7 +1774,7 @@ isc_socket_open(isc_socket_t *sock) {
|
||||
* Attach to a socket. Caller must explicitly detach when it is done.
|
||||
*/
|
||||
void
|
||||
isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
isc__socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||
|
||||
@@ -1791,7 +1791,7 @@ isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
* up by destroying the socket.
|
||||
*/
|
||||
void
|
||||
isc_socket_detach(isc_socket_t **socketp) {
|
||||
isc__socket_detach(isc_socket_t **socketp) {
|
||||
isc_socket_t *sock;
|
||||
isc_boolean_t kill_socket = ISC_FALSE;
|
||||
|
||||
@@ -2434,13 +2434,13 @@ SocketIoThread(LPVOID ThreadContext) {
|
||||
* Create a new socket manager.
|
||||
*/
|
||||
isc_result_t
|
||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
return (isc_socketmgr_create2(mctx, managerp, 0));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks)
|
||||
isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks)
|
||||
{
|
||||
isc_socketmgr_t *manager;
|
||||
isc_result_t result;
|
||||
@@ -2489,7 +2489,7 @@ isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp) {
|
||||
isc__socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp) {
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
REQUIRE(nsockp != NULL);
|
||||
|
||||
@@ -2497,7 +2497,7 @@ isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) {
|
||||
isc__socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) {
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
REQUIRE(ISC_LIST_EMPTY(manager->socklist));
|
||||
REQUIRE(manager->stats == NULL);
|
||||
@@ -2507,7 +2507,7 @@ isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc__socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc_socketmgr_t *manager;
|
||||
int i;
|
||||
isc_mem_t *mctx;
|
||||
@@ -2635,7 +2635,7 @@ socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
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)
|
||||
{
|
||||
@@ -2705,8 +2705,9 @@ isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
isc__socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_taskaction_t action, const void *arg)
|
||||
{
|
||||
isc_socketevent_t *dev;
|
||||
isc_socketmgr_t *manager;
|
||||
@@ -2742,9 +2743,9 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
isc_result_t ret;
|
||||
|
||||
@@ -2852,8 +2853,8 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_send(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
isc__socket_send(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
{
|
||||
/*
|
||||
* REQUIRE() checking is performed in isc_socket_sendto().
|
||||
@@ -2863,9 +2864,9 @@ isc_socket_send(isc_socket_t *sock, isc_region_t *region,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg,
|
||||
isc_sockaddr_t *address, struct in6_pktinfo *pktinfo)
|
||||
isc__socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg,
|
||||
isc_sockaddr_t *address, struct in6_pktinfo *pktinfo)
|
||||
{
|
||||
isc_socketevent_t *dev;
|
||||
isc_socketmgr_t *manager;
|
||||
@@ -2906,17 +2907,17 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
{
|
||||
return (isc_socket_sendtov(sock, buflist, task, action, arg, NULL,
|
||||
NULL));
|
||||
}
|
||||
|
||||
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__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_socketevent_t *dev;
|
||||
isc_socketmgr_t *manager;
|
||||
@@ -2969,10 +2970,10 @@ isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
isc_result_t ret;
|
||||
|
||||
@@ -3004,8 +3005,8 @@ isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr,
|
||||
unsigned int options) {
|
||||
isc__socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr,
|
||||
unsigned int options) {
|
||||
int bind_errno;
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
int on = 1;
|
||||
@@ -3070,7 +3071,7 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_filter(isc_socket_t *sock, const char *filter) {
|
||||
isc__socket_filter(isc_socket_t *sock, const char *filter) {
|
||||
UNUSED(sock);
|
||||
UNUSED(filter);
|
||||
|
||||
@@ -3089,7 +3090,7 @@ isc_socket_filter(isc_socket_t *sock, const char *filter) {
|
||||
* as well keep things simple rather than having to track them.
|
||||
*/
|
||||
isc_result_t
|
||||
isc_socket_listen(isc_socket_t *sock, unsigned int backlog) {
|
||||
isc__socket_listen(isc_socket_t *sock, unsigned int backlog) {
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
@@ -3134,8 +3135,8 @@ isc_socket_listen(isc_socket_t *sock, unsigned int backlog) {
|
||||
* This should try to do aggressive accept() XXXMLG
|
||||
*/
|
||||
isc_result_t
|
||||
isc_socket_accept(isc_socket_t *sock,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
isc__socket_accept(isc_socket_t *sock,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
{
|
||||
isc_socket_newconnev_t *adev;
|
||||
isc_socketmgr_t *manager;
|
||||
@@ -3245,8 +3246,8 @@ isc_socket_accept(isc_socket_t *sock,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
isc__socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg)
|
||||
{
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
isc_socket_connev_t *cdev;
|
||||
@@ -3360,7 +3361,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
isc__socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
@@ -3390,7 +3391,7 @@ isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
isc__socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
ISC_SOCKADDR_LEN_T len;
|
||||
isc_result_t result;
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
@@ -3437,7 +3438,7 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
* queued for task "task" of type "how". "how" is a bitmask.
|
||||
*/
|
||||
void
|
||||
isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
||||
isc__socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
|
||||
@@ -3563,7 +3564,7 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
||||
}
|
||||
|
||||
isc_sockettype_t
|
||||
isc_socket_gettype(isc_socket_t *sock) {
|
||||
isc__socket_gettype(isc_socket_t *sock) {
|
||||
isc_sockettype_t type;
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
@@ -3584,7 +3585,7 @@ isc_socket_gettype(isc_socket_t *sock) {
|
||||
}
|
||||
|
||||
isc_boolean_t
|
||||
isc_socket_isbound(isc_socket_t *sock) {
|
||||
isc__socket_isbound(isc_socket_t *sock) {
|
||||
isc_boolean_t val;
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
@@ -3607,7 +3608,7 @@ isc_socket_isbound(isc_socket_t *sock) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) {
|
||||
isc__socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) {
|
||||
#if defined(IPV6_V6ONLY)
|
||||
int onoff = yes ? 1 : 0;
|
||||
#else
|
||||
@@ -3625,14 +3626,14 @@ isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_cleanunix(isc_sockaddr_t *addr, isc_boolean_t active) {
|
||||
isc__socket_cleanunix(isc_sockaddr_t *addr, isc_boolean_t active) {
|
||||
UNUSED(addr);
|
||||
UNUSED(active);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_permunix(isc_sockaddr_t *addr, isc_uint32_t perm,
|
||||
isc_uint32_t owner, isc_uint32_t group)
|
||||
isc__socket_permunix(isc_sockaddr_t *addr, isc_uint32_t perm,
|
||||
isc_uint32_t owner, isc_uint32_t group)
|
||||
{
|
||||
UNUSED(addr);
|
||||
UNUSED(perm);
|
||||
@@ -3642,7 +3643,7 @@ isc_socket_permunix(isc_sockaddr_t *addr, isc_uint32_t perm,
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_setname(isc_socket_t *socket, const char *name, void *tag) {
|
||||
isc__socket_setname(isc_socket_t *socket, const char *name, void *tag) {
|
||||
|
||||
/*
|
||||
* Name 'socket'.
|
||||
@@ -3658,12 +3659,12 @@ isc_socket_setname(isc_socket_t *socket, const char *name, void *tag) {
|
||||
}
|
||||
|
||||
const char *
|
||||
isc_socket_getname(isc_socket_t *socket) {
|
||||
isc__socket_getname(isc_socket_t *socket) {
|
||||
return (socket->name);
|
||||
}
|
||||
|
||||
void *
|
||||
isc_socket_gettag(isc_socket_t *socket) {
|
||||
isc__socket_gettag(isc_socket_t *socket) {
|
||||
return (socket->tag);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user