Back to index

glibc  2.9
Classes | Defines | Typedefs | Enumerations | Functions
nameser.h File Reference
#include <sys/param.h>
#include <sys/bitypes.h>
#include <sys/cdefs.h>
#include <arpa/nameser_compat.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  __ns_msg
struct  _ns_flagdata
struct  __ns_rr
struct  ns_tsig_key
struct  ns_tcp_tsig_state

Defines

#define BIND_4_COMPAT
#define __NAMESER   19991006 /*%< New interface version stamp. */
#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_msg_id(handle)   ((handle)._id + 0)
#define ns_msg_base(handle)   ((handle)._msg + 0)
#define ns_msg_end(handle)   ((handle)._eom + 0)
#define ns_msg_size(handle)   ((handle)._eom - (handle)._msg)
#define ns_msg_count(handle, section)   ((handle)._counts[section] + 0)
#define ns_rr_name(rr)   (((rr).name[0] != '\0') ? (rr).name : ".")
#define ns_rr_type(rr)   ((ns_type)((rr).type + 0))
#define ns_rr_class(rr)   ((ns_class)((rr).rr_class + 0))
#define ns_rr_ttl(rr)   ((rr).ttl + 0)
#define ns_rr_rdlen(rr)   ((rr).rdlength + 0)
#define ns_rr_rdata(rr)   ((rr).rdata + 0)
#define NS_TSIG_FUDGE   300
#define NS_TSIG_TCP_COUNT   100
#define NS_TSIG_ALG_HMAC_MD5   "HMAC-MD5.SIG-ALG.REG.INT"
#define NS_TSIG_ERROR_NO_TSIG   -10
#define NS_TSIG_ERROR_NO_SPACE   -11
#define NS_TSIG_ERROR_FORMERR   -12
#define ns_t_qt_p(t)
#define ns_t_mrr_p(t)   ((t) == ns_t_tsig || (t) == ns_t_opt)
#define ns_t_rr_p(t)   (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
#define ns_t_udp_p(t)   ((t) != ns_t_axfr && (t) != ns_t_zxfr)
#define ns_t_xfr_p(t)
#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_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_RESERVED_BITMASK
#define NS_KEY_RESERVED_BITMASK2   0xFFFF /*%< no bits defined here */
#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_KEY_PROT_TLS   1
#define NS_KEY_PROT_EMAIL   2
#define NS_KEY_PROT_DNSSEC   3
#define NS_KEY_PROT_IPSEC   4
#define NS_KEY_PROT_ANY   255
#define NS_MD5RSA_MIN_BITS   512 /*%< Size of a mod or exp in bits */
#define NS_MD5RSA_MAX_BITS   4096
#define NS_MD5RSA_MAX_BYTES   ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
#define NS_MD5RSA_MAX_BASE64   (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
#define NS_MD5RSA_MIN_SIZE   ((NS_MD5RSA_MIN_BITS+7)/8)
#define NS_MD5RSA_MAX_SIZE   ((NS_MD5RSA_MAX_BITS+7)/8)
#define NS_DSA_SIG_SIZE   41
#define NS_DSA_MIN_SIZE   213
#define NS_DSA_MAX_BYTES   405
#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_NXT_BITS   8
#define NS_NXT_BIT_SET(n, p)   (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_BIT_CLEAR(n, p)   (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_BIT_ISSET(n, p)   (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS)))
#define NS_NXT_MAX   127
#define NS_OPT_DNSSEC_OK   0x8000U
#define NS_OPT_NSID   3
#define NS_GET16(s, cp)
#define NS_GET32(l, cp)
#define NS_PUT16(s, cp)
#define NS_PUT32(l, cp)

Typedefs

typedef enum __ns_sect ns_sect
typedef struct __ns_msg ns_msg
typedef struct __ns_rr ns_rr
typedef enum __ns_flag ns_flag
typedef enum __ns_opcode ns_opcode
typedef enum __ns_rcode ns_rcode
typedef enum __ns_update_operation ns_update_operation
typedef struct ns_tsig_key
typedef struct ns_tcp_tsig_state
typedef enum __ns_type ns_type
typedef enum __ns_class ns_class
typedef enum __ns_key_types ns_key_types
typedef enum __ns_cert_types ns_cert_types

Enumerations

