Vendor import of BIND 9.4.1

This commit is contained in:
Hajimu UMEMOTO 2007-06-03 17:02:29 +00:00
parent 3f25740ec6
commit 861249f583
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/resolver/dist/; revision=170242
42 changed files with 835 additions and 755 deletions

View File

@ -53,9 +53,9 @@
* --Copyright--
*/
/*
/*%
* @(#)inet.h 8.1 (Berkeley) 6/2/93
* $Id: inet.h,v 1.1.206.1 2004/03/09 08:33:30 marka Exp $
* $Id: inet.h,v 1.2.18.1 2005/04/27 05:00:50 sra Exp $
*/
#ifndef _INET_H_
@ -122,3 +122,5 @@ __END_DECLS
#endif
#endif /* !_INET_H_ */
/*! \file */

View File

@ -49,12 +49,14 @@
*/
/*
* $Id: nameser.h,v 1.2.2.4.4.1 2004/03/09 08:33:30 marka Exp $
* $Id: nameser.h,v 1.7.18.1 2005/04/27 05:00:50 sra Exp $
*/
#ifndef _ARPA_NAMESER_H_
#define _ARPA_NAMESER_H_
/*! \file */
#define BIND_4_COMPAT
#include <sys/param.h>
@ -65,7 +67,7 @@
#endif
#include <sys/cdefs.h>
/*
/*%
* Revision information. This is the release date in YYYYMMDD format.
* It can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not
@ -73,43 +75,41 @@
* contains a new enough lib/nameser/ to support the feature you need.
*/
#define __NAMESER 19991006 /* New interface version stamp. */
#define __NAMESER 19991006 /*%< 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_MAXMSG 65535 /* maximum message size */
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
#define NS_MAXLABEL 63 /* maximum length of domain label */
#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 */
#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */
#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */
#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */
#define NS_INADDRSZ 4 /* IPv4 T_A */
#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */
#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
#define NS_PACKETSZ 512 /*%< default UDP packet size */
#define NS_MAXDNAME 1025 /*%< maximum domain name */
#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_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 */
#define NS_INT32SZ 4 /*%< #/bytes of data in a u_int32_t */
#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
#define NS_INT8SZ 1 /*%< #/bytes of data in a u_int8_t */
#define NS_INADDRSZ 4 /*%< IPv4 T_A */
#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */
#define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */
#define NS_DEFAULTPORT 53 /*%< For both TCP and UDP. */
/*
* These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
* in synch with it.
*/
typedef enum __ns_sect {
ns_s_qd = 0, /* Query: Question. */
ns_s_zn = 0, /* Update: Zone. */
ns_s_an = 1, /* Query: Answer. */
ns_s_pr = 1, /* Update: Prerequisites. */
ns_s_ns = 2, /* Query: Name servers. */
ns_s_ud = 2, /* Update: Update. */
ns_s_ar = 3, /* Query|Update: Additional records. */
ns_s_qd = 0, /*%< Query: Question. */
ns_s_zn = 0, /*%< Update: Zone. */
ns_s_an = 1, /*%< Query: Answer. */
ns_s_pr = 1, /*%< Update: Prerequisites. */
ns_s_ns = 2, /*%< Query: Name servers. */
ns_s_ud = 2, /*%< Update: Update. */
ns_s_ar = 3, /*%< Query|Update: Additional records. */
ns_s_max = 4
} ns_sect;
/*
/*%
* 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
* leading _'s on the member names. Use the accessor functions, not the _'s.
@ -135,7 +135,7 @@ extern struct _ns_flagdata _ns_flagdata[];
#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
/*
/*%
* This is a parsed record. It is caller allocated and has no dynamic data.
*/
typedef struct __ns_rr {
@ -155,54 +155,54 @@ typedef struct __ns_rr {
#define ns_rr_rdlen(rr) ((rr).rdlength + 0)
#define ns_rr_rdata(rr) ((rr).rdata + 0)
/*
/*%
* These don't have to be in the same order as in the packet flags word,
* and they can even overlap in some cases, but they will need to be kept
* in synch with ns_parse.c:ns_flagdata[].
*/
typedef enum __ns_flag {
ns_f_qr, /* Question/Response. */
ns_f_opcode, /* Operation code. */
ns_f_aa, /* Authoritative Answer. */
ns_f_tc, /* Truncation occurred. */
ns_f_rd, /* Recursion Desired. */
ns_f_ra, /* Recursion Available. */
ns_f_z, /* MBZ. */
ns_f_ad, /* Authentic Data (DNSSEC). */
ns_f_cd, /* Checking Disabled (DNSSEC). */
ns_f_rcode, /* Response code. */
ns_f_qr, /*%< Question/Response. */
ns_f_opcode, /*%< Operation code. */
ns_f_aa, /*%< Authoritative Answer. */
ns_f_tc, /*%< Truncation occurred. */
ns_f_rd, /*%< Recursion Desired. */
ns_f_ra, /*%< Recursion Available. */
ns_f_z, /*%< MBZ. */
ns_f_ad, /*%< Authentic Data (DNSSEC). */
ns_f_cd, /*%< Checking Disabled (DNSSEC). */
ns_f_rcode, /*%< Response code. */
ns_f_max
} ns_flag;
/*
/*%
* Currently defined opcodes.
*/
typedef enum __ns_opcode {
ns_o_query = 0, /* Standard query. */
ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
ns_o_status = 2, /* Name server status query (unsupported). */
ns_o_query = 0, /*%< Standard query. */
ns_o_iquery = 1, /*%< Inverse query (deprecated/unsupported). */
ns_o_status = 2, /*%< Name server status query (unsupported). */
/* Opcode 3 is undefined/reserved. */
ns_o_notify = 4, /* Zone change notification. */
ns_o_update = 5, /* Zone update message. */
ns_o_notify = 4, /*%< Zone change notification. */
ns_o_update = 5, /*%< Zone update message. */
ns_o_max = 6
} ns_opcode;
/*
/*%
* Currently defined response codes.
*/
typedef enum __ns_rcode {
ns_r_noerror = 0, /* No error occurred. */
ns_r_formerr = 1, /* Format error. */
ns_r_servfail = 2, /* Server failure. */
ns_r_nxdomain = 3, /* Name error. */
ns_r_notimpl = 4, /* Unimplemented. */
ns_r_refused = 5, /* Operation refused. */
ns_r_noerror = 0, /*%< No error occurred. */
ns_r_formerr = 1, /*%< Format error. */
ns_r_servfail = 2, /*%< Server failure. */
ns_r_nxdomain = 3, /*%< Name error. */
ns_r_notimpl = 4, /*%< Unimplemented. */
ns_r_refused = 5, /*%< Operation refused. */
/* these are for BIND_UPDATE */
ns_r_yxdomain = 6, /* Name exists */
ns_r_yxrrset = 7, /* RRset exists */
ns_r_nxrrset = 8, /* RRset does not exist */
ns_r_notauth = 9, /* Not authoritative for zone */
ns_r_notzone = 10, /* Zone of record different from zone section */
ns_r_yxdomain = 6, /*%< Name exists */
ns_r_yxrrset = 7, /*%< RRset exists */
ns_r_nxrrset = 8, /*%< RRset does not exist */
ns_r_notauth = 9, /*%< Not authoritative for zone */
ns_r_notzone = 10, /*%< Zone of record different from zone section */
ns_r_max = 11,
/* The following are EDNS extended rcodes */
ns_r_badvers = 16,
@ -219,7 +219,7 @@ typedef enum __ns_update_operation {
ns_uop_max = 2
} ns_update_operation;
/*
/*%
* This structure is used for TSIG authenticated messages
*/
struct ns_tsig_key {
@ -229,7 +229,7 @@ struct ns_tsig_key {
};
typedef struct ns_tsig_key ns_tsig_key;
/*
/*%
* This structure is used for TSIG authenticated TCP messages
*/
struct ns_tcp_tsig_state {
@ -249,61 +249,61 @@ typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
#define NS_TSIG_ERROR_NO_SPACE -11
#define NS_TSIG_ERROR_FORMERR -12
/*
/*%
* Currently defined type values for resources and queries.
*/
typedef enum __ns_type {
ns_t_invalid = 0, /* Cookie. */
ns_t_a = 1, /* Host address. */
ns_t_ns = 2, /* Authoritative server. */
ns_t_md = 3, /* Mail destination. */
ns_t_mf = 4, /* Mail forwarder. */
ns_t_cname = 5, /* Canonical name. */
ns_t_soa = 6, /* Start of authority zone. */
ns_t_mb = 7, /* Mailbox domain name. */
ns_t_mg = 8, /* Mail group member. */
ns_t_mr = 9, /* Mail rename name. */
ns_t_null = 10, /* Null resource record. */
ns_t_wks = 11, /* Well known service. */
ns_t_ptr = 12, /* Domain name pointer. */
ns_t_hinfo = 13, /* Host information. */
ns_t_minfo = 14, /* Mailbox information. */
ns_t_mx = 15, /* Mail routing information. */
ns_t_txt = 16, /* Text strings. */
ns_t_rp = 17, /* Responsible person. */
ns_t_afsdb = 18, /* AFS cell database. */
ns_t_x25 = 19, /* X_25 calling address. */
ns_t_isdn = 20, /* ISDN calling address. */
ns_t_rt = 21, /* Router. */
ns_t_nsap = 22, /* NSAP address. */
ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
ns_t_sig = 24, /* Security signature. */
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_loc = 29, /* Location Information. */
ns_t_nxt = 30, /* Next domain (security). */
ns_t_eid = 31, /* Endpoint identifier. */
ns_t_nimloc = 32, /* Nimrod Locator. */
ns_t_srv = 33, /* Server Selection. */
ns_t_atma = 34, /* ATM Address */
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_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
ns_t_apl = 42, /* Address prefix list (RFC 3123) */
ns_t_tkey = 249, /* Transaction key */
ns_t_tsig = 250, /* Transaction signature. */
ns_t_ixfr = 251, /* Incremental zone transfer. */
ns_t_axfr = 252, /* Transfer zone of authority. */
ns_t_mailb = 253, /* Transfer mailbox records. */
ns_t_maila = 254, /* Transfer mail agent records. */
ns_t_any = 255, /* Wildcard match. */
ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
ns_t_invalid = 0, /*%< Cookie. */
ns_t_a = 1, /*%< Host address. */
ns_t_ns = 2, /*%< Authoritative server. */
ns_t_md = 3, /*%< Mail destination. */
ns_t_mf = 4, /*%< Mail forwarder. */
ns_t_cname = 5, /*%< Canonical name. */
ns_t_soa = 6, /*%< Start of authority zone. */
ns_t_mb = 7, /*%< Mailbox domain name. */
ns_t_mg = 8, /*%< Mail group member. */
ns_t_mr = 9, /*%< Mail rename name. */
ns_t_null = 10, /*%< Null resource record. */
ns_t_wks = 11, /*%< Well known service. */
ns_t_ptr = 12, /*%< Domain name pointer. */
ns_t_hinfo = 13, /*%< Host information. */
ns_t_minfo = 14, /*%< Mailbox information. */
ns_t_mx = 15, /*%< Mail routing information. */
ns_t_txt = 16, /*%< Text strings. */
ns_t_rp = 17, /*%< Responsible person. */
ns_t_afsdb = 18, /*%< AFS cell database. */
ns_t_x25 = 19, /*%< X_25 calling address. */
ns_t_isdn = 20, /*%< ISDN calling address. */
ns_t_rt = 21, /*%< Router. */
ns_t_nsap = 22, /*%< NSAP address. */
ns_t_nsap_ptr = 23, /*%< Reverse NSAP lookup (deprecated). */
ns_t_sig = 24, /*%< Security signature. */
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_loc = 29, /*%< Location Information. */
ns_t_nxt = 30, /*%< Next domain (security). */
ns_t_eid = 31, /*%< Endpoint identifier. */
ns_t_nimloc = 32, /*%< Nimrod Locator. */
ns_t_srv = 33, /*%< Server Selection. */
ns_t_atma = 34, /*%< ATM Address */
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_sink = 40, /*%< Kitchen sink (experimentatl) */
ns_t_opt = 41, /*%< EDNS0 option (meta-RR) */
ns_t_apl = 42, /*%< Address prefix list (RFC3123) */
ns_t_tkey = 249, /*%< Transaction key */
ns_t_tsig = 250, /*%< Transaction signature. */
ns_t_ixfr = 251, /*%< Incremental zone transfer. */
ns_t_axfr = 252, /*%< Transfer zone of authority. */
ns_t_mailb = 253, /*%< Transfer mailbox records. */
ns_t_maila = 254, /*%< Transfer mail agent records. */
ns_t_any = 255, /*%< Wildcard match. */
ns_t_zxfr = 256, /*%< BIND-specific, nonstandard. */
ns_t_max = 65536
} ns_type;
@ -318,61 +318,61 @@ typedef enum __ns_type {
#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
(t) == ns_t_zxfr)
/*
/*%
* Values for class field
*/
typedef enum __ns_class {
ns_c_invalid = 0, /* Cookie. */
ns_c_in = 1, /* Internet. */
ns_c_2 = 2, /* unallocated/unsupported. */
ns_c_chaos = 3, /* MIT Chaos-net. */
ns_c_hs = 4, /* MIT Hesiod. */
ns_c_invalid = 0, /*%< Cookie. */
ns_c_in = 1, /*%< Internet. */
ns_c_2 = 2, /*%< unallocated/unsupported. */
ns_c_chaos = 3, /*%< MIT Chaos-net. */
ns_c_hs = 4, /*%< MIT Hesiod. */
/* Query class values which do not appear in resource records */
ns_c_none = 254, /* for prereq. sections in update requests */
ns_c_any = 255, /* Wildcard match. */
ns_c_none = 254, /*%< for prereq. sections in update requests */
ns_c_any = 255, /*%< Wildcard match. */
ns_c_max = 65536
} ns_class;
/* DNSSEC constants. */
typedef enum __ns_key_types {
ns_kt_rsa = 1, /* key type RSA/MD5 */
ns_kt_dh = 2, /* Diffie Hellman */
ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */
ns_kt_private = 254 /* Private key type starts with OID */
ns_kt_rsa = 1, /*%< key type RSA/MD5 */
ns_kt_dh = 2, /*%< Diffie Hellman */
ns_kt_dsa = 3, /*%< Digital Signature Standard (MANDATORY) */
ns_kt_private = 254 /*%< Private key type starts with OID */
} ns_key_types;
typedef enum __ns_cert_types {
cert_t_pkix = 1, /* PKIX (X.509v3) */
cert_t_spki = 2, /* SPKI */
cert_t_pgp = 3, /* PGP */
cert_t_url = 253, /* URL private type */
cert_t_oid = 254 /* OID private type */
cert_t_pkix = 1, /*%< PKIX (X.509v3) */
cert_t_spki = 2, /*%< SPKI */
cert_t_pgp = 3, /*%< PGP */
cert_t_url = 253, /*%< URL private type */
cert_t_oid = 254 /*%< OID private type */
} ns_cert_types;
/* Flags field of the KEY RR rdata. */
#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */
#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
#define NS_KEY_TYPEMASK 0xC000 /*%< Mask for "type" bits */
#define NS_KEY_TYPE_AUTH_CONF 0x0000 /*%< Key usable for both */
#define NS_KEY_TYPE_CONF_ONLY 0x8000 /*%< Key usable for confidentiality */
#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /*%< Key usable for authentication */
#define NS_KEY_TYPE_NO_KEY 0xC000 /*%< No key usable for either; no key */
/* The type bits can also be interpreted independently, as single bits: */
#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */
#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */
#define NS_KEY_NO_AUTH 0x8000 /*%< Key unusable for authentication */
#define NS_KEY_NO_CONF 0x4000 /*%< Key unusable for confidentiality */
#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */
#define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */
#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */
#define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */
#define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */
#define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */
#define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */
#define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */
#define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */
#define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */
#define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */
#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */
#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */
#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */
#define NS_KEY_EXTENDED_FLAGS 0x1000 /*%< reserved - must be zero */
#define NS_KEY_RESERVED4 0x0800 /*%< reserved - must be zero */
#define NS_KEY_RESERVED5 0x0400 /*%< reserved - must be zero */
#define NS_KEY_NAME_TYPE 0x0300 /*%< these bits determine the type */
#define NS_KEY_NAME_USER 0x0000 /*%< key is assoc. with user */
#define NS_KEY_NAME_ENTITY 0x0200 /*%< key is assoc. with entity eg host */
#define NS_KEY_NAME_ZONE 0x0100 /*%< key is zone key */
#define NS_KEY_NAME_RESERVED 0x0300 /*%< reserved meaning */
#define NS_KEY_RESERVED8 0x0080 /*%< reserved - must be zero */
#define NS_KEY_RESERVED9 0x0040 /*%< reserved - must be zero */
#define NS_KEY_RESERVED10 0x0020 /*%< reserved - must be zero */
#define NS_KEY_RESERVED11 0x0010 /*%< reserved - must be zero */
#define NS_KEY_SIGNATORYMASK 0x000F /*%< key can sign RR's of same name */
#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
NS_KEY_RESERVED4 | \
NS_KEY_RESERVED5 | \
@ -380,16 +380,14 @@ typedef enum __ns_cert_types {
NS_KEY_RESERVED9 | \
NS_KEY_RESERVED10 | \
NS_KEY_RESERVED11 )
#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */
#define NS_KEY_RESERVED_BITMASK2 0xFFFF /*%< no bits defined here */
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
#define NS_ALG_MD5RSA 1 /* MD5 with RSA */
#define NS_ALG_DH 2 /* Diffie Hellman KEY */
#define NS_ALG_DSA 3 /* DSA KEY */
#define NS_ALG_MD5RSA 1 /*%< MD5 with RSA */
#define NS_ALG_DH 2 /*%< Diffie Hellman KEY */
#define NS_ALG_DSA 3 /*%< DSA KEY */
#define NS_ALG_DSS NS_ALG_DSA
#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */
#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */
#define NS_ALG_EXPIRE_ONLY 253 /*%< No alg, no security */
#define NS_ALG_PRIVATE_OID 254 /*%< Key begins with OID giving alg */
/* Protocol values */
/* value 0 is reserved */
#define NS_KEY_PROT_TLS 1
@ -399,7 +397,7 @@ typedef enum __ns_cert_types {
#define NS_KEY_PROT_ANY 255
/* Signatures */
#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */
#define NS_MD5RSA_MIN_BITS 512 /*%< Size of a mod or exp in bits */
#define NS_MD5RSA_MAX_BITS 4096
/* Total of binary mod and exp */
#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
@ -413,15 +411,14 @@ typedef enum __ns_cert_types {
#define NS_DSA_MAX_BYTES 405
/* Offsets into SIG record rdata to find various values */
#define NS_SIG_TYPE 0 /* Type flags */
#define NS_SIG_ALG 2 /* Algorithm */
#define NS_SIG_LABELS 3 /* How many labels in name */
#define NS_SIG_OTTL 4 /* Original TTL */
#define NS_SIG_EXPIR 8 /* Expiration time */
#define NS_SIG_SIGNED 12 /* Signature time */
#define NS_SIG_FOOT 16 /* Key footprint */
#define NS_SIG_SIGNER 18 /* Domain name of who signed it */
#define NS_SIG_TYPE 0 /*%< Type flags */
#define NS_SIG_ALG 2 /*%< Algorithm */
#define NS_SIG_LABELS 3 /*%< How many labels in name */
#define NS_SIG_OTTL 4 /*%< Original TTL */
#define NS_SIG_EXPIR 8 /*%< Expiration time */
#define NS_SIG_SIGNED 12 /*%< Signature time */
#define NS_SIG_FOOT 16 /*%< Key footprint */
#define NS_SIG_SIGNER 18 /*%< Domain name of who signed it */
/* How RR types are represented as bit-flags in NXT records */
#define NS_NXT_BITS 8
#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS)))
@ -429,12 +426,12 @@ typedef enum __ns_cert_types {
#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_MAX 127
/*
/*%
* EDNS0 extended flags, host order.
*/
#define NS_OPT_DNSSEC_OK 0x8000U
/*
/*%
* Inline versions of get/put short/long. Pointer is advanced.
*/
#define NS_GET16(s, cp) do { \
@ -473,7 +470,7 @@ typedef enum __ns_cert_types {
(cp) += NS_INT32SZ; \
} while (0)
/*
/*%
* ANSI C identifier hiding for bind's lib/nameser.
*/
#define ns_msg_getflag __ns_msg_getflag
@ -574,3 +571,4 @@ __END_DECLS
#endif
#endif /* !_ARPA_NAMESER_H_ */
/*! \file */

View File

@ -30,16 +30,15 @@
* SUCH DAMAGE.
*/
/*
/*%
* from nameser.h 8.1 (Berkeley) 6/2/93
* $Id: nameser_compat.h,v 1.1.2.3.4.3 2006/05/19 02:38:15 marka Exp $
* $Id: nameser_compat.h,v 1.5.18.3 2006/05/19 02:36:00 marka Exp $
*/
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
#define __BIND 19950621 /* (DEAD) interface version stamp. */
#define __BIND 19950621 /*%< (DEAD) interface version stamp. */
#ifndef BYTE_ORDER
#if (BSD >= 199103)
# include <machine/endian.h>
@ -47,10 +46,9 @@
#ifdef __linux
# include <endian.h>
#else
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
#define LITTLE_ENDIAN 1234 /*%< least-significant byte first (vax, pc) */
#define BIG_ENDIAN 4321 /*%< most-significant byte first (IBM, net) */
#define PDP_ENDIAN 3412 /*%< LSB first in word, MSW first in long (pdp) */
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
defined(__i386__) || defined(__i386) || defined(__amd64__) || \
defined(__x86_64__) || defined(MIPSEL) || defined(_MIPSEL) || \
@ -86,7 +84,7 @@
error "Undefined or invalid BYTE_ORDER";
#endif
/*
/*%
* 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
@ -94,40 +92,40 @@
*/
typedef struct {
unsigned id :16; /* query identification number */
unsigned id :16; /*%< query identification number */
#if BYTE_ORDER == BIG_ENDIAN
/* fields in third byte */
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 */
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 */
/* fields in fourth byte */
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 */
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 */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
/* fields in third byte */
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 */
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 */
/* fields in fourth byte */
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 */
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 */
#endif
/* remaining bytes */
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 */
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 */
} HEADER;
#define PACKETSZ NS_PACKETSZ
@ -231,3 +229,4 @@ typedef struct {
#define PUTLONG NS_PUT32
#endif /* _ARPA_NAMESER_COMPAT_ */
/*! \file */

View File

@ -16,34 +16,36 @@
*/
/*
* $Id: res_update.h,v 1.1.206.1 2004/03/09 08:33:29 marka Exp $
* $Id: res_update.h,v 1.2.18.1 2005/04/27 05:00:49 sra Exp $
*/
#ifndef __RES_UPDATE_H
#define __RES_UPDATE_H
/*! \file */
#include <sys/types.h>
#include <arpa/nameser.h>
#include <isc/list.h>
#include <resolv.h>
/*
/*%
* This RR-like structure is particular to UPDATE.
*/
struct ns_updrec {
LINK(struct ns_updrec) r_link, r_glink;
ns_sect r_section; /* ZONE/PREREQUISITE/UPDATE */
char * r_dname; /* owner of the RR */
ns_class r_class; /* class number */
ns_type r_type; /* type number */
u_int32_t r_ttl; /* time to live */
u_char * r_data; /* rdata fields as text string */
u_int r_size; /* size of r_data field */
int r_opcode; /* type of operation */
ns_sect r_section; /*%< ZONE/PREREQUISITE/UPDATE */
char * r_dname; /*%< owner of the RR */
ns_class r_class; /*%< class number */
ns_type r_type; /*%< type number */
u_int32_t r_ttl; /*%< time to live */
u_char * r_data; /*%< rdata fields as text string */
u_int r_size; /*%< size of r_data field */
int r_opcode; /*%< type of operation */
/* following fields for private use by the resolver/server routines */
struct databuf *r_dp; /* databuf to process */
struct databuf *r_deldp; /* databuf's deleted/overwritten */
u_int r_zone; /* zone number on server */
struct databuf *r_dp; /*%< databuf to process */
struct databuf *r_deldp; /*%< databuf's deleted/overwritten */
u_int r_zone; /*%< zone number on server */
};
typedef struct ns_updrec ns_updrec;
typedef LIST(ns_updrec) ns_updque;
@ -63,3 +65,5 @@ int res_nmkupdate __P((res_state, ns_updrec *, u_char *, int));
int res_nupdate __P((res_state, ns_updrec *, ns_tsig_key *));
#endif /*__RES_UPDATE_H*/
/*! \file */

View File

@ -48,9 +48,9 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
/*%
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
* $Id: resolv.h,v 1.7.2.11.4.3 2005/08/25 04:44:13 marka Exp $
* $Id: resolv.h,v 1.19.18.3 2005/08/25 04:43:51 marka Exp $
*/
#ifndef _RESOLV_H_
@ -67,7 +67,7 @@
#include <stdio.h>
#include <arpa/nameser.h>
/*
/*%
* Revision information. This is the release date in YYYYMMDD format.
* It can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__RES > 19931104)". Do not
@ -77,7 +77,7 @@
#define __RES 20030124
/*
/*%
* This used to be defined in res_query.c, now it's in herror.c.
* [XXX no it's not. It's in irs/irs_data.c]
* It was
@ -97,12 +97,12 @@
*/
#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
struct __res_state; /* forward */
struct __res_state; /*%< forward */
__BEGIN_DECLS
void __h_errno_set(struct __res_state *res, int err);
__END_DECLS
/*
/*%
* Resolver configuration file.
* Normally not present, but may contain the address of the
* initial name server(s) to query and the domain search list.
@ -132,70 +132,68 @@ typedef res_sendhookact (*res_send_rhook)__PMT((const struct sockaddr *,
int, int *));
struct res_sym {
int number; /* Identifying number, like T_MX */
const char * name; /* Its symbolic name, like "MX" */
const char * humanname; /* Its fun name, like "mail exchanger" */
int number; /*%< Identifying number, like T_MX */
const char * name; /*%< Its symbolic name, like "MX" */
const char * humanname; /*%< Its fun name, like "mail exchanger" */
};
/*
/*%
* Global defines and variables for resolver stub.
*/
#define MAXNS 3 /* max # name servers we'll track */
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define MAXRESOLVSORT 10 /* number of net to sort on */
#define RES_MAXNDOTS 15 /* should reflect bit field size */
#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */
#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */
#define RES_DFLRETRY 2 /* Default #/tries. */
#define RES_MAXTIME 65535 /* Infinity, in milliseconds. */
#define MAXNS 3 /*%< max # name servers we'll track */
#define MAXDFLSRCH 3 /*%< # default domain levels to try */
#define MAXDNSRCH 6 /*%< max # domains in search path */
#define LOCALDOMAINPARTS 2 /*%< min levels in name that is "local" */
#define RES_TIMEOUT 5 /*%< min. seconds between retries */
#define MAXRESOLVSORT 10 /*%< number of net to sort on */
#define RES_MAXNDOTS 15 /*%< should reflect bit field size */
#define RES_MAXRETRANS 30 /*%< only for resolv.conf/RES_OPTIONS */
#define RES_MAXRETRY 5 /*%< only for resolv.conf/RES_OPTIONS */
#define RES_DFLRETRY 2 /*%< Default #/tries. */
#define RES_MAXTIME 65535 /*%< Infinity, in milliseconds. */
struct __res_state_ext;
struct __res_state {
int retrans; /* retransmission time interval */
int retry; /* number of times to retransmit */
int retrans; /*%< retransmission time interval */
int retry; /*%< number of times to retransmit */
#ifdef sun
u_int options; /* option flags - see below. */
u_int options; /*%< option flags - see below. */
#else
u_long options; /* option flags - see below. */
u_long options; /*%< option flags - see below. */
#endif
int nscount; /* number of name servers */
int nscount; /*%< number of name servers */
struct sockaddr_in
nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
u_short id; /* current message id */
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
char defdname[256]; /* default domain (deprecated) */
nsaddr_list[MAXNS]; /*%< address of name server */
#define nsaddr nsaddr_list[0] /*%< for backward compatibility */
u_short id; /*%< current message id */
char *dnsrch[MAXDNSRCH+1]; /*%< components of domain to search */
char defdname[256]; /*%< default domain (deprecated) */
#ifdef sun
u_int pfcode; /* RES_PRF_ flags - see below. */
u_int pfcode; /*%< RES_PRF_ flags - see below. */
#else
u_long pfcode; /* RES_PRF_ flags - see below. */
u_long pfcode; /*%< RES_PRF_ flags - see below. */
#endif
unsigned ndots:4; /* threshold for initial abs. query */
unsigned nsort:4; /* number of elements in sort_list[] */
unsigned ndots:4; /*%< threshold for initial abs. query */
unsigned nsort:4; /*%< number of elements in sort_list[] */
char unused[3];
struct {
struct in_addr addr;
u_int32_t mask;
} sort_list[MAXRESOLVSORT];
res_send_qhook qhook; /* query hook */
res_send_rhook rhook; /* response hook */
int res_h_errno; /* last one set for this context */
int _vcsock; /* PRIVATE: for res_send VC i/o */
u_int _flags; /* PRIVATE: see below */
u_int _pad; /* make _u 64 bit aligned */
res_send_qhook qhook; /*%< query hook */
res_send_rhook rhook; /*%< response hook */
int res_h_errno; /*%< last one set for this context */
int _vcsock; /*%< PRIVATE: for res_send VC i/o */
u_int _flags; /*%< PRIVATE: see below */
u_int _pad; /*%< make _u 64 bit aligned */
union {
/* On an 32-bit arch this means 512b total. */
char pad[72 - 4*sizeof (int) - 2*sizeof (void *)];
struct {
u_int16_t nscount;
u_int16_t nstimes[MAXNS]; /* ms. */
u_int16_t nstimes[MAXNS]; /*%< ms. */
int nssocks[MAXNS];
struct __res_state_ext *ext; /* extention for IPv6 */
struct __res_state_ext *ext; /*%< extention for IPv6 */
} _ext;
} _u;
};
@ -208,62 +206,62 @@ union res_sockaddr_union {
struct sockaddr_in6 sin6;
#endif
#ifdef ISC_ALIGN64
int64_t __align64; /* 64bit alignment */
int64_t __align64; /*%< 64bit alignment */
#else
int32_t __align32; /* 32bit alignment */
int32_t __align32; /*%< 32bit alignment */
#endif
char __space[128]; /* max size */
char __space[128]; /*%< max size */
};
/*
/*%
* Resolver flags (used to be discrete per-module statics ints).
*/
#define RES_F_VC 0x00000001 /* socket is TCP */
#define RES_F_CONN 0x00000002 /* socket is connected */
#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */
#define RES_F__UNUSED 0x00000008 /* (unused) */
#define RES_F_LASTMASK 0x000000F0 /* ordinal server of last res_nsend */
#define RES_F_LASTSHIFT 4 /* bit position of LASTMASK "flag" */
#define RES_F_VC 0x00000001 /*%< socket is TCP */
#define RES_F_CONN 0x00000002 /*%< socket is connected */
#define RES_F_EDNS0ERR 0x00000004 /*%< EDNS0 caused errors */
#define RES_F__UNUSED 0x00000008 /*%< (unused) */
#define RES_F_LASTMASK 0x000000F0 /*%< ordinal server of last res_nsend */
#define RES_F_LASTSHIFT 4 /*%< bit position of LASTMASK "flag" */
#define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
/* res_findzonecut2() options */
#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */
#define RES_IPV4ONLY 0x00000002 /* IPv4 only */
#define RES_IPV6ONLY 0x00000004 /* IPv6 only */
#define RES_EXHAUSTIVE 0x00000001 /*%< always do all queries */
#define RES_IPV4ONLY 0x00000002 /*%< IPv4 only */
#define RES_IPV6ONLY 0x00000004 /*%< IPv6 only */
/*
/*%
* Resolver options (keep these in synch with res_debug.c, please)
*/
#define RES_INIT 0x00000001 /* address initialized */
#define RES_DEBUG 0x00000002 /* print debug messages */
#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
#define RES_USEVC 0x00000008 /* use virtual circuit */
#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
#define RES_IGNTC 0x00000020 /* ignore trucation errors */
#define RES_RECURSE 0x00000040 /* recursion desired */
#define RES_DEFNAMES 0x00000080 /* use default domain name */
#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
#define RES_DNSRCH 0x00000200 /* search up local domain tree */
#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
#define RES_ROTATE 0x00004000 /* rotate ns list after each query */
#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */
#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */
#define RES_BLAST 0x00020000 /* blast all recursive servers */
#define RES_NOTLDQUERY 0x00100000 /* don't unqualified name as a tld */
#define RES_USE_DNSSEC 0x00200000 /* use DNSSEC using OK bit in OPT */
#define RES_INIT 0x00000001 /*%< address initialized */
#define RES_DEBUG 0x00000002 /*%< print debug messages */
#define RES_AAONLY 0x00000004 /*%< authoritative answers only (!IMPL)*/
#define RES_USEVC 0x00000008 /*%< use virtual circuit */
#define RES_PRIMARY 0x00000010 /*%< query primary server only (!IMPL) */
#define RES_IGNTC 0x00000020 /*%< ignore trucation errors */
#define RES_RECURSE 0x00000040 /*%< recursion desired */
#define RES_DEFNAMES 0x00000080 /*%< use default domain name */
#define RES_STAYOPEN 0x00000100 /*%< Keep TCP socket open */
#define RES_DNSRCH 0x00000200 /*%< search up local domain tree */
#define RES_INSECURE1 0x00000400 /*%< type 1 security disabled */
#define RES_INSECURE2 0x00000800 /*%< type 2 security disabled */
#define RES_NOALIASES 0x00001000 /*%< shuts off HOSTALIASES feature */
#define RES_USE_INET6 0x00002000 /*%< use/map IPv6 in gethostbyname() */
#define RES_ROTATE 0x00004000 /*%< rotate ns list after each query */
#define RES_NOCHECKNAME 0x00008000 /*%< do not check names for sanity. */
#define RES_KEEPTSIG 0x00010000 /*%< do not strip TSIG records */
#define RES_BLAST 0x00020000 /*%< blast all recursive servers */
#define RES_NOTLDQUERY 0x00100000 /*%< don't unqualified name as a tld */
#define RES_USE_DNSSEC 0x00200000 /*%< use DNSSEC using OK bit in OPT */
/* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */
/* KAME extensions: use higher bit to avoid conflict with ISC use */
#define RES_USE_DNAME 0x10000000 /* use DNAME */
#define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */
#define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */
#define RES_USE_DNAME 0x10000000 /*%< use DNAME */
#define RES_USE_EDNS0 0x40000000 /*%< use EDNS0 if configured */
#define RES_NO_NIBBLE2 0x80000000 /*%< disable alternate nibble lookup */
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | \
RES_DNSRCH | RES_NO_NIBBLE2)
/*
/*%
* Resolver "pfcode" values. Used by dig.
*/
#define RES_PRF_STATS 0x00000001
@ -504,3 +502,4 @@ int res_getservers __P((res_state,
__END_DECLS
#endif /* !_RESOLV_H_ */
/*! \file */

View File

@ -18,7 +18,7 @@
/* eventlib.h - exported interfaces for eventlib
* vix 09sep95 [initial]
*
* $Id: eventlib.h,v 1.1.2.1.4.2 2005/07/28 07:43:18 marka Exp $
* $Id: eventlib.h,v 1.3.18.2 2005/07/28 07:38:07 marka Exp $
*/
#ifndef _EVENTLIB_H
@ -200,3 +200,5 @@ int evDefer __P((evContext, evWaitFunc, void *));
#endif
#endif /*_EVENTLIB_H*/
/*! \file */

View File

@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
static const char rcsid[] = "$Id: inet_addr.c,v 1.2.206.2 2004/03/17 00:29:45 marka Exp $";
static const char rcsid[] = "$Id: inet_addr.c,v 1.4.18.1 2005/04/27 05:00:52 sra Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -85,7 +85,7 @@ static const char rcsid[] = "$Id: inet_addr.c,v 1.2.206.2 2004/03/17 00:29:45 ma
#include "port_after.h"
/*
/*%
* Ascii internet address interpretation routine.
* The value returned is in network order.
*/
@ -98,7 +98,7 @@ inet_addr(const char *cp) {
return (INADDR_NONE);
}
/*
/*%
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.
* Returns 1 if the address is valid, 0 if not.
@ -179,22 +179,22 @@ inet_aton(const char *cp, struct in_addr *addr) {
*/
n = pp - parts + 1;
switch (n) {
case 1: /* a -- 32 bits */
case 1: /*%< a -- 32 bits */
break;
case 2: /* a.b -- 8.24 bits */
case 2: /*%< a.b -- 8.24 bits */
if (val > 0xffffffU)
return (0);
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
case 3: /*%< a.b.c -- 8.8.16 bits */
if (val > 0xffffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
case 4: /*%< a.b.c.d -- 8.8.8.8 bits */
if (val > 0xffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
@ -204,3 +204,5 @@ inet_aton(const char *cp, struct in_addr *addr) {
addr->s_addr = htonl(val);
return (1);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_cidr_ntop.c,v 1.1.2.1.8.4 2006/10/11 02:32:50 marka Exp $";
static const char rcsid[] = "$Id: inet_cidr_ntop.c,v 1.4.18.3 2006/10/11 02:32:47 marka Exp $";
#endif
#include "port_before.h"
@ -45,7 +45,7 @@ inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size);
static char *
inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size);
/*
/*%
* char *
* inet_cidr_ntop(af, src, bits, dst, size)
* convert network address from network to presentation format.
@ -92,7 +92,7 @@ decoct(const u_char *src, int bytes, char *dst, size_t size) {
return (dst - odst);
}
/*
/*%
* static char *
* inet_cidr_ntop_ipv4(src, bits, dst, size)
* convert IPv4 network address from network to presentation format.
@ -259,3 +259,5 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) {
strcpy(dst, tmp);
return (dst);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_cidr_pton.c,v 1.2.2.1.8.2 2004/03/17 00:29:46 marka Exp $";
static const char rcsid[] = "$Id: inet_cidr_pton.c,v 1.5.18.1 2005/04/27 05:00:53 sra Exp $";
#endif
#include "port_before.h"
@ -49,7 +49,7 @@ static int inet_cidr_pton_ipv6 __P((const char *src, u_char *dst,
static int getbits(const char *, int ipv6);
/*
/*%
* int
* inet_cidr_pton(af, src, dst, *bits)
* convert network address from presentation to network format.
@ -204,7 +204,7 @@ inet_cidr_pton_ipv6(const char *src, u_char *dst, int *pbits) {
inet_cidr_pton_ipv4(curtok, tp, &bits, 1) == 0) {
tp += NS_INADDRSZ;
saw_xdigit = 0;
break; /* '\0' was seen by inet_pton4(). */
break; /*%< '\\0' was seen by inet_pton4(). */
}
if (ch == '/') {
bits = getbits(src, 1);
@ -256,20 +256,22 @@ getbits(const char *src, int ipv6) {
int bits = 0;
char *cp, ch;
if (*src == '\0') /* syntax */
if (*src == '\0') /*%< syntax */
return (-2);
do {
ch = *src++;
cp = strchr(digits, ch);
if (cp == NULL) /* syntax */
if (cp == NULL) /*%< syntax */
return (-2);
bits *= 10;
bits += cp - digits;
if (bits == 0 && *src != '\0') /* no leading zeros */
if (bits == 0 && *src != '\0') /*%< no leading zeros */
return (-2);
if (bits > (ipv6 ? 128 : 32)) /* range error */
if (bits > (ipv6 ? 128 : 32)) /*%< range error */
return (-2);
} while (*src != '\0');
return (bits);
}
/*! \file */

View File

@ -43,7 +43,7 @@ static const char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
#include "port_after.h"
/*
/*%
* Return the local network address portion of an
* internet address; handles class a/b/c network
* number formats.
@ -61,3 +61,5 @@ inet_lnaof(in)
else
return ((i)&IN_CLASSC_HOST);
}
/*! \file */

View File

@ -43,7 +43,7 @@ static const char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
#include "port_after.h"
/*
/*%
* Formulate an Internet address from network + host. Used in
* building addresses stored in the ifnet structure.
*/
@ -64,3 +64,5 @@ inet_makeaddr(net, host)
a.s_addr = htonl(a.s_addr);
return (a);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.1.2.1.8.2 2006/06/20 02:53:07 marka Exp $";
static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.3.18.2 2006/06/20 02:51:32 marka Exp $";
#endif
#include "port_before.h"
@ -44,7 +44,7 @@ static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
static char * inet_net_ntop_ipv6 __P((const u_char *src, int bits,
char *dst, size_t size));
/*
/*%
* char *
* inet_net_ntop(af, src, bits, dst, size)
* convert network number from network to presentation format.
@ -73,7 +73,7 @@ inet_net_ntop(af, src, bits, dst, size)
}
}
/*
/*%
* static char *
* inet_net_ntop_ipv4(src, bits, dst, size)
* convert IPv4 network number from network to presentation format.
@ -148,7 +148,7 @@ inet_net_ntop_ipv4(src, bits, dst, size)
return (NULL);
}
/*
/*%
* static char *
* inet_net_ntop_ipv6(src, bits, fakebits, dst, size)
* convert IPv6 network number from network to presentation format.
@ -275,3 +275,5 @@ inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) {
errno = EMSGSIZE;
return (NULL);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.4.2.1.8.2 2004/03/17 00:29:47 marka Exp $";
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.1 2005/04/27 05:00:53 sra Exp $";
#endif
#include "port_before.h"
@ -42,7 +42,7 @@ static const char rcsid[] = "$Id: inet_net_pton.c,v 1.4.2.1.8.2 2004/03/17 00:29
# define SPRINTF(x) ((size_t)sprintf x)
#endif
/*
/*%
* static int
* inet_net_pton_ipv4(src, dst, size)
* convert IPv4 network number from presentation to network format.
@ -73,7 +73,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
if (size <= 0U)
goto emsgsize;
dirty = 0;
src++; /* skip x or X. */
src++; /*%< skip x or X. */
while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) {
if (isupper(ch))
ch = tolower(ch);
@ -90,7 +90,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
dirty = 0;
}
}
if (dirty) { /* Odd trailing nybble? */
if (dirty) { /*%< Odd trailing nybble? */
if (size-- <= 0U)
goto emsgsize;
*dst++ = (u_char) (tmp << 4);
@ -126,7 +126,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
if (ch == '/' && isascii((unsigned char)(src[0])) &&
isdigit((unsigned char)(src[0])) && dst > odst) {
/* CIDR width specifier. Nothing can follow it. */
ch = *src++; /* Skip over the /. */
ch = *src++; /*%< Skip over the /. */
bits = 0;
do {
n = strchr(digits, ch) - digits;
@ -149,15 +149,15 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
goto enoent;
/* If no CIDR spec was given, infer width from net class. */
if (bits == -1) {
if (*odst >= 240) /* Class E */
if (*odst >= 240) /*%< Class E */
bits = 32;
else if (*odst >= 224) /* Class D */
else if (*odst >= 224) /*%< Class D */
bits = 8;
else if (*odst >= 192) /* Class C */
else if (*odst >= 192) /*%< Class C */
bits = 24;
else if (*odst >= 128) /* Class B */
else if (*odst >= 128) /*%< Class B */
bits = 16;
else /* Class A */
else /*%< Class A */
bits = 8;
/* If imputed mask is narrower than specified octets, widen. */
if (bits < ((dst - odst) * 8))
@ -200,11 +200,11 @@ getbits(const char *src, int *bitsp) {
pch = strchr(digits, ch);
if (pch != NULL) {
if (n++ != 0 && val == 0) /* no leading zeros */
if (n++ != 0 && val == 0) /*%< no leading zeros */
return (0);
val *= 10;
val += (pch - digits);
if (val > 128) /* range */
if (val > 128) /*%< range */
return (0);
continue;
}
@ -231,16 +231,16 @@ getv4(const char *src, u_char *dst, int *bitsp) {
pch = strchr(digits, ch);
if (pch != NULL) {
if (n++ != 0 && val == 0) /* no leading zeros */
if (n++ != 0 && val == 0) /*%< no leading zeros */
return (0);
val *= 10;
val += (pch - digits);
if (val > 255) /* range */
if (val > 255) /*%< range */
return (0);
continue;
}
if (ch == '.' || ch == '/') {
if (dst - odst > 3) /* too many octets? */
if (dst - odst > 3) /*%< too many octets? */
return (0);
*dst++ = val;
if (ch == '/')
@ -253,7 +253,7 @@ getv4(const char *src, u_char *dst, int *bitsp) {
}
if (n == 0)
return (0);
if (dst - odst > 3) /* too many octets? */
if (dst - odst > 3) /*%< too many octets? */
return (0);
*dst++ = val;
return (1);
@ -322,7 +322,7 @@ inet_net_pton_ipv6(const char *src, u_char *dst, size_t size) {
tp += NS_INADDRSZ;
saw_xdigit = 0;
ipv4 = 1;
break; /* '\0' was seen by inet_pton4(). */
break; /*%< '\\0' was seen by inet_pton4(). */
}
if (ch == '/' && getbits(src, &bits) > 0)
break;
@ -378,7 +378,7 @@ inet_net_pton_ipv6(const char *src, u_char *dst, size_t size) {
return (-1);
}
/*
/*%
* int
* inet_net_pton(af, src, dst, size)
* convert network number from presentation to network format.
@ -403,3 +403,5 @@ inet_net_pton(int af, const char *src, void *dst, size_t size) {
return (-1);
}
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_neta.c,v 1.1.206.1 2004/03/09 08:33:33 marka Exp $";
static const char rcsid[] = "$Id: inet_neta.c,v 1.2.18.1 2005/04/27 05:00:53 sra Exp $";
#endif
#include "port_before.h"
@ -38,7 +38,7 @@ static const char rcsid[] = "$Id: inet_neta.c,v 1.1.206.1 2004/03/09 08:33:33 ma
# define SPRINTF(x) ((size_t)sprintf x)
#endif
/*
/*%
* char *
* inet_neta(src, dst, size)
* format a u_long network number into presentation format.
@ -85,3 +85,5 @@ inet_neta(src, dst, size)
errno = EMSGSIZE;
return (NULL);
}
/*! \file */

View File

@ -43,7 +43,7 @@ static const char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93";
#include "port_after.h"
/*
/*%
* Return the network number from an internet
* address; handles class a/b/c network #'s.
*/
@ -60,3 +60,5 @@ inet_netof(in)
else
return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
}
/*! \file */

View File

@ -44,7 +44,7 @@ static const char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
#include "port_after.h"
/*
/*%
* Internet network address interpretation routine.
* The library routines call this routine to interpret
* network numbers.
@ -102,3 +102,5 @@ inet_network(cp)
}
return (val);
}
/*! \file */

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: inet_ntoa.c,v 1.1 2001/03/29 06:31:38 marka Exp $";
static const char rcsid[] = "$Id: inet_ntoa.c,v 1.1.352.1 2005/04/27 05:00:54 sra Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -48,7 +48,7 @@ static const char rcsid[] = "$Id: inet_ntoa.c,v 1.1 2001/03/29 06:31:38 marka Ex
#include "port_after.h"
/*
/*%
* Convert network-format internet address
* to base 256 d.d.d.d representation.
*/
@ -60,3 +60,5 @@ inet_ntoa(struct in_addr in) {
(void) inet_ntop(AF_INET, &in, ret, sizeof ret);
return (ret);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_ntop.c,v 1.1.2.1.8.2 2005/11/03 23:08:40 marka Exp $";
static const char rcsid[] = "$Id: inet_ntop.c,v 1.3.18.2 2005/11/03 23:02:22 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -41,7 +41,7 @@ static const char rcsid[] = "$Id: inet_ntop.c,v 1.1.2.1.8.2 2005/11/03 23:08:40
# define SPRINTF(x) ((size_t)sprintf x)
#endif
/*
/*%
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
@ -203,3 +203,5 @@ inet_ntop6(src, dst, size)
strcpy(dst, tmp);
return (dst);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_pton.c,v 1.2.206.2 2005/07/28 07:43:18 marka Exp $";
static const char rcsid[] = "$Id: inet_pton.c,v 1.3.18.2 2005/07/28 07:38:07 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -30,7 +30,7 @@ static const char rcsid[] = "$Id: inet_pton.c,v 1.2.206.2 2005/07/28 07:43:18 ma
#include <errno.h>
#include "port_after.h"
/*
/*%
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
@ -188,7 +188,7 @@ inet_pton6(src, dst)
inet_pton4(curtok, tp) > 0) {
tp += NS_INADDRSZ;
seen_xdigits = 0;
break; /* '\0' was seen by inet_pton4(). */
break; /*%< '\\0' was seen by inet_pton4(). */
}
return (0);
}
@ -219,3 +219,5 @@ inet_pton6(src, dst)
memcpy(dst, tmp, NS_IN6ADDRSZ);
return (1);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: nsap_addr.c,v 1.2.206.2 2005/07/28 07:43:18 marka Exp $";
static const char rcsid[] = "$Id: nsap_addr.c,v 1.3.18.2 2005/07/28 07:38:08 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -107,3 +107,5 @@ inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
*ascii = '\0';
return (start);
}
/*! \file */

View File

@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
static const char rcsid[] = "$Id: ev_streams.c,v 1.2.206.2 2004/03/17 00:29:51 marka Exp $";
static const char rcsid[] = "$Id: ev_streams.c,v 1.4.18.1 2005/04/27 05:01:06 sra Exp $";
#endif
#include "port_before.h"
@ -304,3 +304,5 @@ readable(evContext opaqueCtx, void *uap, int fd, int evmask) {
if (str->ioDone <= 0 || str->ioDone == str->ioTotal)
done(opaqueCtx, str);
}
/*! \file */

View File

@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
static const char rcsid[] = "$Id: ev_timers.c,v 1.2.2.1.4.5 2004/03/17 02:39:13 marka Exp $";
static const char rcsid[] = "$Id: ev_timers.c,v 1.5.18.1 2005/04/27 05:01:06 sra Exp $";
#endif
/* Import. */
@ -495,3 +495,5 @@ idle_timeout(evContext opaqueCtx,
this->timer->inter = evSubTime(this->max_idle, idle);
}
}
/*! \file */

View File

@ -15,10 +15,11 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* eventlib_p.h - private interfaces for eventlib
* vix 09sep95 [initial]
/*! \file
* \brief private interfaces for eventlib
* \author vix 09sep95 [initial]
*
* $Id: eventlib_p.h,v 1.3.2.1.4.4 2006/03/10 00:17:21 marka Exp $
* $Id: eventlib_p.h,v 1.5.18.4 2006/03/10 00:20:08 marka Exp $
*/
#ifndef _EVENTLIB_P_H
@ -77,9 +78,9 @@ typedef struct evConn {
void * uap;
int fd;
int flags;
#define EV_CONN_LISTEN 0x0001 /* Connection is a listener. */
#define EV_CONN_SELECTED 0x0002 /* evSelectFD(conn->file). */
#define EV_CONN_BLOCK 0x0004 /* Listener fd was blocking. */
#define EV_CONN_LISTEN 0x0001 /*%< Connection is a listener. */
#define EV_CONN_SELECTED 0x0002 /*%< evSelectFD(conn->file). */
#define EV_CONN_BLOCK 0x0004 /*%< Listener fd was blocking. */
evFileID file;
struct evConn * prev;
struct evConn * next;
@ -126,7 +127,7 @@ typedef struct evStream {
evFileID file;
evTimerID timer;
int flags;
#define EV_STR_TIMEROK 0x0001 /* IFF timer valid. */
#define EV_STR_TIMEROK 0x0001 /*%< IFF timer valid. */
int fd;
struct iovec * iovOrig;
int iovOrigCount;

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_name.c,v 1.3.2.4.4.2 2004/05/04 03:27:47 marka Exp $";
static const char rcsid[] = "$Id: ns_name.c,v 1.8.18.2 2005/04/27 05:01:08 sra Exp $";
#endif
#include "port_before.h"
@ -41,7 +41,7 @@ static const char rcsid[] = "$Id: ns_name.c,v 1.3.2.4.4.2 2004/05/04 03:27:47 ma
# define SPRINTF(x) ((size_t)sprintf x)
#endif
#define NS_TYPE_ELT 0x40 /* EDNS0 extended label type */
#define NS_TYPE_ELT 0x40 /*%< EDNS0 extended label type */
#define DNS_LABELTYPE_BITSTRING 0x41
/* Data. */
@ -83,14 +83,15 @@ static int decode_bitstring(const unsigned char **,
/* Public. */
/*
* ns_name_ntop(src, dst, dstsiz)
/*%
* Convert an encoded domain name to printable ascii as per RFC1035.
* return:
* Number of bytes written to buffer, or -1 (with errno set)
*\li Number of bytes written to buffer, or -1 (with errno set)
*
* notes:
* The root is returned as "."
* All other domains are returned in non absolute form
*\li The root is returned as "."
*\li All other domains are returned in non absolute form
*/
int
ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
@ -119,7 +120,7 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
*dn++ = '.';
}
if ((l = labellen(cp - 1)) < 0) {
errno = EMSGSIZE; /* XXX */
errno = EMSGSIZE; /*%< XXX */
return(-1);
}
if (dn + l >= eom) {
@ -184,15 +185,17 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
return (dn - dst);
}
/*
* ns_name_pton(src, dst, dstsiz)
/*%
* Convert a ascii string into an encoded domain name as per RFC1035.
*
* return:
* -1 if it fails
* 1 if string was fully qualified
* 0 is string was not fully qualified
*
*\li -1 if it fails
*\li 1 if string was fully qualified
*\li 0 is string was not fully qualified
*
* notes:
* Enforces label and domain length limits.
*\li Enforces label and domain length limits.
*/
int
@ -209,9 +212,9 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
while ((c = *src++) != 0) {
if (escaped) {
if (c == '[') { /* start a bit string label */
if (c == '[') { /*%< start a bit string label */
if ((cp = strchr(src, ']')) == NULL) {
errno = EINVAL; /* ??? */
errno = EINVAL; /*%< ??? */
return(-1);
}
if ((e = encode_bitsring(&src, cp + 2,
@ -256,7 +259,7 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
continue;
} else if (c == '.') {
c = (bp - label - 1);
if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
errno = EMSGSIZE;
return (-1);
}
@ -294,7 +297,7 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
*bp++ = (u_char)c;
}
c = (bp - label - 1);
if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
errno = EMSGSIZE;
return (-1);
}
@ -311,20 +314,21 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
}
*bp++ = 0;
}
if ((bp - dst) > MAXCDNAME) { /* src too big */
if ((bp - dst) > MAXCDNAME) { /*%< src too big */
errno = EMSGSIZE;
return (-1);
}
return (0);
}
/*
* ns_name_ntol(src, dst, dstsiz)
/*%
* Convert a network strings labels into all lowercase.
*
* return:
* Number of bytes written to buffer, or -1 (with errno set)
*\li Number of bytes written to buffer, or -1 (with errno set)
*
* notes:
* Enforces label and domain length limits.
*\li Enforces label and domain length limits.
*/
int
@ -371,11 +375,11 @@ ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz)
return (dn - dst);
}
/*
* ns_name_unpack(msg, eom, src, dst, dstsiz)
/*%
* Unpack a domain name from a message, source may be compressed.
*
* return:
* -1 if it fails, or consumed octets if it succeeds.
*\li -1 if it fails, or consumed octets if it succeeds.
*/
int
ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
@ -424,7 +428,7 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
if (len < 0)
len = srcp - src + 1;
srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff));
if (srcp < msg || srcp >= eom) { /* Out of range. */
if (srcp < msg || srcp >= eom) { /*%< Out of range. */
errno = EMSGSIZE;
return (-1);
}
@ -442,7 +446,7 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
default:
errno = EMSGSIZE;
return (-1); /* flag error */
return (-1); /*%< flag error */
}
}
*dstp = '\0';
@ -451,19 +455,21 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
return (len);
}
/*
* ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr)
/*%
* Pack domain name 'domain' into 'comp_dn'.
*
* return:
* Size of the compressed name, or -1.
*\li Size of the compressed name, or -1.
*
* notes:
* 'dnptrs' is an array of pointers to previous compressed names.
* dnptrs[0] is a pointer to the beginning of the message. The array
*\li 'dnptrs' is an array of pointers to previous compressed names.
*\li dnptrs[0] is a pointer to the beginning of the message. The array
* ends with NULL.
* 'lastdnptr' is a pointer to the end of the array pointed to
*\li 'lastdnptr' is a pointer to the end of the array pointed to
* by 'dnptrs'.
*
* Side effects:
* The list of pointers in dnptrs is updated for labels inserted into
*\li The list of pointers in dnptrs is updated for labels inserted into
* the message as we compress the name. If 'dnptr' is NULL, we don't
* try to compress names. If 'lastdnptr' is NULL, we don't update the
* list.
@ -485,7 +491,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
if ((msg = *dnptrs++) != NULL) {
for (cpp = dnptrs; *cpp != NULL; cpp++)
(void)NULL;
lpp = cpp; /* end of list to search */
lpp = cpp; /*%< end of list to search */
}
} else
msg = NULL;
@ -560,13 +566,14 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
return (dstp - dst);
}
/*
* ns_name_uncompress(msg, eom, src, dst, dstsiz)
/*%
* Expand compressed domain name to presentation format.
*
* return:
* Number of bytes read out of `src', or -1 (with errno set).
*\li Number of bytes read out of `src', or -1 (with errno set).
*
* note:
* Root domain returns as "." not "".
*\li Root domain returns as "." not "".
*/
int
ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
@ -582,18 +589,19 @@ ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
return (n);
}
/*
* ns_name_compress(src, dst, dstsiz, dnptrs, lastdnptr)
/*%
* Compress a domain name into wire format, using compression pointers.
*
* return:
* Number of bytes consumed in `dst' or -1 (with errno set).
*\li Number of bytes consumed in `dst' or -1 (with errno set).
*
* notes:
* 'dnptrs' is an array of pointers to previous compressed names.
* dnptrs[0] is a pointer to the beginning of the message.
* The list ends with NULL. 'lastdnptr' is a pointer to the end of the
*\li 'dnptrs' is an array of pointers to previous compressed names.
*\li dnptrs[0] is a pointer to the beginning of the message.
*\li The list ends with NULL. 'lastdnptr' is a pointer to the end of the
* array pointed to by 'dnptrs'. Side effect is to update the list of
* pointers for labels inserted into the message as we compress the name.
* If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
*\li If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
* is NULL, we don't update the list.
*/
int
@ -607,7 +615,7 @@ ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
}
/*
/*%
* Reset dnptrs so that there are no active references to pointers at or
* after src.
*/
@ -624,11 +632,11 @@ ns_name_rollback(const u_char *src, const u_char **dnptrs,
}
}
/*
* ns_name_skip(ptrptr, eom)
/*%
* Advance *ptrptr to skip over the compressed name it points at.
*
* return:
* 0 on success, -1 (with errno set) on failure.
*\li 0 on success, -1 (with errno set) on failure.
*/
int
ns_name_skip(const u_char **ptrptr, const u_char *eom)
@ -641,20 +649,20 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom)
while (cp < eom && (n = *cp++) != 0) {
/* Check for indirection. */
switch (n & NS_CMPRSFLGS) {
case 0: /* normal case, n == len */
case 0: /*%< normal case, n == len */
cp += n;
continue;
case NS_TYPE_ELT: /* EDNS0 extended label */
case NS_TYPE_ELT: /*%< EDNS0 extended label */
if ((l = labellen(cp - 1)) < 0) {
errno = EMSGSIZE; /* XXX */
errno = EMSGSIZE; /*%< XXX */
return(-1);
}
cp += l;
continue;
case NS_CMPRSFLGS: /* indirection */
case NS_CMPRSFLGS: /*%< indirection */
cp++;
break;
default: /* illegal type */
default: /*%< illegal type */
errno = EMSGSIZE;
return (-1);
}
@ -670,44 +678,44 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom)
/* Private. */
/*
* special(ch)
/*%
* Thinking in noninternationalized USASCII (per the DNS spec),
* is this characted special ("in need of quoting") ?
*
* return:
* boolean.
*\li boolean.
*/
static int
special(int ch) {
switch (ch) {
case 0x22: /* '"' */
case 0x2E: /* '.' */
case 0x3B: /* ';' */
case 0x5C: /* '\\' */
case 0x28: /* '(' */
case 0x29: /* ')' */
case 0x22: /*%< '"' */
case 0x2E: /*%< '.' */
case 0x3B: /*%< ';' */
case 0x5C: /*%< '\\' */
case 0x28: /*%< '(' */
case 0x29: /*%< ')' */
/* Special modifiers in zone files. */
case 0x40: /* '@' */
case 0x24: /* '$' */
case 0x40: /*%< '@' */
case 0x24: /*%< '$' */
return (1);
default:
return (0);
}
}
/*
* printable(ch)
/*%
* Thinking in noninternationalized USASCII (per the DNS spec),
* is this character visible and not a space when printed ?
*
* return:
* boolean.
*\li boolean.
*/
static int
printable(int ch) {
return (ch > 0x20 && ch < 0x7f);
}
/*
/*%
* Thinking in noninternationalized USASCII (per the DNS spec),
* convert this character to lower case if it's upper case.
*/
@ -718,14 +726,15 @@ mklower(int ch) {
return (ch);
}
/*
* dn_find(domain, msg, dnptrs, lastdnptr)
/*%
* Search for the counted-label name in an array of compressed names.
*
* return:
* offset from msg if found, or -1.
*\li offset from msg if found, or -1.
*
* notes:
* dnptrs is the pointer to the first name on the list,
* not the pointer to the start of the message.
*\li dnptrs is the pointer to the first name on the list,
*\li not the pointer to the start of the message.
*/
static int
dn_find(const u_char *domain, const u_char *msg,
@ -753,9 +762,8 @@ dn_find(const u_char *domain, const u_char *msg,
* check for indirection
*/
switch (n & NS_CMPRSFLGS) {
case 0: /* normal case, n == len */
n = labellen(cp - 1); /* XXX */
case 0: /*%< normal case, n == len */
n = labellen(cp - 1); /*%< XXX */
if (n != *dn++)
goto next;
@ -769,11 +777,11 @@ dn_find(const u_char *domain, const u_char *msg,
if (*dn)
continue;
goto next;
case NS_CMPRSFLGS: /* indirection */
case NS_CMPRSFLGS: /*%< indirection */
cp = msg + (((n & 0x3f) << 8) | *cp);
break;
default: /* illegal type */
default: /*%< illegal type */
errno = EMSGSIZE;
return (-1);
}
@ -855,12 +863,12 @@ encode_bitsring(const char **bp, const char *end, unsigned char **labelp,
/* XXX: currently, only hex strings are supported */
if (*cp++ != 'x')
return(EINVAL);
if (!isxdigit((*cp) & 0xff)) /* reject '\[x/BLEN]' */
if (!isxdigit((*cp) & 0xff)) /*%< reject '\[x/BLEN]' */
return(EINVAL);
for (tp = *dst + 1; cp < end && tp < eom; cp++) {
switch((c = *cp)) {
case ']': /* end of the bitstring */
case ']': /*%< end of the bitstring */
if (afterslash) {
if (beg_blen == NULL)
return(EINVAL);
@ -870,7 +878,7 @@ encode_bitsring(const char **bp, const char *end, unsigned char **labelp,
}
if (count)
*tp++ = ((value << 4) & 0xff);
cp++; /* skip ']' */
cp++; /*%< skip ']' */
goto done;
case '/':
afterslash = 1;
@ -914,14 +922,14 @@ encode_bitsring(const char **bp, const char *end, unsigned char **labelp,
* MUST be just sufficient to contain the number of bits specified
* by the <length>. If there are insignificant bits in a final
* hexadecimal or octal digit, they MUST be zero.
* RFC 2673, Section 3.2.
* RFC2673, Section 3.2.
*/
if (blen > 0) {
int traillen;
if (((blen + 3) & ~3) != tbcount)
return(EINVAL);
traillen = tbcount - blen; /* between 0 and 3 */
traillen = tbcount - blen; /*%< between 0 and 3 */
if (((value << (8 - traillen)) & 0xff) != 0)
return(EINVAL);
}
@ -957,7 +965,9 @@ labellen(const u_char *lp)
bitlen = 256;
return((bitlen + 7 ) / 8 + 1);
}
return(-1); /* unknwon ELT */
return(-1); /*%< unknwon ELT */
}
return(l);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_netint.c,v 1.1.206.1 2004/03/09 08:33:44 marka Exp $";
static const char rcsid[] = "$Id: ns_netint.c,v 1.2.18.1 2005/04/27 05:01:08 sra Exp $";
#endif
/* Import. */
@ -54,3 +54,5 @@ void
ns_put32(u_long src, u_char *dst) {
NS_PUT32(src, dst);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_parse.c,v 1.3.2.1.4.3 2005/10/11 00:48:16 marka Exp $";
static const char rcsid[] = "$Id: ns_parse.c,v 1.5.18.3 2005/10/11 00:25:10 marka Exp $";
#endif
/* Import. */
@ -51,22 +51,22 @@ static void setsection(ns_msg *msg, ns_sect sect);
/* These need to be in the same order as the nres.h:ns_flag enum. */
struct _ns_flagdata _ns_flagdata[16] = {
{ 0x8000, 15 }, /* qr. */
{ 0x7800, 11 }, /* opcode. */
{ 0x0400, 10 }, /* aa. */
{ 0x0200, 9 }, /* tc. */
{ 0x0100, 8 }, /* rd. */
{ 0x0080, 7 }, /* ra. */
{ 0x0040, 6 }, /* z. */
{ 0x0020, 5 }, /* ad. */
{ 0x0010, 4 }, /* cd. */
{ 0x000f, 0 }, /* rcode. */
{ 0x0000, 0 }, /* expansion (1/6). */
{ 0x0000, 0 }, /* expansion (2/6). */
{ 0x0000, 0 }, /* expansion (3/6). */
{ 0x0000, 0 }, /* expansion (4/6). */
{ 0x0000, 0 }, /* expansion (5/6). */
{ 0x0000, 0 }, /* expansion (6/6). */
{ 0x8000, 15 }, /*%< qr. */
{ 0x7800, 11 }, /*%< opcode. */
{ 0x0400, 10 }, /*%< aa. */
{ 0x0200, 9 }, /*%< tc. */
{ 0x0100, 8 }, /*%< rd. */
{ 0x0080, 7 }, /*%< ra. */
{ 0x0040, 6 }, /*%< z. */
{ 0x0020, 5 }, /*%< ad. */
{ 0x0010, 4 }, /*%< cd. */
{ 0x000f, 0 }, /*%< rcode. */
{ 0x0000, 0 }, /*%< expansion (1/6). */
{ 0x0000, 0 }, /*%< expansion (2/6). */
{ 0x0000, 0 }, /*%< expansion (3/6). */
{ 0x0000, 0 }, /*%< expansion (4/6). */
{ 0x0000, 0 }, /*%< expansion (5/6). */
{ 0x0000, 0 }, /*%< expansion (6/6). */
};
int ns_msg_getflag(ns_msg handle, int flag) {
@ -207,3 +207,5 @@ setsection(ns_msg *msg, ns_sect sect) {
msg->_msg_ptr = msg->_sections[(int)sect];
}
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_print.c,v 1.3.2.1.4.7 2004/09/16 07:01:12 marka Exp $";
static const char rcsid[] = "$Id: ns_print.c,v 1.6.18.4 2005/04/27 05:01:09 sra Exp $";
#endif
/* Import. */
@ -69,12 +69,11 @@ static int addtab(size_t len, size_t target, int spaced,
/* Public. */
/*
* int
* ns_sprintrr(handle, rr, name_ctx, origin, buf, buflen)
/*%
* Convert an RR to presentation format.
*
* return:
* Number of characters written to buf, or -1 (check errno).
*\li Number of characters written to buf, or -1 (check errno).
*/
int
ns_sprintrr(const ns_msg *handle, const ns_rr *rr,
@ -90,13 +89,11 @@ ns_sprintrr(const ns_msg *handle, const ns_rr *rr,
return (n);
}
/*
* int
* ns_sprintrrf(msg, msglen, name, class, type, ttl, rdata, rdlen,
* name_ctx, origin, buf, buflen)
/*%
* Convert the fields of an RR into presentation format.
*
* return:
* Number of characters written to buf, or -1 (check errno).
*\li Number of characters written to buf, or -1 (check errno).
*/
int
ns_sprintrrf(const u_char *msg, size_t msglen,
@ -645,10 +642,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
T(len = addname(msg, msglen, &rdata, origin, &buf, &buflen));
T(addstr(" ", 1, &buf, &buflen));
rdata += 8; /* time */
rdata += 8; /*%< time */
n = ns_get16(rdata); rdata += INT16SZ;
rdata += n; /* sig */
n = ns_get16(rdata); rdata += INT16SZ; /* original id */
rdata += n; /*%< sig */
n = ns_get16(rdata); rdata += INT16SZ; /*%< original id */
sprintf(buf, "%d", ns_get16(rdata));
rdata += INT16SZ;
addlen(strlen(buf), &buf, &buflen);
@ -735,7 +732,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
/* Private. */
/*
/*%
* size_t
* prune_origin(name, origin)
* Find out if the name is at or under the current origin.
@ -768,7 +765,7 @@ prune_origin(const char *name, const char *origin) {
return (name - oname);
}
/*
/*%
* int
* charstr(rdata, edata, buf, buflen)
* Format a <character-string> into the presentation buffer.
@ -824,7 +821,7 @@ addname(const u_char *msg, size_t msglen,
n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen);
if (n < 0)
goto enospc; /* Guess. */
goto enospc; /*%< Guess. */
newlen = prune_origin(*buf, origin);
if (**buf == '\0') {
goto root;
@ -896,3 +893,5 @@ addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) {
}
return (spaced);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:17 marka Exp $";
static const char rcsid[] = "$Id: ns_samedomain.c,v 1.5.18.1 2005/04/27 05:01:09 sra Exp $";
#endif
#include "port_before.h"
@ -28,21 +28,22 @@ static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34
#include "port_after.h"
/*
* int
* ns_samedomain(a, b)
/*%
* Check whether a name belongs to a domain.
*
* Inputs:
* a - the domain whose ancestory is being verified
* b - the potential ancestor we're checking against
*\li a - the domain whose ancestory is being verified
*\li b - the potential ancestor we're checking against
*
* Return:
* boolean - is a at or below b?
*\li boolean - is a at or below b?
*
* Notes:
* Trailing dots are first removed from name and domain.
*\li Trailing dots are first removed from name and domain.
* Always compare complete subdomains, not only whether the
* domain name is the trailing string of the given name.
*
* "host.foobar.top" lies in "foobar.top" and in "top" and in ""
*\li "host.foobar.top" lies in "foobar.top" and in "top" and in ""
* but NOT in "bar.top"
*/
@ -140,9 +141,7 @@ ns_samedomain(const char *a, const char *b) {
return (strncasecmp(cp, b, lb) == 0);
}
/*
* int
* ns_subdomain(a, b)
/*%
* is "a" a subdomain of "b"?
*/
int
@ -150,30 +149,31 @@ ns_subdomain(const char *a, const char *b) {
return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
}
/*
* int
* ns_makecanon(src, dst, dstsize)
/*%
* make a canonical copy of domain name "src"
*
* notes:
* \code
* foo -> foo.
* foo. -> foo.
* foo.. -> foo.
* foo\. -> foo\..
* foo\\. -> foo\\.
* \endcode
*/
int
ns_makecanon(const char *src, char *dst, size_t dstsize) {
size_t n = strlen(src);
if (n + sizeof "." > dstsize) { /* Note: sizeof == 2 */
if (n + sizeof "." > dstsize) { /*%< Note: sizeof == 2 */
errno = EMSGSIZE;
return (-1);
}
strcpy(dst, src);
while (n >= 1U && dst[n - 1] == '.') /* Ends in "." */
if (n >= 2U && dst[n - 2] == '\\' && /* Ends in "\." */
(n < 3U || dst[n - 3] != '\\')) /* But not "\\." */
while (n >= 1U && dst[n - 1] == '.') /*%< Ends in "." */
if (n >= 2U && dst[n - 2] == '\\' && /*%< Ends in "\." */
(n < 3U || dst[n - 3] != '\\')) /*%< But not "\\." */
break;
else
dst[--n] = '\0';
@ -182,14 +182,13 @@ ns_makecanon(const char *src, char *dst, size_t dstsize) {
return (0);
}
/*
* int
* ns_samename(a, b)
/*%
* determine whether domain name "a" is the same as domain name "b"
*
* return:
* -1 on error
* 0 if names differ
* 1 if names are the same
*\li -1 on error
*\li 0 if names differ
*\li 1 if names are the same
*/
int
@ -204,3 +203,5 @@ ns_samename(const char *a, const char *b) {
else
return (0);
}
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_ttl.c,v 1.1.206.2 2005/07/28 07:43:21 marka Exp $";
static const char rcsid[] = "$Id: ns_ttl.c,v 1.2.18.2 2005/07/28 07:38:10 marka Exp $";
#endif
/* Import. */
@ -158,3 +158,5 @@ fmt1(int t, char s, char **buf, size_t *buflen) {
*buflen -= len;
return (0);
}
/*! \file */

View File

@ -50,7 +50,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: herror.c,v 1.2.206.1 2004/03/09 08:33:54 marka Exp $";
static const char rcsid[] = "$Id: herror.c,v 1.3.18.1 2005/04/27 05:01:09 sra Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -72,10 +72,10 @@ static const char rcsid[] = "$Id: herror.c,v 1.2.206.1 2004/03/09 08:33:54 marka
const char *h_errlist[] = {
"Resolver Error 0 (no error)",
"Unknown host", /* 1 HOST_NOT_FOUND */
"Host name lookup failure", /* 2 TRY_AGAIN */
"Unknown server error", /* 3 NO_RECOVERY */
"No address associated with name", /* 4 NO_ADDRESS */
"Unknown host", /*%< 1 HOST_NOT_FOUND */
"Host name lookup failure", /*%< 2 TRY_AGAIN */
"Unknown server error", /*%< 3 NO_RECOVERY */
"No address associated with name", /*%< 4 NO_ADDRESS */
};
int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
@ -84,7 +84,7 @@ int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
int h_errno;
#endif
/*
/*%
* herror --
* print the error indicated by the h_errno value.
*/
@ -113,7 +113,7 @@ herror(const char *s) {
writev(STDERR_FILENO, iov, (v - iov) + 1);
}
/*
/*%
* hstrerror --
* return the string associated with a given "host" errno value.
*/
@ -125,3 +125,5 @@ hstrerror(int err) {
return (h_errlist[err]);
return ("Unknown resolver error");
}
/*! \file */

View File

@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_comp.c,v 1.1.2.1.4.2 2005/07/28 07:43:22 marka Exp $";
static const char rcsid[] = "$Id: res_comp.c,v 1.3.18.2 2005/07/28 07:38:11 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -85,12 +85,13 @@ static const char rcsid[] = "$Id: res_comp.c,v 1.1.2.1.4.2 2005/07/28 07:43:22 m
#include <unistd.h>
#include "port_after.h"
/*
/*%
* Expand compressed domain name 'src' to full domain name.
* 'msg' is a pointer to the begining of the message,
* 'eom' points to the first location after the message,
* 'dst' is a pointer to a buffer of size 'dstsiz' for the result.
* Return size of compressed name or -1 if there was an error.
*
* \li 'msg' is a pointer to the begining of the message,
* \li 'eom' points to the first location after the message,
* \li 'dst' is a pointer to a buffer of size 'dstsiz' for the result.
* \li Return size of compressed name or -1 if there was an error.
*/
int
dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
@ -103,10 +104,11 @@ dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
return (n);
}
/*
/*%
* Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
* Return the size of the compressed name or -1.
* 'length' is the size of the array pointed to by 'comp_dn'.
*
* \li Return the size of the compressed name or -1.
* \li 'length' is the size of the array pointed to by 'comp_dn'.
*/
int
dn_comp(const char *src, u_char *dst, int dstsiz,
@ -117,7 +119,7 @@ dn_comp(const char *src, u_char *dst, int dstsiz,
(const u_char **)lastdnptr));
}
/*
/*%
* Skip over a compressed domain name. Return the size or -1.
*/
int
@ -129,11 +131,9 @@ dn_skipname(const u_char *ptr, const u_char *eom) {
return (ptr - saveptr);
}
/*
/*%
* Verify that a domain name uses an acceptable character set.
*/
/*
*
* Note the conspicuous absence of ctype macros in these definitions. On
* non-ASCII hosts, we can't depend on string literals or ctype macros to
* tell us anything about network-format data. The rest of the BIND system
@ -176,7 +176,7 @@ res_hnok(const char *dn) {
return (1);
}
/*
/*%
* hostname-like (A, MX, WKS) owners can have "*" as their first label
* but must otherwise be as a host name.
*/
@ -191,7 +191,7 @@ res_ownok(const char *dn) {
return (res_hnok(dn));
}
/*
/*%
* SOA RNAMEs and RP RNAMEs can have any printable character in their first
* label, but the rest of the name has to look like a host name.
*/
@ -219,8 +219,8 @@ res_mailok(const char *dn) {
return (0);
}
/*
* This function is quite liberal, since RFC 1034's character sets are only
/*%
* This function is quite liberal, since RFC1034's character sets are only
* recommendations.
*/
int
@ -234,7 +234,7 @@ res_dnok(const char *dn) {
}
#ifdef BIND_4_COMPAT
/*
/*%
* This module must export the following externally-visible symbols:
* ___putlong
* ___putshort
@ -261,3 +261,5 @@ u_int32_t _getlong(const u_char *src) { return (ns_get32(src)); }
u_int16_t _getshort(const u_char *src) { return (ns_get16(src)); }
#endif /*__ultrix__*/
#endif /*BIND_4_COMPAT*/
/*! \file */

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: res_data.c,v 1.1.206.2 2004/03/16 12:34:18 marka Exp $";
static const char rcsid[] = "$Id: res_data.c,v 1.3.18.1 2005/04/27 05:01:10 sra Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -46,8 +46,8 @@ const char *_res_opcodes[] = {
"QUERY",
"IQUERY",
"CQUERYM",
"CQUERYU", /* experimental */
"NOTIFY", /* experimental */
"CQUERYU", /*%< experimental */
"NOTIFY", /*%< experimental */
"UPDATE",
"6",
"7",
@ -73,7 +73,7 @@ const char *_res_sectioncodes[] = {
#ifndef __BIND_NOSTATIC
struct __res_state _res
# if defined(__BIND_RES_TEXT)
= { RES_TIMEOUT, } /* Motorola, et al. */
= { RES_TIMEOUT, } /*%< Motorola, et al. */
# endif
;
@ -140,14 +140,14 @@ fp_nquery(const u_char *msg, int len, FILE *file) {
}
int
res_mkquery(int op, /* opcode of query */
const char *dname, /* domain name */
int class, int type, /* class and type of query */
const u_char *data, /* resource record data */
int datalen, /* length of data */
const u_char *newrr_in, /* new rr for modify or append */
u_char *buf, /* buffer to put query */
int buflen) /* size of buffer */
res_mkquery(int op, /*!< opcode of query */
const char *dname, /*!< domain name */
int class, int type, /*!< class and type of query */
const u_char *data, /*!< resource record data */
int datalen, /*!< length of data */
const u_char *newrr_in, /*!< new rr for modify or append */
u_char *buf, /*!< buffer to put query */
int buflen) /*!< size of buffer */
{
if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
@ -169,10 +169,10 @@ res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
}
int
res_query(const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer buffer */
res_query(const char *name, /*!< domain name */
int class, int type, /*!< class and type of query */
u_char *answer, /*!< buffer to put answer */
int anslen) /*!< size of answer buffer */
{
if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
@ -234,10 +234,10 @@ res_update(ns_updrec *rrecp_in) {
}
int
res_search(const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
res_search(const char *name, /*!< domain name */
int class, int type, /*!< class and type of query */
u_char *answer, /*!< buffer to put answer */
int anslen) /*!< size of answer */
{
if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
@ -250,9 +250,9 @@ res_search(const char *name, /* domain name */
int
res_querydomain(const char *name,
const char *domain,
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
int class, int type, /*!< class and type of query */
u_char *answer, /*!< buffer to put answer */
int anslen) /*!< size of answer */
{
if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
@ -289,3 +289,5 @@ local_hostname_length(const char *hostname) {
#endif /*ultrix*/
#endif
/*! \file */

View File

@ -95,7 +95,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_debug.c,v 1.3.2.5.4.6 2005/07/28 07:43:22 marka Exp $";
static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -130,7 +130,7 @@ static const char rcsid[] = "$Id: res_debug.c,v 1.3.2.5.4.6 2005/07/28 07:43:22
extern const char *_res_opcodes[];
extern const char *_res_sectioncodes[];
/*
/*%
* Print the current options.
*/
void
@ -223,7 +223,7 @@ do_section(const res_state statp,
free(buf);
}
/*
/*%
* Print the contents of a query.
* This is intended to be primarily a debugging routine.
*/
@ -318,7 +318,8 @@ p_cdname(const u_char *cp, const u_char *msg, FILE *file) {
return (p_cdnname(cp, msg, PACKETSZ, file));
}
/* Return a fully-qualified domain name from a compressed name (with
/*%
* Return a fully-qualified domain name from a compressed name (with
length supplied). */
const u_char *
@ -334,7 +335,7 @@ p_fqnname(cp, msg, msglen, name, namelen)
return (NULL);
newlen = strlen(name);
if (newlen == 0 || name[newlen - 1] != '.') {
if (newlen + 1 >= namelen) /* Lack space for final dot */
if (newlen + 1 >= namelen) /*%< Lack space for final dot */
return (NULL);
else
strcpy(name + newlen, ".");
@ -356,7 +357,7 @@ p_fqname(const u_char *cp, const u_char *msg, FILE *file) {
return (n);
}
/*
/*%
* Names of RR classes and qclasses. Classes and qclasses are the same, except
* that C_ANY is a qclass but not a class. (You can ask for records of class
* C_ANY, but you can't have any records of that class in the database.)
@ -372,7 +373,7 @@ const struct res_sym __p_class_syms[] = {
{C_IN, (char *)0, (char *)0}
};
/*
/*%
* Names of message sections.
*/
const struct res_sym __p_default_section_syms[] = {
@ -409,7 +410,7 @@ const struct res_sym __p_cert_syms[] = {
{0, NULL, NULL}
};
/*
/*%
* Names of RR types and qtypes. Types and qtypes are the same, except
* that T_ANY is a qtype but not a type. (You can ask for records of type
* T_ANY, but you can't have any records of that type in the database.)
@ -467,7 +468,7 @@ const struct res_sym __p_type_syms[] = {
{0, NULL, NULL}
};
/*
/*%
* Names of DNS rcodes.
*/
const struct res_sym __p_rcode_syms[] = {
@ -500,7 +501,7 @@ sym_ston(const struct res_sym *syms, const char *name, int *success) {
}
if (success)
*success = 0;
return (syms->number); /* The default value. */
return (syms->number); /*%< The default value. */
}
const char *
@ -515,7 +516,7 @@ sym_ntos(const struct res_sym *syms, int number, int *success) {
}
}
sprintf(unname, "%d", number); /* XXX nonreentrant */
sprintf(unname, "%d", number); /*%< XXX nonreentrant */
if (success)
*success = 0;
return (unname);
@ -532,13 +533,13 @@ sym_ntop(const struct res_sym *syms, int number, int *success) {
return (syms->humanname);
}
}
sprintf(unname, "%d", number); /* XXX nonreentrant */
sprintf(unname, "%d", number); /*%< XXX nonreentrant */
if (success)
*success = 0;
return (unname);
}
/*
/*%
* Return a string for the type.
*/
const char *
@ -556,7 +557,7 @@ p_type(int type) {
return (typebuf);
}
/*
/*%
* Return a string for the type.
*/
const char *
@ -574,7 +575,7 @@ p_section(int section, int opcode) {
return (sym_ntos(symbols, section, (int *)0));
}
/*
/*%
* Return a mnemonic for class.
*/
const char *
@ -592,7 +593,7 @@ p_class(int class) {
return (classbuf);
}
/*
/*%
* Return a mnemonic for an option
*/
const char *
@ -614,7 +615,7 @@ p_option(u_long option) {
case RES_INSECURE2: return "insecure2";
case RES_NOALIASES: return "noaliases";
case RES_USE_INET6: return "inet6";
#ifdef RES_USE_EDNS0 /* KAME extension */
#ifdef RES_USE_EDNS0 /*%< KAME extension */
case RES_USE_EDNS0: return "edns0";
#endif
#ifdef RES_USE_DNAME
@ -635,7 +636,7 @@ p_option(u_long option) {
}
}
/*
/*%
* Return a mnemonic for a time to live.
*/
const char *
@ -647,7 +648,7 @@ p_time(u_int32_t value) {
return (nbuf);
}
/*
/*%
* Return a string for the rcode.
*/
const char *
@ -655,7 +656,7 @@ p_rcode(int rcode) {
return (sym_ntos(__p_rcode_syms, rcode, (int *)0));
}
/*
/*%
* Return a string for a res_sockaddr_union.
*/
const char *
@ -682,7 +683,7 @@ p_sockun(union res_sockaddr_union u, char *buf, size_t size) {
return (buf);
}
/*
/*%
* routines to convert between on-the-wire RR format and zone file format.
* Does not contain conversion to/from decimal degrees; divide or multiply
* by 60*60*1000 for that.
@ -691,7 +692,7 @@ p_sockun(union res_sockaddr_union u, char *buf, size_t size) {
static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
1000000,10000000,100000000,1000000000};
/* takes an XeY precision/size value, returns a string representation. */
/*% takes an XeY precision/size value, returns a string representation. */
static const char *
precsize_ntoa(prec)
u_int8_t prec;
@ -709,7 +710,7 @@ precsize_ntoa(prec)
return (retbuf);
}
/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
/*% converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
static u_int8_t
precsize_aton(const char **strptr) {
unsigned int mval = 0, cmval = 0;
@ -723,7 +724,7 @@ precsize_aton(const char **strptr) {
while (isdigit((unsigned char)*cp))
mval = mval * 10 + (*cp++ - '0');
if (*cp == '.') { /* centimeters */
if (*cp == '.') { /*%< centimeters */
cp++;
if (isdigit((unsigned char)*cp)) {
cmval = (*cp++ - '0') * 10;
@ -749,7 +750,7 @@ precsize_aton(const char **strptr) {
return (retval);
}
/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
/*% converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
static u_int32_t
latlon2ul(const char **latlonstrptr, int *which) {
const char *cp;
@ -779,7 +780,7 @@ latlon2ul(const char **latlonstrptr, int *which) {
while (isdigit((unsigned char)*cp))
secs = secs * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal seconds */
if (*cp == '.') { /*%< decimal seconds */
cp++;
if (isdigit((unsigned char)*cp)) {
secsfrac = (*cp++ - '0') * 100;
@ -792,7 +793,7 @@ latlon2ul(const char **latlonstrptr, int *which) {
}
}
while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
while (!isspace((unsigned char)*cp)) /*%< if any trailing garbage */
cp++;
while (isspace((unsigned char)*cp))
@ -813,30 +814,29 @@ latlon2ul(const char **latlonstrptr, int *which) {
- secsfrac;
break;
default:
retval = 0; /* invalid value -- indicates error */
retval = 0; /*%< invalid value -- indicates error */
break;
}
switch (*cp) {
case 'N': case 'n':
case 'S': case 's':
*which = 1; /* latitude */
*which = 1; /*%< latitude */
break;
case 'E': case 'e':
case 'W': case 'w':
*which = 2; /* longitude */
*which = 2; /*%< longitude */
break;
default:
*which = 0; /* error */
*which = 0; /*%< error */
break;
}
cp++; /* skip the hemisphere */
while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
cp++; /*%< skip the hemisphere */
while (!isspace((unsigned char)*cp)) /*%< if any trailing garbage */
cp++;
while (isspace((unsigned char)*cp)) /* move to next field */
while (isspace((unsigned char)*cp)) /*%< move to next field */
cp++;
*latlonstrptr = cp;
@ -844,7 +844,8 @@ latlon2ul(const char **latlonstrptr, int *which) {
return (retval);
}
/* converts a zone file representation in a string to an RDATA on-the-wire
/*%
* converts a zone file representation in a string to an RDATA on-the-wire
* representation. */
int
loc_aton(ascii, binary)
@ -857,9 +858,9 @@ loc_aton(ascii, binary)
u_int32_t latit = 0, longit = 0, alt = 0;
u_int32_t lltemp1 = 0, lltemp2 = 0;
int altmeters = 0, altfrac = 0, altsign = 1;
u_int8_t hp = 0x16; /* default = 1e6 cm = 10000.00m = 10km */
u_int8_t vp = 0x13; /* default = 1e3 cm = 10.00m */
u_int8_t siz = 0x12; /* default = 1e2 cm = 1.00m */
u_int8_t hp = 0x16; /*%< default = 1e6 cm = 10000.00m = 10km */
u_int8_t vp = 0x13; /*%< default = 1e3 cm = 10.00m */
u_int8_t siz = 0x12; /*%< default = 1e2 cm = 1.00m */
int which1 = 0, which2 = 0;
cp = ascii;
@ -870,18 +871,18 @@ loc_aton(ascii, binary)
lltemp2 = latlon2ul(&cp, &which2);
switch (which1 + which2) {
case 3: /* 1 + 2, the only valid combination */
if ((which1 == 1) && (which2 == 2)) { /* normal case */
case 3: /*%< 1 + 2, the only valid combination */
if ((which1 == 1) && (which2 == 2)) { /*%< normal case */
latit = lltemp1;
longit = lltemp2;
} else if ((which1 == 2) && (which2 == 1)) { /* reversed */
} else if ((which1 == 2) && (which2 == 1)) { /*%< reversed */
longit = lltemp1;
latit = lltemp2;
} else { /* some kind of brokenness */
} else { /*%< some kind of brokenness */
return (0);
}
break;
default: /* we didn't get one of each */
default: /*%< we didn't get one of each */
return (0);
}
@ -897,7 +898,7 @@ loc_aton(ascii, binary)
while (isdigit((unsigned char)*cp))
altmeters = altmeters * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal meters */
if (*cp == '.') { /*%< decimal meters */
cp++;
if (isdigit((unsigned char)*cp)) {
altfrac = (*cp++ - '0') * 10;
@ -909,7 +910,7 @@ loc_aton(ascii, binary)
alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */
cp++;
while (isspace((unsigned char)*cp) && (cp < maxcp))
@ -920,7 +921,7 @@ loc_aton(ascii, binary)
siz = precsize_aton(&cp);
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */
cp++;
while (isspace((unsigned char)*cp) && (cp < maxcp))
@ -931,7 +932,7 @@ loc_aton(ascii, binary)
hp = precsize_aton(&cp);
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */
cp++;
while (isspace((unsigned char)*cp) && (cp < maxcp))
@ -945,7 +946,7 @@ loc_aton(ascii, binary)
defaults:
bcp = binary;
*bcp++ = (u_int8_t) 0; /* version byte */
*bcp++ = (u_int8_t) 0; /*%< version byte */
*bcp++ = siz;
*bcp++ = hp;
*bcp++ = vp;
@ -953,10 +954,10 @@ loc_aton(ascii, binary)
PUTLONG(longit,bcp);
PUTLONG(alt,bcp);
return (16); /* size of RR in octets */
return (16); /*%< size of RR in octets */
}
/* takes an on-the-wire LOC RR and formats it in a human readable format. */
/*% takes an on-the-wire LOC RR and formats it in a human readable format. */
const char *
loc_ntoa(binary, ascii)
const u_char *binary;
@ -1003,7 +1004,7 @@ loc_ntoa(binary, ascii)
longval = (templ - ((unsigned)1<<31));
GETLONG(templ, cp);
if (templ < referencealt) { /* below WGS 84 spheroid */
if (templ < referencealt) { /*%< below WGS 84 spheroid */
altval = referencealt - templ;
altsign = "-";
} else {
@ -1066,7 +1067,7 @@ loc_ntoa(binary, ascii)
}
/* Return the number of DNS hierarchy levels in the name. */
/*% Return the number of DNS hierarchy levels in the name. */
int
dn_count_labels(const char *name) {
int i, len, count;
@ -1091,8 +1092,7 @@ dn_count_labels(const char *name) {
return (count);
}
/*
/*%
* Make dates expressed in seconds-since-Jan-1-1970 easy to read.
* SIG records are required to be printed like this, by the Secure DNS RFC.
*/
@ -1161,3 +1161,5 @@ res_nametotype(const char *buf, int *successp) {
*successp = success;
return (result);
}
/*! \file */

View File

@ -32,3 +32,4 @@
#endif
#endif /* _RES_DEBUG_H_ */
/*! \file */

View File

@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: res_findzonecut.c,v 1.2.2.3.4.4 2005/10/11 00:48:16 marka Exp $";
static const char rcsid[] = "$Id: res_findzonecut.c,v 1.7.18.3 2005/10/11 00:25:11 marka Exp $";
#endif /* not lint */
/*
@ -96,55 +96,56 @@ static void res_dprintf(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
/* Public. */
/*
* int
* res_findzonecut(res, dname, class, zname, zsize, addrs, naddrs)
/*%
* find enclosing zone for a <dname,class>, and some server addresses
*
* parameters:
* res - resolver context to work within (is modified)
* dname - domain name whose enclosing zone is desired
* class - class of dname (and its enclosing zone)
* zname - found zone name
* zsize - allocated size of zname
* addrs - found server addresses
* naddrs - max number of addrs
*\li res - resolver context to work within (is modified)
*\li dname - domain name whose enclosing zone is desired
*\li class - class of dname (and its enclosing zone)
*\li zname - found zone name
*\li zsize - allocated size of zname
*\li addrs - found server addresses
*\li naddrs - max number of addrs
*
* return values:
* < 0 - an error occurred (check errno)
* = 0 - zname is now valid, but addrs[] wasn't changed
* > 0 - zname is now valid, and return value is number of addrs[] found
*\li < 0 - an error occurred (check errno)
*\li = 0 - zname is now valid, but addrs[] wasn't changed
*\li > 0 - zname is now valid, and return value is number of addrs[] found
*
* notes:
* this function calls res_nsend() which means it depends on correctly
*\li this function calls res_nsend() which means it depends on correctly
* functioning recursive nameservers (usually defined in /etc/resolv.conf
* or its local equivilent).
*
* we start by asking for an SOA<dname,class>. if we get one as an
*\li we start by asking for an SOA<dname,class>. if we get one as an
* answer, that just means <dname,class> is a zone top, which is fine.
* more than likely we'll be told to go pound sand, in the form of a
* negative answer.
*
* note that we are not prepared to deal with referrals since that would
*\li note that we are not prepared to deal with referrals since that would
* only come from authority servers and our correctly functioning local
* recursive server would have followed the referral and got us something
* more definite.
*
* if the authority section contains an SOA, this SOA should also be the
*\li if the authority section contains an SOA, this SOA should also be the
* closest enclosing zone, since any intermediary zone cuts would've been
* returned as referrals and dealt with by our correctly functioning local
* recursive name server. but an SOA in the authority section should NOT
* match our dname (since that would have been returned in the answer
* section). an authority section SOA has to be "above" our dname.
*
* however, since authority section SOA's were once optional, it's
*\li however, since authority section SOA's were once optional, it's
* possible that we'll have to go hunting for the enclosing SOA by
* ripping labels off the front of our dname -- this is known as "doing
* it the hard way."
*
* ultimately we want some server addresses, which are ideally the ones
*\li ultimately we want some server addresses, which are ideally the ones
* pertaining to the SOA.MNAME, but only if there is a matching NS RR.
* so the second phase (after we find an SOA) is to go looking for the
* NS RRset for that SOA's zone.
*
* no answer section processed by this code is allowed to contain CNAME
*\li no answer section processed by this code is allowed to contain CNAME
* or DNAME RR's. for the SOA query this means we strip a label and
* keep going. for the NS and A queries this means we just give up.
*/
@ -717,3 +718,5 @@ res_dprintf(const char *fmt, ...) {
fputc('\n', stderr);
va_end(ap);
}
/*! \file */

View File

@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static const char rcsid[] = "$Id: res_init.c,v 1.9.2.5.4.6 2006/08/30 23:23:01 marka Exp $";
static const char rcsid[] = "$Id: res_init.c,v 1.16.18.5 2006/08/30 23:23:13 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -98,7 +98,7 @@ static const char rcsid[] = "$Id: res_init.c,v 1.9.2.5.4.6 2006/08/30 23:23:01 m
#include "res_private.h"
/* Options. Should all be left alone. */
/*% Options. Should all be left alone. */
#define RESOLVSORT
#define DEBUG
@ -114,7 +114,7 @@ static const char sort_mask[] = "/&";
static u_int32_t net_mask __P((struct in_addr));
#endif
#if !defined(isascii) /* XXX - could be a function */
#if !defined(isascii) /*%< XXX - could be a function */
# define isascii(c) (!(c & 0200))
#endif
@ -122,7 +122,7 @@ static u_int32_t net_mask __P((struct in_addr));
* Resolver state default settings.
*/
/*
/*%
* Set up default settings. If the configuration file exist, the values
* there will have precedence. Otherwise, the server address is set to
* INADDR_ANY and the default domain name comes from the gethostname().
@ -150,14 +150,14 @@ res_ninit(res_state statp) {
return (__res_vinit(statp, 0));
}
/* This function has to be reachable by res_data.c but not publically. */
/*% This function has to be reachable by res_data.c but not publically. */
int
__res_vinit(res_state statp, int preinit) {
register FILE *fp;
register char *cp, **pp;
register int n;
char buf[BUFSIZ];
int nserv = 0; /* number of nameserver records read from file */
int nserv = 0; /*%< number of nameserver records read from file */
int haveenv = 0;
int havesearch = 0;
#ifdef RESOLVSORT
@ -262,7 +262,7 @@ __res_vinit(res_state statp, int preinit) {
pp = statp->dnsrch;
*pp++ = cp;
for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) {
if (*cp == '\n') /* silly backwards compat */
if (*cp == '\n') /*%< silly backwards compat */
break;
else if (*cp == ' ' || *cp == '\t') {
*cp = 0;
@ -294,7 +294,7 @@ __res_vinit(res_state statp, int preinit) {
continue;
/* read default domain name */
if (MATCH(buf, "domain")) {
if (haveenv) /* skip if have from environ */
if (haveenv) /*%< skip if have from environ */
continue;
cp = buf + sizeof("domain") - 1;
while (*cp == ' ' || *cp == '\t')
@ -310,7 +310,7 @@ __res_vinit(res_state statp, int preinit) {
}
/* set search list */
if (MATCH(buf, "search")) {
if (haveenv) /* skip if have from environ */
if (haveenv) /*%< skip if have from environ */
continue;
cp = buf + sizeof("search") - 1;
while (*cp == ' ' || *cp == '\t')
@ -464,7 +464,7 @@ __res_vinit(res_state statp, int preinit) {
while (pp < statp->dnsrch + MAXDFLSRCH) {
if (dots < LOCALDOMAINPARTS)
break;
cp = strchr(cp, '.') + 1; /* we know there is one */
cp = strchr(cp, '.') + 1; /*%< we know there is one */
*pp++ = cp;
dots--;
}
@ -626,7 +626,7 @@ res_setoptions(res_state statp, const char *options, const char *source)
#ifdef RESOLVSORT
/* XXX - should really support CIDR which means explicit masks always. */
static u_int32_t
net_mask(in) /* XXX - should really use system's version of this */
net_mask(in) /*!< XXX - should really use system's version of this */
struct in_addr in;
{
register u_int32_t i = ntohl(in.s_addr);
@ -647,7 +647,7 @@ res_randomid(void) {
return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
}
/*
/*%
* This routine is for closing the socket if a virtual circuit is used and
* the program wants to close it. This provides support for endhostent()
* which expects to close the socket.
@ -790,3 +790,5 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
}
return (statp->nscount);
}
/*! \file */

View File

@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_mkquery.c,v 1.1.2.2.4.2 2004/03/16 12:34:18 marka Exp $";
static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.1 2005/04/27 05:01:11 sra Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -89,20 +89,20 @@ static const char rcsid[] = "$Id: res_mkquery.c,v 1.1.2.2.4.2 2004/03/16 12:34:1
extern const char *_res_opcodes[];
/*
/*%
* Form all types of queries.
* Returns the size of the result or -1.
*/
int
res_nmkquery(res_state statp,
int op, /* opcode of query */
const char *dname, /* domain name */
int class, int type, /* class and type of query */
const u_char *data, /* resource record data */
int datalen, /* length of data */
const u_char *newrr_in, /* new rr for modify or append */
u_char *buf, /* buffer to put query */
int buflen) /* size of buffer */
int op, /*!< opcode of query */
const char *dname, /*!< domain name */
int class, int type, /*!< class and type of query */
const u_char *data, /*!< resource record data */
int datalen, /*!< length of data */
const u_char *newrr_in, /*!< new rr for modify or append */
u_char *buf, /*!< buffer to put query */
int buflen) /*!< size of buffer */
{
register HEADER *hp;
register u_char *cp, *ep;
@ -179,7 +179,7 @@ res_nmkquery(res_state statp,
*/
if (ep - cp < 1 + RRFIXEDSZ + datalen)
return (-1);
*cp++ = '\0'; /* no domain name */
*cp++ = '\0'; /*%< no domain name */
ns_put16(type, cp);
cp += INT16SZ;
ns_put16(class, cp);
@ -209,10 +209,10 @@ res_nmkquery(res_state statp,
int
res_nopt(res_state statp,
int n0, /* current offset in buffer */
u_char *buf, /* buffer to put query */
int buflen, /* size of buffer */
int anslen) /* UDP answer buffer size */
int n0, /*%< current offset in buffer */
u_char *buf, /*%< buffer to put query */
int buflen, /*%< size of buffer */
int anslen) /*%< UDP answer buffer size */
{
register HEADER *hp;
register u_char *cp, *ep;
@ -230,14 +230,13 @@ res_nopt(res_state statp,
if ((ep - cp) < 1 + RRFIXEDSZ)
return (-1);
*cp++ = 0; /* "." */
ns_put16(T_OPT, cp); /* TYPE */
*cp++ = 0; /*%< "." */
ns_put16(T_OPT, cp); /*%< TYPE */
cp += INT16SZ;
ns_put16(anslen & 0xffff, cp); /* CLASS = UDP payload size */
ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */
cp += INT16SZ;
*cp++ = NOERROR; /* extended RCODE */
*cp++ = 0; /* EDNS version */
*cp++ = NOERROR; /*%< extended RCODE */
*cp++ = 0; /*%< EDNS version */
if (statp->options & RES_USE_DNSSEC) {
#ifdef DEBUG
if (statp->options & RES_DEBUG)
@ -247,10 +246,12 @@ res_nopt(res_state statp,
}
ns_put16(flags, cp);
cp += INT16SZ;
ns_put16(0, cp); /* RDLEN */
ns_put16(0, cp); /*%< RDLEN */
cp += INT16SZ;
hp->arcount = htons(ntohs(hp->arcount) + 1);
return (cp - buf);
}
#endif
/*! \file */

View File

@ -15,13 +15,14 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
/*! \file
* \brief
* Based on the Dynamic DNS reference implementation by Viraj Bais
* <viraj_bais@ccm.fm.intel.com>
* &lt;viraj_bais@ccm.fm.intel.com>
*/
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: res_mkupdate.c,v 1.1.2.1.4.5 2005/10/14 05:43:47 marka Exp $";
static const char rcsid[] = "$Id: res_mkupdate.c,v 1.4.18.4 2005/10/14 05:44:12 marka Exp $";
#endif /* not lint */
#include "port_before.h"
@ -62,17 +63,19 @@ static int getstr_str(char *, int, u_char **, u_char *);
int res_protocolnumber(const char *);
int res_servicenumber(const char *);
/*
/*%
* Form update packets.
* Returns the size of the resulting packet if no error
*
* On error,
* returns -1 if error in reading a word/number in rdata
* returns
*\li -1 if error in reading a word/number in rdata
* portion for update packets
* -2 if length of buffer passed is insufficient
* -3 if zone section is not the first section in
*\li -2 if length of buffer passed is insufficient
*\li -3 if zone section is not the first section in
* the linked list, or section order has a problem
* -4 on a number overflow
* -5 unknown operation or no records
*\li -4 on a number overflow
*\li -5 unknown operation or no records
*/
int
res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
@ -189,7 +192,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
}
ShrinkBuffer(INT32SZ + INT16SZ);
PUTLONG(rttl, cp);
sp2 = cp; /* save pointer to length byte */
sp2 = cp; /*%< save pointer to length byte */
cp += INT16SZ;
if (rrecp->r_size == 0) {
if (section == S_UPDATE && rclass != C_ANY)
@ -395,7 +398,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
}
break;
case T_X25:
/* RFC 1183 */
/* RFC1183 */
if ((n = getstr_str(buf2, sizeof buf2, &startp,
endp)) < 0)
return (-1);
@ -407,7 +410,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
cp += n;
break;
case T_ISDN:
/* RFC 1183 */
/* RFC1183 */
if ((n = getstr_str(buf2, sizeof buf2, &startp,
endp)) < 0)
return (-1);
@ -708,7 +711,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
return (cp - buf);
}
/*
/*%
* Get a whitespace delimited word from a string (not file)
* into buf. modify the start pointer to point after the
* word in the string.
@ -721,9 +724,9 @@ getword_str(char *buf, int size, u_char **startpp, u_char *endp) {
for (cp = buf; *startpp <= endp; ) {
c = **startpp;
if (isspace(c) || c == '\0') {
if (cp != buf) /* trailing whitespace */
if (cp != buf) /*%< trailing whitespace */
break;
else { /* leading whitespace */
else { /*%< leading whitespace */
(*startpp)++;
continue;
}
@ -737,9 +740,9 @@ getword_str(char *buf, int size, u_char **startpp, u_char *endp) {
return (cp != buf);
}
/*
/*%
* get a white spae delimited string from memory. Process quoted strings
* and \DDD escapes. Return length or -1 on error. Returned string may
* and \\DDD escapes. Return length or -1 on error. Returned string may
* contain nulls.
*/
static char digits[] = "0123456789";
@ -816,7 +819,8 @@ getstr_str(char *buf, int size, u_char **startpp, u_char *endp) {
*cp = '\0';
return ((cp == buf)? (seen_quote? 0: -1): (cp - buf));
}
/*
/*%
* Get a whitespace delimited base 16 number from a string (not file) into buf
* update the start pointer to point after the number in the string.
*/
@ -832,9 +836,9 @@ gethexnum_str(u_char **startpp, u_char *endp) {
for (n = 0; *startpp <= endp; ) {
c = **startpp;
if (isspace(c) || c == '\0') {
if (seendigit) /* trailing whitespace */
if (seendigit) /*%< trailing whitespace */
break;
else { /* leading whitespace */
else { /*%< leading whitespace */
(*startpp)++;
continue;
}
@ -864,7 +868,7 @@ gethexnum_str(u_char **startpp, u_char *endp) {
return (n + m);
}
/*
/*%
* Get a whitespace delimited base 10 number from a string (not file) into buf
* update the start pointer to point after the number in the string.
*/
@ -877,9 +881,9 @@ getnum_str(u_char **startpp, u_char *endp) {
for (n = 0; *startpp <= endp; ) {
c = **startpp;
if (isspace(c) || c == '\0') {
if (seendigit) /* trailing whitespace */
if (seendigit) /*%< trailing whitespace */
break;
else { /* leading whitespace */
else { /*%< leading whitespace */
(*startpp)++;
continue;
}
@ -906,7 +910,7 @@ getnum_str(u_char **startpp, u_char *endp) {
return (n + m);
}
/*
/*%
* Allocate a resource record buffer & save rr info.
*/
ns_updrec *
@ -928,7 +932,7 @@ res_mkupdrec(int section, const char *dname,
return (rrecp);
}
/*
/*%
* Free a resource record buffer created by res_mkupdrec.
*/
void
@ -970,7 +974,7 @@ res_buildservicelist() {
free(slp);
break;
}
slp->port = ntohs((u_int16_t)sp->s_port); /* host byt order */
slp->port = ntohs((u_int16_t)sp->s_port); /*%< host byt order */
slp->next = servicelist;
slp->prev = NULL;
if (servicelist)
@ -1012,7 +1016,7 @@ res_buildprotolist(void) {
free(slp);
break;
}
slp->port = pp->p_proto; /* host byte order */
slp->port = pp->p_proto; /*%< host byte order */
slp->next = protolist;
slp->prev = NULL;
if (protolist)
@ -1049,14 +1053,14 @@ findservice(const char *s, struct valuelist **list) {
lp->next = *list;
*list = lp;
}
return (lp->port); /* host byte order */
return (lp->port); /*%< host byte order */
}
if (sscanf(s, "%d", &n) != 1 || n <= 0)
n = -1;
return (n);
}
/*
/*%
* Convert service name or (ascii) number to int.
*/
int
@ -1066,7 +1070,7 @@ res_servicenumber(const char *p) {
return (findservice(p, &servicelist));
}
/*
/*%
* Convert protocol name or (ascii) number to int.
*/
int
@ -1077,14 +1081,14 @@ res_protocolnumber(const char *p) {
}
static struct servent *
cgetservbyport(u_int16_t port, const char *proto) { /* Host byte order. */
cgetservbyport(u_int16_t port, const char *proto) { /*%< Host byte order. */
struct valuelist **list = &servicelist;
struct valuelist *lp = *list;
static struct servent serv;
port = ntohs(port);
for (; lp != NULL; lp = lp->next) {
if (port != (u_int16_t)lp->port) /* Host byte order. */
if (port != (u_int16_t)lp->port) /*%< Host byte order. */
continue;
if (strcasecmp(lp->proto, proto) == 0) {
if (lp != *list) {
@ -1105,13 +1109,13 @@ cgetservbyport(u_int16_t port, const char *proto) { /* Host byte order. */
}
static struct protoent *
cgetprotobynumber(int proto) { /* Host byte order. */
cgetprotobynumber(int proto) { /*%< Host byte order. */
struct valuelist **list = &protolist;
struct valuelist *lp = *list;
static struct protoent prot;
for (; lp != NULL; lp = lp->next)
if (lp->port == proto) { /* Host byte order. */
if (lp->port == proto) { /*%< Host byte order. */
if (lp != *list) {
lp->prev->next = lp->next;
if (lp->next)
@ -1121,7 +1125,7 @@ cgetprotobynumber(int proto) { /* Host byte order. */
*list = lp;
}
prot.p_name = lp->name;
prot.p_proto = lp->port; /* Host byte order. */
prot.p_proto = lp->port; /*%< Host byte order. */
return (&prot);
}
return (0);
@ -1143,7 +1147,7 @@ res_protocolname(int num) {
}
const char *
res_servicename(u_int16_t port, const char *proto) { /* Host byte order. */
res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */
static char number[8];
struct servent *ss;

View File

@ -18,3 +18,5 @@ extern int
res_ourserver_p(const res_state statp, const struct sockaddr *sa);
#endif
/*! \file */

View File

@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_query.c,v 1.2.2.3.4.2 2004/03/16 12:34:19 marka Exp $";
static const char rcsid[] = "$Id: res_query.c,v 1.7.18.1 2005/04/27 05:01:11 sra Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -97,7 +97,7 @@ static const char rcsid[] = "$Id: res_query.c,v 1.2.2.3.4.2 2004/03/16 12:34:19
#define MAXPACKET 1024
#endif
/*
/*%
* Formulate a normal query, send, and await answer.
* Returned answer is placed in supplied buffer "answer".
* Perform preliminary check of answer, returning success only
@ -109,10 +109,10 @@ static const char rcsid[] = "$Id: res_query.c,v 1.2.2.3.4.2 2004/03/16 12:34:19
*/
int
res_nquery(res_state statp,
const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer buffer */
const char *name, /*%< domain name */
int class, int type, /*%< class and type of query */
u_char *answer, /*%< buffer to put answer */
int anslen) /*%< size of answer buffer */
{
u_char buf[MAXPACKET];
HEADER *hp = (HEADER *) answer;
@ -122,8 +122,7 @@ res_nquery(res_state statp,
oflags = statp->_flags;
again:
hp->rcode = NOERROR; /* default */
hp->rcode = NOERROR; /*%< default */
#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_query(%s, %d, %d)\n", name, class, type);
@ -195,7 +194,7 @@ res_nquery(res_state statp,
return (n);
}
/*
/*%
* Formulate a normal query, send, and retrieve answer in supplied buffer.
* Return the size of the response on success, -1 on error.
* If enabled, implement search rules until answer or unrecoverable failure
@ -203,10 +202,10 @@ res_nquery(res_state statp,
*/
int
res_nsearch(res_state statp,
const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
const char *name, /*%< domain name */
int class, int type, /*%< class and type of query */
u_char *answer, /*%< buffer to put answer */
int anslen) /*%< size of answer */
{
const char *cp, * const *domain;
HEADER *hp = (HEADER *) answer;
@ -218,8 +217,7 @@ res_nsearch(res_state statp,
int searched = 0;
errno = 0;
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /* True if we never query. */
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /*%< True if we never query. */
dots = 0;
for (cp = name; *cp != '\0'; cp++)
dots += (*cp == '.');
@ -344,7 +342,7 @@ res_nsearch(res_state statp,
return (-1);
}
/*
/*%
* Perform a call on res_query on the concatenation of name and domain,
* removing a trailing dot from name if domain is NULL.
*/
@ -352,9 +350,9 @@ int
res_nquerydomain(res_state statp,
const char *name,
const char *domain,
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
int class, int type, /*%< class and type of query */
u_char *answer, /*%< buffer to put answer */
int anslen) /*%< size of answer */
{
char nbuf[MAXDNAME];
const char *longname = nbuf;
@ -430,3 +428,5 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
fclose(fp);
return (NULL);
}
/*! \file */

View File

@ -70,10 +70,11 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_send.c,v 1.5.2.2.4.9 2006/10/16 23:00:50 marka Exp $";
static const char rcsid[] = "$Id: res_send.c,v 1.9.18.8 2006/10/16 23:00:58 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/*
/*! \file
* \brief
* Send query to name server and wait for reply.
*/
@ -147,14 +148,15 @@ static const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
/* Public. */
/* int
* res_isourserver(ina)
/*%
* looks up "ina" in _res.ns_addr_list[]
*
* returns:
* 0 : not found
* >0 : found
*\li 0 : not found
*\li >0 : found
*
* author:
* paul vixie, 29may94
*\li paul vixie, 29may94
*/
int
res_ourserver_p(const res_state statp, const struct sockaddr *sa) {
@ -197,17 +199,19 @@ res_ourserver_p(const res_state statp, const struct sockaddr *sa) {
return (0);
}
/* int
* res_nameinquery(name, type, class, buf, eom)
/*%
* look for (name,type,class) in the query section of packet (buf,eom)
*
* requires:
* buf + HFIXEDSZ <= eom
*\li buf + HFIXEDSZ <= eom
*
* returns:
* -1 : format error
* 0 : not found
* >0 : found
*\li -1 : format error
*\li 0 : not found
*\li >0 : found
*
* author:
* paul vixie, 29may94
*\li paul vixie, 29may94
*/
int
res_nameinquery(const char *name, int type, int class,
@ -235,16 +239,17 @@ res_nameinquery(const char *name, int type, int class,
return (0);
}
/* int
* res_queriesmatch(buf1, eom1, buf2, eom2)
/*%
* is there a 1:1 mapping of (name,type,class)
* in (buf1,eom1) and (buf2,eom2)?
*
* returns:
* -1 : format error
* 0 : not a 1:1 mapping
* >0 : is a 1:1 mapping
*\li -1 : format error
*\li 0 : not a 1:1 mapping
*\li >0 : is a 1:1 mapping
*
* author:
* paul vixie, 29may94
*\li paul vixie, 29may94
*/
int
res_queriesmatch(const u_char *buf1, const u_char *eom1,
@ -524,9 +529,9 @@ res_nsend(res_state statp,
res_nclose(statp);
if (!v_circuit) {
if (!gotsomewhere)
errno = ECONNREFUSED; /* no nameservers found */
errno = ECONNREFUSED; /*%< no nameservers found */
else
errno = ETIMEDOUT; /* no answer obtained */
errno = ETIMEDOUT; /*%< no answer obtained */
} else
errno = terrno;
return (-1);
@ -553,10 +558,10 @@ get_salen(sa)
else if (sa->sa_family == AF_INET6)
return (sizeof(struct sockaddr_in6));
else
return (0); /* unknown, die on connect */
return (0); /*%< unknown, die on connect */
}
/*
/*%
* pick appropriate nsaddr_list for use. see res_init() for initialization.
*/
static struct sockaddr *

View File

@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: res_update.c,v 1.6.2.4.4.2 2004/03/16 12:34:20 marka Exp $";
static const char rcsid[] = "$Id: res_update.c,v 1.12.18.1 2005/04/27 05:01:12 sra Exp $";
#endif /* not lint */
/*
@ -19,9 +19,10 @@ static const char rcsid[] = "$Id: res_update.c,v 1.6.2.4.4.2 2004/03/16 12:34:20
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
/*! \file
* \brief
* Based on the Dynamic DNS reference implementation by Viraj Bais
* <viraj_bais@ccm.fm.intel.com>
* &lt;viraj_bais@ccm.fm.intel.com>
*/
#include "port_before.h"
@ -49,7 +50,7 @@ static const char rcsid[] = "$Id: res_update.c,v 1.6.2.4.4.2 2004/03/16 12:34:20
#include "port_after.h"
#include "res_private.h"
/*
/*%
* Separate a linked list of records into groups so that all records
* in a group will belong to a single zone on the nameserver.
* Create a dynamic update packet for each zone and send it to the