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