xref: /aosp_15_r20/external/openthread/include/openthread/platform/dnssd.h (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1*cfb92d14SAndroid Build Coastguard Worker /*
2*cfb92d14SAndroid Build Coastguard Worker  *  Copyright (c) 2023, The OpenThread Authors.
3*cfb92d14SAndroid Build Coastguard Worker  *  All rights reserved.
4*cfb92d14SAndroid Build Coastguard Worker  *
5*cfb92d14SAndroid Build Coastguard Worker  *  Redistribution and use in source and binary forms, with or without
6*cfb92d14SAndroid Build Coastguard Worker  *  modification, are permitted provided that the following conditions are met:
7*cfb92d14SAndroid Build Coastguard Worker  *  1. Redistributions of source code must retain the above copyright
8*cfb92d14SAndroid Build Coastguard Worker  *     notice, this list of conditions and the following disclaimer.
9*cfb92d14SAndroid Build Coastguard Worker  *  2. Redistributions in binary form must reproduce the above copyright
10*cfb92d14SAndroid Build Coastguard Worker  *     notice, this list of conditions and the following disclaimer in the
11*cfb92d14SAndroid Build Coastguard Worker  *     documentation and/or other materials provided with the distribution.
12*cfb92d14SAndroid Build Coastguard Worker  *  3. Neither the name of the copyright holder nor the
13*cfb92d14SAndroid Build Coastguard Worker  *     names of its contributors may be used to endorse or promote products
14*cfb92d14SAndroid Build Coastguard Worker  *     derived from this software without specific prior written permission.
15*cfb92d14SAndroid Build Coastguard Worker  *
16*cfb92d14SAndroid Build Coastguard Worker  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17*cfb92d14SAndroid Build Coastguard Worker  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*cfb92d14SAndroid Build Coastguard Worker  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*cfb92d14SAndroid Build Coastguard Worker  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20*cfb92d14SAndroid Build Coastguard Worker  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*cfb92d14SAndroid Build Coastguard Worker  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*cfb92d14SAndroid Build Coastguard Worker  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*cfb92d14SAndroid Build Coastguard Worker  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*cfb92d14SAndroid Build Coastguard Worker  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*cfb92d14SAndroid Build Coastguard Worker  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*cfb92d14SAndroid Build Coastguard Worker  *  POSSIBILITY OF SUCH DAMAGE.
27*cfb92d14SAndroid Build Coastguard Worker  */
28*cfb92d14SAndroid Build Coastguard Worker 
29*cfb92d14SAndroid Build Coastguard Worker /**
30*cfb92d14SAndroid Build Coastguard Worker  * @file
31*cfb92d14SAndroid Build Coastguard Worker  * @brief
32*cfb92d14SAndroid Build Coastguard Worker  *   This file includes the platform abstraction for DNS-SD (e.g., mDNS) on the infrastructure network.
33*cfb92d14SAndroid Build Coastguard Worker  *
34*cfb92d14SAndroid Build Coastguard Worker  */
35*cfb92d14SAndroid Build Coastguard Worker 
36*cfb92d14SAndroid Build Coastguard Worker #ifndef OPENTHREAD_PLATFORM_DNSSD_H_
37*cfb92d14SAndroid Build Coastguard Worker #define OPENTHREAD_PLATFORM_DNSSD_H_
38*cfb92d14SAndroid Build Coastguard Worker 
39*cfb92d14SAndroid Build Coastguard Worker #include <stdint.h>
40*cfb92d14SAndroid Build Coastguard Worker 
41*cfb92d14SAndroid Build Coastguard Worker #include <openthread/dns.h>
42*cfb92d14SAndroid Build Coastguard Worker #include <openthread/error.h>
43*cfb92d14SAndroid Build Coastguard Worker #include <openthread/instance.h>
44*cfb92d14SAndroid Build Coastguard Worker #include <openthread/ip6.h>
45*cfb92d14SAndroid Build Coastguard Worker 
46*cfb92d14SAndroid Build Coastguard Worker #ifdef __cplusplus
47*cfb92d14SAndroid Build Coastguard Worker extern "C" {
48*cfb92d14SAndroid Build Coastguard Worker #endif
49*cfb92d14SAndroid Build Coastguard Worker 
50*cfb92d14SAndroid Build Coastguard Worker /**
51*cfb92d14SAndroid Build Coastguard Worker  * @addtogroup plat-dns-sd
52*cfb92d14SAndroid Build Coastguard Worker  *
53*cfb92d14SAndroid Build Coastguard Worker  * @brief
54*cfb92d14SAndroid Build Coastguard Worker  *   This module includes the platform abstraction for DNS-SD (e.g., mDNS) on the infrastructure network.
55*cfb92d14SAndroid Build Coastguard Worker  *
56*cfb92d14SAndroid Build Coastguard Worker  * @{
57*cfb92d14SAndroid Build Coastguard Worker  *
58*cfb92d14SAndroid Build Coastguard Worker  * The DNS-SD platform APIs are used only when `OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE` is enabled.
59*cfb92d14SAndroid Build Coastguard Worker  *
60*cfb92d14SAndroid Build Coastguard Worker  */
61*cfb92d14SAndroid Build Coastguard Worker 
62*cfb92d14SAndroid Build Coastguard Worker /**
63*cfb92d14SAndroid Build Coastguard Worker  * Represents the state of the DNS-SD platform.
64*cfb92d14SAndroid Build Coastguard Worker  *
65*cfb92d14SAndroid Build Coastguard Worker  */
66*cfb92d14SAndroid Build Coastguard Worker typedef enum otPlatDnssdState
67*cfb92d14SAndroid Build Coastguard Worker {
68*cfb92d14SAndroid Build Coastguard Worker     OT_PLAT_DNSSD_STOPPED, ///< Stopped and unable to register any service or host, or start any browser/resolver.
69*cfb92d14SAndroid Build Coastguard Worker     OT_PLAT_DNSSD_READY,   ///< Running and ready to register service or host.
70*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdState;
71*cfb92d14SAndroid Build Coastguard Worker 
72*cfb92d14SAndroid Build Coastguard Worker /**
73*cfb92d14SAndroid Build Coastguard Worker  * Represents a request ID for registering/unregistering a service or host.
74*cfb92d14SAndroid Build Coastguard Worker  *
75*cfb92d14SAndroid Build Coastguard Worker  */
76*cfb92d14SAndroid Build Coastguard Worker typedef uint32_t otPlatDnssdRequestId;
77*cfb92d14SAndroid Build Coastguard Worker 
78*cfb92d14SAndroid Build Coastguard Worker /**
79*cfb92d14SAndroid Build Coastguard Worker  * Represents the callback function used when registering/unregistering a host or service.
80*cfb92d14SAndroid Build Coastguard Worker  *
81*cfb92d14SAndroid Build Coastguard Worker  * See `otPlatDnssdRegisterService()`, `otPlatDnssdUnregisterService()`, `otPlatDnssdRegisterHost()`, and
82*cfb92d14SAndroid Build Coastguard Worker  * `otPlatDnssdUnregisterHost()` for more details about when to invoke the callback and the `aError` values that can
83*cfb92d14SAndroid Build Coastguard Worker  * be returned in each case.
84*cfb92d14SAndroid Build Coastguard Worker  *
85*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
86*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aRequestId    The request ID.
87*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aError        Error indicating the outcome of request.
88*cfb92d14SAndroid Build Coastguard Worker  *
89*cfb92d14SAndroid Build Coastguard Worker  */
90*cfb92d14SAndroid Build Coastguard Worker typedef void (*otPlatDnssdRegisterCallback)(otInstance *aInstance, otPlatDnssdRequestId aRequestId, otError aError);
91*cfb92d14SAndroid Build Coastguard Worker 
92*cfb92d14SAndroid Build Coastguard Worker /**
93*cfb92d14SAndroid Build Coastguard Worker  * Represents a DNS-SD service.
94*cfb92d14SAndroid Build Coastguard Worker  *
95*cfb92d14SAndroid Build Coastguard Worker  * See `otPlatDnssdRegisterService()`, `otPlatDnssdUnregisterService()` for more details about fields in each case.
96*cfb92d14SAndroid Build Coastguard Worker  *
97*cfb92d14SAndroid Build Coastguard Worker  */
98*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdService
99*cfb92d14SAndroid Build Coastguard Worker {
100*cfb92d14SAndroid Build Coastguard Worker     const char        *mHostName;            ///< The host name (does not include domain name).
101*cfb92d14SAndroid Build Coastguard Worker     const char        *mServiceInstance;     ///< The service instance name label (not the full name).
102*cfb92d14SAndroid Build Coastguard Worker     const char        *mServiceType;         ///< The service type (e.g., "_mt._udp", does not include domain name).
103*cfb92d14SAndroid Build Coastguard Worker     const char *const *mSubTypeLabels;       ///< Array of sub-type labels (can be NULL if no label).
104*cfb92d14SAndroid Build Coastguard Worker     uint16_t           mSubTypeLabelsLength; ///< Length of array of sub-type labels.
105*cfb92d14SAndroid Build Coastguard Worker     const uint8_t     *mTxtData;             ///< Encoded TXT data bytes.
106*cfb92d14SAndroid Build Coastguard Worker     uint16_t           mTxtDataLength;       ///< Length of TXT data.
107*cfb92d14SAndroid Build Coastguard Worker     uint16_t           mPort;                ///< The service port number.
108*cfb92d14SAndroid Build Coastguard Worker     uint16_t           mPriority;            ///< The service priority.
109*cfb92d14SAndroid Build Coastguard Worker     uint16_t           mWeight;              ///< The service weight.
110*cfb92d14SAndroid Build Coastguard Worker     uint32_t           mTtl;                 ///< The service TTL in seconds.
111*cfb92d14SAndroid Build Coastguard Worker     uint32_t           mInfraIfIndex;        ///< The infrastructure network interface index.
112*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdService;
113*cfb92d14SAndroid Build Coastguard Worker 
114*cfb92d14SAndroid Build Coastguard Worker /**
115*cfb92d14SAndroid Build Coastguard Worker  * Represents a DNS-SD host.
116*cfb92d14SAndroid Build Coastguard Worker  *
117*cfb92d14SAndroid Build Coastguard Worker  * See `otPlatDnssdRegisterHost()`, `otPlatDnssdUnregisterHost()` for more details about fields in each case.
118*cfb92d14SAndroid Build Coastguard Worker  *
119*cfb92d14SAndroid Build Coastguard Worker  */
120*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdHost
121*cfb92d14SAndroid Build Coastguard Worker {
122*cfb92d14SAndroid Build Coastguard Worker     const char         *mHostName;        ///< The host name (does not include domain name).
123*cfb92d14SAndroid Build Coastguard Worker     const otIp6Address *mAddresses;       ///< Array of IPv6 host addresses.
124*cfb92d14SAndroid Build Coastguard Worker     uint16_t            mAddressesLength; ///< Number of entries in @p mAddresses array.
125*cfb92d14SAndroid Build Coastguard Worker     uint32_t            mTtl;             ///< The host TTL in seconds.
126*cfb92d14SAndroid Build Coastguard Worker     uint32_t            mInfraIfIndex;    ///< The infrastructure network interface index.
127*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdHost;
128*cfb92d14SAndroid Build Coastguard Worker 
129*cfb92d14SAndroid Build Coastguard Worker /**
130*cfb92d14SAndroid Build Coastguard Worker  * Represents a DNS-SD key record.
131*cfb92d14SAndroid Build Coastguard Worker  *
132*cfb92d14SAndroid Build Coastguard Worker  * See `otPlatDnssdRegisterKey()`, `otPlatDnssdUnregisterKey()` for more details about fields in each case.
133*cfb92d14SAndroid Build Coastguard Worker  *
134*cfb92d14SAndroid Build Coastguard Worker  */
135*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdKey
136*cfb92d14SAndroid Build Coastguard Worker {
137*cfb92d14SAndroid Build Coastguard Worker     const char    *mName;          ///< A host or a service instance name (does not include domain name).
138*cfb92d14SAndroid Build Coastguard Worker     const char    *mServiceType;   ///< The service type if key is for a service (does not include domain name).
139*cfb92d14SAndroid Build Coastguard Worker     const uint8_t *mKeyData;       ///< Byte array containing the key record data.
140*cfb92d14SAndroid Build Coastguard Worker     uint16_t       mKeyDataLength; ///< Length of @p mKeyData in bytes.
141*cfb92d14SAndroid Build Coastguard Worker     uint16_t       mClass;         ///< The resource record class.
142*cfb92d14SAndroid Build Coastguard Worker     uint32_t       mTtl;           ///< The TTL in seconds.
143*cfb92d14SAndroid Build Coastguard Worker     uint32_t       mInfraIfIndex;  ///< The infrastructure network interface index.
144*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdKey;
145*cfb92d14SAndroid Build Coastguard Worker 
146*cfb92d14SAndroid Build Coastguard Worker /**
147*cfb92d14SAndroid Build Coastguard Worker  * Callback to notify state changes of the DNS-SD platform.
148*cfb92d14SAndroid Build Coastguard Worker  *
149*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack will call `otPlatDnssdGetState()` (from this callback or later) to get the new state. The
150*cfb92d14SAndroid Build Coastguard Worker  * platform MUST therefore ensure that the returned state from `otPlatDnssdGetState()` is updated before calling this.
151*cfb92d14SAndroid Build Coastguard Worker  *
152*cfb92d14SAndroid Build Coastguard Worker  * When the platform signals a state change to `OT_PLAT_DNSSD_STOPPED` using this callback, all active browsers and
153*cfb92d14SAndroid Build Coastguard Worker  * resolvers are considered to be stopped, and any previously registered host, service, key entries as removed.
154*cfb92d14SAndroid Build Coastguard Worker  *
155*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance The OpenThread instance structure.
156*cfb92d14SAndroid Build Coastguard Worker  *
157*cfb92d14SAndroid Build Coastguard Worker  */
158*cfb92d14SAndroid Build Coastguard Worker extern void otPlatDnssdStateHandleStateChange(otInstance *aInstance);
159*cfb92d14SAndroid Build Coastguard Worker 
160*cfb92d14SAndroid Build Coastguard Worker /**
161*cfb92d14SAndroid Build Coastguard Worker  * Gets the current state of the DNS-SD module.
162*cfb92d14SAndroid Build Coastguard Worker  *
163*cfb92d14SAndroid Build Coastguard Worker  * The platform MUST notify the OpenThread stack whenever its state gets changed by invoking
164*cfb92d14SAndroid Build Coastguard Worker  * `otPlatDnssdStateHandleStateChange()`.
165*cfb92d14SAndroid Build Coastguard Worker  *
166*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
167*cfb92d14SAndroid Build Coastguard Worker  *
168*cfb92d14SAndroid Build Coastguard Worker  * @returns The current state of the DNS-SD module.
169*cfb92d14SAndroid Build Coastguard Worker  *
170*cfb92d14SAndroid Build Coastguard Worker  */
171*cfb92d14SAndroid Build Coastguard Worker otPlatDnssdState otPlatDnssdGetState(otInstance *aInstance);
172*cfb92d14SAndroid Build Coastguard Worker 
173*cfb92d14SAndroid Build Coastguard Worker /**
174*cfb92d14SAndroid Build Coastguard Worker  * Registers or updates a service on the infrastructure network's DNS-SD module.
175*cfb92d14SAndroid Build Coastguard Worker  *
176*cfb92d14SAndroid Build Coastguard Worker  * The @p aService and all its contained information (strings and buffers) are only valid during this call. The
177*cfb92d14SAndroid Build Coastguard Worker  * platform MUST save a copy of the information if it wants to retain the information after returning from this
178*cfb92d14SAndroid Build Coastguard Worker  * function.
179*cfb92d14SAndroid Build Coastguard Worker  *
180*cfb92d14SAndroid Build Coastguard Worker  * The fields in @p aService follow these rules:
181*cfb92d14SAndroid Build Coastguard Worker  *
182*cfb92d14SAndroid Build Coastguard Worker  * - The `mServiceInstance` and `mServiceType` fields specify the service instance label and service type name,
183*cfb92d14SAndroid Build Coastguard Worker  *   respectively. They are never NULL.
184*cfb92d14SAndroid Build Coastguard Worker  * - The `mHostName` field specifies the host name of the service if it is not NULL. Otherwise, if it is NULL, it
185*cfb92d14SAndroid Build Coastguard Worker  *   indicates that this service is for the device itself and leaves the host name selection to DNS-SD platform.
186*cfb92d14SAndroid Build Coastguard Worker  * - The `mSubTypeLabels` is an array of strings representing sub-types associated with the service. It can be NULL
187*cfb92d14SAndroid Build Coastguard Worker  *   if there are no sub-types. Otherwise, the array length is specified by `mSubTypeLabelsLength`.
188*cfb92d14SAndroid Build Coastguard Worker  * - The `mTxtData` and `mTxtDataLength` fields specify the encoded TXT data.
189*cfb92d14SAndroid Build Coastguard Worker  * - The `mPort`, `mWeight`, and `mPriority` fields specify the service's parameters (as specified in DNS SRV record).
190*cfb92d14SAndroid Build Coastguard Worker  * - The `mTtl` field specifies the TTL if non-zero. If zero, the platform can choose the TTL to use.
191*cfb92d14SAndroid Build Coastguard Worker  * - The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this
192*cfb92d14SAndroid Build Coastguard Worker  *   request. If zero, the platform implementation can decided the interface.
193*cfb92d14SAndroid Build Coastguard Worker  *
194*cfb92d14SAndroid Build Coastguard Worker  * When the `mHostName` field in @p aService is not NULL (indicating that this registration is on behalf of another
195*cfb92d14SAndroid Build Coastguard Worker  * host), the OpenThread stack will ensure that `otPlatDnssdRegisterHost()` is also called for the same host before any
196*cfb92d14SAndroid Build Coastguard Worker  * service registration requests for the same host.
197*cfb92d14SAndroid Build Coastguard Worker  *
198*cfb92d14SAndroid Build Coastguard Worker  * Once the registration request is finished, either successfully or failed, the platform reports the outcome by
199*cfb92d14SAndroid Build Coastguard Worker  * invoking the @p aCallback and passing the same @p aRequestId in the callback. The @p aCallback function pointer can
200*cfb92d14SAndroid Build Coastguard Worker  * be NULL, which indicates that the OpenThread stack does not need to be notified of the outcome of the request.
201*cfb92d14SAndroid Build Coastguard Worker  * If the outcome is determined, the platform implementation may invoke the @p aCallback before returning from this
202*cfb92d14SAndroid Build Coastguard Worker  * function. The OpenThread stack will ensure to handle such a situation.
203*cfb92d14SAndroid Build Coastguard Worker  *
204*cfb92d14SAndroid Build Coastguard Worker  * On success, the @p aCallback MUST be called (if non-NULL) with `OT_ERROR_NONE` as the `aError` input parameter. If
205*cfb92d14SAndroid Build Coastguard Worker  * the registration causes a name conflict on DNS-SD domain (the service instance name is already claimed by another
206*cfb92d14SAndroid Build Coastguard Worker  * host), the `OT_ERROR_DUPLICATED` error MUST be used. The platform implementation can use other `OT_ERROR` types for
207*cfb92d14SAndroid Build Coastguard Worker  * other types of errors.
208*cfb92d14SAndroid Build Coastguard Worker  *
209*cfb92d14SAndroid Build Coastguard Worker  * The platform implementation MUST not assume that the @p aRequestId used in subsequent requests will be different.
210*cfb92d14SAndroid Build Coastguard Worker  * OpenThread may reuse the same request ID again for a different request.
211*cfb92d14SAndroid Build Coastguard Worker  *
212*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack will not register the same service (with no changes) that was registered successfully earlier.
213*cfb92d14SAndroid Build Coastguard Worker  * Therefore, the platform implementation does not need to check for duplicate/same service and can assume that calls
214*cfb92d14SAndroid Build Coastguard Worker  * to this function are either registering a new entry or changing some parameter in a previously registered item. As
215*cfb92d14SAndroid Build Coastguard Worker  * a result, these changes always need to be synced on the infrastructure DNS-SD module.
216*cfb92d14SAndroid Build Coastguard Worker  *
217*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack does not require the platform implementation to always invoke the @p aCallback function.
218*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack has its own mechanism to time out an aged request with no response. This relaxes the
219*cfb92d14SAndroid Build Coastguard Worker  * requirement for platform implementations.
220*cfb92d14SAndroid Build Coastguard Worker  *
221*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
222*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aService      Information about the service to register.
223*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aRequestId    The ID associated with this request.
224*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aCallback     The callback function pointer to report the outcome (may be NULL if no callback needed).
225*cfb92d14SAndroid Build Coastguard Worker  *
226*cfb92d14SAndroid Build Coastguard Worker  */
227*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdRegisterService(otInstance                 *aInstance,
228*cfb92d14SAndroid Build Coastguard Worker                                 const otPlatDnssdService   *aService,
229*cfb92d14SAndroid Build Coastguard Worker                                 otPlatDnssdRequestId        aRequestId,
230*cfb92d14SAndroid Build Coastguard Worker                                 otPlatDnssdRegisterCallback aCallback);
231*cfb92d14SAndroid Build Coastguard Worker 
232*cfb92d14SAndroid Build Coastguard Worker /**
233*cfb92d14SAndroid Build Coastguard Worker  * Unregisters a service on the infrastructure network's DNS-SD module.
234*cfb92d14SAndroid Build Coastguard Worker  *
235*cfb92d14SAndroid Build Coastguard Worker  * The @p aService and all its contained information (strings and buffers) are only valid during this call. The
236*cfb92d14SAndroid Build Coastguard Worker  * platform MUST save a copy of the information if it wants to retain the information after returning from this
237*cfb92d14SAndroid Build Coastguard Worker  * function.
238*cfb92d14SAndroid Build Coastguard Worker  *
239*cfb92d14SAndroid Build Coastguard Worker  * The fields in @p aService follow these rules:
240*cfb92d14SAndroid Build Coastguard Worker  *
241*cfb92d14SAndroid Build Coastguard Worker  * - The `mServiceInstance` and `mServiceType` fields specify the service instance label and service type name,
242*cfb92d14SAndroid Build Coastguard Worker  *   respectively. They are never NULL.
243*cfb92d14SAndroid Build Coastguard Worker  * - The `mHostName` field specifies the host name of the service if it is not NULL. Otherwise, if it is NULL, it
244*cfb92d14SAndroid Build Coastguard Worker  *   indicates that this service is for the device itself and leaves the host name selection to DNS-SD platform.
245*cfb92d14SAndroid Build Coastguard Worker  * - The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this
246*cfb92d14SAndroid Build Coastguard Worker  *   request. If zero, the platform implementation can decided the interface.
247*cfb92d14SAndroid Build Coastguard Worker  * - The rest of the fields in @p aService structure MUST be ignored in `otPlatDnssdUnregisterService()` call and may
248*cfb92d14SAndroid Build Coastguard Worker  *   be set to zero by the OpenThread stack.
249*cfb92d14SAndroid Build Coastguard Worker  *
250*cfb92d14SAndroid Build Coastguard Worker  * Regarding the invocation of the @p aCallback and the reuse of the @p aRequestId, this function follows the same
251*cfb92d14SAndroid Build Coastguard Worker  * rules as described in `otPlatDnssdRegisterService()`.
252*cfb92d14SAndroid Build Coastguard Worker  *
253*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack may request the unregistration of a service that was not previously registered, and the
254*cfb92d14SAndroid Build Coastguard Worker  * platform implementation MUST handle this case. In such a case, the platform can use either `OT_ERROR_NOT_FOUND` to
255*cfb92d14SAndroid Build Coastguard Worker  * indicate that there was no such registration, or `OT_ERROR_NONE` when invoking the @p aCallback function. The
256*cfb92d14SAndroid Build Coastguard Worker  * OpenThread stack will handle either case correctly.
257*cfb92d14SAndroid Build Coastguard Worker  *
258*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
259*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aService      Information about the service to unregister.
260*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aRequestId    The ID associated with this request.
261*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aCallback     The callback function pointer to report the outcome (may be NULL if no callback needed).
262*cfb92d14SAndroid Build Coastguard Worker  *
263*cfb92d14SAndroid Build Coastguard Worker  */
264*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdUnregisterService(otInstance                 *aInstance,
265*cfb92d14SAndroid Build Coastguard Worker                                   const otPlatDnssdService   *aService,
266*cfb92d14SAndroid Build Coastguard Worker                                   otPlatDnssdRequestId        aRequestId,
267*cfb92d14SAndroid Build Coastguard Worker                                   otPlatDnssdRegisterCallback aCallback);
268*cfb92d14SAndroid Build Coastguard Worker 
269*cfb92d14SAndroid Build Coastguard Worker /**
270*cfb92d14SAndroid Build Coastguard Worker  * Registers or updates a host on the infrastructure network's DNS-SD module.
271*cfb92d14SAndroid Build Coastguard Worker  *
272*cfb92d14SAndroid Build Coastguard Worker  * The @p aHost and all its contained information (strings and arrays) are only valid during this call. The
273*cfb92d14SAndroid Build Coastguard Worker  * platform MUST save a copy of the information if it wants to retain the information after returning from this
274*cfb92d14SAndroid Build Coastguard Worker  * function.
275*cfb92d14SAndroid Build Coastguard Worker  *
276*cfb92d14SAndroid Build Coastguard Worker  * The fields in @p aHost follow these rules:
277*cfb92d14SAndroid Build Coastguard Worker  *
278*cfb92d14SAndroid Build Coastguard Worker  * - The `mHostName` field specifies the host name to register. It is never NULL.
279*cfb92d14SAndroid Build Coastguard Worker  * - The `mAddresses` field is an array of IPv6 addresses to register with the host. `mAddressesLength` field provides
280*cfb92d14SAndroid Build Coastguard Worker  *   the number of entries in `mAddresses` array. The platform implementation MUST not filter or remove any of
281*cfb92d14SAndroid Build Coastguard Worker  *   addresses in the list.
282*cfb92d14SAndroid Build Coastguard Worker  *   The OpenThread stack will already ensure that the given addresses are externally reachable. For example, when
283*cfb92d14SAndroid Build Coastguard Worker  *   registering host from an SRP registration, link-local or mesh-local addresses associated with the host which are
284*cfb92d14SAndroid Build Coastguard Worker  *   intended for use within Thread mesh are not included in `mAddresses` array passed to this API. The `mAddresses`
285*cfb92d14SAndroid Build Coastguard Worker  *   array can be empty with zero `mAddressesLength`. In such a case, the platform MUST stop advertising any addresses
286*cfb92d14SAndroid Build Coastguard Worker  *   for this host name on the infrastructure DNS-SD.
287*cfb92d14SAndroid Build Coastguard Worker  * - The `mTtl` field specifies the TTL if non-zero. If zero, the platform can choose the TTL to use.
288*cfb92d14SAndroid Build Coastguard Worker  * - The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this
289*cfb92d14SAndroid Build Coastguard Worker  *   request. If zero, the platform implementation can decided the interface.
290*cfb92d14SAndroid Build Coastguard Worker  *
291*cfb92d14SAndroid Build Coastguard Worker  * Regarding the invocation of the @p aCallback and the reuse of the @p aRequestId, this function follows the same
292*cfb92d14SAndroid Build Coastguard Worker  * rules as described in `otPlatDnssdRegisterService()`.
293*cfb92d14SAndroid Build Coastguard Worker  *
294*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack will not register the same host (with no changes) that was registered successfully earlier.
295*cfb92d14SAndroid Build Coastguard Worker  * Therefore, the platform implementation does not need to check for duplicate/same host and can assume that calls
296*cfb92d14SAndroid Build Coastguard Worker  * to this function are either registering a new entry or changing some parameter in a previously registered item. As
297*cfb92d14SAndroid Build Coastguard Worker  * a result, these changes always need to be synced on the infrastructure DNS-SD module.
298*cfb92d14SAndroid Build Coastguard Worker  *
299*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
300*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aHost         Information about the host to register.
301*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aRequestId    The ID associated with this request.
302*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aCallback     The callback function pointer to report the outcome (may be NULL if no callback needed).
303*cfb92d14SAndroid Build Coastguard Worker  *
304*cfb92d14SAndroid Build Coastguard Worker  */
305*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdRegisterHost(otInstance                 *aInstance,
306*cfb92d14SAndroid Build Coastguard Worker                              const otPlatDnssdHost      *aHost,
307*cfb92d14SAndroid Build Coastguard Worker                              otPlatDnssdRequestId        aRequestId,
308*cfb92d14SAndroid Build Coastguard Worker                              otPlatDnssdRegisterCallback aCallback);
309*cfb92d14SAndroid Build Coastguard Worker 
310*cfb92d14SAndroid Build Coastguard Worker /**
311*cfb92d14SAndroid Build Coastguard Worker  * Unregisters a host on the infrastructure network's DNS-SD module.
312*cfb92d14SAndroid Build Coastguard Worker  *
313*cfb92d14SAndroid Build Coastguard Worker  * The @p aHost and all its contained information (strings and arrays) are only valid during this call. The
314*cfb92d14SAndroid Build Coastguard Worker  * platform MUST save a copy of the information if it wants to retain the information after returning from this
315*cfb92d14SAndroid Build Coastguard Worker  * function.
316*cfb92d14SAndroid Build Coastguard Worker  *
317*cfb92d14SAndroid Build Coastguard Worker  * The fields in @p aHost follow these rules:
318*cfb92d14SAndroid Build Coastguard Worker  *
319*cfb92d14SAndroid Build Coastguard Worker  * - The `mHostName` field specifies the host name to unregister. It is never NULL.
320*cfb92d14SAndroid Build Coastguard Worker  * - The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this
321*cfb92d14SAndroid Build Coastguard Worker  *   request. If zero, the platform implementation can decided the interface.
322*cfb92d14SAndroid Build Coastguard Worker  * - The rest of the fields in @p aHost structure MUST be ignored in `otPlatDnssdUnregisterHost()` call and may
323*cfb92d14SAndroid Build Coastguard Worker  *   be set to zero by the OpenThread stack.
324*cfb92d14SAndroid Build Coastguard Worker  *
325*cfb92d14SAndroid Build Coastguard Worker  * Regarding the invocation of the @p aCallback and the reuse of the @p aRequestId, this function follows the same
326*cfb92d14SAndroid Build Coastguard Worker  * rules as described in `otPlatDnssdRegisterService()`.
327*cfb92d14SAndroid Build Coastguard Worker  *
328*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack may request the unregistration of a host that was not previously registered, and the platform
329*cfb92d14SAndroid Build Coastguard Worker  * implementation MUST handle this case. In such a case, the platform can use either `OT_ERROR_NOT_FOUND` to indicate
330*cfb92d14SAndroid Build Coastguard Worker  * that there was no such registration, or `OT_ERROR_NONE` when invoking the @p aCallback function. OpenThread stack
331*cfb92d14SAndroid Build Coastguard Worker  * will handle either case correctly.
332*cfb92d14SAndroid Build Coastguard Worker  *
333*cfb92d14SAndroid Build Coastguard Worker  * When unregistering a host, the OpenThread stack will also unregister any previously registered services
334*cfb92d14SAndroid Build Coastguard Worker  * associated with the same host (by calling `otPlatDnssdUnregisterService()`). However, the platform implementation
335*cfb92d14SAndroid Build Coastguard Worker  * MAY assume that unregistering a host also unregisters all its associated services.
336*cfb92d14SAndroid Build Coastguard Worker  *
337*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
338*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aHost         Information about the host to unregister.
339*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aRequestId    The ID associated with this request.
340*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aCallback     The callback function pointer to report the outcome (may be NULL if no callback needed).
341*cfb92d14SAndroid Build Coastguard Worker  *
342*cfb92d14SAndroid Build Coastguard Worker  */
343*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdUnregisterHost(otInstance                 *aInstance,
344*cfb92d14SAndroid Build Coastguard Worker                                const otPlatDnssdHost      *aHost,
345*cfb92d14SAndroid Build Coastguard Worker                                otPlatDnssdRequestId        aRequestId,
346*cfb92d14SAndroid Build Coastguard Worker                                otPlatDnssdRegisterCallback aCallback);
347*cfb92d14SAndroid Build Coastguard Worker 
348*cfb92d14SAndroid Build Coastguard Worker /**
349*cfb92d14SAndroid Build Coastguard Worker  * Registers or updates a key record on the infrastructure network's DNS-SD module.
350*cfb92d14SAndroid Build Coastguard Worker  *
351*cfb92d14SAndroid Build Coastguard Worker  * The @p aKey and all its contained information (strings and arrays) are only valid during this call. The
352*cfb92d14SAndroid Build Coastguard Worker  * platform MUST save a copy of the information if it wants to retain the information after returning from this
353*cfb92d14SAndroid Build Coastguard Worker  * function.
354*cfb92d14SAndroid Build Coastguard Worker  *
355*cfb92d14SAndroid Build Coastguard Worker  * The fields in @p aKey follow these rules:
356*cfb92d14SAndroid Build Coastguard Worker  *
357*cfb92d14SAndroid Build Coastguard Worker  * - If the key is associated with a host, `mName` field specifies the host name and `mServiceType` will be NULL.
358*cfb92d14SAndroid Build Coastguard Worker  * - If the key is associated with a service, `mName` field specifies the service instance label and `mServiceType`
359*cfb92d14SAndroid Build Coastguard Worker  *   field specifies the service type. In this case the DNS name for key record is `{mName}.{mServiceTye}`.
360*cfb92d14SAndroid Build Coastguard Worker  * - The `mKeyData` field contains the key record's data with `mKeyDataLength` as its length in byes. It is never NULL.
361*cfb92d14SAndroid Build Coastguard Worker  * - The `mClass` fields specifies the resource record class to use when registering key record.
362*cfb92d14SAndroid Build Coastguard Worker  * - The `mTtl` field specifies the TTL if non-zero. If zero, the platform can choose the TTL to use.
363*cfb92d14SAndroid Build Coastguard Worker  * - The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this
364*cfb92d14SAndroid Build Coastguard Worker  *   request. If zero, the platform implementation can decided the interface.
365*cfb92d14SAndroid Build Coastguard Worker  *
366*cfb92d14SAndroid Build Coastguard Worker  * Regarding the invocation of the @p aCallback and the reuse of the @p aRequestId, this function follows the same
367*cfb92d14SAndroid Build Coastguard Worker  * rules as described in `otPlatDnssdRegisterService()`.
368*cfb92d14SAndroid Build Coastguard Worker  *
369*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack will not register the same key (with no changes) that was registered successfully earlier.
370*cfb92d14SAndroid Build Coastguard Worker  * Therefore, the platform implementation does not need to check for duplicate/same name and can assume that calls
371*cfb92d14SAndroid Build Coastguard Worker  * to this function are either registering a new key or changing the key data in a previously registered one. As
372*cfb92d14SAndroid Build Coastguard Worker  * a result, these changes always need to be synced on the infrastructure DNS-SD module.
373*cfb92d14SAndroid Build Coastguard Worker  *
374*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
375*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aKey          Information about the key record to register.
376*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aRequestId    The ID associated with this request.
377*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aCallback     The callback function pointer to report the outcome (may be NULL if no callback needed).
378*cfb92d14SAndroid Build Coastguard Worker  *
379*cfb92d14SAndroid Build Coastguard Worker  */
380*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdRegisterKey(otInstance                 *aInstance,
381*cfb92d14SAndroid Build Coastguard Worker                             const otPlatDnssdKey       *aKey,
382*cfb92d14SAndroid Build Coastguard Worker                             otPlatDnssdRequestId        aRequestId,
383*cfb92d14SAndroid Build Coastguard Worker                             otPlatDnssdRegisterCallback aCallback);
384*cfb92d14SAndroid Build Coastguard Worker 
385*cfb92d14SAndroid Build Coastguard Worker /**
386*cfb92d14SAndroid Build Coastguard Worker  * Unregisters a key record on the infrastructure network's DNS-SD module.
387*cfb92d14SAndroid Build Coastguard Worker  *
388*cfb92d14SAndroid Build Coastguard Worker  * The @p aKey and all its contained information (strings and arrays) are only valid during this call. The
389*cfb92d14SAndroid Build Coastguard Worker  * platform MUST save a copy of the information if it wants to retain the information after returning from this
390*cfb92d14SAndroid Build Coastguard Worker  * function.
391*cfb92d14SAndroid Build Coastguard Worker  *
392*cfb92d14SAndroid Build Coastguard Worker  * The fields in @p aKey follow these rules:
393*cfb92d14SAndroid Build Coastguard Worker  *
394*cfb92d14SAndroid Build Coastguard Worker  * - If the key is associated with a host, `mName` field specifies the host name and `mServiceType` will be NULL.
395*cfb92d14SAndroid Build Coastguard Worker  * - If the key is associated with a service, `mName` field specifies the service instance label and `mServiceType`
396*cfb92d14SAndroid Build Coastguard Worker  *   field specifies the service type. In this case the DNS name for key record is `{mName}.{mServiceTye}`.
397*cfb92d14SAndroid Build Coastguard Worker  * - The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this
398*cfb92d14SAndroid Build Coastguard Worker  *   request. If zero, the platform implementation can decided the interface.
399*cfb92d14SAndroid Build Coastguard Worker  * - The rest of the fields in @p aKey structure MUST be ignored in `otPlatDnssdUnregisterKey()` call and may
400*cfb92d14SAndroid Build Coastguard Worker  *   be set to zero by the OpenThread stack.
401*cfb92d14SAndroid Build Coastguard Worker  *
402*cfb92d14SAndroid Build Coastguard Worker  * Regarding the invocation of the @p aCallback and the reuse of the @p aRequestId, this function follows the same
403*cfb92d14SAndroid Build Coastguard Worker  * rules as described in `otPlatDnssdRegisterService()`.
404*cfb92d14SAndroid Build Coastguard Worker  *
405*cfb92d14SAndroid Build Coastguard Worker  * The OpenThread stack may request the unregistration of a key that was not previously registered, and the platform
406*cfb92d14SAndroid Build Coastguard Worker  * implementation MUST handle this case. In such a case, the platform can use either `OT_ERROR_NOT_FOUND` to indicate
407*cfb92d14SAndroid Build Coastguard Worker  * that there was no such registration, or `OT_ERROR_NONE` when invoking the @p aCallback function. the OpenThread
408*cfb92d14SAndroid Build Coastguard Worker  * stack will handle either case correctly.
409*cfb92d14SAndroid Build Coastguard Worker  *
410*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance     The OpenThread instance.
411*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aKey          Information about the key to unregister.
412*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aRequestId    The ID associated with this request.
413*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aCallback     The callback function pointer to report the outcome (may be NULL if no callback needed).
414*cfb92d14SAndroid Build Coastguard Worker  *
415*cfb92d14SAndroid Build Coastguard Worker  */
416*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdUnregisterKey(otInstance                 *aInstance,
417*cfb92d14SAndroid Build Coastguard Worker                               const otPlatDnssdKey       *aKey,
418*cfb92d14SAndroid Build Coastguard Worker                               otPlatDnssdRequestId        aRequestId,
419*cfb92d14SAndroid Build Coastguard Worker                               otPlatDnssdRegisterCallback aCallback);
420*cfb92d14SAndroid Build Coastguard Worker 
421*cfb92d14SAndroid Build Coastguard Worker //======================================================================================================================
422*cfb92d14SAndroid Build Coastguard Worker 
423*cfb92d14SAndroid Build Coastguard Worker /**
424*cfb92d14SAndroid Build Coastguard Worker  * Represents a browse result.
425*cfb92d14SAndroid Build Coastguard Worker  *
426*cfb92d14SAndroid Build Coastguard Worker  */
427*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdBrowseResult
428*cfb92d14SAndroid Build Coastguard Worker {
429*cfb92d14SAndroid Build Coastguard Worker     const char *mServiceType;     ///< The service type (e.g., "_mt._udp").
430*cfb92d14SAndroid Build Coastguard Worker     const char *mSubTypeLabel;    ///< The sub-type label if browsing for sub-type, NULL otherwise.
431*cfb92d14SAndroid Build Coastguard Worker     const char *mServiceInstance; ///< Service instance label.
432*cfb92d14SAndroid Build Coastguard Worker     uint32_t    mTtl;             ///< TTL in seconds. Zero TTL indicates that service is removed.
433*cfb92d14SAndroid Build Coastguard Worker     uint32_t    mInfraIfIndex;    ///< The infrastructure network interface index.
434*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdBrowseResult;
435*cfb92d14SAndroid Build Coastguard Worker 
436*cfb92d14SAndroid Build Coastguard Worker /**
437*cfb92d14SAndroid Build Coastguard Worker  * Represents the callback function used to report a browse result.
438*cfb92d14SAndroid Build Coastguard Worker  *
439*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
440*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResult      The browse result.
441*cfb92d14SAndroid Build Coastguard Worker  *
442*cfb92d14SAndroid Build Coastguard Worker  */
443*cfb92d14SAndroid Build Coastguard Worker typedef void (*otPlatDnssdBrowseCallback)(otInstance *aInstance, const otPlatDnssdBrowseResult *aResult);
444*cfb92d14SAndroid Build Coastguard Worker 
445*cfb92d14SAndroid Build Coastguard Worker /**
446*cfb92d14SAndroid Build Coastguard Worker  * Represents a service browser.
447*cfb92d14SAndroid Build Coastguard Worker  *
448*cfb92d14SAndroid Build Coastguard Worker  */
449*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdBrowser
450*cfb92d14SAndroid Build Coastguard Worker {
451*cfb92d14SAndroid Build Coastguard Worker     const char               *mServiceType;  ///< The service type (e.g., "_mt._udp"). MUST NOT include domain name.
452*cfb92d14SAndroid Build Coastguard Worker     const char               *mSubTypeLabel; ///< The sub-type label if browsing for sub-type, NULL otherwise.
453*cfb92d14SAndroid Build Coastguard Worker     uint32_t                  mInfraIfIndex; ///< The infrastructure network interface index.
454*cfb92d14SAndroid Build Coastguard Worker     otPlatDnssdBrowseCallback mCallback;     ///< The callback to report result.
455*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdBrowser;
456*cfb92d14SAndroid Build Coastguard Worker 
457*cfb92d14SAndroid Build Coastguard Worker /**
458*cfb92d14SAndroid Build Coastguard Worker  * Represents an SRV resolver result.
459*cfb92d14SAndroid Build Coastguard Worker  *
460*cfb92d14SAndroid Build Coastguard Worker  */
461*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdSrvResult
462*cfb92d14SAndroid Build Coastguard Worker {
463*cfb92d14SAndroid Build Coastguard Worker     const char *mServiceInstance; ///< The service instance name label.
464*cfb92d14SAndroid Build Coastguard Worker     const char *mServiceType;     ///< The service type.
465*cfb92d14SAndroid Build Coastguard Worker     const char *mHostName;        ///< The host name (e.g., "myhost"). Can be NULL when `mTtl` is zero.
466*cfb92d14SAndroid Build Coastguard Worker     uint16_t    mPort;            ///< The service port number.
467*cfb92d14SAndroid Build Coastguard Worker     uint16_t    mPriority;        ///< The service priority.
468*cfb92d14SAndroid Build Coastguard Worker     uint16_t    mWeight;          ///< The service weight.
469*cfb92d14SAndroid Build Coastguard Worker     uint32_t    mTtl;             ///< The service TTL in seconds. Zero TTL indicates SRV record is removed.
470*cfb92d14SAndroid Build Coastguard Worker     uint32_t    mInfraIfIndex;    ///< The infrastructure network interface index.
471*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdSrvResult;
472*cfb92d14SAndroid Build Coastguard Worker 
473*cfb92d14SAndroid Build Coastguard Worker /**
474*cfb92d14SAndroid Build Coastguard Worker  * Represents the callback function used to report an SRV resolve result.
475*cfb92d14SAndroid Build Coastguard Worker  *
476*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
477*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResult      The SRV resolve result.
478*cfb92d14SAndroid Build Coastguard Worker  *
479*cfb92d14SAndroid Build Coastguard Worker  */
480*cfb92d14SAndroid Build Coastguard Worker typedef void (*otPlatDnssdSrvCallback)(otInstance *aInstance, const otPlatDnssdSrvResult *aResult);
481*cfb92d14SAndroid Build Coastguard Worker 
482*cfb92d14SAndroid Build Coastguard Worker /**
483*cfb92d14SAndroid Build Coastguard Worker  * Represents an SRV service resolver.
484*cfb92d14SAndroid Build Coastguard Worker  *
485*cfb92d14SAndroid Build Coastguard Worker  */
486*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdSrvResolver
487*cfb92d14SAndroid Build Coastguard Worker {
488*cfb92d14SAndroid Build Coastguard Worker     const char            *mServiceInstance; ///< The service instance label.
489*cfb92d14SAndroid Build Coastguard Worker     const char            *mServiceType;     ///< The service type.
490*cfb92d14SAndroid Build Coastguard Worker     uint32_t               mInfraIfIndex;    ///< The infrastructure network interface index.
491*cfb92d14SAndroid Build Coastguard Worker     otPlatDnssdSrvCallback mCallback;        ///< The callback to report result.
492*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdSrvResolver;
493*cfb92d14SAndroid Build Coastguard Worker 
494*cfb92d14SAndroid Build Coastguard Worker /**
495*cfb92d14SAndroid Build Coastguard Worker  * Represents a TXT resolver result.
496*cfb92d14SAndroid Build Coastguard Worker  *
497*cfb92d14SAndroid Build Coastguard Worker  */
498*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdTxtResult
499*cfb92d14SAndroid Build Coastguard Worker {
500*cfb92d14SAndroid Build Coastguard Worker     const char    *mServiceInstance; ///< The service instance name label.
501*cfb92d14SAndroid Build Coastguard Worker     const char    *mServiceType;     ///< The service type.
502*cfb92d14SAndroid Build Coastguard Worker     const uint8_t *mTxtData;         ///< Encoded TXT data bytes. Can be NULL when `mTtl` is zero.
503*cfb92d14SAndroid Build Coastguard Worker     uint16_t       mTxtDataLength;   ///< Length of TXT data.
504*cfb92d14SAndroid Build Coastguard Worker     uint32_t       mTtl;             ///< The TXT data TTL in seconds. Zero TTL indicates record is removed.
505*cfb92d14SAndroid Build Coastguard Worker     uint32_t       mInfraIfIndex;    ///< The infrastructure network interface index.
506*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdTxtResult;
507*cfb92d14SAndroid Build Coastguard Worker 
508*cfb92d14SAndroid Build Coastguard Worker /**
509*cfb92d14SAndroid Build Coastguard Worker  * Represents the callback function used to report a TXT resolve result.
510*cfb92d14SAndroid Build Coastguard Worker  *
511*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
512*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResult      The TXT resolve result.
513*cfb92d14SAndroid Build Coastguard Worker  *
514*cfb92d14SAndroid Build Coastguard Worker  */
515*cfb92d14SAndroid Build Coastguard Worker typedef void (*otPlatDnssdTxtCallback)(otInstance *aInstance, const otPlatDnssdTxtResult *aResult);
516*cfb92d14SAndroid Build Coastguard Worker 
517*cfb92d14SAndroid Build Coastguard Worker /**
518*cfb92d14SAndroid Build Coastguard Worker  * Represents a TXT service resolver.
519*cfb92d14SAndroid Build Coastguard Worker  *
520*cfb92d14SAndroid Build Coastguard Worker  */
521*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdTxtResolver
522*cfb92d14SAndroid Build Coastguard Worker {
523*cfb92d14SAndroid Build Coastguard Worker     const char            *mServiceInstance; ///< Service instance label.
524*cfb92d14SAndroid Build Coastguard Worker     const char            *mServiceType;     ///< Service type.
525*cfb92d14SAndroid Build Coastguard Worker     uint32_t               mInfraIfIndex;    ///< The infrastructure network interface index.
526*cfb92d14SAndroid Build Coastguard Worker     otPlatDnssdTxtCallback mCallback;
527*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdTxtResolver;
528*cfb92d14SAndroid Build Coastguard Worker 
529*cfb92d14SAndroid Build Coastguard Worker /**
530*cfb92d14SAndroid Build Coastguard Worker  * Represents a discovered host address and its TTL.
531*cfb92d14SAndroid Build Coastguard Worker  *
532*cfb92d14SAndroid Build Coastguard Worker  */
533*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdAddressAndTtl
534*cfb92d14SAndroid Build Coastguard Worker {
535*cfb92d14SAndroid Build Coastguard Worker     otIp6Address mAddress; ///< The IPv6 address. For IPv4 address the IPv4-mapped IPv6 address format is used.
536*cfb92d14SAndroid Build Coastguard Worker     uint32_t     mTtl;     ///< The TTL in seconds.
537*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdAddressAndTtl;
538*cfb92d14SAndroid Build Coastguard Worker 
539*cfb92d14SAndroid Build Coastguard Worker /**
540*cfb92d14SAndroid Build Coastguard Worker  * Represents address resolver result.
541*cfb92d14SAndroid Build Coastguard Worker  *
542*cfb92d14SAndroid Build Coastguard Worker  */
543*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdAddressResult
544*cfb92d14SAndroid Build Coastguard Worker {
545*cfb92d14SAndroid Build Coastguard Worker     const char                     *mHostName;        ///< The host name.
546*cfb92d14SAndroid Build Coastguard Worker     const otPlatDnssdAddressAndTtl *mAddresses;       ///< Array of host addresses and their TTL. Can be NULL if empty.
547*cfb92d14SAndroid Build Coastguard Worker     uint16_t                        mAddressesLength; ///< Number of entries in `mAddresses` array.
548*cfb92d14SAndroid Build Coastguard Worker     uint32_t                        mInfraIfIndex;    ///< The infrastructure network interface index.
549*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdAddressResult;
550*cfb92d14SAndroid Build Coastguard Worker 
551*cfb92d14SAndroid Build Coastguard Worker /**
552*cfb92d14SAndroid Build Coastguard Worker  * Represents the callback function use to report a IPv6/IPv4 address resolve result.
553*cfb92d14SAndroid Build Coastguard Worker  *
554*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
555*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResult      The address resolve result.
556*cfb92d14SAndroid Build Coastguard Worker  *
557*cfb92d14SAndroid Build Coastguard Worker  */
558*cfb92d14SAndroid Build Coastguard Worker typedef void (*otPlatDnssdAddressCallback)(otInstance *aInstance, const otPlatDnssdAddressResult *aResult);
559*cfb92d14SAndroid Build Coastguard Worker 
560*cfb92d14SAndroid Build Coastguard Worker /**
561*cfb92d14SAndroid Build Coastguard Worker  * Represents an address resolver.
562*cfb92d14SAndroid Build Coastguard Worker  *
563*cfb92d14SAndroid Build Coastguard Worker  */
564*cfb92d14SAndroid Build Coastguard Worker typedef struct otPlatDnssdAddressResolver
565*cfb92d14SAndroid Build Coastguard Worker {
566*cfb92d14SAndroid Build Coastguard Worker     const char                *mHostName;     ///< The host name (e.g., "myhost"). MUST NOT contain domain name.
567*cfb92d14SAndroid Build Coastguard Worker     uint32_t                   mInfraIfIndex; ///< The infrastructure network interface index.
568*cfb92d14SAndroid Build Coastguard Worker     otPlatDnssdAddressCallback mCallback;     ///< The callback to report result.
569*cfb92d14SAndroid Build Coastguard Worker } otPlatDnssdAddressResolver;
570*cfb92d14SAndroid Build Coastguard Worker 
571*cfb92d14SAndroid Build Coastguard Worker /**
572*cfb92d14SAndroid Build Coastguard Worker  * Starts a service browser.
573*cfb92d14SAndroid Build Coastguard Worker  *
574*cfb92d14SAndroid Build Coastguard Worker  * Initiates a continuous search for the specified `mServiceType` in @p aBrowser. For sub-type services,
575*cfb92d14SAndroid Build Coastguard Worker  * `mSubTypeLabel` specifies the sub-type, for base services,  `mSubTypeLabel` is set to NULL.
576*cfb92d14SAndroid Build Coastguard Worker  *
577*cfb92d14SAndroid Build Coastguard Worker  * Discovered services should be reported through the `mCallback` function in @p aBrowser. Services that have been
578*cfb92d14SAndroid Build Coastguard Worker  * removed are reported with a TTL value of zero. The callback may be invoked immediately with cached information
579*cfb92d14SAndroid Build Coastguard Worker  * (if available) and potentially before this function returns. When cached results are used, the reported TTL value
580*cfb92d14SAndroid Build Coastguard Worker  * should reflect the original TTL from the last received response.
581*cfb92d14SAndroid Build Coastguard Worker  *
582*cfb92d14SAndroid Build Coastguard Worker  * Multiple browsers can be started for the same service, provided they use different callback functions.
583*cfb92d14SAndroid Build Coastguard Worker  *
584*cfb92d14SAndroid Build Coastguard Worker  * The @p aBrowser and all its contained information (strings) are only valid during this call. The platform MUST save
585*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
586*cfb92d14SAndroid Build Coastguard Worker  *
587*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance   The OpenThread instance.
588*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aBrowser    The browser to be started.
589*cfb92d14SAndroid Build Coastguard Worker  *
590*cfb92d14SAndroid Build Coastguard Worker  */
591*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStartBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser);
592*cfb92d14SAndroid Build Coastguard Worker 
593*cfb92d14SAndroid Build Coastguard Worker /**
594*cfb92d14SAndroid Build Coastguard Worker  * Stops a service browser.
595*cfb92d14SAndroid Build Coastguard Worker  *
596*cfb92d14SAndroid Build Coastguard Worker  * No action is performed if no matching browser with the same service and callback is currently active.
597*cfb92d14SAndroid Build Coastguard Worker  *
598*cfb92d14SAndroid Build Coastguard Worker  * The @p aBrowser and all its contained information (strings) are only valid during this call. The platform MUST save
599*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
600*cfb92d14SAndroid Build Coastguard Worker  *
601*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance   The OpenThread instance.
602*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aBrowser    The browser to stop.
603*cfb92d14SAndroid Build Coastguard Worker  *
604*cfb92d14SAndroid Build Coastguard Worker  */
605*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStopBrowser(otInstance *aInstance, const otPlatDnssdBrowser *aBrowser);
606*cfb92d14SAndroid Build Coastguard Worker 
607*cfb92d14SAndroid Build Coastguard Worker /**
608*cfb92d14SAndroid Build Coastguard Worker  * Starts an SRV record resolver.
609*cfb92d14SAndroid Build Coastguard Worker  *
610*cfb92d14SAndroid Build Coastguard Worker  * Initiates a continuous SRV record resolver for the specified service in @p aResolver.
611*cfb92d14SAndroid Build Coastguard Worker  *
612*cfb92d14SAndroid Build Coastguard Worker  * Discovered information should be reported through the `mCallback` function in @p aResolver. When the service is
613*cfb92d14SAndroid Build Coastguard Worker  * removed it is reported with a TTL value of zero. In this case, `mHostName` may be NULL and other result fields (such
614*cfb92d14SAndroid Build Coastguard Worker  * as `mPort`) will be ignored by the OpenThread stack.
615*cfb92d14SAndroid Build Coastguard Worker  *
616*cfb92d14SAndroid Build Coastguard Worker  * The callback may be invoked immediately with cached information (if available) and potentially before this function
617*cfb92d14SAndroid Build Coastguard Worker  * returns. When cached result is used, the reported TTL value should reflect the original TTL from the last received
618*cfb92d14SAndroid Build Coastguard Worker  * response.
619*cfb92d14SAndroid Build Coastguard Worker  *
620*cfb92d14SAndroid Build Coastguard Worker  * Multiple resolvers can be started for the same service, provided they use different callback functions.
621*cfb92d14SAndroid Build Coastguard Worker  *
622*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
623*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
624*cfb92d14SAndroid Build Coastguard Worker  *
625*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
626*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to be started.
627*cfb92d14SAndroid Build Coastguard Worker  *
628*cfb92d14SAndroid Build Coastguard Worker  */
629*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStartSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver);
630*cfb92d14SAndroid Build Coastguard Worker 
631*cfb92d14SAndroid Build Coastguard Worker /**
632*cfb92d14SAndroid Build Coastguard Worker  * Stops an SRV record resolver.
633*cfb92d14SAndroid Build Coastguard Worker  *
634*cfb92d14SAndroid Build Coastguard Worker  * No action is performed if no matching resolver with the same service and callback is currently active.
635*cfb92d14SAndroid Build Coastguard Worker  *
636*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
637*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
638*cfb92d14SAndroid Build Coastguard Worker  *
639*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
640*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to stop.
641*cfb92d14SAndroid Build Coastguard Worker  *
642*cfb92d14SAndroid Build Coastguard Worker  */
643*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStopSrvResolver(otInstance *aInstance, const otPlatDnssdSrvResolver *aResolver);
644*cfb92d14SAndroid Build Coastguard Worker 
645*cfb92d14SAndroid Build Coastguard Worker /**
646*cfb92d14SAndroid Build Coastguard Worker  * Starts a TXT record resolver.
647*cfb92d14SAndroid Build Coastguard Worker  *
648*cfb92d14SAndroid Build Coastguard Worker  * Initiates a continuous TXT record resolver for the specified service in @p aResolver.
649*cfb92d14SAndroid Build Coastguard Worker  *
650*cfb92d14SAndroid Build Coastguard Worker  * Discovered information should be reported through the `mCallback` function in @p aResolver. When the TXT record is
651*cfb92d14SAndroid Build Coastguard Worker  * removed it is reported with a TTL value of zero. In this case, `mTxtData` may be NULL, and other result fields
652*cfb92d14SAndroid Build Coastguard Worker  * (such as `mTxtDataLength`) will be ignored by the OpenThread stack.
653*cfb92d14SAndroid Build Coastguard Worker  *
654*cfb92d14SAndroid Build Coastguard Worker  * The callback may be invoked immediately with cached information (if available) and potentially before this function
655*cfb92d14SAndroid Build Coastguard Worker  * returns. When cached result is used, the reported TTL value should reflect the original TTL from the last received
656*cfb92d14SAndroid Build Coastguard Worker  * response.
657*cfb92d14SAndroid Build Coastguard Worker  *
658*cfb92d14SAndroid Build Coastguard Worker  * Multiple resolvers can be started for the same service, provided they use different callback functions.
659*cfb92d14SAndroid Build Coastguard Worker  *
660*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
661*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
662*cfb92d14SAndroid Build Coastguard Worker  *
663*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
664*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to be started.
665*cfb92d14SAndroid Build Coastguard Worker  *
666*cfb92d14SAndroid Build Coastguard Worker  */
667*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStartTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver);
668*cfb92d14SAndroid Build Coastguard Worker 
669*cfb92d14SAndroid Build Coastguard Worker /**
670*cfb92d14SAndroid Build Coastguard Worker  * Stops a TXT record resolver.
671*cfb92d14SAndroid Build Coastguard Worker  *
672*cfb92d14SAndroid Build Coastguard Worker  * No action is performed if no matching resolver with the same service and callback is currently active.
673*cfb92d14SAndroid Build Coastguard Worker  *
674*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
675*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
676*cfb92d14SAndroid Build Coastguard Worker  *
677*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
678*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to stop.
679*cfb92d14SAndroid Build Coastguard Worker  *
680*cfb92d14SAndroid Build Coastguard Worker  */
681*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStopTxtResolver(otInstance *aInstance, const otPlatDnssdTxtResolver *aResolver);
682*cfb92d14SAndroid Build Coastguard Worker 
683*cfb92d14SAndroid Build Coastguard Worker /**
684*cfb92d14SAndroid Build Coastguard Worker  * Starts an IPv6 address resolver.
685*cfb92d14SAndroid Build Coastguard Worker  *
686*cfb92d14SAndroid Build Coastguard Worker  * Initiates a continuous IPv6 address resolver for the specified host name in @p aResolver.
687*cfb92d14SAndroid Build Coastguard Worker  *
688*cfb92d14SAndroid Build Coastguard Worker  * Discovered addresses should be reported through the `mCallback` function in @p aResolver. The callback should be
689*cfb92d14SAndroid Build Coastguard Worker  * invoked whenever addresses are added or removed, providing an updated list. If all addresses are removed, the
690*cfb92d14SAndroid Build Coastguard Worker  * callback should be invoked with an empty list (`mAddressesLength` set to zero).
691*cfb92d14SAndroid Build Coastguard Worker  *
692*cfb92d14SAndroid Build Coastguard Worker  * The callback may be invoked immediately with cached information (if available) and potentially before this function
693*cfb92d14SAndroid Build Coastguard Worker  * returns. When cached result is used, the reported TTL values should reflect the original TTL from the last received
694*cfb92d14SAndroid Build Coastguard Worker  * response.
695*cfb92d14SAndroid Build Coastguard Worker  *
696*cfb92d14SAndroid Build Coastguard Worker  * Multiple resolvers can be started for the same host name, provided they use different callback functions.
697*cfb92d14SAndroid Build Coastguard Worker  *
698*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
699*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
700*cfb92d14SAndroid Build Coastguard Worker  *
701*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
702*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to be started.
703*cfb92d14SAndroid Build Coastguard Worker  *
704*cfb92d14SAndroid Build Coastguard Worker  */
705*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStartIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver);
706*cfb92d14SAndroid Build Coastguard Worker 
707*cfb92d14SAndroid Build Coastguard Worker /**
708*cfb92d14SAndroid Build Coastguard Worker  * Stops an IPv6 address resolver.
709*cfb92d14SAndroid Build Coastguard Worker  *
710*cfb92d14SAndroid Build Coastguard Worker  * No action is performed if no matching resolver with the same host name and callback is currently active.
711*cfb92d14SAndroid Build Coastguard Worker  *
712*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
713*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
714*cfb92d14SAndroid Build Coastguard Worker  *
715*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
716*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to stop.
717*cfb92d14SAndroid Build Coastguard Worker  *
718*cfb92d14SAndroid Build Coastguard Worker  */
719*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStopIp6AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver);
720*cfb92d14SAndroid Build Coastguard Worker 
721*cfb92d14SAndroid Build Coastguard Worker /**
722*cfb92d14SAndroid Build Coastguard Worker  * Starts an IPv4 address resolver.
723*cfb92d14SAndroid Build Coastguard Worker  *
724*cfb92d14SAndroid Build Coastguard Worker  * Initiates a continuous IPv4 address resolver for the specified host name in @p aResolver.
725*cfb92d14SAndroid Build Coastguard Worker  *
726*cfb92d14SAndroid Build Coastguard Worker  * Discovered addresses should be reported through the `mCallback` function in @p aResolver. The IPv4 addresses are
727*cfb92d14SAndroid Build Coastguard Worker  * represented using the IPv4-mapped IPv6 address format in `mAddresses` array.  The callback should be invoked
728*cfb92d14SAndroid Build Coastguard Worker  * whenever addresses are added or removed, providing an updated list. If all addresses are removed, the callback
729*cfb92d14SAndroid Build Coastguard Worker  * should be invoked with an empty list (`mAddressesLength` set to zero).
730*cfb92d14SAndroid Build Coastguard Worker  *
731*cfb92d14SAndroid Build Coastguard Worker  * The callback may be invoked immediately with cached information (if available) and potentially before this function
732*cfb92d14SAndroid Build Coastguard Worker  * returns. When cached result is used, the reported TTL values will reflect the original TTL from the last received
733*cfb92d14SAndroid Build Coastguard Worker  * response.
734*cfb92d14SAndroid Build Coastguard Worker  *
735*cfb92d14SAndroid Build Coastguard Worker  * Multiple resolvers can be started for the same host name, provided they use different callback functions.
736*cfb92d14SAndroid Build Coastguard Worker  *
737*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
738*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
739*cfb92d14SAndroid Build Coastguard Worker  *
740*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
741*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to be started.
742*cfb92d14SAndroid Build Coastguard Worker  *
743*cfb92d14SAndroid Build Coastguard Worker  */
744*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStartIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver);
745*cfb92d14SAndroid Build Coastguard Worker 
746*cfb92d14SAndroid Build Coastguard Worker /**
747*cfb92d14SAndroid Build Coastguard Worker  * Stops an IPv4 address resolver.
748*cfb92d14SAndroid Build Coastguard Worker  *
749*cfb92d14SAndroid Build Coastguard Worker  * No action is performed if no matching resolver with the same host name and callback is currently active.
750*cfb92d14SAndroid Build Coastguard Worker  *
751*cfb92d14SAndroid Build Coastguard Worker  * The @p aResolver and all its contained information (strings) are only valid during this call. The platform MUST save
752*cfb92d14SAndroid Build Coastguard Worker  * a copy of the information if it wants to retain the information after returning from this function.
753*cfb92d14SAndroid Build Coastguard Worker  *
754*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aInstance    The OpenThread instance.
755*cfb92d14SAndroid Build Coastguard Worker  * @param[in] aResolver    The resolver to stop.
756*cfb92d14SAndroid Build Coastguard Worker  *
757*cfb92d14SAndroid Build Coastguard Worker  */
758*cfb92d14SAndroid Build Coastguard Worker void otPlatDnssdStopIp4AddressResolver(otInstance *aInstance, const otPlatDnssdAddressResolver *aResolver);
759*cfb92d14SAndroid Build Coastguard Worker 
760*cfb92d14SAndroid Build Coastguard Worker /**
761*cfb92d14SAndroid Build Coastguard Worker  * @}
762*cfb92d14SAndroid Build Coastguard Worker  *
763*cfb92d14SAndroid Build Coastguard Worker  */
764*cfb92d14SAndroid Build Coastguard Worker 
765*cfb92d14SAndroid Build Coastguard Worker #ifdef __cplusplus
766*cfb92d14SAndroid Build Coastguard Worker } // extern "C"
767*cfb92d14SAndroid Build Coastguard Worker #endif
768*cfb92d14SAndroid Build Coastguard Worker 
769*cfb92d14SAndroid Build Coastguard Worker #endif // OPENTHREAD_PLATFORM_DNSSD_H_
770