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