mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Merge branch 'socket-options-refactoring' into 'master'
Refactoring #defines into typedef enums See merge request isc-projects/bind9!135
This commit is contained in:
commit
fd9c3ad389
3
CHANGES
3
CHANGES
@ -1,3 +1,6 @@
|
||||
4923. [cleanup] Refactor socket and socket event options into
|
||||
enum types. [GL !135]
|
||||
|
||||
4922. [bug] dnstap: Log the destination address of client
|
||||
packets rather than the interface address.
|
||||
[GL #197]
|
||||
|
@ -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;
|
||||
|
||||
|
@ -219,7 +219,7 @@ typedef struct query {
|
||||
isc_dscp_t dscp;
|
||||
int ednsversion;
|
||||
unsigned int options;
|
||||
unsigned int attributes;
|
||||
isc_sockeventattr_t attributes;
|
||||
unsigned int sends;
|
||||
unsigned int connects;
|
||||
unsigned int udpsize;
|
||||
|
@ -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.
|
||||
@ -209,6 +214,31 @@ enum {
|
||||
isc_sockstatscounter_max = 62
|
||||
};
|
||||
|
||||
/*@{*/
|
||||
/*!
|
||||
* _ATTACHED: Internal use only.
|
||||
* _TRUNC: Packet was truncated on receive.
|
||||
* _CTRUNC: Packet control information was truncated. This can
|
||||
* indicate that the packet is not complete, even though
|
||||
* all the data is valid.
|
||||
* _TIMESTAMP: The timestamp member is valid.
|
||||
* _PKTINFO: The pktinfo member is valid.
|
||||
* _MULTICAST: The UDP packet was received via a multicast transmission.
|
||||
* _DSCP: The UDP DSCP value is valid.
|
||||
* _USEMINMTU: Set the per packet IPV6_USE_MIN_MTU flag.
|
||||
*/
|
||||
typedef enum {
|
||||
ISC_SOCKEVENTATTR_ATTACHED = 0x80000000U, /* internal */
|
||||
ISC_SOCKEVENTATTR_TRUNC = 0x00800000U, /* public */
|
||||
ISC_SOCKEVENTATTR_CTRUNC = 0x00400000U, /* public */
|
||||
ISC_SOCKEVENTATTR_TIMESTAMP = 0x00200000U, /* public */
|
||||
ISC_SOCKEVENTATTR_PKTINFO = 0x00100000U, /* public */
|
||||
ISC_SOCKEVENTATTR_MULTICAST = 0x00080000U, /* public */
|
||||
ISC_SOCKEVENTATTR_DSCP = 0x00040000U, /* public */
|
||||
ISC_SOCKEVENTATTR_USEMINMTU = 0x00020000U /* public */
|
||||
} isc_sockeventattr_t;
|
||||
/*@}*/
|
||||
|
||||
/***
|
||||
*** Types
|
||||
***/
|
||||
@ -224,7 +254,8 @@ struct isc_socketevent {
|
||||
isc_sockaddr_t address; /*%< source address */
|
||||
isc_time_t timestamp; /*%< timestamp of packet recv */
|
||||
struct in6_pktinfo pktinfo; /*%< ipv6 pktinfo */
|
||||
isc_uint32_t attributes; /*%< see below */
|
||||
isc_sockeventattr_t attributes; /*%< see isc_sockeventattr_t
|
||||
enum */
|
||||
isc_eventdestructor_t destroy; /*%< original destructor */
|
||||
unsigned int dscp; /*%< UDP dscp value */
|
||||
};
|
||||
@ -243,29 +274,6 @@ struct isc_socket_connev {
|
||||
isc_result_t result; /*%< OK, EOF, whatever else */
|
||||
};
|
||||
|
||||
/*@{*/
|
||||
/*!
|
||||
* _ATTACHED: Internal use only.
|
||||
* _TRUNC: Packet was truncated on receive.
|
||||
* _CTRUNC: Packet control information was truncated. This can
|
||||
* indicate that the packet is not complete, even though
|
||||
* all the data is valid.
|
||||
* _TIMESTAMP: The timestamp member is valid.
|
||||
* _PKTINFO: The pktinfo member is valid.
|
||||
* _MULTICAST: The UDP packet was received via a multicast transmission.
|
||||
* _DSCP: The UDP DSCP value is valid.
|
||||
* _USEMINMTU: Set the per packet IPV6_USE_MIN_MTU flag.
|
||||
*/
|
||||
#define ISC_SOCKEVENTATTR_ATTACHED 0x80000000U /* internal */
|
||||
#define ISC_SOCKEVENTATTR_TRUNC 0x00800000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_CTRUNC 0x00400000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_PKTINFO 0x00100000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_MULTICAST 0x00080000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_DSCP 0x00040000U /* public */
|
||||
#define ISC_SOCKEVENTATTR_USEMINMTU 0x00020000U /* public */
|
||||
/*@}*/
|
||||
|
||||
#define ISC_SOCKEVENT_ANYEVENT (0)
|
||||
#define ISC_SOCKEVENT_RECVDONE (ISC_EVENTCLASS_SOCKET + 1)
|
||||
#define ISC_SOCKEVENT_SENDDONE (ISC_EVENTCLASS_SOCKET + 2)
|
||||
@ -691,7 +699,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'.
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user