enum  __ns_sect {
  ns_s_qd = 0, ns_s_zn = 0, ns_s_an = 1, ns_s_pr = 1,
  ns_s_ns = 2, ns_s_ud = 2, ns_s_ar = 3, ns_s_max = 4
}
enum  __ns_flag {
  ns_f_qr, ns_f_opcode, ns_f_aa, ns_f_tc,
  ns_f_rd, ns_f_ra, ns_f_z, ns_f_ad,
  ns_f_cd, ns_f_rcode, ns_f_max
}
enum  __ns_opcode {
  ns_o_query = 0, ns_o_iquery = 1, ns_o_status = 2, ns_o_notify = 4,
  ns_o_update = 5, ns_o_max = 6
}
enum  __ns_rcode {
  ns_r_noerror = 0, ns_r_formerr = 1, ns_r_servfail = 2, ns_r_nxdomain = 3,
  ns_r_notimpl = 4, ns_r_refused = 5, ns_r_yxdomain = 6, ns_r_yxrrset = 7,
  ns_r_nxrrset = 8, ns_r_notauth = 9, ns_r_notzone = 10, ns_r_max = 11,
  ns_r_badvers = 16, ns_r_badsig = 16, ns_r_badkey = 17, ns_r_badtime = 18
}
enum  __ns_update_operation { ns_uop_delete = 0, ns_uop_add = 1, ns_uop_max = 2 }
enum  __ns_type {
  ns_t_invalid = 0, ns_t_a = 1, ns_t_ns = 2, ns_t_md = 3,
  ns_t_mf = 4, ns_t_cname = 5, ns_t_soa = 6, ns_t_mb = 7,
  ns_t_mg = 8, ns_t_mr = 9, ns_t_null = 10, ns_t_wks = 11,
  ns_t_ptr = 12, ns_t_hinfo = 13, ns_t_minfo = 14, ns_t_mx = 15,
  ns_t_txt = 16, ns_t_rp = 17, ns_t_afsdb = 18, ns_t_x25 = 19,
  ns_t_isdn = 20, ns_t_rt = 21, ns_t_nsap = 22, ns_t_nsap_ptr = 23,
  ns_t_sig = 24, ns_t_key = 25, ns_t_px = 26, ns_t_gpos = 27,
  ns_t_aaaa = 28, ns_t_loc = 29, ns_t_nxt = 30, ns_t_eid = 31,
  ns_t_nimloc = 32, ns_t_srv = 33, ns_t_atma = 34, ns_t_naptr = 35,
  ns_t_kx = 36, ns_t_cert = 37, ns_t_a6 = 38, ns_t_dname = 39,
  ns_t_sink = 40, ns_t_opt = 41, ns_t_apl = 42, ns_t_tkey = 249,
  ns_t_tsig = 250, ns_t_ixfr = 251, ns_t_axfr = 252, ns_t_mailb = 253,
  ns_t_maila = 254, ns_t_any = 255, ns_t_zxfr = 256, ns_t_max = 65536
}
enum  __ns_class {
  ns_c_invalid = 0, ns_c_in = 1, ns_c_2 = 2, ns_c_chaos = 3,
  ns_c_hs = 4, ns_c_none = 254, ns_c_any = 255, ns_c_max = 65536
}
enum  __ns_key_types { ns_kt_rsa = 1, ns_kt_dh = 2, ns_kt_dsa = 3, ns_kt_private = 254 }
enum  __ns_cert_types {
  cert_t_pkix = 1, cert_t_spki = 2, cert_t_pgp = 3, cert_t_url = 253,
  cert_t_oid = 254
}

Functions

__BEGIN_DECLS int ns_msg_getflag (ns_msg, int) __THROW
u_int ns_get16 (const u_char *) __THROW
u_long ns_get32 (const u_char *) __THROW
void ns_put16 (u_int, u_char *) __THROW
void ns_put32 (u_long, u_char *) __THROW
int ns_initparse (const u_char *, int, ns_msg *) __THROW
int ns_skiprr (const u_char *, const u_char *, ns_sect, int) __THROW
int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW
int ns_sprintrr (const ns_msg *, const ns_rr *, const char *, const char *, char *, size_t) __THROW
int ns_sprintrrf (const u_char *, size_t, const char *, ns_class, ns_type, u_long, const u_char *, size_t, const char *, const char *, char *, size_t) __THROW
int ns_format_ttl (u_long, char *, size_t) __THROW
int ns_parse_ttl (const char *, u_long *) __THROW
u_int32_t ns_datetosecs (const char *cp, int *errp) __THROW
int ns_name_ntol (const u_char *, u_char *, size_t) __THROW
int ns_name_ntop (const u_char *, char *, size_t) __THROW
int ns_name_pton (const char *, u_char *, size_t) __THROW
int ns_name_unpack (const u_char *, const u_char *, const u_char *, u_char *, size_t) __THROW
int ns_name_pack (const u_char *, u_char *, int, const u_char **, const u_char **) __THROW
int ns_name_uncompress (const u_char *, const u_char *, const u_char *, char *, size_t) __THROW
int ns_name_compress (const char *, u_char *, size_t, const u_char **, const u_char **) __THROW
int ns_name_skip (const u_char **, const u_char *) __THROW
void ns_name_rollback (const u_char *, const u_char **, const u_char **) __THROW
int ns_sign (u_char *, int *, int, int, void *, const u_char *, int, u_char *, int *, time_t) __THROW
int ns_sign2 (u_char *, int *, int, int, void *, const u_char *, int, u_char *, int *, time_t, u_char **, u_char **) __THROW
int ns_sign_tcp (u_char *, int *, int, int, ns_tcp_tsig_state *, int) __THROW
int ns_sign_tcp2 (u_char *, int *, int, int, ns_tcp_tsig_state *, int, u_char **, u_char **) __THROW
int ns_sign_tcp_init (void *, const u_char *, int, ns_tcp_tsig_state *) __THROW
u_charns_find_tsig (u_char *, u_char *) __THROW
int ns_verify (u_char *, int *, void *, const u_char *, int, u_char *, int *, time_t *, int) __THROW
int ns_verify_tcp (u_char *, int *, ns_tcp_tsig_state *, int) __THROW
int ns_verify_tcp_init (void *, const u_char *, int, ns_tcp_tsig_state *) __THROW
int ns_samedomain (const char *, const char *) __THROW
int ns_subdomain (const char *, const char *) __THROW
int ns_makecanon (const char *, char *, size_t) __THROW
int ns_samename (const char *, const char *) __THROW

Detailed Description

Definition in file nameser.h.


Class Documentation

struct __ns_msg

Definition at line 114 of file nameser.h.

Class Members
u_int16_t _counts
const u_char * _eom
u_int16_t _flags
u_int16_t _id
const u_char * _msg
const u_char * _msg_ptr
int _rrnum
ns_sect _sect
const u_char * _sections
struct _ns_flagdata

Definition at line 124 of file nameser.h.

Class Members
int mask
int shift
struct __ns_rr

Definition at line 138 of file nameser.h.

Class Members
char name
const u_char * rdata
u_int16_t rdlength
u_int16_t rr_class
u_int32_t ttl
u_int16_t type
struct ns_tsig_key

Definition at line 222 of file nameser.h.

Class Members
char alg
unsigned char * data
int len
char name
struct ns_tcp_tsig_state

Definition at line 232 of file nameser.h.

Class Members
int counter
void * ctx
struct dst_key * key
unsigned char sig
int siglen

