]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Refactor ISC_SOCKET_* defines into an isc_socket_options_t enum
authorOndřej Surý <ondrej@sury.org>
Sat, 17 Mar 2018 11:01:39 +0000 (11:01 +0000)
committerOndřej Surý <ondrej@sury.org>
Thu, 12 Apr 2018 07:54:21 +0000 (09:54 +0200)
lib/dns/dispatch.c
lib/isc/include/isc/socket.h
lib/isc/unix/socket.c
lib/isc/win32/socket.c

index f66533154d3ae8b36a3c6677bcc39c819098bf77..a65f69300273474a3958dd7b9bdefe938cf681e9 100644 (file)
@@ -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;
 
index a5033c3ede557b4f40d8354b95f94b709e610f83..70b28e83a4df2a58f4fd9d3267404ad256e96117 100644 (file)
@@ -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'.
  *
index fd767100bd81fa91e8f7e77e1cb143fa2f3490df..b5ddbf745aebbf79b44cd5bf12e20c91b8f87e34 100644 (file)
@@ -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;
index 3e54988e94d59044999bf4121b6734e2e5141ff0..f2c3f8325c14bab60e0bd7fe04f71fe034aeaf3f 100644 (file)
@@ -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;