Merge "Sync up nameser with upstream(2014.03.05)"
This commit is contained in:
@@ -1,4 +1,21 @@
|
||||
/* $NetBSD: nameser.h,v 1.19 2005/12/26 19:01:47 perry Exp $ */
|
||||
/* $NetBSD: nameser.h,v 1.25 2009/04/12 17:07:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Portions Copyright (C) 1996-2003 Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1993
|
||||
@@ -30,24 +47,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1996-1999 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Id: nameser.h,v 1.2.2.4.4.1 2004/03/09 08:33:30 marka Exp
|
||||
* Id: nameser.h,v 1.16 2009/03/03 01:52:48 each Exp
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_NAMESER_H_
|
||||
@@ -66,16 +66,19 @@
|
||||
* contains a new enough lib/nameser/ to support the feature you need.
|
||||
*/
|
||||
|
||||
#define __NAMESER 19991006 /* New interface version stamp. */
|
||||
#define __NAMESER 20090302 /*%< New interface version stamp. */
|
||||
|
||||
/*
|
||||
* Define constants based on RFC 883, RFC 1034, RFC 1035
|
||||
* Define constants based on RFC0883, RFC1034, RFC 1035
|
||||
*/
|
||||
#define NS_PACKETSZ 512 /* default UDP packet size */
|
||||
#define NS_MAXDNAME 1025 /* maximum domain name */
|
||||
#define NS_MAXDNAME 1025 /* maximum domain name (presentation format)*/
|
||||
#define NS_MAXMSG 65535 /* maximum message size */
|
||||
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
|
||||
#define NS_MAXLABEL 63 /* maximum length of domain label */
|
||||
#define NS_MAXLABELS 128 /* theoretical max #/labels per domain name */
|
||||
#define NS_MAXNNAME 256 /* maximum uncompressed (binary) domain name*/
|
||||
#define NS_MAXPADDR (sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
|
||||
#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
|
||||
#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
|
||||
#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
|
||||
@@ -102,6 +105,18 @@ typedef enum __ns_sect {
|
||||
ns_s_max = 4
|
||||
} ns_sect;
|
||||
|
||||
/*
|
||||
* Network name (compressed or not) type. Equivilent to a pointer when used
|
||||
* in a function prototype. Can be const'd.
|
||||
*/
|
||||
typedef u_char ns_nname[NS_MAXNNAME];
|
||||
typedef const u_char *ns_nname_ct;
|
||||
typedef u_char *ns_nname_t;
|
||||
|
||||
struct ns_namemap { ns_nname_ct base; int len; };
|
||||
typedef struct ns_namemap *ns_namemap_t;
|
||||
typedef const struct ns_namemap *ns_namemap_ct;
|
||||
|
||||
/*
|
||||
* This is a message handle. It is caller allocated and has no dynamic data.
|
||||
* This structure is intended to be opaque to all but ns_parse.c, thus the
|
||||
@@ -115,6 +130,16 @@ typedef struct __ns_msg {
|
||||
int _rrnum;
|
||||
const u_char *_msg_ptr;
|
||||
} ns_msg;
|
||||
/*
|
||||
* This is a newmsg handle, used when constructing new messages with
|
||||
* ns_newmsg_init, et al.
|
||||
*/
|
||||
struct ns_newmsg {
|
||||
ns_msg msg;
|
||||
const u_char *dnptrs[25];
|
||||
const u_char **lastdnptr;
|
||||
};
|
||||
typedef struct ns_newmsg ns_newmsg;
|
||||
|
||||
/* Private data structure - do not use from outside library. */
|
||||
struct _ns_flagdata { int mask, shift; };
|
||||
@@ -140,8 +165,22 @@ typedef struct __ns_rr {
|
||||
const u_char * rdata;
|
||||
} ns_rr;
|
||||
|
||||
/*
|
||||
* Same thing, but using uncompressed network binary names, and real C types.
|
||||
*/
|
||||
typedef struct __ns_rr2 {
|
||||
ns_nname nname;
|
||||
size_t nnamel;
|
||||
int type;
|
||||
int rr_class;
|
||||
u_int ttl;
|
||||
int rdlength;
|
||||
const u_char * rdata;
|
||||
} ns_rr2;
|
||||
/* Accessor macros - this is part of the public interface. */
|
||||
#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".")
|
||||
#define ns_rr_nname(rr) ((const ns_nname_t)(rr).nname)
|
||||
#define ns_rr_nnamel(rr) ((rr).nnamel + 0)
|
||||
#define ns_rr_type(rr) ((ns_type)((rr).type + 0))
|
||||
#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0))
|
||||
#define ns_rr_ttl(rr) ((u_long)(rr).ttl + 0)
|
||||
@@ -274,7 +313,7 @@ typedef enum __ns_type {
|
||||
ns_t_key = 25, /* Security key. */
|
||||
ns_t_px = 26, /* X.400 mail mapping. */
|
||||
ns_t_gpos = 27, /* Geographical position (withdrawn). */
|
||||
ns_t_aaaa = 28, /* Ip6 Address. */
|
||||
ns_t_aaaa = 28, /* IPv6 Address. */
|
||||
ns_t_loc = 29, /* Location Information. */
|
||||
ns_t_nxt = 30, /* Next domain (security). */
|
||||
ns_t_eid = 31, /* Endpoint identifier. */
|
||||
@@ -284,11 +323,22 @@ typedef enum __ns_type {
|
||||
ns_t_naptr = 35, /* Naming Authority PoinTeR */
|
||||
ns_t_kx = 36, /* Key Exchange */
|
||||
ns_t_cert = 37, /* Certification record */
|
||||
ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
|
||||
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
|
||||
ns_t_a6 = 38, /* IPv6 address (experimental) */
|
||||
ns_t_dname = 39, /* Non-terminal DNAME */
|
||||
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
|
||||
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
|
||||
ns_t_apl = 42, /* Address prefix list (RFC 3123) */
|
||||
ns_t_ds = 43, /* Delegation Signer */
|
||||
ns_t_sshfp = 44, /* SSH Fingerprint */
|
||||
ns_t_ipseckey = 45, /* IPSEC Key */
|
||||
ns_t_rrsig = 46, /* RRset Signature */
|
||||
ns_t_nsec = 47, /* Negative security */
|
||||
ns_t_dnskey = 48, /* DNS Key */
|
||||
ns_t_dhcid = 49, /* Dynamic host configuratin identifier */
|
||||
ns_t_nsec3 = 50, /* Negative security type 3 */
|
||||
ns_t_nsec3param = 51, /* Negative security type 3 parameters */
|
||||
ns_t_hip = 55, /* Host Identity Protocol */
|
||||
ns_t_spf = 99, /* Sender Policy Framework */
|
||||
ns_t_tkey = 249, /* Transaction key */
|
||||
ns_t_tsig = 250, /* Transaction signature. */
|
||||
ns_t_ixfr = 251, /* Incremental zone transfer. */
|
||||
@@ -297,6 +347,7 @@ typedef enum __ns_type {
|
||||
ns_t_maila = 254, /* Transfer mail agent records. */
|
||||
ns_t_any = 255, /* Wildcard match. */
|
||||
ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
|
||||
ns_t_dlv = 32769, /* DNSSEC look-aside validatation. */
|
||||
ns_t_max = 65536
|
||||
} ns_type;
|
||||
|
||||
@@ -423,9 +474,10 @@ typedef enum __ns_cert_types {
|
||||
#define NS_NXT_MAX 127
|
||||
|
||||
/*
|
||||
* EDNS0 extended flags, host order.
|
||||
* EDNS0 extended flags and option codes, host order.
|
||||
*/
|
||||
#define NS_OPT_DNSSEC_OK 0x8000U
|
||||
#define NS_OPT_NSID 3
|
||||
|
||||
/*
|
||||
* Inline versions of get/put short/long. Pointer is advanced.
|
||||
@@ -477,6 +529,7 @@ typedef enum __ns_cert_types {
|
||||
#define ns_initparse __ns_initparse
|
||||
#define ns_skiprr __ns_skiprr
|
||||
#define ns_parserr __ns_parserr
|
||||
#define ns_parserr2 __ns_parserr2
|
||||
#define ns_sprintrr __ns_sprintrr
|
||||
#define ns_sprintrrf __ns_sprintrrf
|
||||
#define ns_format_ttl __ns_format_ttl
|
||||
@@ -485,12 +538,19 @@ typedef enum __ns_cert_types {
|
||||
#define ns_name_ntol __ns_name_ntol
|
||||
#define ns_name_ntop __ns_name_ntop
|
||||
#define ns_name_pton __ns_name_pton
|
||||
#define ns_name_pton2 __ns_name_pton2
|
||||
#define ns_name_unpack __ns_name_unpack
|
||||
#define ns_name_unpack2 __ns_name_unpack2
|
||||
#define ns_name_pack __ns_name_pack
|
||||
#define ns_name_compress __ns_name_compress
|
||||
#define ns_name_uncompress __ns_name_uncompress
|
||||
#define ns_name_skip __ns_name_skip
|
||||
#define ns_name_rollback __ns_name_rollback
|
||||
#define ns_name_length __ns_name_length
|
||||
#define ns_name_eq __ns_name_eq
|
||||
#define ns_name_owned __ns_name_owned
|
||||
#define ns_name_map __ns_name_map
|
||||
#define ns_name_labels __ns_name_labels
|
||||
#define ns_sign __ns_sign
|
||||
#define ns_sign2 __ns_sign2
|
||||
#define ns_sign_tcp __ns_sign_tcp
|
||||
@@ -504,6 +564,16 @@ typedef enum __ns_cert_types {
|
||||
#define ns_subdomain __ns_subdomain
|
||||
#define ns_makecanon __ns_makecanon
|
||||
#define ns_samename __ns_samename
|
||||
#define ns_newmsg_init __ns_newmsg_init
|
||||
#define ns_newmsg_copy __ns_newmsg_copy
|
||||
#define ns_newmsg_id __ns_newmsg_id
|
||||
#define ns_newmsg_flag __ns_newmsg_flag
|
||||
#define ns_newmsg_q __ns_newmsg_q
|
||||
#define ns_newmsg_rr __ns_newmsg_rr
|
||||
#define ns_newmsg_done __ns_newmsg_done
|
||||
#define ns_rdata_unpack __ns_rdata_unpack
|
||||
#define ns_rdata_equal __ns_rdata_equal
|
||||
#define ns_rdata_refers __ns_rdata_refers
|
||||
|
||||
__BEGIN_DECLS
|
||||
int ns_msg_getflag(ns_msg, int);
|
||||
@@ -514,6 +584,7 @@ void ns_put32(uint32_t, u_char *);
|
||||
int ns_initparse(const u_char *, int, ns_msg *);
|
||||
int ns_skiprr(const u_char *, const u_char *, ns_sect, int);
|
||||
int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
|
||||
int ns_parserr2(ns_msg *, ns_sect, int, ns_rr2 *);
|
||||
int ns_sprintrr(const ns_msg *, const ns_rr *,
|
||||
const char *, const char *, char *, size_t);
|
||||
int ns_sprintrrf(const u_char *, size_t, const char *,
|
||||
@@ -526,8 +597,12 @@ uint32_t ns_datetosecs(const char *cp, int *errp);
|
||||
int ns_name_ntol(const u_char *, u_char *, size_t);
|
||||
int ns_name_ntop(const u_char *, char *, size_t);
|
||||
int ns_name_pton(const char *, u_char *, size_t);
|
||||
int ns_name_pton2(const char *, u_char *, size_t, size_t *);
|
||||
int ns_name_unpack(const u_char *, const u_char *,
|
||||
const u_char *, u_char *, size_t);
|
||||
int ns_name_unpack2(const u_char *, const u_char *,
|
||||
const u_char *, u_char *, size_t,
|
||||
size_t *);
|
||||
int ns_name_pack(const u_char *, u_char *, int,
|
||||
const u_char **, const u_char **);
|
||||
int ns_name_uncompress(const u_char *, const u_char *,
|
||||
@@ -542,6 +617,11 @@ int ns_sign(u_char *, int *, int, int, void *,
|
||||
int ns_sign2(u_char *, int *, int, int, void *,
|
||||
const u_char *, int, u_char *, int *, time_t,
|
||||
u_char **, u_char **);
|
||||
ssize_t ns_name_length(ns_nname_ct, size_t);
|
||||
int ns_name_eq(ns_nname_ct, size_t, ns_nname_ct, size_t);
|
||||
int ns_name_owned(ns_namemap_ct, int, ns_namemap_ct, int);
|
||||
int ns_name_map(ns_nname_ct, size_t, ns_namemap_t, int);
|
||||
int ns_name_labels(ns_nname_ct, size_t);
|
||||
int ns_sign_tcp(u_char *, int *, int, int,
|
||||
ns_tcp_tsig_state *, int);
|
||||
int ns_sign_tcp2(u_char *, int *, int, int,
|
||||
@@ -560,17 +640,29 @@ int ns_samedomain(const char *, const char *);
|
||||
int ns_subdomain(const char *, const char *);
|
||||
int ns_makecanon(const char *, char *, size_t);
|
||||
int ns_samename(const char *, const char *);
|
||||
int ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *);
|
||||
int ns_newmsg_copy(ns_newmsg *, ns_msg *);
|
||||
void ns_newmsg_id(ns_newmsg *handle, uint16_t id);
|
||||
void ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value);
|
||||
int ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname,
|
||||
ns_type qtype, ns_class qclass);
|
||||
int ns_newmsg_rr(ns_newmsg *handle, ns_sect sect,
|
||||
ns_nname_ct name, ns_type type,
|
||||
ns_class rr_class, uint32_t ttl,
|
||||
uint16_t rdlen, const u_char *rdata);
|
||||
size_t ns_newmsg_done(ns_newmsg *handle);
|
||||
ssize_t ns_rdata_unpack(const u_char *, const u_char *, ns_type,
|
||||
const u_char *, size_t, u_char *, size_t);
|
||||
int ns_rdata_equal(ns_type,
|
||||
const u_char *, size_t,
|
||||
const u_char *, size_t);
|
||||
int ns_rdata_refers(ns_type,
|
||||
const u_char *, size_t,
|
||||
const u_char *);
|
||||
__END_DECLS
|
||||
|
||||
#ifdef BIND_4_COMPAT
|
||||
#include <arpa/nameser_compat.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
# include "private/libc_logging.h"
|
||||
# define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__)
|
||||
#else
|
||||
#define XLOG(...) do {} while (0)
|
||||
#endif
|
||||
|
||||
#endif /* !_ARPA_NAMESER_H_ */
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
/*
|
||||
* from nameser.h 8.1 (Berkeley) 6/2/93
|
||||
* Id: nameser_compat.h,v 1.1.2.3.4.2 2004/07/01 04:43:41 marka Exp
|
||||
* Id: nameser_compat.h,v 1.8 2006/05/19 02:33:40 marka Exp
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_NAMESER_COMPAT_
|
||||
@@ -48,7 +48,7 @@
|
||||
#if (BSD >= 199103)
|
||||
# include <machine/endian.h>
|
||||
#else
|
||||
#ifdef __linux
|
||||
#ifdef __linux__
|
||||
# include <endian.h>
|
||||
#else
|
||||
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
|
||||
@@ -57,7 +57,9 @@
|
||||
|
||||
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
|
||||
defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
|
||||
defined(__alpha__) || defined(__alpha) || \
|
||||
defined(__i386__) || defined(__i386) || defined(__amd64__) || \
|
||||
defined(__x86_64__) || defined(MIPSEL) || defined(_MIPSEL) || \
|
||||
defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \
|
||||
(defined(__Lynx__) && defined(__x86__))
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user