Refactor ISC_SOCKET_* defines into an isc_socket_options_t enum

This commit is contained in:
Ondřej Surý 2018-03-17 11:01:39 +00:00
parent 01f8e5dbb8
commit c2f42583c0
4 changed files with 17 additions and 10 deletions

View 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;

View 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'.
*

View 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;

View 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;