home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / unixlib / arpa / h / nameser < prev    next >
Encoding:
Text File  |  2006-09-17  |  19.1 KB  |  537 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/arpa/nameser.h,v $
  4.  * $Date: 2003/01/29 18:49:00 $
  5.  * $Revision: 1.5 $
  6.  * $State: Exp $
  7.  * $Author: admin $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /*
  12.  * Copyright (c) 1996-1999 by Internet Software Consortium.
  13.  *
  14.  * Permission to use, copy, modify, and distribute this software for any
  15.  * purpose with or without fee is hereby granted, provided that the above
  16.  * copyright notice and this permission notice appear in all copies.
  17.  *
  18.  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
  19.  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
  20.  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
  21.  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  22.  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  23.  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  24.  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  25.  * SOFTWARE.
  26.  */
  27.  
  28. /*
  29.  *    $BINDId: nameser.h,v 8.37 2000/03/30 21:16:49 vixie Exp $
  30.  */
  31.  
  32. #ifndef __ARPA_NAMESER_H
  33. #define __ARPA_NAMESER_H
  34.  
  35. #define BIND_4_COMPAT
  36.  
  37. #include <sys/param.h>
  38. #if (!defined(BSD)) || (BSD < 199306)
  39. # include <sys/bitypes.h>
  40. #else
  41. # include <sys/types.h>
  42. #endif
  43. #include <features.h>
  44.  
  45. /*
  46.  * Revision information.  This is the release date in YYYYMMDD format.
  47.  * It can change every day so the right thing to do with it is use it
  48.  * in preprocessor commands such as "#if (__NAMESER > 19931104)".  Do not
  49.  * compare for equality; rather, use it to determine whether your libbind.a
  50.  * contains a new enough lib/nameser/ to support the feature you need.
  51.  */
  52.  
  53. #define __NAMESER    19991006    /* New interface version stamp. */
  54.  
  55. /*
  56.  * Define constants based on RFC 883, RFC 1034, RFC 1035
  57.  */
  58. #define NS_PACKETSZ    512    /* maximum packet size */
  59. #define NS_MAXDNAME    1025    /* maximum domain name */
  60. #define NS_MAXCDNAME    255    /* maximum compressed domain name */
  61. #define NS_MAXLABEL    63    /* maximum length of domain label */
  62. #define NS_HFIXEDSZ    12    /* #/bytes of fixed data in header */
  63. #define NS_QFIXEDSZ    4    /* #/bytes of fixed data in query */
  64. #define NS_RRFIXEDSZ    10    /* #/bytes of fixed data in r record */
  65. #define NS_INT32SZ    4    /* #/bytes of data in a u_int32_t */
  66. #define NS_INT16SZ    2    /* #/bytes of data in a u_int16_t */
  67. #define NS_INT8SZ    1    /* #/bytes of data in a u_int8_t */
  68. #define NS_INADDRSZ    4    /* IPv4 T_A */
  69. #define NS_IN6ADDRSZ    16    /* IPv6 T_AAAA */
  70. #define NS_CMPRSFLGS    0xc0    /* Flag bits indicating name compression. */
  71. #define NS_DEFAULTPORT    53    /* For both TCP and UDP. */
  72.  
  73. /*
  74.  * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
  75.  * in synch with it.
  76.  */
  77. typedef enum __ns_sect {
  78.   ns_s_qd = 0,        /* Query: Question. */
  79.   ns_s_zn = 0,        /* Update: Zone. */
  80.   ns_s_an = 1,        /* Query: Answer. */
  81.   ns_s_pr = 1,        /* Update: Prerequisites. */
  82.   ns_s_ns = 2,        /* Query: Name servers. */
  83.   ns_s_ud = 2,        /* Update: Update. */
  84.   ns_s_ar = 3,        /* Query|Update: Additional records. */
  85.   ns_s_max = 4
  86. } ns_sect;
  87.  
  88. /*
  89.  * This is a message handle.  It is caller allocated and has no dynamic data.
  90.  * This structure is intended to be opaque to all but ns_parse.c, thus the
  91.  * leading _'s on the member names.  Use the accessor functions, not the _'s.
  92.  */
  93. typedef struct __ns_msg {
  94.   const u_char    *_msg, *_eom;
  95.   u_int16_t    _id, _flags, _counts[ns_s_max];
  96.   const u_char    *_sections[ns_s_max];
  97.   ns_sect        _sect;
  98.   int        _rrnum;
  99.   const u_char    *_ptr;
  100. } ns_msg;
  101.  
  102. /* Private data structure - do not use from outside library. */
  103. struct _ns_flagdata {  int mask, shift;  };
  104. extern struct _ns_flagdata _ns_flagdata[];
  105.  
  106. /* Accessor macros - this is part of the public interface. */
  107. #define ns_msg_getflag(handle, flag) ( \
  108.              ((handle)._flags & _ns_flagdata[flag].mask) \
  109.               >> _ns_flagdata[flag].shift \
  110.              )
  111. #define ns_msg_id(handle) ((handle)._id + 0)
  112. #define ns_msg_base(handle) ((handle)._msg + 0)
  113. #define ns_msg_end(handle) ((handle)._eom + 0)
  114. #define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
  115. #define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
  116.  
  117. /*
  118.  * This is a parsed record.  It is caller allocated and has no dynamic data.
  119.  */
  120. typedef    struct __ns_rr {
  121.   char        name[NS_MAXDNAME];
  122.   u_int16_t    type;
  123.   u_int16_t    rr_class;
  124.   u_int32_t    ttl;
  125.   u_int16_t    rdlength;
  126.   const u_char *    rdata;
  127. } ns_rr;
  128.  
  129. /* Accessor macros - this is part of the public interface. */
  130. #define ns_rr_name(rr)    (((rr).name[0] != '\0') ? (rr).name : ".")
  131. #define ns_rr_type(rr)    ((ns_type)((rr).type + 0))
  132. #define ns_rr_class(rr)    ((ns_class)((rr).rr_class + 0))
  133. #define ns_rr_ttl(rr)    ((rr).ttl + 0)
  134. #define ns_rr_rdlen(rr)    ((rr).rdlength + 0)
  135. #define ns_rr_rdata(rr)    ((rr).rdata + 0)
  136.  
  137. /*
  138.  * These don't have to be in the same order as in the packet flags word,
  139.  * and they can even overlap in some cases, but they will need to be kept
  140.  * in synch with ns_parse.c:ns_flagdata[].
  141.  */
  142. typedef enum __ns_flag {
  143.   ns_f_qr,        /* Question/Response. */
  144.   ns_f_opcode,        /* Operation code. */
  145.   ns_f_aa,        /* Authoritative Answer. */
  146.   ns_f_tc,        /* Truncation occurred. */
  147.   ns_f_rd,        /* Recursion Desired. */
  148.   ns_f_ra,        /* Recursion Available. */
  149.   ns_f_z,            /* MBZ. */
  150.   ns_f_ad,        /* Authentic Data (DNSSEC). */
  151.   ns_f_cd,        /* Checking Disabled (DNSSEC). */
  152.   ns_f_rcode,        /* Response code. */
  153.   ns_f_max
  154. } ns_flag;
  155.  
  156. /*
  157.  * Currently defined opcodes.
  158.  */
  159. typedef enum __ns_opcode {
  160.   ns_o_query = 0,        /* Standard query. */
  161.   ns_o_iquery = 1,    /* Inverse query (deprecated/unsupported). */
  162.   ns_o_status = 2,    /* Name server status query (unsupported). */
  163.   /* Opcode 3 is undefined/reserved. */
  164.   ns_o_notify = 4,    /* Zone change notification. */
  165.   ns_o_update = 5,    /* Zone update message. */
  166.   ns_o_max = 6
  167. } ns_opcode;
  168.  
  169. /*
  170.  * Currently defined response codes.
  171.  */
  172. typedef    enum __ns_rcode {
  173.   ns_r_noerror = 0,    /* No error occurred. */
  174.   ns_r_formerr = 1,    /* Format error. */
  175.   ns_r_servfail = 2,    /* Server failure. */
  176.   ns_r_nxdomain = 3,    /* Name error. */
  177.   ns_r_notimpl = 4,    /* Unimplemented. */
  178.   ns_r_refused = 5,    /* Operation refused. */
  179.   /* these are for BIND_UPDATE */
  180.   ns_r_yxdomain = 6,    /* Name exists */
  181.   ns_r_yxrrset = 7,    /* RRset exists */
  182.   ns_r_nxrrset = 8,    /* RRset does not exist */
  183.   ns_r_notauth = 9,    /* Not authoritative for zone */
  184.   ns_r_notzone = 10,    /* Zone of record different from zone section */
  185.   ns_r_max = 11,
  186.   /* The following are TSIG extended errors */
  187.   ns_r_badsig = 16,
  188.   ns_r_badkey = 17,
  189.   ns_r_badtime = 18
  190. } ns_rcode;
  191.  
  192. /* BIND_UPDATE */
  193. typedef enum __ns_update_operation {
  194.   ns_uop_delete = 0,
  195.   ns_uop_add = 1,
  196.   ns_uop_max = 2
  197. } ns_update_operation;
  198.  
  199. /*
  200.  * This structure is used for TSIG authenticated messages
  201.  */
  202. struct ns_tsig_key {
  203.   char name[NS_MAXDNAME], alg[NS_MAXDNAME];
  204.   unsigned char *data;
  205.   int len;
  206. };
  207. typedef struct ns_tsig_key ns_tsig_key;
  208.  
  209. /*
  210.  * This structure is used for TSIG authenticated TCP messages
  211.  */
  212. struct ns_tcp_tsig_state {
  213.   int counter;
  214.   struct dst_key *key;
  215.   void *ctx;
  216.   unsigned char sig[NS_PACKETSZ];
  217.   int siglen;
  218. };
  219. typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
  220.  
  221. #define NS_TSIG_FUDGE 300
  222. #define NS_TSIG_TCP_COUNT 100
  223. #define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
  224.  
  225. #define NS_TSIG_ERROR_NO_TSIG -10
  226. #define NS_TSIG_ERROR_NO_SPACE -11
  227. #define NS_TSIG_ERROR_FORMERR -12
  228.  
  229. /*
  230.  * Currently defined type values for resources and queries.
  231.  */
  232. typedef enum __ns_type {
  233.   ns_t_invalid = 0,    /* Cookie. */
  234.   ns_t_a = 1,        /* Host address. */
  235.   ns_t_ns = 2,        /* Authoritative server. */
  236.   ns_t_md = 3,        /* Mail destination. */
  237.   ns_t_mf = 4,        /* Mail forwarder. */
  238.   ns_t_cname = 5,        /* Canonical name. */
  239.   ns_t_soa = 6,        /* Start of authority zone. */
  240.   ns_t_mb = 7,        /* Mailbox domain name. */
  241.   ns_t_mg = 8,        /* Mail group member. */
  242.   ns_t_mr = 9,        /* Mail rename name. */
  243.   ns_t_null = 10,        /* Null resource record. */
  244.   ns_t_wks = 11,        /* Well known service. */
  245.   ns_t_ptr = 12,        /* Domain name pointer. */
  246.   ns_t_hinfo = 13,    /* Host information. */
  247.   ns_t_minfo = 14,    /* Mailbox information. */
  248.   ns_t_mx = 15,        /* Mail routing information. */
  249.   ns_t_txt = 16,        /* Text strings. */
  250.   ns_t_rp = 17,        /* Responsible person. */
  251.   ns_t_afsdb = 18,    /* AFS cell database. */
  252.   ns_t_x25 = 19,        /* X_25 calling address. */
  253.   ns_t_isdn = 20,        /* ISDN calling address. */
  254.   ns_t_rt = 21,        /* Router. */
  255.   ns_t_nsap = 22,        /* NSAP address. */
  256.   ns_t_nsap_ptr = 23,    /* Reverse NSAP lookup (deprecated). */
  257.   ns_t_sig = 24,        /* Security signature. */
  258.   ns_t_key = 25,        /* Security key. */
  259.   ns_t_px = 26,        /* X.400 mail mapping. */
  260.   ns_t_gpos = 27,        /* Geographical position (withdrawn). */
  261.   ns_t_aaaa = 28,        /* Ip6 Address. */
  262.   ns_t_loc = 29,        /* Location Information. */
  263.   ns_t_nxt = 30,        /* Next domain (security). */
  264.   ns_t_eid = 31,        /* Endpoint identifier. */
  265.   ns_t_nimloc = 32,    /* Nimrod Locator. */
  266.   ns_t_srv = 33,        /* Server Selection. */
  267.   ns_t_atma = 34,        /* ATM Address */
  268.   ns_t_naptr = 35,    /* Naming Authority PoinTeR */
  269.   ns_t_kx = 36,        /* Key Exchange */
  270.   ns_t_cert = 37,        /* Certification record */
  271.   ns_t_a6 = 38,        /* IPv6 address (deprecates AAAA) */
  272.   ns_t_dname = 39,    /* Non-terminal DNAME (for IPv6) */
  273.   ns_t_sink = 40,        /* Kitchen sink (experimentatl) */
  274.   ns_t_opt = 41,        /* EDNS0 option (meta-RR) */
  275.   ns_t_tsig = 250,    /* Transaction signature. */
  276.   ns_t_ixfr = 251,    /* Incremental zone transfer. */
  277.   ns_t_axfr = 252,    /* Transfer zone of authority. */
  278.   ns_t_mailb = 253,    /* Transfer mailbox records. */
  279.   ns_t_maila = 254,    /* Transfer mail agent records. */
  280.   ns_t_any = 255,        /* Wildcard match. */
  281.   ns_t_zxfr = 256,    /* BIND-specific, nonstandard. */
  282.   ns_t_max = 65536
  283. } ns_type;
  284.  
  285. /* Exclusively a QTYPE? (not also an RTYPE) */
  286. #define    ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
  287.                (t) == ns_t_mailb || (t) == ns_t_maila)
  288. /* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
  289. #define    ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
  290. /* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
  291. #define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
  292. #define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
  293. #define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
  294.                 (t) == ns_t_zxfr)
  295.  
  296. /*
  297.  * Values for class field
  298.  */
  299. typedef enum __ns_class {
  300.   ns_c_invalid = 0,    /* Cookie. */
  301.   ns_c_in = 1,        /* Internet. */
  302.   ns_c_2 = 2,        /* unallocated/unsupported. */
  303.   ns_c_chaos = 3,        /* MIT Chaos-net. */
  304.   ns_c_hs = 4,        /* MIT Hesiod. */
  305.   /* Query class values which do not appear in resource records */
  306.   ns_c_none = 254,    /* for prereq. sections in update requests */
  307.   ns_c_any = 255,        /* Wildcard match. */
  308.   ns_c_max = 65536
  309. } ns_class;
  310.  
  311. /* DNSSEC constants. */
  312.  
  313. typedef enum __ns_key_types {
  314.   ns_kt_rsa = 1,        /* key type RSA/MD5 */
  315.   ns_kt_dh  = 2,        /* Diffie Hellman */
  316.   ns_kt_dsa = 3,        /* Digital Signature Standard (MANDATORY) */
  317.   ns_kt_private = 254    /* Private key type starts with OID */
  318. } ns_key_types;
  319.  
  320. typedef enum __ns_cert_types {
  321.   cert_t_pkix = 1,    /* PKIX (X.509v3) */
  322.   cert_t_spki = 2,    /* SPKI */
  323.   cert_t_pgp  = 3,    /* PGP */
  324.   cert_t_url  = 253,    /* URL private type */
  325.   cert_t_oid  = 254    /* OID private type */
  326. } ns_cert_types;
  327.  
  328. /* Flags field of the KEY RR rdata. */
  329. #define    NS_KEY_TYPEMASK        0xC000    /* Mask for "type" bits */
  330. #define    NS_KEY_TYPE_AUTH_CONF    0x0000    /* Key usable for both */
  331. #define    NS_KEY_TYPE_CONF_ONLY    0x8000    /* Key usable for confidentiality */
  332. #define    NS_KEY_TYPE_AUTH_ONLY    0x4000    /* Key usable for authentication */
  333. #define    NS_KEY_TYPE_NO_KEY    0xC000    /* No key usable for either; no key */
  334. /* The type bits can also be interpreted independently, as single bits: */
  335. #define    NS_KEY_NO_AUTH        0x8000    /* Key unusable for authentication */
  336. #define    NS_KEY_NO_CONF        0x4000    /* Key unusable for confidentiality */
  337. #define    NS_KEY_RESERVED2    0x2000    /* Security is *mandatory* if bit=0 */
  338. #define    NS_KEY_EXTENDED_FLAGS    0x1000    /* reserved - must be zero */
  339. #define    NS_KEY_RESERVED4    0x0800  /* reserved - must be zero */
  340. #define    NS_KEY_RESERVED5    0x0400  /* reserved - must be zero */
  341. #define    NS_KEY_NAME_TYPE    0x0300    /* these bits determine the type */
  342. #define    NS_KEY_NAME_USER    0x0000    /* key is assoc. with user */
  343. #define    NS_KEY_NAME_ENTITY    0x0200    /* key is assoc. with entity eg host */
  344. #define    NS_KEY_NAME_ZONE    0x0100    /* key is zone key */
  345. #define    NS_KEY_NAME_RESERVED    0x0300    /* reserved meaning */
  346. #define    NS_KEY_RESERVED8    0x0080  /* reserved - must be zero */
  347. #define    NS_KEY_RESERVED9    0x0040  /* reserved - must be zero */
  348. #define    NS_KEY_RESERVED10    0x0020  /* reserved - must be zero */
  349. #define    NS_KEY_RESERVED11    0x0010  /* reserved - must be zero */
  350. #define    NS_KEY_SIGNATORYMASK    0x000F    /* key can sign RR's of same name */
  351. #define    NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
  352.                   NS_KEY_RESERVED4 | \
  353.                   NS_KEY_RESERVED5 | \
  354.                   NS_KEY_RESERVED8 | \
  355.                   NS_KEY_RESERVED9 | \
  356.                   NS_KEY_RESERVED10 | \
  357.                   NS_KEY_RESERVED11 )
  358. #define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */
  359.  
  360. /* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
  361. #define    NS_ALG_MD5RSA        1    /* MD5 with RSA */
  362. #define    NS_ALG_DH               2    /* Diffie Hellman KEY */
  363. #define    NS_ALG_DSA              3    /* DSA KEY */
  364. #define    NS_ALG_DSS              NS_ALG_DSA
  365. #define    NS_ALG_EXPIRE_ONLY    253    /* No alg, no security */
  366. #define    NS_ALG_PRIVATE_OID    254    /* Key begins with OID giving alg */
  367.  
  368. /* Protocol values  */
  369. /* value 0 is reserved */
  370. #define NS_KEY_PROT_TLS         1
  371. #define NS_KEY_PROT_EMAIL       2
  372. #define NS_KEY_PROT_DNSSEC      3
  373. #define NS_KEY_PROT_IPSEC       4
  374. #define NS_KEY_PROT_ANY        255
  375.  
  376. /* Signatures */
  377. #define    NS_MD5RSA_MIN_BITS     512    /* Size of a mod or exp in bits */
  378. #define    NS_MD5RSA_MAX_BITS    2552
  379. /* Total of binary mod and exp */
  380. #define    NS_MD5RSA_MAX_BYTES    ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
  381. /* Max length of text sig block */
  382. #define    NS_MD5RSA_MAX_BASE64    (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
  383. #define NS_MD5RSA_MIN_SIZE    ((NS_MD5RSA_MIN_BITS+7)/8)
  384. #define NS_MD5RSA_MAX_SIZE    ((NS_MD5RSA_MAX_BITS+7)/8)
  385.  
  386. #define NS_DSA_SIG_SIZE         41
  387. #define NS_DSA_MIN_SIZE         213
  388. #define NS_DSA_MAX_BYTES        405
  389.  
  390. /* Offsets into SIG record rdata to find various values */
  391. #define    NS_SIG_TYPE    0    /* Type flags */
  392. #define    NS_SIG_ALG    2    /* Algorithm */
  393. #define    NS_SIG_LABELS    3    /* How many labels in name */
  394. #define    NS_SIG_OTTL    4    /* Original TTL */
  395. #define    NS_SIG_EXPIR    8    /* Expiration time */
  396. #define    NS_SIG_SIGNED    12    /* Signature time */
  397. #define    NS_SIG_FOOT    16    /* Key footprint */
  398. #define    NS_SIG_SIGNER    18    /* Domain name of who signed it */
  399.  
  400. /* How RR types are represented as bit-flags in NXT records */
  401. #define    NS_NXT_BITS 8
  402. #define    NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
  403. #define    NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
  404. #define    NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
  405. #define NS_NXT_MAX 127
  406.  
  407. /*
  408.  * Inline versions of get/put short/long.  Pointer is advanced.
  409.  */
  410. #define NS_GET16(s, cp) do { \
  411.     register u_char *t_cp = (u_char *)(cp); \
  412.     (s) = ((u_int16_t)t_cp[0] << 8) \
  413.         | ((u_int16_t)t_cp[1]) \
  414.           ; \
  415.     (cp) += NS_INT16SZ; \
  416. } while (0)
  417.  
  418. #define NS_GET32(l, cp) do { \
  419.     register u_char *t_cp = (u_char *)(cp); \
  420.     (l) = ((u_int32_t)t_cp[0] << 24) \
  421.         | ((u_int32_t)t_cp[1] << 16) \
  422.         | ((u_int32_t)t_cp[2] << 8) \
  423.         | ((u_int32_t)t_cp[3]) \
  424.           ; \
  425.     (cp) += NS_INT32SZ; \
  426. } while (0)
  427.  
  428. #define NS_PUT16(s, cp) do { \
  429.     register u_int16_t t_s = (u_int16_t)(s); \
  430.     register u_char *t_cp = (u_char *)(cp); \
  431.       *t_cp++ = t_s >> 8; \
  432.       *t_cp   = t_s; \
  433.     (cp) += NS_INT16SZ; \
  434. } while (0)
  435.  
  436. #define NS_PUT32(l, cp) do { \
  437.     register u_int32_t t_l = (u_int32_t)(l); \
  438.     register u_char *t_cp = (u_char *)(cp); \
  439.       *t_cp++ = t_l >> 24; \
  440.       *t_cp++ = t_l >> 16; \
  441.       *t_cp++ = t_l >> 8; \
  442.       *t_cp   = t_l; \
  443.     (cp) += NS_INT32SZ; \
  444. } while (0)
  445.  
  446. /*
  447.  * ANSI C identifier hiding for bind's lib/nameser.
  448.  */
  449. #define ns_get16        __ns_get16
  450. #define ns_get32        __ns_get32
  451. #define ns_put16        __ns_put16
  452. #define ns_put32        __ns_put32
  453. #define ns_initparse        __ns_initparse
  454. #define ns_skiprr        __ns_skiprr
  455. #define ns_parserr        __ns_parserr
  456. #define    ns_sprintrr        __ns_sprintrr
  457. #define    ns_sprintrrf        __ns_sprintrrf
  458. #define    ns_format_ttl        __ns_format_ttl
  459. #define    ns_parse_ttl        __ns_parse_ttl
  460. #define ns_datetosecs        __ns_datetosecs
  461. #define    ns_name_ntol        __ns_name_ntol
  462. #define    ns_name_ntop        __ns_name_ntop
  463. #define    ns_name_pton        __ns_name_pton
  464. #define    ns_name_unpack        __ns_name_unpack
  465. #define    ns_name_pack        __ns_name_pack
  466. #define    ns_name_compress    __ns_name_compress
  467. #define    ns_name_uncompress    __ns_name_uncompress
  468. #define    ns_name_skip        __ns_name_skip
  469. #define    ns_name_rollback    __ns_name_rollback
  470. #define    ns_sign            __ns_sign
  471. #define    ns_sign_tcp        __ns_sign_tcp
  472. #define    ns_sign_tcp_init    __ns_sign_tcp_init
  473. #define ns_find_tsig        __ns_find_tsig
  474. #define    ns_verify        __ns_verify
  475. #define    ns_verify_tcp        __ns_verify_tcp
  476. #define    ns_verify_tcp_init    __ns_verify_tcp_init
  477. #define    ns_samedomain        __ns_samedomain
  478. #define    ns_subdomain        __ns_subdomain
  479. #define    ns_makecanon        __ns_makecanon
  480. #define    ns_samename        __ns_samename
  481.  
  482. __BEGIN_DECLS
  483. u_int        ns_get16 __P((const u_char *));
  484. u_long        ns_get32 __P((const u_char *));
  485. void        ns_put16 __P((u_int, u_char *));
  486. void        ns_put32 __P((u_long, u_char *));
  487. int        ns_initparse __P((const u_char *, int, ns_msg *));
  488. int        ns_skiprr __P((const u_char *, const u_char *, ns_sect, int));
  489. int        ns_parserr __P((ns_msg *, ns_sect, int, ns_rr *));
  490. int        ns_sprintrr __P((const ns_msg *, const ns_rr *,
  491.                  const char *, const char *, char *, size_t));
  492. int        ns_sprintrrf __P((const u_char *, size_t, const char *,
  493.                   ns_class, ns_type, u_long, const u_char *,
  494.                   size_t, const char *, const char *,
  495.                   char *, size_t));
  496. int        ns_format_ttl __P((u_long, char *, size_t));
  497. int        ns_parse_ttl __P((const char *, u_long *));
  498. u_int32_t    ns_datetosecs __P((const char *cp, int *errp));
  499. int        ns_name_ntol __P((const u_char *, u_char *, size_t));
  500. int        ns_name_ntop __P((const u_char *, char *, size_t));
  501. int        ns_name_pton __P((const char *, u_char *, size_t));
  502. int        ns_name_unpack __P((const u_char *, const u_char *,
  503.                     const u_char *, u_char *, size_t));
  504. int        ns_name_pack __P((const u_char *, u_char *, int,
  505.                   const u_char **, const u_char **));
  506. int        ns_name_uncompress __P((const u_char *, const u_char *,
  507.                     const u_char *, char *, size_t));
  508. int        ns_name_compress __P((const char *, u_char *, size_t,
  509.                       const u_char **, const u_char **));
  510. int        ns_name_skip __P((const u_char **, const u_char *));
  511. void        ns_name_rollback __P((const u_char *, const u_char **,
  512.                       const u_char **));
  513. int        ns_sign __P((u_char *, int *, int, int, void *,
  514.                  const u_char *, int, u_char *, int *, time_t));
  515. int        ns_sign_tcp __P((u_char *, int *, int, int,
  516.                  ns_tcp_tsig_state *, int));
  517. int        ns_sign_tcp_init __P((void *, const u_char *, int,
  518.                       ns_tcp_tsig_state *));
  519. u_char        *ns_find_tsig __P((u_char *, u_char *));
  520. int        ns_verify __P((u_char *, int *, void *,
  521.                    const u_char *, int, u_char *, int *,
  522.                    time_t *, int));
  523. int        ns_verify_tcp __P((u_char *, int *, ns_tcp_tsig_state *, int));
  524. int        ns_verify_tcp_init __P((void *, const u_char *, int,
  525.                     ns_tcp_tsig_state *));
  526. int        ns_samedomain __P((const char *, const char *));
  527. int        ns_subdomain __P((const char *, const char *));
  528. int        ns_makecanon __P((const char *, char *, size_t));
  529. int        ns_samename __P((const char *, const char *));
  530. __END_DECLS
  531.  
  532. #ifdef BIND_4_COMPAT
  533. #include <arpa/nameser_compat.h>
  534. #endif
  535.  
  536. #endif /* !__ARPA_NAMESER_H_ */
  537.