Define Documentation

#define __NAMESER   19991006 /*%< New interface version stamp. */

Definition at line 75 of file nameser.h.

#define BIND_4_COMPAT

Definition at line 57 of file nameser.h.

#define NS_ALG_DH   2 /*%< Diffie Hellman KEY */

Definition at line 383 of file nameser.h.

#define NS_ALG_DSA   3 /*%< DSA KEY */

Definition at line 384 of file nameser.h.

#define NS_ALG_DSS   NS_ALG_DSA

Definition at line 385 of file nameser.h.

#define NS_ALG_EXPIRE_ONLY   253 /*%< No alg, no security */

Definition at line 386 of file nameser.h.

#define NS_ALG_MD5RSA   1 /*%< MD5 with RSA */

Definition at line 382 of file nameser.h.

#define NS_ALG_PRIVATE_OID   254 /*%< Key begins with OID giving alg */

Definition at line 387 of file nameser.h.

#define NS_CMPRSFLGS   0xc0 /*%< Flag bits indicating name compression. */

Definition at line 92 of file nameser.h.

#define NS_DEFAULTPORT   53 /*%< For both TCP and UDP. */

Definition at line 93 of file nameser.h.

#define NS_DSA_MAX_BYTES   405

Definition at line 408 of file nameser.h.

#define NS_DSA_MIN_SIZE   213

Definition at line 407 of file nameser.h.

#define NS_DSA_SIG_SIZE   41

Definition at line 406 of file nameser.h.

#define NS_GET16 (   s,
  cp 
)
Value:
do { \
       register const u_char *t_cp = (const u_char *)(cp); \
       (s) = ((u_int16_t)t_cp[0] << 8) \
           | ((u_int16_t)t_cp[1]) \
           ; \
       (cp) += NS_INT16SZ; \
} while (0)

Definition at line 435 of file nameser.h.

#define NS_GET32 (   l,
  cp 
)
Value:
do { \
       register const u_char *t_cp = (const u_char *)(cp); \
       (l) = ((u_int32_t)t_cp[0] << 24) \
           | ((u_int32_t)t_cp[1] << 16) \
           | ((u_int32_t)t_cp[2] << 8) \
           | ((u_int32_t)t_cp[3]) \
           ; \
       (cp) += NS_INT32SZ; \
} while (0)

Definition at line 443 of file nameser.h.

#define NS_HFIXEDSZ   12 /*%< #/bytes of fixed data in header */

Definition at line 84 of file nameser.h.

#define NS_IN6ADDRSZ   16 /*%< IPv6 T_AAAA */

Definition at line 91 of file nameser.h.

#define NS_INADDRSZ   4 /*%< IPv4 T_A */

Definition at line 90 of file nameser.h.

#define NS_INT16SZ   2 /*%< #/bytes of data in a u_int16_t */

Definition at line 88 of file nameser.h.

#define NS_INT32SZ   4 /*%< #/bytes of data in a u_int32_t */

Definition at line 87 of file nameser.h.

#define NS_INT8SZ   1 /*%< #/bytes of data in a u_int8_t */

Definition at line 89 of file nameser.h.

#define NS_KEY_EXTENDED_FLAGS   0x1000 /*%< reserved - must be zero */

Definition at line 360 of file nameser.h.

#define NS_KEY_NAME_ENTITY   0x0200 /*%< key is assoc. with entity eg host */

Definition at line 365 of file nameser.h.

#define NS_KEY_NAME_RESERVED   0x0300 /*%< reserved meaning */

Definition at line 367 of file nameser.h.

#define NS_KEY_NAME_TYPE   0x0300 /*%< these bits determine the type */

Definition at line 363 of file nameser.h.

#define NS_KEY_NAME_USER   0x0000 /*%< key is assoc. with user */

Definition at line 364 of file nameser.h.

#define NS_KEY_NAME_ZONE   0x0100 /*%< key is zone key */

Definition at line 366 of file nameser.h.

#define NS_KEY_NO_AUTH   0x8000 /*%< Key unusable for authentication */

Definition at line 357 of file nameser.h.

#define NS_KEY_NO_CONF   0x4000 /*%< Key unusable for confidentiality */

Definition at line 358 of file nameser.h.

#define NS_KEY_PROT_ANY   255

Definition at line 394 of file nameser.h.

#define NS_KEY_PROT_DNSSEC   3

Definition at line 392 of file nameser.h.

#define NS_KEY_PROT_EMAIL   2

Definition at line 391 of file nameser.h.

#define NS_KEY_PROT_IPSEC   4

Definition at line 393 of file nameser.h.

#define NS_KEY_PROT_TLS   1

Definition at line 390 of file nameser.h.

#define NS_KEY_RESERVED10   0x0020 /*%< reserved - must be zero */

Definition at line 370 of file nameser.h.

#define NS_KEY_RESERVED11   0x0010 /*%< reserved - must be zero */

Definition at line 371 of file nameser.h.

#define NS_KEY_RESERVED2   0x2000 /* Security is *mandatory* if bit=0 */

Definition at line 359 of file nameser.h.

#define NS_KEY_RESERVED4   0x0800 /*%< reserved - must be zero */

Definition at line 361 of file nameser.h.

#define NS_KEY_RESERVED5   0x0400 /*%< reserved - must be zero */

Definition at line 362 of file nameser.h.

#define NS_KEY_RESERVED8   0x0080 /*%< reserved - must be zero */

Definition at line 368 of file nameser.h.

#define NS_KEY_RESERVED9   0x0040 /*%< reserved - must be zero */

Definition at line 369 of file nameser.h.

Value:
( NS_KEY_RESERVED2 | \
                              NS_KEY_RESERVED4 | \
                              NS_KEY_RESERVED5 | \
                              NS_KEY_RESERVED8 | \
                              NS_KEY_RESERVED9 | \
                              NS_KEY_RESERVED10 | \
                              NS_KEY_RESERVED11 )

