Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
cascoda_dns.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020, Cascoda Ltd.
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
41#ifndef CASCODA_DNS_H
42#define CASCODA_DNS_H
43
44#include <stddef.h>
45#include <stdint.h>
46
47#include "openthread/ip6.h"
48
49#include "ca821x_error.h"
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
58typedef struct dnsServer *dns_index;
59
74typedef void (*dns_callback)(ca_error aError, const otIp6Address *aAddress, dns_index aIndex, void *aContext);
75
80void DNS_Init(otInstance *aInstance);
81
98ca_error DNS_HostToIpv6(otInstance *aInstance, char *host, dns_callback aCallback, void *aContext);
99
114ca_error DNS_AddServer(otIp6Address *aAddress, uint8_t aPreference, bool aUseDns64);
115
121
126void DNS_RegisterSuccess(dns_index aIndex);
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif // CASCODA_DNS_H
133
Global error declarations for use across the Cascoda SDK.
void DNS_Init(otInstance *aInstance)
Initialise the DNS utilities.
Definition cascoda_dns.c:397
void DNS_RegisterSuccess(dns_index aIndex)
Register a successful use of a service resolved with DNS and increase the preference of the correspon...
Definition cascoda_dns.c:302
ca_error DNS_AddServer(otIp6Address *aAddress, uint8_t aPreference, bool aUseDns64)
Add a DNS server with the given preference, to be used for DNS requests.
Definition cascoda_dns.c:308
void DNS_RegisterServiceFail(dns_index aIndex)
Register the fact that a DNS server returned an address that could not be contacted.
Definition cascoda_dns.c:296
ca_error DNS_HostToIpv6(otInstance *aInstance, char *host, dns_callback aCallback, void *aContext)
Resolve a hostname to an IPv6 address, running DNS queries if necessary.
Definition cascoda_dns.c:337
struct dnsServer * dns_index
Opaque dns_index type which holds the DNS server that was used for a request.
Definition cascoda_dns.h:58
void(* dns_callback)(ca_error aError, const otIp6Address *aAddress, dns_index aIndex, void *aContext)
The callback used to report results from the host resolution to the requesting layer.
Definition cascoda_dns.h:74
ca_error
Cascoda error type.
Definition ca821x_error.h:51
DNS server entry for managed list of DNS servers.
Definition cascoda_dns.c:72