1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers. 3*7c478bd9Sstevel@tonic-gate * All rights reserved. 4*7c478bd9Sstevel@tonic-gate * 5*7c478bd9Sstevel@tonic-gate * By using this file, you agree to the terms and conditions set 6*7c478bd9Sstevel@tonic-gate * forth in the LICENSE file which can be found at the top level of 7*7c478bd9Sstevel@tonic-gate * the sendmail distribution. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate */ 10*7c478bd9Sstevel@tonic-gate 11*7c478bd9Sstevel@tonic-gate /* 12*7c478bd9Sstevel@tonic-gate * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H�gskolan 13*7c478bd9Sstevel@tonic-gate * (Royal Institute of Technology, Stockholm, Sweden). 14*7c478bd9Sstevel@tonic-gate * All rights reserved. 15*7c478bd9Sstevel@tonic-gate * 16*7c478bd9Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 17*7c478bd9Sstevel@tonic-gate * modification, are permitted provided that the following conditions 18*7c478bd9Sstevel@tonic-gate * are met: 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 21*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 22*7c478bd9Sstevel@tonic-gate * 23*7c478bd9Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 24*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 25*7c478bd9Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 26*7c478bd9Sstevel@tonic-gate * 27*7c478bd9Sstevel@tonic-gate * 3. Neither the name of the Institute nor the names of its contributors 28*7c478bd9Sstevel@tonic-gate * may be used to endorse or promote products derived from this software 29*7c478bd9Sstevel@tonic-gate * without specific prior written permission. 30*7c478bd9Sstevel@tonic-gate * 31*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 32*7c478bd9Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 33*7c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 34*7c478bd9Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 35*7c478bd9Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36*7c478bd9Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37*7c478bd9Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38*7c478bd9Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 39*7c478bd9Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 40*7c478bd9Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41*7c478bd9Sstevel@tonic-gate * SUCH DAMAGE. 42*7c478bd9Sstevel@tonic-gate */ 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* $Id: sm_resolve.h,v 8.8 2001/09/01 00:06:02 gshapiro Exp $ */ 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate #if DNSMAP 47*7c478bd9Sstevel@tonic-gate # ifndef __ROKEN_RESOLVE_H__ 48*7c478bd9Sstevel@tonic-gate # define __ROKEN_RESOLVE_H__ 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* We use these, but they are not always present in <arpa/nameser.h> */ 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate # ifndef T_TXT 53*7c478bd9Sstevel@tonic-gate # define T_TXT 16 54*7c478bd9Sstevel@tonic-gate # endif /* ! T_TXT */ 55*7c478bd9Sstevel@tonic-gate # ifndef T_AFSDB 56*7c478bd9Sstevel@tonic-gate # define T_AFSDB 18 57*7c478bd9Sstevel@tonic-gate # endif /* ! T_AFSDB */ 58*7c478bd9Sstevel@tonic-gate # ifndef T_SRV 59*7c478bd9Sstevel@tonic-gate # define T_SRV 33 60*7c478bd9Sstevel@tonic-gate # endif /* ! T_SRV */ 61*7c478bd9Sstevel@tonic-gate # ifndef T_NAPTR 62*7c478bd9Sstevel@tonic-gate # define T_NAPTR 35 63*7c478bd9Sstevel@tonic-gate # endif /* ! T_NAPTR */ 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate typedef struct 66*7c478bd9Sstevel@tonic-gate { 67*7c478bd9Sstevel@tonic-gate char *dns_q_domain; 68*7c478bd9Sstevel@tonic-gate unsigned int dns_q_type; 69*7c478bd9Sstevel@tonic-gate unsigned int dns_q_class; 70*7c478bd9Sstevel@tonic-gate } DNS_QUERY_T; 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate typedef struct 73*7c478bd9Sstevel@tonic-gate { 74*7c478bd9Sstevel@tonic-gate unsigned int mx_r_preference; 75*7c478bd9Sstevel@tonic-gate char mx_r_domain[1]; 76*7c478bd9Sstevel@tonic-gate } MX_RECORD_T; 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate typedef struct 79*7c478bd9Sstevel@tonic-gate { 80*7c478bd9Sstevel@tonic-gate unsigned int srv_r_priority; 81*7c478bd9Sstevel@tonic-gate unsigned int srv_r_weight; 82*7c478bd9Sstevel@tonic-gate unsigned int srv_r_port; 83*7c478bd9Sstevel@tonic-gate char srv_r_target[1]; 84*7c478bd9Sstevel@tonic-gate } SRV_RECORDT_T; 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate typedef struct resource_record RESOURCE_RECORD_T; 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate struct resource_record 90*7c478bd9Sstevel@tonic-gate { 91*7c478bd9Sstevel@tonic-gate char *rr_domain; 92*7c478bd9Sstevel@tonic-gate unsigned int rr_type; 93*7c478bd9Sstevel@tonic-gate unsigned int rr_class; 94*7c478bd9Sstevel@tonic-gate unsigned int rr_ttl; 95*7c478bd9Sstevel@tonic-gate unsigned int rr_size; 96*7c478bd9Sstevel@tonic-gate union 97*7c478bd9Sstevel@tonic-gate { 98*7c478bd9Sstevel@tonic-gate void *rr_data; 99*7c478bd9Sstevel@tonic-gate MX_RECORD_T *rr_mx; 100*7c478bd9Sstevel@tonic-gate MX_RECORD_T *rr_afsdb; /* mx and afsdb are identical */ 101*7c478bd9Sstevel@tonic-gate SRV_RECORDT_T *rr_srv; 102*7c478bd9Sstevel@tonic-gate # if NETINET 103*7c478bd9Sstevel@tonic-gate struct in_addr *rr_a; 104*7c478bd9Sstevel@tonic-gate # endif /* NETINET */ 105*7c478bd9Sstevel@tonic-gate # if NETINET6 106*7c478bd9Sstevel@tonic-gate struct in6_addr *rr_aaaa; 107*7c478bd9Sstevel@tonic-gate # endif /* NETINET6 */ 108*7c478bd9Sstevel@tonic-gate char *rr_txt; 109*7c478bd9Sstevel@tonic-gate } rr_u; 110*7c478bd9Sstevel@tonic-gate RESOURCE_RECORD_T *rr_next; 111*7c478bd9Sstevel@tonic-gate }; 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate # if !defined(T_A) && !defined(T_AAAA) 114*7c478bd9Sstevel@tonic-gate /* XXX if <arpa/nameser.h> isn't included */ 115*7c478bd9Sstevel@tonic-gate typedef int HEADER; /* will never be used */ 116*7c478bd9Sstevel@tonic-gate # endif /* !defined(T_A) && !defined(T_AAAA) */ 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate typedef struct 119*7c478bd9Sstevel@tonic-gate { 120*7c478bd9Sstevel@tonic-gate HEADER dns_r_h; 121*7c478bd9Sstevel@tonic-gate DNS_QUERY_T dns_r_q; 122*7c478bd9Sstevel@tonic-gate RESOURCE_RECORD_T *dns_r_head; 123*7c478bd9Sstevel@tonic-gate } DNS_REPLY_T; 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate extern void dns_free_data __P((DNS_REPLY_T *)); 127*7c478bd9Sstevel@tonic-gate extern int dns_string_to_type __P((const char *)); 128*7c478bd9Sstevel@tonic-gate extern const char *dns_type_to_string __P((int)); 129*7c478bd9Sstevel@tonic-gate extern DNS_REPLY_T *dns_lookup_int __P((const char *, 130*7c478bd9Sstevel@tonic-gate int, 131*7c478bd9Sstevel@tonic-gate int, 132*7c478bd9Sstevel@tonic-gate time_t, 133*7c478bd9Sstevel@tonic-gate int)); 134*7c478bd9Sstevel@tonic-gate # if 0 135*7c478bd9Sstevel@tonic-gate extern DNS_REPLY_T *dns_lookup __P((const char *domain, 136*7c478bd9Sstevel@tonic-gate const char *type_name, 137*7c478bd9Sstevel@tonic-gate time_t retrans, 138*7c478bd9Sstevel@tonic-gate int retry)); 139*7c478bd9Sstevel@tonic-gate # endif /* 0 */ 140*7c478bd9Sstevel@tonic-gate 141*7c478bd9Sstevel@tonic-gate # endif /* ! __ROKEN_RESOLVE_H__ */ 142*7c478bd9Sstevel@tonic-gate #endif /* DNSMAP */ 143