sm_resolve.h revision 261363
1241675Suqs/*
2241675Suqs * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
3241675Suqs *	All rights reserved.
4241675Suqs *
5241675Suqs * By using this file, you agree to the terms and conditions set
6241675Suqs * forth in the LICENSE file which can be found at the top level of
7241675Suqs * the sendmail distribution.
8241675Suqs *
9241675Suqs */
10241675Suqs
11241675Suqs/*
12241675Suqs * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H�gskolan
13241675Suqs * (Royal Institute of Technology, Stockholm, Sweden).
14241675Suqs * All rights reserved.
15241675Suqs *
16241675Suqs * Redistribution and use in source and binary forms, with or without
17241675Suqs * modification, are permitted provided that the following conditions
18241675Suqs * are met:
19241675Suqs *
20241675Suqs * 1. Redistributions of source code must retain the above copyright
21241675Suqs *    notice, this list of conditions and the following disclaimer.
22241675Suqs *
23241675Suqs * 2. Redistributions in binary form must reproduce the above copyright
24241675Suqs *    notice, this list of conditions and the following disclaimer in the
25241675Suqs *    documentation and/or other materials provided with the distribution.
26241675Suqs *
27241675Suqs * 3. Neither the name of the Institute nor the names of its contributors
28241675Suqs *    may be used to endorse or promote products derived from this software
29241675Suqs *    without specific prior written permission.
30241675Suqs *
31241675Suqs * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
32241675Suqs * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33241675Suqs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34241675Suqs * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
35241675Suqs * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36241675Suqs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37241675Suqs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38241675Suqs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39241675Suqs * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40241675Suqs * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41241675Suqs * SUCH DAMAGE.
42241675Suqs */
43241675Suqs
44241675Suqs/* $Id: sm_resolve.h,v 8.9 2013/11/22 20:51:56 ca Exp $ */
45241675Suqs
46241675Suqs#if DNSMAP
47241675Suqs# ifndef __ROKEN_RESOLVE_H__
48241675Suqs#  define __ROKEN_RESOLVE_H__
49241675Suqs
50241675Suqs/* We use these, but they are not always present in <arpa/nameser.h> */
51241675Suqs
52241675Suqs#  ifndef T_TXT
53241675Suqs#   define T_TXT		16
54241675Suqs#  endif /* ! T_TXT */
55241675Suqs#  ifndef T_AFSDB
56241675Suqs#   define T_AFSDB		18
57241675Suqs#  endif /* ! T_AFSDB */
58241675Suqs#  ifndef T_SRV
59241675Suqs#   define T_SRV		33
60241675Suqs#  endif /* ! T_SRV */
61241675Suqs#  ifndef T_NAPTR
62241675Suqs#   define T_NAPTR		35
63241675Suqs#  endif /* ! T_NAPTR */
64241675Suqs
65241675Suqstypedef struct
66241675Suqs{
67241675Suqs	char		*dns_q_domain;
68241675Suqs	unsigned int	dns_q_type;
69241675Suqs	unsigned int	dns_q_class;
70241675Suqs} DNS_QUERY_T;
71241675Suqs
72241675Suqstypedef struct
73241675Suqs{
74241675Suqs	unsigned int	mx_r_preference;
75241675Suqs	char		mx_r_domain[1];
76241675Suqs} MX_RECORD_T;
77241675Suqs
78241675Suqstypedef struct
79241675Suqs{
80241675Suqs	unsigned int	srv_r_priority;
81241675Suqs	unsigned int	srv_r_weight;
82241675Suqs	unsigned int	srv_r_port;
83241675Suqs	char		srv_r_target[1];
84241675Suqs} SRV_RECORDT_T;
85241675Suqs
86241675Suqs
87241675Suqstypedef struct resource_record RESOURCE_RECORD_T;
88241675Suqs
89241675Suqsstruct resource_record
90241675Suqs{
91241675Suqs	char			*rr_domain;
92241675Suqs	unsigned int		rr_type;
93241675Suqs	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 */
115typedef int HEADER; /* will never be used */
116#  endif /* !defined(T_A) && !defined(T_AAAA)  */
117
118typedef 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
126extern void		dns_free_data __P((DNS_REPLY_T *));
127extern int		dns_string_to_type __P((const char *));
128extern const char	*dns_type_to_string __P((int));
129extern DNS_REPLY_T	*dns_lookup_int __P((const char *,
130				int,
131				int,
132				time_t,
133				int));
134#  if 0
135extern 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