Definition at line 373 of file nameser.h.

#define NS_KEY_RESERVED_BITMASK2   0xFFFF /*%< no bits defined here */

Definition at line 380 of file nameser.h.

#define NS_KEY_SIGNATORYMASK   0x000F /*%< key can sign RR's of same name */

Definition at line 372 of file nameser.h.

#define NS_KEY_TYPE_AUTH_CONF   0x0000 /*%< Key usable for both */

Definition at line 352 of file nameser.h.

#define NS_KEY_TYPE_AUTH_ONLY   0x4000 /*%< Key usable for authentication */

Definition at line 354 of file nameser.h.

#define NS_KEY_TYPE_CONF_ONLY   0x8000 /*%< Key usable for confidentiality */

Definition at line 353 of file nameser.h.

#define NS_KEY_TYPE_NO_KEY   0xC000 /*%< No key usable for either; no key */

Definition at line 355 of file nameser.h.

#define NS_KEY_TYPEMASK   0xC000 /*%< Mask for "type" bits */

Definition at line 351 of file nameser.h.

#define NS_MAXCDNAME   255 /*%< maximum compressed domain name */

Definition at line 82 of file nameser.h.

#define NS_MAXDNAME   1025 /*%< maximum domain name */

Definition at line 80 of file nameser.h.

#define NS_MAXLABEL   63 /*%< maximum length of domain label */

Definition at line 83 of file nameser.h.

#define NS_MAXMSG   65535 /*%< maximum message size */

Definition at line 81 of file nameser.h.

#define NS_MD5RSA_MAX_BASE64   (((NS_MD5RSA_MAX_BYTES+2)/3)*4)

Definition at line 402 of file nameser.h.

#define NS_MD5RSA_MAX_BITS   4096

Definition at line 398 of file nameser.h.

#define NS_MD5RSA_MAX_BYTES   ((NS_MD5RSA_MAX_BITS+7/8)*2+3)

Definition at line 400 of file nameser.h.

#define NS_MD5RSA_MAX_SIZE   ((NS_MD5RSA_MAX_BITS+7)/8)

Definition at line 404 of file nameser.h.

#define NS_MD5RSA_MIN_BITS   512 /*%< Size of a mod or exp in bits */

Definition at line 397 of file nameser.h.

#define NS_MD5RSA_MIN_SIZE   ((NS_MD5RSA_MIN_BITS+7)/8)

Definition at line 403 of file nameser.h.

#define ns_msg_base (   handle)    ((handle)._msg + 0)

Definition at line 130 of file nameser.h.

#define ns_msg_count (   handle,
  section 
)    ((handle)._counts[section] + 0)

Definition at line 133 of file nameser.h.

#define ns_msg_end (   handle)    ((handle)._eom + 0)

Definition at line 131 of file nameser.h.

#define ns_msg_id (   handle)    ((handle)._id + 0)

Definition at line 129 of file nameser.h.

#define ns_msg_size (   handle)    ((handle)._eom - (handle)._msg)

Definition at line 132 of file nameser.h.

#define NS_NXT_BIT_CLEAR (   n,
  p 
)    (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))

Definition at line 422 of file nameser.h.

#define NS_NXT_BIT_ISSET (   n,
  p 
)    (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS)))

Definition at line 423 of file nameser.h.

#define NS_NXT_BIT_SET (   n,
  p 
)    (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS)))

Definition at line 421 of file nameser.h.

#define NS_NXT_BITS   8

Definition at line 420 of file nameser.h.

#define NS_NXT_MAX   127

Definition at line 424 of file nameser.h.

#define NS_OPT_DNSSEC_OK   0x8000U

Definition at line 429 of file nameser.h.

#define NS_OPT_NSID   3

Definition at line 430 of file nameser.h.

#define NS_PACKETSZ   512 /*%< default UDP packet size */

Definition at line 79 of file nameser.h.

#define NS_PUT16 (   s,
  cp 
)
Value:
do { \
       register u_int16_t t_s = (u_int16_t)(s); \
       register u_char *t_cp = (u_char *)(cp); \
       *t_cp++ = t_s >> 8; \
       *t_cp   = t_s; \
       (cp) += NS_INT16SZ; \
} while (0)

Definition at line 453 of file nameser.h.

#define NS_PUT32 (   l,
  cp 
)
Value:
do { \
       register u_int32_t t_l = (u_int32_t)(l); \
       register u_char *t_cp = (u_char *)(cp); \
       *t_cp++ = t_l >> 24; \
       *t_cp++ = t_l >> 16; \
       *t_cp++ = t_l >> 8; \
       *t_cp   = t_l; \
       (cp) += NS_INT32SZ; \
} while (0)

Definition at line 461 of file nameser.h.

#define NS_QFIXEDSZ   4 /*%< #/bytes of fixed data in query */

Definition at line 85 of file nameser.h.

#define ns_rr_class (   rr)    ((ns_class)((rr).rr_class + 0))

Definition at line 150 of file nameser.h.

#define ns_rr_name (   rr)    (((rr).name[0] != '\0') ? (rr).name : ".")

Definition at line 148 of file nameser.h.

#define ns_rr_rdata (   rr)    ((rr).rdata + 0)

Definition at line 153 of file nameser.h.

#define ns_rr_rdlen (   rr)    ((rr).rdlength + 0)

Definition at line 152 of file nameser.h.

#define ns_rr_ttl (   rr)    ((rr).ttl + 0)

Definition at line 151 of file nameser.h.

#define ns_rr_type (   rr)    ((ns_type)((rr).type + 0))

Definition at line 149 of file nameser.h.

#define NS_RRFIXEDSZ   10 /*%< #/bytes of fixed data in r record */

Definition at line 86 of file nameser.h.

