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