]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSShared/ClientRequests.h
mDNSResponder-1096.100.3.tar.gz
[apple/mdnsresponder.git] / mDNSShared / ClientRequests.h
1 /*
2 * Copyright (c) 2018-2019 Apple Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __ClientRequests_h
18 #define __ClientRequests_h
19
20 #include "mDNSEmbeddedAPI.h"
21 #include "dns_sd_internal.h"
22
23 typedef void (*QueryRecordResultHandler)(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord,
24 DNSServiceErrorType error, void *context);
25
26 typedef struct
27 {
28 DNSQuestion q; // DNSQuestion for record query.
29 domainname * qname; // Name of the original record.
30 mDNSInterfaceID interfaceID; // Interface over which to perform query.
31 QueryRecordResultHandler resultHandler; // Handler for query record operation results.
32 void * resultContext; // Context to pass to result handler.
33 mDNSu32 reqID; //
34 int searchListIndex; // Index that indicates the next search domain to try.
35 #if MDNSRESPONDER_SUPPORTS(APPLE, UNICAST_DOTLOCAL)
36 DNSQuestion * q2; // DNSQuestion for unicast version of a record with a dot-local name.
37 mDNSu16 q2Type; // q2's original qtype value.
38 mDNSBool q2LongLived; // q2's original LongLived value.
39 mDNSBool q2ReturnIntermed; // q2's original ReturnIntermed value.
40 mDNSBool q2TimeoutQuestion; // q2's original TimeoutQuestion value.
41 mDNSBool q2AppendSearchDomains; // q2's original AppendSearchDomains value.
42 #endif
43 #if MDNSRESPONDER_SUPPORTS(APPLE, REACHABILITY_TRIGGER)
44 mDNSBool answered; // True if the query was answered.
45 #endif
46
47 } QueryRecordOp;
48
49 typedef struct
50 {
51 mDNSInterfaceID interfaceID; // InterfaceID being used for query record operations.
52 mDNSu32 protocols; // Protocols (IPv4, IPv6) specified by client.
53 QueryRecordOp * op4; // Query record operation object for A record.
54 QueryRecordOp * op6; // Query record operation object for AAAA record.
55
56 } GetAddrInfoClientRequest;
57
58 typedef struct
59 {
60 QueryRecordOp op; // Query record operation object.
61
62 } QueryRecordClientRequest;
63
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67
68 mDNSexport mStatus GetAddrInfoClientRequestStart(GetAddrInfoClientRequest *inRequest, mDNSu32 inReqID,
69 const char *inHostnameStr, mDNSu32 inInterfaceIndex, DNSServiceFlags inFlags, mDNSu32 inProtocols, mDNSs32 inPID,
70 const mDNSu8 inUUID[UUID_SIZE], mDNSu32 inUID, QueryRecordResultHandler inResultHandler, void *inResultContext);
71 mDNSexport void GetAddrInfoClientRequestStop(GetAddrInfoClientRequest *inRequest);
72 mDNSexport const domainname * GetAddrInfoClientRequestGetQName(const GetAddrInfoClientRequest *inRequest);
73 mDNSexport mDNSBool GetAddrInfoClientRequestIsMulticast(const GetAddrInfoClientRequest *inRequest);
74
75 mDNSexport mStatus QueryRecordClientRequestStart(QueryRecordClientRequest *inRequest, mDNSu32 inReqID,
76 const char *inQNameStr, mDNSu32 inInterfaceIndex, DNSServiceFlags inFlags, mDNSu16 inQType, mDNSu16 inQClass,
77 mDNSs32 inPID, mDNSu8 inUUID[UUID_SIZE], mDNSu32 inUID, QueryRecordResultHandler inResultHandler, void *inResultContext);
78 mDNSexport void QueryRecordClientRequestStop(QueryRecordClientRequest *inRequest);
79 mDNSexport const domainname * QueryRecordClientRequestGetQName(const QueryRecordClientRequest *inRequest);
80 mDNSexport mDNSu16 QueryRecordClientRequestGetType(const QueryRecordClientRequest *inRequest);
81 mDNSexport mDNSBool QueryRecordClientRequestIsMulticast(QueryRecordClientRequest *inRequest);
82
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif // __ClientRequests_h