sm_resolve.h revision 90792
1129202Scognet/*
2129202Scognet * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3129202Scognet *	All rights reserved.
4129202Scognet *
5129202Scognet * By using this file, you agree to the terms and conditions set
6129202Scognet * forth in the LICENSE file which can be found at the top level of
7129202Scognet * the sendmail distribution.
8129202Scognet *
9129202Scognet */
10129202Scognet
11129202Scognet/*
12129202Scognet * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H�gskolan
13129202Scognet * (Royal Institute of Technology, Stockholm, Sweden).
14129202Scognet * All rights reserved.
15129202Scognet *
16129202Scognet * Redistribution and use in source and binary forms, with or without
17129202Scognet * modification, are permitted provided that the following conditions
18129202Scognet * are met:
19129202Scognet *
20129202Scognet * 1. Redistributions of source code must retain the above copyright
21129202Scognet *    notice, this list of conditions and the following disclaimer.
22129202Scognet *
23129202Scognet * 2. Redistributions in binary form must reproduce the above copyright
24129202Scognet *    notice, this list of conditions and the following disclaimer in the
25129202Scognet *    documentation and/or other materials provided with the distribution.
26129202Scognet *
27129202Scognet * 3. Neither the name of the Institute nor the names of its contributors
28129202Scognet *    may be used to endorse or promote products derived from this software
29129202Scognet *    without specific prior written permission.
30129202Scognet *
31129202Scognet * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
32129202Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33129202Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34129202Scognet * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
35129202Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36129202Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37129202Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38129202Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39129202Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40129202Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41129202Scognet * SUCH DAMAGE.
42129202Scognet */
43129202Scognet
44129202Scognet/* $Id: sm_resolve.h,v 8.8 2001/09/01 00:06:02 gshapiro Exp $ */
45129202Scognet
46129202Scognet#if DNSMAP
47129202Scognet# ifndef __ROKEN_RESOLVE_H__
48129202Scognet#  define __ROKEN_RESOLVE_H__
49129202Scognet
50129202Scognet/* We use these, but they are not always present in <arpa/nameser.h> */
51129202Scognet
52129202Scognet#  ifndef T_TXT
53129202Scognet#   define T_TXT		16
54129202Scognet#  endif /* ! T_TXT */
55129202Scognet#  ifndef T_AFSDB
56129202Scognet#   define T_AFSDB		18
57129202Scognet#  endif /* ! T_AFSDB */
58129202Scognet#  ifndef T_SRV
59129202Scognet#   define T_SRV		33
60129202Scognet#  endif /* ! T_SRV */
61129202Scognet#  ifndef T_NAPTR
62129202Scognet#   define T_NAPTR		35
63129202Scognet#  endif /* ! T_NAPTR */
64129202Scognet
65129202Scognettypedef struct
66129202Scognet{
67129202Scognet	char		*dns_q_domain;
68129202Scognet	unsigned int	dns_q_type;
69129202Scognet	unsigned int	dns_q_class;
70129202Scognet} DNS_QUERY_T;
71129202Scognet
72129202Scognettypedef struct
73129202Scognet{
74129202Scognet	unsigned int	mx_r_preference;
75129202Scognet	char		mx_r_domain[1];
76129202Scognet} MX_RECORD_T;
77129202Scognet
78129202Scognettypedef struct
79129202Scognet{
80129202Scognet	unsigned int	srv_r_priority;
81129202Scognet	unsigned int	srv_r_weight;
82129202Scognet	unsigned int	srv_r_port;
83129202Scognet	char		srv_r_target[1];
84129202Scognet} SRV_RECORDT_T;
85129202Scognet
86129202Scognet
87129202Scognettypedef struct resource_record RESOURCE_RECORD_T;
88129202Scognet
89129202Scognetstruct resource_record
90129202Scognet{
91129202Scognet	char			*rr_domain;
92129202Scognet	unsigned int		rr_type;
93129202Scognet	unsigned int		rr_class;
94129202Scognet	unsigned int		rr_ttl;
95129202Scognet	unsigned int		rr_size;
96129202Scognet	union
97129202Scognet	{
98129202Scognet		void		*rr_data;
99129202Scognet		MX_RECORD_T	*rr_mx;
100129202Scognet		MX_RECORD_T	*rr_afsdb; /* mx and afsdb are identical */
101129202Scognet		SRV_RECORDT_T	*rr_srv;
102129202Scognet#  if NETINET
103129202Scognet		struct in_addr	*rr_a;
104129202Scognet#  endif /* NETINET */
105129202Scognet#  if NETINET6
106129202Scognet		struct in6_addr *rr_aaaa;
107129202Scognet#  endif /* NETINET6 */
108129202Scognet		char		*rr_txt;
109129202Scognet	} rr_u;
110129202Scognet	RESOURCE_RECORD_T *rr_next;
111129202Scognet};
112129202Scognet
113129202Scognet#  if !defined(T_A) && !defined(T_AAAA)
114129202Scognet/* XXX if <arpa/nameser.h> isn't included */
115129202Scognettypedef int HEADER; /* will never be used */
116129202Scognet#  endif /* !defined(T_A) && !defined(T_AAAA)  */
117129202Scognet
118129202Scognettypedef struct
119129202Scognet{
120129202Scognet	HEADER			dns_r_h;
121129202Scognet	DNS_QUERY_T		dns_r_q;
122129202Scognet	RESOURCE_RECORD_T	*dns_r_head;
123129202Scognet} DNS_REPLY_T;
124129202Scognet
125129202Scognet
126129202Scognetextern void		dns_free_data __P((DNS_REPLY_T *));
127129202Scognetextern int		dns_string_to_type __P((const char *));
128129202Scognetextern const char	*dns_type_to_string __P((int));
129129202Scognetextern DNS_REPLY_T	*dns_lookup_int __P((const char *,
130129202Scognet				int,
131129202Scognet				int,
132129202Scognet				time_t,
133129202Scognet				int));
134129202Scognet#  if 0
135129202Scognetextern DNS_REPLY_T	*dns_lookup __P((const char *domain,
136129202Scognet				const char *type_name,
137129202Scognet				time_t retrans,
138129202Scognet				int retry));
139129202Scognet#  endif /* 0 */
140129202Scognet
141129202Scognet# endif /* ! __ROKEN_RESOLVE_H__ */
142129202Scognet#endif /* DNSMAP */
143129202Scognet