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