Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
dns_resolve.h File Reference

DNS resolving library. More...

Go to the source code of this file.

Data Structures

struct  dns_addrinfo
 Address info struct is passed to callback that gets all the results. More...
 
struct  dns_resolve_context
 DNS resolve context structure. More...
 
struct  dns_resolve_context::dns_server
 List of configured DNS servers. More...
 
struct  dns_resolve_context::dns_pending_query
 Result callbacks. More...
 

Macros

#define DNS_MAX_NAME_SIZE   20
 Max size of the resolved name.
 

Typedefs

typedef void(* dns_resolve_cb_t) (enum dns_resolve_status status, struct dns_addrinfo *info, void *user_data)
 DNS resolve callback.
 

Enumerations

enum  dns_query_type { DNS_QUERY_TYPE_A = 1 , DNS_QUERY_TYPE_AAAA = 28 }
 DNS query type enum. More...
 
enum  dns_resolve_status {
  DNS_EAI_BADFLAGS = -1 , DNS_EAI_NONAME = -2 , DNS_EAI_AGAIN = -3 , DNS_EAI_FAIL = -4 ,
  DNS_EAI_NODATA = -5 , DNS_EAI_FAMILY = -6 , DNS_EAI_SOCKTYPE = -7 , DNS_EAI_SERVICE = -8 ,
  DNS_EAI_ADDRFAMILY = -9 , DNS_EAI_MEMORY = -10 , DNS_EAI_SYSTEM = -11 , DNS_EAI_OVERFLOW = -12 ,
  DNS_EAI_INPROGRESS = -100 , DNS_EAI_CANCELED = -101 , DNS_EAI_NOTCANCELED = -102 , DNS_EAI_ALLDONE = -103 ,
  DNS_EAI_IDN_ENCODE = -105
}
 Status values for the callback. More...
 

Functions

int dns_resolve_init (struct dns_resolve_context *ctx, const char *dns_servers_str[], const struct sockaddr *dns_servers_sa[])
 Init DNS resolving context.
 
int dns_resolve_init_default (struct dns_resolve_context *ctx)
 Init DNS resolving context with default Kconfig options.
 
int dns_resolve_close (struct dns_resolve_context *ctx)
 Close DNS resolving context.
 
int dns_resolve_reconfigure (struct dns_resolve_context *ctx, const char *servers_str[], const struct sockaddr *servers_sa[])
 Reconfigure DNS resolving context.
 
int dns_resolve_cancel (struct dns_resolve_context *ctx, uint16_t dns_id)
 Cancel a pending DNS query.
 
int dns_resolve_cancel_with_name (struct dns_resolve_context *ctx, uint16_t dns_id, const char *query_name, enum dns_query_type query_type)
 Cancel a pending DNS query using id, name and type.
 
int dns_resolve_name (struct dns_resolve_context *ctx, const char *query, enum dns_query_type type, uint16_t *dns_id, dns_resolve_cb_t cb, void *user_data, int32_t timeout)
 Resolve DNS name.
 
struct dns_resolve_contextdns_resolve_get_default (void)
 Get default DNS context.
 
static int dns_get_addr_info (const char *query, enum dns_query_type type, uint16_t *dns_id, dns_resolve_cb_t cb, void *user_data, int32_t timeout)
 Get IP address info from DNS.
 
static int dns_cancel_addr_info (uint16_t dns_id)
 Cancel a pending DNS query.
 

Detailed Description

DNS resolving library.

An API for applications to resolve a DNS name.