Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
cascoda_dns.c File Reference
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "openthread/dns.h"
#include "openthread/dns_client.h"
#include "ca-ot-util/cascoda_dns.h"
#include "ca821x_log.h"
Include dependency graph for cascoda_dns.c:

Classes

struct  dnsServer
 DNS server entry for managed list of DNS servers. More...
 
struct  dns_context
 Dynamically allocated context structure to pass to the DNS subsystem as a context. More...
 

Macros

#define NAT64_PREFIX   "64:ff9b::"
 
#define MAX_IPV4   "255.255.255.255"
 
#define DNS_INDEX_INIT   ((dns_index)NULL)
 

Enumerations

enum  {
  DNS_SERVER_COUNT = 2 , DNS_PREF_MIN = 1 , DNS_PREF_MAX = 255 , DNS_PREF_BASE = 6 ,
  DNS_PREF_BONUS = 1 , DNS_PREF_PENALTY = 4
}
 

Functions

void DNS_RegisterServiceFail (dns_index aIndex)
 Register the fact that a DNS server returned an address that could not be contacted. More...
 
void DNS_RegisterSuccess (dns_index aIndex)
 Register a successful use of a service resolved with DNS and increase the preference of the corresponding DNS server. More...
 
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. More...
 
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. More...
 
void DNS_Init (otInstance *aInstance)
 Initialise the DNS utilities. More...
 

Macro Definition Documentation

◆ DNS_INDEX_INIT

#define DNS_INDEX_INIT   ((dns_index)NULL)

◆ MAX_IPV4

#define MAX_IPV4   "255.255.255.255"

◆ NAT64_PREFIX

#define NAT64_PREFIX   "64:ff9b::"

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DNS_SERVER_COUNT 

Number of DNS servers to remember at a time.

DNS_PREF_MIN 

Minimum value for DNS preference (also set for timeout)

DNS_PREF_MAX 

Maximum value for DNS preference.

DNS_PREF_BASE 

Base value for DNS preference.

DNS_PREF_BONUS 

Value to add to DNS preference upon success.

DNS_PREF_PENALTY 

Value to remove from DNS preference upon service fail (if it is above base)