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