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