]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/dnssec_v2/dnssec_v2_retrieval.h
mDNSResponder-1310.40.42.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / dnssec_v2 / dnssec_v2_retrieval.h
1 //
2 // dnssec_v2_retrieval.h
3 // mDNSResponder
4 //
5 // Copyright (c) 2020 Apple Inc. All rights reserved.
6 //
7
8 #ifndef DNSSEC_v2_RETRIEVAL_H
9 #define DNSSEC_v2_RETRIEVAL_H
10
11 #include "mDNSEmbeddedAPI.h" // for mStatus
12 #if MDNSRESPONDER_SUPPORTS(APPLE, DNSSECv2)
13 #include "ClientRequests.h" // QueryRecordOp
14 #include "dnssec_v2_embedded.h" // for dnssec_status_t
15 #include "dnssec_v2_structs.h"
16
17 typedef enum dnssec_retrieval_result {
18 // normal
19 dnssec_retrieval_no_error = 0,
20 dnssec_retrieval_waiting_for_records = 1,
21 dnssec_retrieval_validate_again = 2,
22 dnssec_retrieval_no_new_change = 3,
23 dnssec_retrieval_suppressed = 4,
24 dnssec_retrieval_cname_removed = 5,
25
26 // error
27 dnssec_retrieval_no_rrsig = -65537,
28 dnssec_retrieval_zone_not_found = -65538,
29 dnssec_retrieval_invalid_qtype = -65539,
30 dnssec_retrieval_record_not_added = -65540,
31 dnssec_retrieval_no_record = -65541,
32 dnssec_retrieval_not_qc_add = -65542,
33 dnssec_retrieval_too_many_zones = -65543,
34 dnssec_retrieval_query_failed = -65544,
35 dnssec_retrieval_unknown_error = -65545,
36 dnssec_retrieval_invalid_wildcard = -65546,
37 dnssec_retrieval_invalid_internal_state = -65547,
38 dnssec_retrieval_non_dnskey_ds_record_for_zone = -65548
39 } dnssec_retrieval_result_t;
40
41 //======================================================================================================================
42 // function prototypes
43 //======================================================================================================================
44
45 // dnssec_status_t
46 mDNSexport mStatus
47 initialize_dnssec_status_t(dnssec_status_t * const _Nonnull status, const domainname * const _Nonnull qname,
48 const mDNSu16 qtype, const mDNSu32 flags, void * const _Nonnull context);
49
50 mDNSexport mStatus
51 uninitialize_dnssec_status_t(dnssec_status_t * const _Nonnull status);
52
53 #pragma mark - dnssec_context_t function prototypes
54 mDNSexport mStatus
55 create_dnssec_context_t(
56 QueryRecordClientRequest * const _Nullable request,
57 const mDNSu32 request_id,
58 const domainname * const _Nonnull question_name,
59 const mDNSu16 question_type,
60 const mDNSu16 question_class,
61 const mDNSInterfaceID _Nullable interface_id,
62 const mDNSs32 service_id,
63 const mDNSu32 flags,
64 const mDNSBool append_search_domains,
65 const mDNSs32 pid,
66 const mDNSu8 * _Nullable uuid,
67 const mDNSs32 uid,
68 #if MDNSRESPONDER_SUPPORTS(APPLE, AUDIT_TOKEN)
69 const audit_token_t * _Nullable peer_audit_token_ptr,
70 const audit_token_t * _Nullable delegate_audit_token_ptr,
71 #endif
72 #if MDNSRESPONDER_SUPPORTS(APPLE, QUERIER)
73 const mDNSu8 * _Nullable resolver_uuid,
74 mDNSBool need_encryption,
75 const mdns_dns_service_id_t custom_id,
76 #endif
77 const QueryRecordResultHandler _Nonnull result_handler,
78 void * const _Nullable result_context,
79 dnssec_context_t * const _Nullable primary_dnssec_context,
80 dnssec_context_t * _Nullable * const _Nonnull out_dnssec_context);
81
82 mDNSexport void
83 print_dnssec_context_t(const dnssec_context_t * const _Nonnull context);
84
85 mDNSexport void
86 destroy_dnssec_context_t(dnssec_context_t * const _Nonnull context);
87
88 mDNSexport dnssec_retrieval_result_t
89 add_no_error_records(
90 mDNS *const _Nonnull m,
91 DNSQuestion * _Nonnull question,
92 const ResourceRecord * const _Nonnull answer,
93 const QC_result add_record,
94 const DNSServiceErrorType dns_result_error,
95 dnssec_context_t * const _Nonnull dnssec_context);
96
97 mDNSexport dnssec_retrieval_result_t
98 add_denial_of_existence_records(
99 const mDNS *const _Nonnull m,
100 const DNSQuestion * _Nonnull question,
101 ResourceRecord * const _Nonnull answer,
102 const QC_result add_record,
103 const DNSServiceErrorType dns_result_error,
104 dnssec_context_t * const _Nonnull dnssec_context);
105
106 mDNSexport dnssec_retrieval_result_t
107 fetch_necessary_dnssec_records(dnssec_context_t * const _Nonnull context, mDNSBool anchor_reached);
108
109 // list_t<dnssec_zone_t>
110 mDNSexport dnssec_zone_t * _Nullable
111 find_dnssec_zone_t(const list_t * const _Nonnull zones, const mDNSu8 * const _Nonnull name);
112
113 // cnames_with_rrsig_t
114 mDNSexport mStatus
115 add_to_cname_with_rrsig_t(cnames_with_rrsig_t * const _Nonnull cnames_with_rrisg, ResourceRecord * const _Nonnull rr);
116
117 mDNSexport mDNSBool
118 remove_from_cname_with_rrsig_t(cnames_with_rrsig_t * const _Nonnull cnames_with_rrisg, const ResourceRecord * const _Nonnull rr);
119
120 // nsecs_with_rrsig_t
121 mDNSexport mStatus
122 add_to_nsec_with_rrsig_t(nsecs_with_rrsig_t * const _Nonnull nsecs_with_rrisg, ResourceRecord * const _Nonnull rr);
123
124 mDNSexport mDNSBool
125 remove_from_nsec_with_rrsig_t(nsecs_with_rrsig_t * const _Nonnull nsecs_with_rrisg, const ResourceRecord * const _Nonnull rr);
126
127 // nsec3s_with_rrsig_t
128 mDNSexport mStatus
129 add_to_nsec3_with_rrsig_t(nsec3s_with_rrsig_t * const _Nonnull nsec3s_with_rrisg, ResourceRecord * const _Nonnull rr);
130
131 mDNSexport mDNSBool
132 remove_from_nsec3_with_rrsig_t(nsec3s_with_rrsig_t * const _Nonnull nsec3s_with_rrisg, const ResourceRecord * const _Nonnull rr);
133
134 // originals_with_rrsig_t
135 mDNSexport mStatus
136 add_to_originals_with_rrsig_t(
137 originals_with_rrsig_t * const _Nonnull originals_with_rrisg,
138 ResourceRecord * const _Nonnull rr,
139 const mDNSBool answer_from_cache,
140 const DNSServiceErrorType dns_error,
141 const QC_result qc_result);
142
143 mDNSexport void
144 remove_from_originals_with_rrsig_t(
145 originals_with_rrsig_t * const _Nonnull originals_with_rrisg,
146 const ResourceRecord * const _Nonnull rr);
147
148 // dnskeys_with_rrsig_t
149 mDNSexport mStatus
150 add_to_dnskeys_with_rrsig_t(dnskeys_with_rrsig_t * const _Nonnull dnskeys_with_rrsig, ResourceRecord * const _Nonnull rr);
151
152 mDNSexport void
153 remove_from_dnskeys_with_rrsig_t(dnskeys_with_rrsig_t * const _Nonnull dnskeys_with_rrsig, const ResourceRecord * const _Nonnull rr);
154
155 // dses_with_rrsig_t
156 mDNSexport mStatus
157 add_to_dses_with_rrsig_t(dses_with_rrsig_t * const _Nonnull dses_with_rrsig, ResourceRecord * const _Nonnull rr);
158
159 mDNSexport void
160 remove_from_dses_with_rrsig_t(dses_with_rrsig_t * const _Nonnull dses_with_rrsig, const ResourceRecord * const _Nonnull rr);
161
162 // denial_of_existence_records_t
163 mDNSexport denial_of_existence_records_t * _Nullable
164 create_denial_of_existence_records_t(void);
165
166 mDNSexport void
167 destroy_denial_of_existence_records_t(denial_of_existence_records_t * const _Nonnull denial_of_existence_records);
168
169 mDNSexport void
170 destroy_denial_of_existence_records_t_if_nonnull(denial_of_existence_records_t * const _Nonnull denial_of_existence_records);
171
172 mDNSexport mStatus
173 add_to_denial_of_existence_records_t(denial_of_existence_records_t * const _Nonnull denial_of_existence_records, const ResourceRecord * const _Nonnull rr);
174
175 // dnssec_zone_t
176 mDNSexport mStatus
177 add_to_dnssec_zone_t(
178 dnssec_zone_t * const _Nonnull zone,
179 ResourceRecord * const _Nonnull rr,
180 const mDNSu16 question_type);
181
182 mDNSexport dnssec_retrieval_result_t
183 update_dnssec_zone_t_from_cache_for_no_error_response(
184 const mDNS * const _Nonnull m,
185 const DNSQuestion * const _Nonnull question,
186 const ResourceRecord * const _Nonnull answer,
187 const QC_result add_record,
188 dnssec_zone_t * const _Nonnull zone);
189
190 mDNSexport dnssec_retrieval_result_t
191 update_original_from_cache_for_no_error_response(
192 mDNS * const _Nonnull m,
193 const DNSQuestion * const _Nonnull question,
194 const ResourceRecord * const _Nonnull answer,
195 const QC_result add_record,
196 const DNSServiceErrorType dns_result_error,
197 dnssec_context_t * const _Nonnull dnssec_context);
198
199 mDNSexport dnssec_retrieval_result_t
200 update_original_from_cache_for_denial_of_existence_response(
201 const mDNS *const _Nonnull m,
202 const DNSQuestion * _Nonnull question,
203 ResourceRecord * const _Nonnull answer,
204 const QC_result add_record,
205 const DNSServiceErrorType dns_result_error,
206 dnssec_context_t * const _Nonnull dnssec_context);
207
208 #endif // MDNSRESPONDER_SUPPORTS(APPLE, DNSSECv2)
209 #endif /* DNSSEC_v2_RETRIEVAL_H */