From: Ondřej Surý Date: Sat, 17 Mar 2018 11:01:39 +0000 (+0000) Subject: Refactor ISC_SOCKET_* defines into an isc_socket_options_t enum X-Git-Tag: v9.13.0~61^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2f42583c0b126e6f62b1ab250f3126d1972f236;p=thirdparty%2Fbind9.git Refactor ISC_SOCKET_* defines into an isc_socket_options_t enum --- diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index f66533154d3..a65f6930027 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -673,7 +673,7 @@ get_dispsocket(dns_dispatch_t *disp, const isc_sockaddr_t *dest, dispsocket_t *dispsock; unsigned int nports; in_port_t *ports; - unsigned int bindoptions; + isc_socket_options_t bindoptions; dispportentry_t *portentry = NULL; dns_qid_t *qid; diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index a5033c3ede5..70b28e83a4d 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -9,8 +9,6 @@ * information regarding copyright ownership. */ -/* $Id$ */ - #ifndef ISC_SOCKET_H #define ISC_SOCKET_H 1 @@ -122,11 +120,18 @@ ISC_LANG_BEGINDECLS */ #define ISC_SOCKET_MAXSCATTERGATHER 8 -/*% - * In isc_socket_bind() set socket option SO_REUSEADDR prior to calling - * bind() if a non zero port is specified (AF_INET and AF_INET6). +/*@{*/ +/*! + * Socket options: + * + * _REUSEADDRESS: Set SO_REUSEADDR prior to calling bind(), + * if a non-zero port is specified (applies to + * AF_INET and AF_INET6). */ -#define ISC_SOCKET_REUSEADDRESS 0x01U +typedef enum { + ISC_SOCKET_REUSEADDRESS = 0x01U, +} isc_socket_options_t; +/*@}*/ /*% * Statistics counters. Used as isc_statscounter_t values. @@ -691,7 +696,7 @@ isc_socket_close(isc_socket_t *sock); isc_result_t isc_socket_bind(isc_socket_t *sock, const isc_sockaddr_t *addressp, - unsigned int options); + isc_socket_options_t options); /*%< * Bind 'socket' to '*addressp'. * diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index fd767100bd8..b5ddbf745ae 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -5573,7 +5573,8 @@ isc__socket_permunix(const isc_sockaddr_t *sockaddr, isc_uint32_t perm, isc_result_t isc__socket_bind(isc_socket_t *sock0, const isc_sockaddr_t *sockaddr, - unsigned int options) { + isc_socket_options_t options) +{ isc__socket_t *sock = (isc__socket_t *)sock0; char strbuf[ISC_STRERRORSIZE]; int on = 1; diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index 3e54988e94d..f2c3f8325c1 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -3238,7 +3238,8 @@ isc__socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_result_t isc__socket_bind(isc_socket_t *sock, const isc_sockaddr_t *sockaddr, - unsigned int options) { + isc_socket_options_t options) +{ int bind_errno; char strbuf[ISC_STRERRORSIZE]; int on = 1;