2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 08:05:21 +00:00

add protocol family

This commit is contained in:
Bob Halley
1999-07-15 20:11:35 +00:00
parent 1d29f10aef
commit 86bbe826f0
2 changed files with 9 additions and 4 deletions

View File

@@ -148,11 +148,16 @@ typedef enum {
isc_result_t isc_result_t
isc_socket_create(isc_socketmgr_t *manager, isc_socket_create(isc_socketmgr_t *manager,
int pf,
isc_sockettype_t type, isc_sockettype_t type,
isc_socket_t **socketp); isc_socket_t **socketp);
/* /*
* Create a new 'type' socket managed by 'manager'. * Create a new 'type' socket managed by 'manager'.
* *
* Note:
*
* 'pf' is the desired protocol family, e.g. PF_INET or PF_INET6.
*
* Requires: * Requires:
* *
* 'manager' is a valid manager * 'manager' is a valid manager

View File

@@ -335,7 +335,7 @@ destroy(isc_socket_t **sockp)
LOCK(&manager->lock); LOCK(&manager->lock);
/* /*
* Noone has this socket open, so the watcher doesn't have to be * No one has this socket open, so the watcher doesn't have to be
* poked, and the socket doesn't have to be locked. * poked, and the socket doesn't have to be locked.
*/ */
manager->fds[sock->fd] = NULL; manager->fds[sock->fd] = NULL;
@@ -467,7 +467,7 @@ free_socket(isc_socket_t **socketp)
* in 'socketp'. * in 'socketp'.
*/ */
isc_result_t isc_result_t
isc_socket_create(isc_socketmgr_t *manager, isc_sockettype_t type, isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
isc_socket_t **socketp) isc_socket_t **socketp)
{ {
isc_socket_t *sock = NULL; isc_socket_t *sock = NULL;
@@ -484,10 +484,10 @@ isc_socket_create(isc_socketmgr_t *manager, isc_sockettype_t type,
switch (type) { switch (type) {
case isc_sockettype_udp: case isc_sockettype_udp:
sock->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP);
break; break;
case isc_sockettype_tcp: case isc_sockettype_tcp:
sock->fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
break; break;
} }
if (sock->fd < 0) { if (sock->fd < 0) {