190792Sgshapiro/*
2261194Sgshapiro * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
390792Sgshapiro *	All rights reserved.
490792Sgshapiro *
590792Sgshapiro * By using this file, you agree to the terms and conditions set
690792Sgshapiro * forth in the LICENSE file which can be found at the top level of
790792Sgshapiro * the sendmail distribution.
890792Sgshapiro *
990792Sgshapiro */
1090792Sgshapiro
1190792Sgshapiro/*
1290792Sgshapiro * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H�gskolan
1390792Sgshapiro * (Royal Institute of Technology, Stockholm, Sweden).
1490792Sgshapiro * All rights reserved.
1590792Sgshapiro *
1690792Sgshapiro * Redistribution and use in source and binary forms, with or without
1790792Sgshapiro * modification, are permitted provided that the following conditions
1890792Sgshapiro * are met:
1990792Sgshapiro *
2090792Sgshapiro * 1. Redistributions of source code must retain the above copyright
2190792Sgshapiro *    notice, this list of conditions and the following disclaimer.
2290792Sgshapiro *
2390792Sgshapiro * 2. Redistributions in binary form must reproduce the above copyright
2490792Sgshapiro *    notice, this list of conditions and the following disclaimer in the
2590792Sgshapiro *    documentation and/or other materials provided with the distribution.
2690792Sgshapiro *
2790792Sgshapiro * 3. Neither the name of the Institute nor the names of its contributors
2890792Sgshapiro *    may be used to endorse or promote products derived from this software
2990792Sgshapiro *    without specific prior written permission.
3090792Sgshapiro *
3190792Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
3290792Sgshapiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3390792Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3490792Sgshapiro * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
3590792Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3690792Sgshapiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3790792Sgshapiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3890792Sgshapiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3990792Sgshapiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4090792Sgshapiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4190792Sgshapiro * SUCH DAMAGE.
4290792Sgshapiro */
4390792Sgshapiro
44266527Sgshapiro/* $Id: sm_resolve.h,v 8.9 2013-11-22 20:51:56 ca Exp $ */
4590792Sgshapiro
4690792Sgshapiro#if DNSMAP
4790792Sgshapiro# ifndef __ROKEN_RESOLVE_H__
4890792Sgshapiro#  define __ROKEN_RESOLVE_H__
4990792Sgshapiro
5090792Sgshapiro/* We use these, but they are not always present in <arpa/nameser.h> */
5190792Sgshapiro
5290792Sgshapiro#  ifndef T_TXT
5390792Sgshapiro#   define T_TXT		16
5490792Sgshapiro#  endif /* ! T_TXT */
5590792Sgshapiro#  ifndef T_AFSDB
5690792Sgshapiro#   define T_AFSDB		18
5790792Sgshapiro#  endif /* ! T_AFSDB */
5890792Sgshapiro#  ifndef T_SRV
5990792Sgshapiro#   define T_SRV		33
6090792Sgshapiro#  endif /* ! T_SRV */
6190792Sgshapiro#  ifndef T_NAPTR
6290792Sgshapiro#   define T_NAPTR		35
6390792Sgshapiro#  endif /* ! T_NAPTR */
6490792Sgshapiro
6590792Sgshapirotypedef struct
6690792Sgshapiro{
6790792Sgshapiro	char		*dns_q_domain;
6890792Sgshapiro	unsigned int	dns_q_type;
6990792Sgshapiro	unsigned int	dns_q_class;
7090792Sgshapiro} DNS_QUERY_T;
7190792Sgshapiro
7290792Sgshapirotypedef struct
7390792Sgshapiro{
7490792Sgshapiro	unsigned int	mx_r_preference;
7590792Sgshapiro	char		mx_r_domain[1];
7690792Sgshapiro} MX_RECORD_T;
7790792Sgshapiro
7890792Sgshapirotypedef struct
7990792Sgshapiro{
8090792Sgshapiro	unsigned int	srv_r_priority;
8190792Sgshapiro	unsigned int	srv_r_weight;
8290792Sgshapiro	unsigned int	srv_r_port;
8390792Sgshapiro	char		srv_r_target[1];
8490792Sgshapiro} SRV_RECORDT_T;
8590792Sgshapiro
8690792Sgshapiro
8790792Sgshapirotypedef struct resource_record RESOURCE_RECORD_T;
8890792Sgshapiro
8990792Sgshapirostruct resource_record
9090792Sgshapiro{
9190792Sgshapiro	char			*rr_domain;
9290792Sgshapiro	unsigned int		rr_type;
9390792Sgshapiro	unsigned int		rr_class;
9490792Sgshapiro	unsigned int		rr_ttl;
9590792Sgshapiro	unsigned int		rr_size;
9690792Sgshapiro	union
9790792Sgshapiro	{
9890792Sgshapiro		void		*rr_data;
9990792Sgshapiro		MX_RECORD_T	*rr_mx;
10090792Sgshapiro		MX_RECORD_T	*rr_afsdb; /* mx and afsdb are identical */
10190792Sgshapiro		SRV_RECORDT_T	*rr_srv;
10290792Sgshapiro#  if NETINET
10390792Sgshapiro		struct in_addr	*rr_a;
10490792Sgshapiro#  endif /* NETINET */
10590792Sgshapiro#  if NETINET6
10690792Sgshapiro		struct in6_addr *rr_aaaa;
10790792Sgshapiro#  endif /* NETINET6 */
10890792Sgshapiro		char		*rr_txt;
10990792Sgshapiro	} rr_u;
11090792Sgshapiro	RESOURCE_RECORD_T *rr_next;
11190792Sgshapiro};
11290792Sgshapiro
11390792Sgshapiro#  if !defined(T_A) && !defined(T_AAAA)
11490792Sgshapiro/* XXX if <arpa/nameser.h> isn't included */
11590792Sgshapirotypedef int HEADER; /* will never be used */
11690792Sgshapiro#  endif /* !defined(T_A) && !defined(T_AAAA)  */
11790792Sgshapiro
11890792Sgshapirotypedef struct
11990792Sgshapiro{
12090792Sgshapiro	HEADER			dns_r_h;
12190792Sgshapiro	DNS_QUERY_T		dns_r_q;
12290792Sgshapiro	RESOURCE_RECORD_T	*dns_r_head;
12390792Sgshapiro} DNS_REPLY_T;
12490792Sgshapiro
12590792Sgshapiro
12690792Sgshapiroextern void		dns_free_data __P((DNS_REPLY_T *));
12790792Sgshapiroextern int		dns_string_to_type __P((const char *));
12890792Sgshapiroextern const char	*dns_type_to_string __P((int));
12990792Sgshapiroextern DNS_REPLY_T	*dns_lookup_int __P((const char *,
13090792Sgshapiro				int,
13190792Sgshapiro				int,
13290792Sgshapiro				time_t,
13390792Sgshapiro				int));
13490792Sgshapiro#  if 0
13590792Sgshapiroextern DNS_REPLY_T	*dns_lookup __P((const char *domain,
13690792Sgshapiro				const char *type_name,
13790792Sgshapiro				time_t retrans,
13890792Sgshapiro				int retry));
13990792Sgshapiro#  endif /* 0 */
14090792Sgshapiro
14190792Sgshapiro# endif /* ! __ROKEN_RESOLVE_H__ */
14290792Sgshapiro#endif /* DNSMAP */
143