0.01.00
dns.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, The OpenThread Authors.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
35 #ifndef OPENTHREAD_DNS_H_
36 #define OPENTHREAD_DNS_H_
37 
38 #include <openthread/message.h>
39 #include <openthread/types.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
55 #define OT_DNS_MAX_HOSTNAME_LENGTH 62
56 
57 #define OT_DNS_DEFAULT_DNS_SERVER_IP "2001:4860:4860::8888"
58 #define OT_DNS_DEFAULT_DNS_SERVER_PORT 53
59 
60 
64 typedef struct otDnsQuery
65 {
66  const char *mHostname;
68  bool mNoRecursion;
69 } otDnsQuery;
70 
88 typedef void (*otDnsResponseHandler)(void *aContext, const char *aHostname, otIp6Address *aAddress,
89  uint32_t aTtl, otError aResult);
90 
102 otError otDnsClientQuery(otInstance *aInstance, const otDnsQuery *aQuery, otDnsResponseHandler aHandler,
103  void *aContext);
104 
110 #ifdef __cplusplus
111 } // extern "C"
112 #endif
113 
114 #endif // OPENTHREAD_DNS_H_
This structure represents an IPv6 address.
Definition: types.h:417
This type represents all the static / global variables used by OpenThread allocated in one place...
Definition: openthread-instance.h:59
bool mNoRecursion
If cleared, it directs name server to pursue the query recursively.
Definition: dns.h:68
This file defines the types and structures used in the OpenThread library API.
void(* otDnsResponseHandler)(void *aContext, const char *aHostname, otIp6Address *aAddress, uint32_t aTtl, otError aResult)
This function pointer is called when a DNS response is received.
Definition: dns.h:88
This file defines the top-level OpenThread APIs related to message buffer and queues.
const char * mHostname
Identifies hostname to be found. It shall not change during resolving.
Definition: dns.h:66
struct otDnsQuery otDnsQuery
This structure implements DNS Query parameters.
const otMessageInfo * mMessageInfo
A reference to the message info related with DNS Server.
Definition: dns.h:67
This structure represents the local and peer IPv6 socket addresses.
Definition: types.h:436
This structure implements DNS Query parameters.
Definition: dns.h:64
otError
This enumeration represents error codes used throughout OpenThread.
Definition: types.h:107
otError otDnsClientQuery(otInstance *aInstance, const otDnsQuery *aQuery, otDnsResponseHandler aHandler, void *aContext)
This function sends a DNS query for AAAA (IPv6) record.