#define NS_SIG_ALG   2 /*%< Algorithm */

Definition at line 412 of file nameser.h.

#define NS_SIG_EXPIR   8 /*%< Expiration time */

Definition at line 415 of file nameser.h.

#define NS_SIG_FOOT   16 /*%< Key footprint */

Definition at line 417 of file nameser.h.

#define NS_SIG_LABELS   3 /*%< How many labels in name */

Definition at line 413 of file nameser.h.

#define NS_SIG_OTTL   4 /*%< Original TTL */

Definition at line 414 of file nameser.h.

#define NS_SIG_SIGNED   12 /*%< Signature time */

Definition at line 416 of file nameser.h.

#define NS_SIG_SIGNER   18 /*%< Domain name of who signed it */

Definition at line 418 of file nameser.h.

#define NS_SIG_TYPE   0 /*%< Type flags */

Definition at line 411 of file nameser.h.

#define ns_t_mrr_p (   t)    ((t) == ns_t_tsig || (t) == ns_t_opt)

Definition at line 311 of file nameser.h.

#define ns_t_qt_p (   t)
Value:
(ns_t_xfr_p(t) || (t) == ns_t_any || \
                    (t) == ns_t_mailb || (t) == ns_t_maila)

Definition at line 308 of file nameser.h.

#define ns_t_rr_p (   t)    (!ns_t_qt_p(t) && !ns_t_mrr_p(t))

Definition at line 313 of file nameser.h.

#define ns_t_udp_p (   t)    ((t) != ns_t_axfr && (t) != ns_t_zxfr)

Definition at line 314 of file nameser.h.

#define ns_t_xfr_p (   t)
Value:
((t) == ns_t_axfr || (t) == ns_t_ixfr || \
                     (t) == ns_t_zxfr)

Definition at line 315 of file nameser.h.

#define NS_TSIG_ALG_HMAC_MD5   "HMAC-MD5.SIG-ALG.REG.INT"

Definition at line 243 of file nameser.h.

#define NS_TSIG_ERROR_FORMERR   -12

Definition at line 247 of file nameser.h.

#define NS_TSIG_ERROR_NO_SPACE   -11

Definition at line 246 of file nameser.h.

#define NS_TSIG_ERROR_NO_TSIG   -10

Definition at line 245 of file nameser.h.

#define NS_TSIG_FUDGE   300

Definition at line 241 of file nameser.h.

#define NS_TSIG_TCP_COUNT   100

Definition at line 242 of file nameser.h.


Typedef Documentation

typedef enum __ns_class ns_class
typedef enum __ns_flag ns_flag
typedef struct __ns_msg ns_msg
typedef enum __ns_opcode ns_opcode
typedef enum __ns_rcode ns_rcode
typedef struct __ns_rr ns_rr
typedef enum __ns_sect ns_sect
typedef struct ns_tcp_tsig_state

Definition at line 239 of file nameser.h.

typedef struct ns_tsig_key

Definition at line 227 of file nameser.h.

typedef enum __ns_type ns_type

Enumeration Type Documentation

Enumerator:
cert_t_pkix 
cert_t_spki 
cert_t_pgp 
cert_t_url 
cert_t_oid 

