1999-12-04 18:05:55 +00:00
|
|
|
/* Copyright (c) 1983, 1989
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
2008-06-10 22:35:01 +00:00
|
|
|
*
|
1999-12-04 18:05:55 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
2008-06-10 22:35:01 +00:00
|
|
|
*
|
1999-12-04 18:05:55 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ARPA_NAMESER_COMPAT_
|
|
|
|
#define _ARPA_NAMESER_COMPAT_
|
|
|
|
|
|
|
|
#include <endian.h>
|
|
|
|
|
2008-08-01 17:16:31 +00:00
|
|
|
/*%
|
1999-12-04 18:05:55 +00:00
|
|
|
* Structure for query header. The order of the fields is machine- and
|
|
|
|
* compiler-dependent, depending on the byte/bit order and the layout
|
|
|
|
* of bit fields. We use bit fields only in int variables, as this
|
|
|
|
* is all ANSI requires. This requires a somewhat confusing rearrangement.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct {
|
2008-08-01 17:16:31 +00:00
|
|
|
unsigned id :16; /*%< query identification number */
|
Installed-header hygiene (BZ#20366): Simple self-contained fixes.
Some headers did not include all of their prerequisite headers.
* rpcsvc/nislib.h: Include rpcsvc/nis.h.
* sysdeps/unix/sysv/linux/netrose/rose.h:
Include sys/socket.h and netax25/ax25.h.
<endian.h> only defines BYTE_ORDER, BIG_ENDIAN, LITTLE_ENDIAN,
etc. under __USE_MISC; glibc's headers should use __BYTE_ORDER,
__BIG_ENDIAN, __LITTLE_ENDIAN, etc. instead.
* inet/netinet/icmp6.h, inet/netinet/ip6.h
* resolv/arpa/nameser_compat.h:
Use __BYTE_ORDER etc. instead of BYTE_ORDER etc.
sys/types.h only conditionally defines caddr_t and clockid_t.
* sysdeps/unix/sysv/linux/sys/quota.h:
Use __caddr_t instead of caddr_t.
* sysdeps/unix/sysv/linux/sys/timerfd.h:
Use __clockid_t instead of clockid_t.
Remove a #warning that was the sole actual problem with using sys/ipc.h
without _GNU_SOURCE/_XOPEN_SOURCE.
* sysvipc/sys/ipc.h: Remove unnecessary #warning.
_LIBC, __USE_XOPEN2K8, and __STDC_VERSION__ are not always defined.
It seems to me that _LIBC should not appear in installed headers, but
avoiding that for argp specifically would require more surgery than
feels appropriate for this patch set. It's possible that
"#ifdef _LIBC" would be sufficient, but I wanted to be conservative.
All three versions of bits/socket.h want to know whether __flexarr
will produce a real flexible array member -- specifically, one that
doesn't alter sizeof(the structure containing it). They were testing
for this with a complicated #if condition that did not agree with
sys/cdefs.h and that tripped -Wundef warnings under -std=c90.
I added a new macro to sys/cdefs.h, __glibc_c99_flexarr_available,
which reveals exactly what these headers want to know. I also took
the opportunity to flatten the rather messy conditional nest defining
__flexarr.
* argp/argp.h: Check whether _LIBC is defined before expanding it.
* posix/glob.h: Check whether __USE_XOPEN2K8 is defined instead
of expanding it.
* misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr.
Define __glibc_c99_flexarr_available to 1 when the compiler
supports C99-compatible flexible array members, 0 otherwise.
* sysdeps/unix/sysv/linux/bits/socket.h
* sysdeps/mach/hurd/bits/socket.h
* bits/socket.h: Use __glibc_c99_flexarr_available in
definitions of struct cmsghdr and CMSG_DATA.
2016-08-22 12:06:30 +00:00
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
1999-12-04 18:05:55 +00:00
|
|
|
/* fields in third byte */
|
2008-08-01 17:16:31 +00:00
|
|
|
unsigned qr: 1; /*%< response flag */
|
|
|
|
unsigned opcode: 4; /*%< purpose of message */
|
|
|
|
unsigned aa: 1; /*%< authoritive answer */
|
|
|
|
unsigned tc: 1; /*%< truncated message */
|
|
|
|
unsigned rd: 1; /*%< recursion desired */
|
1999-12-04 18:05:55 +00:00
|
|
|
/* fields in fourth byte */
|
2008-08-01 17:16:31 +00:00
|
|
|
unsigned ra: 1; /*%< recursion available */
|
|
|
|
unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
|
|
|
|
unsigned ad: 1; /*%< authentic data from named */
|
|
|
|
unsigned cd: 1; /*%< checking disabled by resolver */
|
|
|
|
unsigned rcode :4; /*%< response code */
|
1999-12-04 18:05:55 +00:00
|
|
|
#endif
|
Installed-header hygiene (BZ#20366): Simple self-contained fixes.
Some headers did not include all of their prerequisite headers.
* rpcsvc/nislib.h: Include rpcsvc/nis.h.
* sysdeps/unix/sysv/linux/netrose/rose.h:
Include sys/socket.h and netax25/ax25.h.
<endian.h> only defines BYTE_ORDER, BIG_ENDIAN, LITTLE_ENDIAN,
etc. under __USE_MISC; glibc's headers should use __BYTE_ORDER,
__BIG_ENDIAN, __LITTLE_ENDIAN, etc. instead.
* inet/netinet/icmp6.h, inet/netinet/ip6.h
* resolv/arpa/nameser_compat.h:
Use __BYTE_ORDER etc. instead of BYTE_ORDER etc.
sys/types.h only conditionally defines caddr_t and clockid_t.
* sysdeps/unix/sysv/linux/sys/quota.h:
Use __caddr_t instead of caddr_t.
* sysdeps/unix/sysv/linux/sys/timerfd.h:
Use __clockid_t instead of clockid_t.
Remove a #warning that was the sole actual problem with using sys/ipc.h
without _GNU_SOURCE/_XOPEN_SOURCE.
* sysvipc/sys/ipc.h: Remove unnecessary #warning.
_LIBC, __USE_XOPEN2K8, and __STDC_VERSION__ are not always defined.
It seems to me that _LIBC should not appear in installed headers, but
avoiding that for argp specifically would require more surgery than
feels appropriate for this patch set. It's possible that
"#ifdef _LIBC" would be sufficient, but I wanted to be conservative.
All three versions of bits/socket.h want to know whether __flexarr
will produce a real flexible array member -- specifically, one that
doesn't alter sizeof(the structure containing it). They were testing
for this with a complicated #if condition that did not agree with
sys/cdefs.h and that tripped -Wundef warnings under -std=c90.
I added a new macro to sys/cdefs.h, __glibc_c99_flexarr_available,
which reveals exactly what these headers want to know. I also took
the opportunity to flatten the rather messy conditional nest defining
__flexarr.
* argp/argp.h: Check whether _LIBC is defined before expanding it.
* posix/glob.h: Check whether __USE_XOPEN2K8 is defined instead
of expanding it.
* misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr.
Define __glibc_c99_flexarr_available to 1 when the compiler
supports C99-compatible flexible array members, 0 otherwise.
* sysdeps/unix/sysv/linux/bits/socket.h
* sysdeps/mach/hurd/bits/socket.h
* bits/socket.h: Use __glibc_c99_flexarr_available in
definitions of struct cmsghdr and CMSG_DATA.
2016-08-22 12:06:30 +00:00
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN
|
1999-12-04 18:05:55 +00:00
|
|
|
/* fields in third byte */
|
2008-08-01 17:16:31 +00:00
|
|
|
unsigned rd :1; /*%< recursion desired */
|
|
|
|
unsigned tc :1; /*%< truncated message */
|
|
|
|
unsigned aa :1; /*%< authoritive answer */
|
|
|
|
unsigned opcode :4; /*%< purpose of message */
|
|
|
|
unsigned qr :1; /*%< response flag */
|
1999-12-04 18:05:55 +00:00
|
|
|
/* fields in fourth byte */
|
2008-08-01 17:16:31 +00:00
|
|
|
unsigned rcode :4; /*%< response code */
|
|
|
|
unsigned cd: 1; /*%< checking disabled by resolver */
|
|
|
|
unsigned ad: 1; /*%< authentic data from named */
|
|
|
|
unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
|
|
|
|
unsigned ra :1; /*%< recursion available */
|
1999-12-04 18:05:55 +00:00
|
|
|
#endif
|
|
|
|
/* remaining bytes */
|
2008-08-01 17:16:31 +00:00
|
|
|
unsigned qdcount :16; /*%< number of question entries */
|
|
|
|
unsigned ancount :16; /*%< number of answer entries */
|
|
|
|
unsigned nscount :16; /*%< number of authority entries */
|
|
|
|
unsigned arcount :16; /*%< number of resource entries */
|
1999-12-04 18:05:55 +00:00
|
|
|
} HEADER;
|
|
|
|
|
|
|
|
#define PACKETSZ NS_PACKETSZ
|
|
|
|
#define MAXDNAME NS_MAXDNAME
|
|
|
|
#define MAXCDNAME NS_MAXCDNAME
|
|
|
|
#define MAXLABEL NS_MAXLABEL
|
|
|
|
#define HFIXEDSZ NS_HFIXEDSZ
|
|
|
|
#define QFIXEDSZ NS_QFIXEDSZ
|
|
|
|
#define RRFIXEDSZ NS_RRFIXEDSZ
|
|
|
|
#define INT32SZ NS_INT32SZ
|
|
|
|
#define INT16SZ NS_INT16SZ
|
2008-08-01 17:16:31 +00:00
|
|
|
#define INT8SZ NS_INT8SZ
|
1999-12-04 18:05:55 +00:00
|
|
|
#define INADDRSZ NS_INADDRSZ
|
|
|
|
#define IN6ADDRSZ NS_IN6ADDRSZ
|
|
|
|
#define INDIR_MASK NS_CMPRSFLGS
|
|
|
|
#define NAMESERVER_PORT NS_DEFAULTPORT
|
|
|
|
|
|
|
|
#define S_ZONE ns_s_zn
|
|
|
|
#define S_PREREQ ns_s_pr
|
|
|
|
#define S_UPDATE ns_s_ud
|
|
|
|
#define S_ADDT ns_s_ar
|
|
|
|
|
|
|
|
#define QUERY ns_o_query
|
|
|
|
#define IQUERY ns_o_iquery
|
|
|
|
#define STATUS ns_o_status
|
|
|
|
#define NS_NOTIFY_OP ns_o_notify
|
|
|
|
#define NS_UPDATE_OP ns_o_update
|
|
|
|
|
|
|
|
#define NOERROR ns_r_noerror
|
|
|
|
#define FORMERR ns_r_formerr
|
|
|
|
#define SERVFAIL ns_r_servfail
|
|
|
|
#define NXDOMAIN ns_r_nxdomain
|
|
|
|
#define NOTIMP ns_r_notimpl
|
|
|
|
#define REFUSED ns_r_refused
|
|
|
|
#define YXDOMAIN ns_r_yxdomain
|
|
|
|
#define YXRRSET ns_r_yxrrset
|
|
|
|
#define NXRRSET ns_r_nxrrset
|
|
|
|
#define NOTAUTH ns_r_notauth
|
|
|
|
#define NOTZONE ns_r_notzone
|
|
|
|
/*#define BADSIG ns_r_badsig*/
|
|
|
|
/*#define BADKEY ns_r_badkey*/
|
|
|
|
/*#define BADTIME ns_r_badtime*/
|
|
|
|
|
|
|
|
|
|
|
|
#define DELETE ns_uop_delete
|
|
|
|
#define ADD ns_uop_add
|
|
|
|
|
2016-12-31 20:16:27 +00:00
|
|
|
#define T_A ns_t_a
|
|
|
|
#define T_NS ns_t_ns
|
|
|
|
#define T_MD ns_t_md
|
|
|
|
#define T_MF ns_t_mf
|
|
|
|
#define T_CNAME ns_t_cname
|
|
|
|
#define T_SOA ns_t_soa
|
|
|
|
#define T_MB ns_t_mb
|
|
|
|
#define T_MG ns_t_mg
|
|
|
|
#define T_MR ns_t_mr
|
|
|
|
#define T_NULL ns_t_null
|
|
|
|
#define T_WKS ns_t_wks
|
|
|
|
#define T_PTR ns_t_ptr
|
|
|
|
#define T_HINFO ns_t_hinfo
|
|
|
|
#define T_MINFO ns_t_minfo
|
|
|
|
#define T_MX ns_t_mx
|
|
|
|
#define T_TXT ns_t_txt
|
|
|
|
#define T_RP ns_t_rp
|
|
|
|
#define T_AFSDB ns_t_afsdb
|
|
|
|
#define T_X25 ns_t_x25
|
|
|
|
#define T_ISDN ns_t_isdn
|
|
|
|
#define T_RT ns_t_rt
|
|
|
|
#define T_NSAP ns_t_nsap
|
|
|
|
#define T_NSAP_PTR ns_t_nsap_ptr
|
|
|
|
#define T_SIG ns_t_sig
|
|
|
|
#define T_KEY ns_t_key
|
|
|
|
#define T_PX ns_t_px
|
|
|
|
#define T_GPOS ns_t_gpos
|
|
|
|
#define T_AAAA ns_t_aaaa
|
|
|
|
#define T_LOC ns_t_loc
|
|
|
|
#define T_NXT ns_t_nxt
|
|
|
|
#define T_EID ns_t_eid
|
|
|
|
#define T_NIMLOC ns_t_nimloc
|
|
|
|
#define T_SRV ns_t_srv
|
|
|
|
#define T_ATMA ns_t_atma
|
|
|
|
#define T_NAPTR ns_t_naptr
|
|
|
|
#define T_KX ns_t_kx
|
|
|
|
#define T_CERT ns_t_cert
|
|
|
|
#define T_A6 ns_t_a6
|
|
|
|
#define T_DNAME ns_t_dname
|
|
|
|
#define T_SINK ns_t_sink
|
|
|
|
#define T_OPT ns_t_opt
|
|
|
|
#define T_APL ns_t_apl
|
|
|
|
#define T_DS ns_t_ds
|
|
|
|
#define T_SSHFP ns_t_sshfp
|
|
|
|
#define T_IPSECKEY ns_t_ipseckey
|
|
|
|
#define T_RRSIG ns_t_rrsig
|
|
|
|
#define T_NSEC ns_t_nsec
|
|
|
|
#define T_DNSKEY ns_t_dnskey
|
|
|
|
#define T_DHCID ns_t_dhcid
|
|
|
|
#define T_NSEC3 ns_t_nsec3
|
|
|
|
#define T_NSEC3PARAM ns_t_nsec3param
|
|
|
|
#define T_TLSA ns_t_tlsa
|
|
|
|
#define T_SMIMEA ns_t_smimea
|
|
|
|
#define T_HIP ns_t_hip
|
|
|
|
#define T_NINFO ns_t_ninfo
|
|
|
|
#define T_RKEY ns_t_rkey
|
|
|
|
#define T_TALINK ns_t_talink
|
|
|
|
#define T_CDS ns_t_cds
|
|
|
|
#define T_CDNSKEY ns_t_cdnskey
|
|
|
|
#define T_OPENPGPKEY ns_t_openpgpkey
|
|
|
|
#define T_CSYNC ns_t_csync
|
|
|
|
#define T_SPF ns_t_spf
|
|
|
|
#define T_UINFO ns_t_uinfo
|
|
|
|
#define T_UID ns_t_uid
|
|
|
|
#define T_GID ns_t_gid
|
|
|
|
#define T_UNSPEC ns_t_unspec
|
|
|
|
#define T_NID ns_t_nid
|
|
|
|
#define T_L32 ns_t_l32
|
|
|
|
#define T_L64 ns_t_l64
|
|
|
|
#define T_LP ns_t_lp
|
|
|
|
#define T_EUI48 ns_t_eui48
|
|
|
|
#define T_EUI64 ns_t_eui64
|
|
|
|
#define T_TKEY ns_t_tkey
|
|
|
|
#define T_TSIG ns_t_tsig
|
|
|
|
#define T_IXFR ns_t_ixfr
|
|
|
|
#define T_AXFR ns_t_axfr
|
|
|
|
#define T_MAILB ns_t_mailb
|
|
|
|
#define T_MAILA ns_t_maila
|
|
|
|
#define T_ANY ns_t_any
|
|
|
|
#define T_URI ns_t_uri
|
|
|
|
#define T_CAA ns_t_caa
|
|
|
|
#define T_AVC ns_t_avc
|
|
|
|
#define T_TA ns_t_ta
|
|
|
|
#define T_DLV ns_t_dlv
|
1999-12-04 18:05:55 +00:00
|
|
|
|
|
|
|
#define C_IN ns_c_in
|
|
|
|
#define C_CHAOS ns_c_chaos
|
|
|
|
#define C_HS ns_c_hs
|
|
|
|
/* BIND_UPDATE */
|
|
|
|
#define C_NONE ns_c_none
|
|
|
|
#define C_ANY ns_c_any
|
|
|
|
|
|
|
|
#define GETSHORT NS_GET16
|
|
|
|
#define GETLONG NS_GET32
|
|
|
|
#define PUTSHORT NS_PUT16
|
|
|
|
#define PUTLONG NS_PUT32
|
|
|
|
|
|
|
|
#endif /* _ARPA_NAMESER_COMPAT_ */
|
2008-08-01 17:16:31 +00:00
|
|
|
/*! \file */
|