Definition at line 342 of file nameser.h.

                             {
       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;
enum __ns_class
Enumerator:
ns_c_invalid 
ns_c_in 
ns_c_2 
ns_c_chaos 
ns_c_hs 
ns_c_none 
ns_c_any 
ns_c_max 

Definition at line 321 of file nameser.h.

                        {
       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_max = 65536
} ns_class;
enum __ns_flag
Enumerator:
ns_f_qr 
ns_f_opcode 
ns_f_aa 
ns_f_tc 
ns_f_rd 
ns_f_ra 
ns_f_z 
ns_f_ad 
ns_f_cd 
ns_f_rcode 
ns_f_max 

Definition at line 160 of file nameser.h.

                       {
       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;
Enumerator:
ns_kt_rsa 
ns_kt_dh 
ns_kt_dsa 
ns_kt_private 

Definition at line 335 of file nameser.h.

                            {
       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;
Enumerator:
ns_o_query 
ns_o_iquery 
ns_o_status 
ns_o_notify 
ns_o_update 
ns_o_max 

Definition at line 177 of file nameser.h.

                         {
       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_max = 6
} ns_opcode;
enum __ns_rcode
Enumerator:
ns_r_noerror 
ns_r_formerr 
ns_r_servfail 
ns_r_nxdomain 
ns_r_notimpl 
ns_r_refused 
ns_r_yxdomain 
ns_r_yxrrset 
ns_r_nxrrset 
ns_r_notauth 
ns_r_notzone 
ns_r_max 
ns_r_badvers 
ns_r_badsig 
ns_r_badkey 
ns_r_badtime 

Definition at line 190 of file nameser.h.

                              {
       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_max = 11,
       /* The following are EDNS extended rcodes */
       ns_r_badvers = 16,
       /* The following are TSIG errors */
       ns_r_badsig = 16,
       ns_r_badkey = 17,
       ns_r_badtime = 18
} ns_rcode;
enum __ns_sect
Enumerator:
ns_s_qd 
ns_s_zn 
ns_s_an 
ns_s_pr 
ns_s_ns 
ns_s_ud 
ns_s_ar 
ns_s_max 

Definition at line 98 of file nameser.h.

                       {
       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;
enum __ns_type
Enumerator:
ns_t_invalid 
ns_t_a 
ns_t_ns 
ns_t_md 
ns_t_mf 
ns_t_cname 
ns_t_soa 
ns_t_mb 
ns_t_mg 
ns_t_mr 
ns_t_null 
ns_t_wks 
ns_t_ptr 
ns_t_hinfo 
ns_t_minfo 
ns_t_mx 
ns_t_txt 
ns_t_rp 
ns_t_afsdb 
ns_t_x25 
ns_t_isdn 
ns_t_rt 
ns_t_nsap 
ns_t_nsap_ptr 
ns_t_sig 
ns_t_key 
ns_t_px 
ns_t_gpos 
ns_t_aaaa 
ns_t_loc 
ns_t_nxt 
ns_t_eid 
ns_t_nimloc 
ns_t_srv 
ns_t_atma 
ns_t_naptr 
ns_t_kx 
ns_t_cert 
ns_t_a6 
ns_t_dname 
ns_t_sink 
ns_t_opt 
ns_t_apl 
ns_t_tkey 
ns_t_tsig 
ns_t_ixfr 
ns_t_axfr 
ns_t_mailb 
ns_t_maila 
ns_t_any 
ns_t_zxfr 
ns_t_max 

Definition at line 252 of file nameser.h.

                       {
       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 (deprecated, use ns_t_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;
Enumerator:
ns_uop_delete 
ns_uop_add 
ns_uop_max 

Definition at line 213 of file nameser.h.


Function Documentation

u_int32_t ns_datetosecs ( const char *  cp,
int errp 
)

Definition at line 47 of file ns_date.c.

                                         {
       struct tm time;
       u_int32_t result;
       int mdays, i;
       static const int days_per_month[12] =
              {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

       if (strlen(cp) != 14U) {
              *errp = 1;
              return (0);
       }
       *errp = 0;

       memset(&time, 0, sizeof time);
       time.tm_year  = datepart(cp +  0, 4, 1990, 9999, errp) - 1900;
       time.tm_mon   = datepart(cp +  4, 2,   01,   12, errp) - 1;
       time.tm_mday  = datepart(cp +  6, 2,   01,   31, errp);
       time.tm_hour  = datepart(cp +  8, 2,   00,   23, errp);
       time.tm_min   = datepart(cp + 10, 2,   00,   59, errp);
       time.tm_sec   = datepart(cp + 12, 2,   00,   59, errp);
       if (*errp)           /*%< Any parse errors? */
              return (0);

       /*
        * OK, now because timegm() is not available in all environments,
        * we will do it by hand.  Roll up sleeves, curse the gods, begin!
        */

#define SECS_PER_DAY    ((u_int32_t)24*60*60)
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)

       result  = time.tm_sec;                           /*%< Seconds */
       result += time.tm_min * 60;               /*%< Minutes */
       result += time.tm_hour * (60*60);         /*%< Hours */
       result += (time.tm_mday - 1) * SECS_PER_DAY;     /*%< Days */
       /* Months are trickier.  Look without leaping, then leap */
       mdays = 0;
       for (i = 0; i < time.tm_mon; i++)
              mdays += days_per_month[i];
       result += mdays * SECS_PER_DAY;                  /*%< Months */
       if (time.tm_mon > 1 && isleap(1900+time.tm_year))
              result += SECS_PER_DAY;            /*%< Add leapday for this year */
       /* First figure years without leapdays, then add them in.  */
       /* The loop is slow, FIXME, but simple and accurate.  */
       result += (time.tm_year - 70) * (SECS_PER_DAY*365); /*%< Years */
       for (i = 70; i < time.tm_year; i++)
              if (isleap(1900+i))
                     result += SECS_PER_DAY; /*%< Add leapday for prev year */
       return (result);
}

Here is the call graph for this function:

u_char* ns_find_tsig ( u_char ,
u_char  
)
int ns_format_ttl ( u_long  ,
char *  ,
size_t   
)

Definition at line 49 of file ns_ttl.c.

                                                    {
       char *odst = dst;
       int secs, mins, hours, days, weeks, x;
       char *p;

       secs = src % 60;   src /= 60;
       mins = src % 60;   src /= 60;
       hours = src % 24;  src /= 24;
       days = src % 7;    src /= 7;
       weeks = src;       src = 0;

       x = 0;
       if (weeks) {
              T(fmt1(weeks, 'W', &dst, &dstlen));
              x++;
       }
       if (days) {
              T(fmt1(days, 'D', &dst, &dstlen));
              x++;
       }
       if (hours) {
              T(fmt1(hours, 'H', &dst, &dstlen));
              x++;
       }
       if (mins) {
              T(fmt1(mins, 'M', &dst, &dstlen));
              x++;
       }
       if (secs || !(weeks || days || hours || mins)) {
              T(fmt1(secs, 'S', &dst, &dstlen));
              x++;
       }

       if (x > 1) {
              int ch;

              for (p = odst; (ch = *p) != '\0'; p++)
                     if (isascii(ch) && isupper(ch))
                            *p = tolower(ch);
       }

       return (dst - odst);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 30 of file ns_netint.c.

                            {
       u_int dst;

       NS_GET16(dst, src);
       return (dst);
}

Here is the caller graph for this function:

Here is the caller graph for this function:

int ns_initparse ( const u_char ,
int  ,
ns_msg  
)

Here is the caller graph for this function:

int ns_makecanon ( const char *  ,
char *  ,
size_t   
)

Definition at line 164 of file ns_samedomain.c.

                                                         {
       size_t n = strlen(src);

       if (n + sizeof "." > dstsize) {                  /*%< Note: sizeof == 2 */
              __set_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 "\\." */
                     break;
              else
                     dst[--n] = '\0';
       dst[n++] = '.';
       dst[n] = '\0';
       return (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 64 of file ns_parse.c.

                                            {
       return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
}
int ns_name_compress ( const char *  ,
u_char ,
size_t  ,
const u_char **  ,
const u_char **   
)

Here is the caller graph for this function:

int ns_name_ntol ( const u_char ,
u_char ,
size_t   
)
int ns_name_ntop ( const u_char ,
char *  ,
size_t   
)

Definition at line 89 of file ns_name.c.

{
       const u_char *cp;
       char *dn, *eom;
       u_char c;
       u_int n;
       int l;

       cp = src;
       dn = dst;
       eom = dst + dstsiz;

       while ((n = *cp++) != 0) {
              if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
                     /* Some kind of compression pointer. */
                     __set_errno (EMSGSIZE);
                     return (-1);
              }
              if (dn != dst) {
                     if (dn >= eom) {
                            __set_errno (EMSGSIZE);
                            return (-1);
                     }
                     *dn++ = '.';
              }
              if ((l = labellen(cp - 1)) < 0) {
                     __set_errno (EMSGSIZE);
                     return(-1);
              }
              if (dn + l >= eom) {
                     __set_errno (EMSGSIZE);
                     return (-1);
              }
              if ((n & NS_CMPRSFLGS) == NS_TYPE_ELT) {
                     int m;

                     if (n != DNS_LABELTYPE_BITSTRING) {
                            /* XXX: labellen should reject this case */
                            __set_errno (EINVAL);
                            return(-1);
                     }
                     if ((m = decode_bitstring(&cp, dn, eom)) < 0)
                     {
                            __set_errno (EMSGSIZE);
                            return(-1);
                     }
                     dn += m;
                     continue;
              }
              for ((void)NULL; l > 0; l--) {
                     c = *cp++;
                     if (special(c)) {
                            if (dn + 1 >= eom) {
                                   __set_errno (EMSGSIZE);
                                   return (-1);
                            }
                            *dn++ = '\\';
                            *dn++ = (char)c;
                     } else if (!printable(c)) {
                            if (dn + 3 >= eom) {
                                   __set_errno (EMSGSIZE);
                                   return (-1);
                            }
                            *dn++ = '\\';
                            *dn++ = digits[c / 100];
                            *dn++ = digits[(c % 100) / 10];
                            *dn++ = digits[c % 10];
                     } else {
                            if (dn >= eom) {
                                   __set_errno (EMSGSIZE);
                                   return (-1);
                            }
                            *dn++ = (char)c;
                     }
              }
       }
       if (dn == dst) {
              if (dn >= eom) {
                     __set_errno (EMSGSIZE);
                     return (-1);
              }
              *dn++ = '.';
       }
       if (dn >= eom) {
              __set_errno (EMSGSIZE);
              return (-1);
       }
       *dn++ = '\0';
       return (dn - dst);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ns_name_pack ( const u_char ,
u_char ,
int  ,
const u_char **  ,
const u_char **   
)

Here is the caller graph for this function:

int ns_name_pton ( const char *  ,
u_char ,
size_t   
)

Here is the caller graph for this function:

void ns_name_rollback ( const u_char ,
const u_char **  ,
const u_char **   
)
int ns_name_skip ( const u_char **  ,
const u_char  
)

Definition at line 642 of file ns_name.c.

{
       const u_char *cp;
       u_int n;
       int l;

       cp = *ptrptr;
       while (cp < eom && (n = *cp++) != 0) {
              /* Check for indirection. */
              switch (n & NS_CMPRSFLGS) {
              case 0:                     /*%< normal case, n == len */
                     cp += n;
                     continue;
              case NS_TYPE_ELT: /*%< EDNS0 extended label */
                     if ((l = labellen(cp - 1)) < 0) {
                            __set_errno (EMSGSIZE);
                            return(-1);
                     }
                     cp += l;
                     continue;
              case NS_CMPRSFLGS:   /*%< indirection */
                     cp++;
                     break;
              default:             /*%< illegal type */
                     __set_errno (EMSGSIZE);
                     return (-1);
              }
              break;
       }
       if (cp > eom) {
              __set_errno (EMSGSIZE);
              return (-1);
       }
       *ptrptr = cp;
       return (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ns_name_uncompress ( const u_char ,
const u_char ,
const u_char ,
char *  ,
size_t   
)

Here is the caller graph for this function:

int ns_name_unpack ( const u_char ,
const u_char ,
const u_char ,
u_char ,
size_t   
)

Definition at line 380 of file ns_name.c.

{
       const u_char *srcp, *dstlim;
       u_char *dstp;
       int n, len, checked, l;

       len = -1;
       checked = 0;
       dstp = dst;
       srcp = src;
       dstlim = dst + dstsiz;
       if (srcp < msg || srcp >= eom) {
              __set_errno (EMSGSIZE);
              return (-1);
       }
       /* Fetch next label in domain name. */
       while ((n = *srcp++) != 0) {
              /* Check for indirection. */
              switch (n & NS_CMPRSFLGS) {
              case 0:
              case NS_TYPE_ELT:
                     /* Limit checks. */
                     if ((l = labellen(srcp - 1)) < 0) {
                            __set_errno (EMSGSIZE);
                            return(-1);
                     }
                     if (dstp + l + 1 >= dstlim || srcp + l >= eom) {
                            __set_errno (EMSGSIZE);
                            return (-1);
                     }
                     checked += l + 1;
                     *dstp++ = n;
                     memcpy(dstp, srcp, l);
                     dstp += l;
                     srcp += l;
                     break;

              case NS_CMPRSFLGS:
                     if (srcp >= eom) {
                            __set_errno (EMSGSIZE);
                            return (-1);
                     }
                     if (len < 0)
                            len = srcp - src + 1;
                     srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff));
                     if (srcp < msg || srcp >= eom) {  /*%< Out of range. */
                            __set_errno (EMSGSIZE);
                            return (-1);
                     }
                     checked += 2;
                     /*
                      * Check for loops in the compressed name;
                      * if we've looked at the whole message,
                      * there must be a loop.
                      */
                     if (checked >= eom - msg) {
                            __set_errno (EMSGSIZE);
                            return (-1);
                     }
                     break;

              default:
                     __set_errno (EMSGSIZE);
                     return (-1);                /*%< flag error */
              }
       }
       *dstp = '\0';
       if (len < 0)
              len = srcp - src;
       return (len);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ns_parse_ttl ( const char *  ,
u_long  
)
int ns_parserr ( ns_msg ,
ns_sect  ,
int  ,
ns_rr  
)

Here is the caller graph for this function:

void ns_put16 ( u_int  ,
u_char  
)

Here is the caller graph for this function:

void ns_put32 ( u_long  ,
u_char  
)

Here is the caller graph for this function:

int ns_samedomain ( const char *  ,
const char *   
)

Definition at line 48 of file ns_samedomain.c.

                                            {
       size_t la, lb;
       int diff, i, escaped;
       const char *cp;

       la = strlen(a);
       lb = strlen(b);

       /* Ignore a trailing label separator (i.e. an unescaped dot) in 'a'. */
       if (la != 0U && a[la - 1] == '.') {
              escaped = 0;
              /* Note this loop doesn't get executed if la==1. */
              for (i = la - 2; i >= 0; i--)
                     if (a[i] == '\\') {
                            if (escaped)
                                   escaped = 0;
                            else
                                   escaped = 1;
                     } else
                            break;
              if (!escaped)
                     la--;
       }

       /* Ignore a trailing label separator (i.e. an unescaped dot) in 'b'. */
       if (lb != 0U && b[lb - 1] == '.') {
              escaped = 0;
              /* note this loop doesn't get executed if lb==1 */
              for (i = lb - 2; i >= 0; i--)
                     if (b[i] == '\\') {
                            if (escaped)
                                   escaped = 0;
                            else
                                   escaped = 1;
                     } else
                            break;
              if (!escaped)
                     lb--;
       }

       /* lb == 0 means 'b' is the root domain, so 'a' must be in 'b'. */
       if (lb == 0U)
              return (1);

       /* 'b' longer than 'a' means 'a' can't be in 'b'. */
       if (lb > la)
              return (0);

       /* 'a' and 'b' being equal at this point indicates sameness. */
       if (lb == la)
              return (strncasecmp(a, b, lb) == 0);

       /* Ok, we know la > lb. */

       diff = la - lb;

       /*
        * If 'a' is only 1 character longer than 'b', then it can't be
        * a subdomain of 'b' (because of the need for the '.' label
        * separator).
        */
       if (diff < 2)
              return (0);

       /*
        * If the character before the last 'lb' characters of 'b'
        * isn't '.', then it can't be a match (this lets us avoid
        * having "foobar.com" match "bar.com").
        */
       if (a[diff - 1] != '.')
              return (0);

       /*
        * We're not sure about that '.', however.  It could be escaped
         * and thus not a really a label separator.
        */
       escaped = 0;
       for (i = diff - 2; i >= 0; i--)
              if (a[i] == '\\') {
                     if (escaped)
                            escaped = 0;
                     else
                            escaped = 1;
              } else
                     break;
       if (escaped)
              return (0);

       /* Now compare aligned trailing substring. */
       cp = a + diff;
       return (strncasecmp(cp, b, lb) == 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ns_samename ( const char *  ,
const char *   
)

Here is the caller graph for this function:

int ns_sign ( u_char ,
int ,
int  ,
int  ,
void *  ,
const u_char ,
int  ,
u_char ,
int ,
time_t   
)
int ns_sign2 ( u_char ,
int ,
int  ,
int  ,
void *  ,
const u_char ,
int  ,
u_char ,
int ,
time_t  ,
u_char **  ,
u_char **   
)
int ns_sign_tcp ( u_char ,
int ,
int  ,
int  ,
ns_tcp_tsig_state ,
int   
)
int ns_sign_tcp2 ( u_char ,
int ,
int  ,
int  ,
ns_tcp_tsig_state ,
int  ,
u_char **  ,
u_char **   
)
int ns_sign_tcp_init ( void *  ,
const u_char ,
int  ,
ns_tcp_tsig_state  
)
int ns_skiprr ( const u_char ,
const u_char ,
ns_sect  ,
int   
)

Definition at line 69 of file ns_parse.c.

                                                                            {
       const u_char *optr = ptr;

       for ((void)NULL; count > 0; count--) {
              int b, rdlength;

              b = dn_skipname(ptr, eom);
              if (b < 0)
                     RETERR(EMSGSIZE);
              ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/;
              if (section != ns_s_qd) {
                     if (ptr + NS_INT32SZ + NS_INT16SZ > eom)
                            RETERR(EMSGSIZE);
                     ptr += NS_INT32SZ/*TTL*/;
                     NS_GET16(rdlength, ptr);
                     ptr += rdlength/*RData*/;
              }
       }
       if (ptr > eom)
              RETERR(EMSGSIZE);
       return (ptr - optr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ns_sprintrr ( const ns_msg ,
const ns_rr ,
const char *  ,
const char *  ,
char *  ,
size_t   
)

Definition at line 73 of file ns_print.c.

{
       int n;

       n = ns_sprintrrf(ns_msg_base(*handle), ns_msg_size(*handle),
                      ns_rr_name(*rr), ns_rr_class(*rr), ns_rr_type(*rr),
                      ns_rr_ttl(*rr), ns_rr_rdata(*rr), ns_rr_rdlen(*rr),
                      name_ctx, origin, buf, buflen);
       return (n);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ns_sprintrrf ( const u_char ,
size_t  ,
const char *  ,
ns_class  ,
ns_type  ,
u_long  ,
const u_char ,
size_t  ,
const char *  ,
const char *  ,
char *  ,
size_t   
)

Here is the caller graph for this function:

int ns_subdomain ( const char *  ,
const char *   
)
int ns_verify ( u_char ,
int ,
void *  ,
const u_char ,
int  ,
u_char ,
int ,
time_t ,
int   
)
int ns_verify_tcp ( u_char ,
int ,
ns_tcp_tsig_state ,
int   
)
int ns_verify_tcp_init ( void *  ,
const u_char ,
int  ,
ns_tcp_tsig_state  
)