Embedded TCP/IP stack  4.7.0
fnet_dns.h
1 /**************************************************************************
2 *
3 * Copyright 2011-2020 by Andrej Butok. FNET Community.
4 *
5 ***************************************************************************
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ***************************************************************************
20 *
21 * DNS Resolver API.
22 *
23 ***************************************************************************/
24 
25 #ifndef _FNET_DNS_H_
26 
27 #define _FNET_DNS_H_
28 
29 #if FNET_CFG_DNS || defined(__DOXYGEN__)
30 
73 /**************************************************************************/
77 typedef struct
78 {
79  struct fnet_sockaddr resolved_addr;
80  fnet_uint32_t resolved_addr_ttl;
83 
84 /**************************************************************************/
88 typedef void *fnet_dns_desc_t;
89 
90 /**************************************************************************/
105 typedef void(*fnet_dns_callback_resolved_t)(const fnet_dns_resolved_addr_t *addr_list, fnet_size_t addr_list_size, const fnet_char_t *host_name, void *cookie);
106 
107 /**************************************************************************/
111 {
119  void *cookie;
121 };
122 
123 #if defined(__cplusplus)
124 extern "C" {
125 #endif
126 
127 /***************************************************************************/
155 
156 /***************************************************************************/
174 
175 /***************************************************************************/
191 
192 #if defined(__cplusplus)
193 }
194 #endif
195 
198 #endif /* FNET_CFG_DNS */
199 
200 #endif /* _FNET_DNS_H_ */
fnet_bool_t fnet_dns_is_enabled(fnet_dns_desc_t desc)
Detects if the DNS client service is enabled or disabled.
const fnet_char_t * host_name
Host name to resolve (null-terminated string).
Definition: fnet_dns.h:114
fnet_dns_desc_t fnet_dns_init(struct fnet_dns_params *params)
Initializes the DNS client service and starts the host name resolving.
Initialization parameters for the fnet_dns_init() function.
Definition: fnet_dns.h:110
fnet_uint32_t resolved_addr_ttl
Specifies the time interval (in seconds) that the resolved address may be cached before it should be ...
Definition: fnet_dns.h:80
void(* fnet_dns_callback_resolved_t)(const fnet_dns_resolved_addr_t *addr_list, fnet_size_t addr_list_size, const fnet_char_t *host_name, void *cookie)
Prototype of the DNS-client callback function that is called when the DNS client has completed the re...
Definition: fnet_dns.h:105
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:55
void fnet_dns_release(fnet_dns_desc_t desc)
Aborts the resolving and releases the DNS-client service.
void * fnet_dns_desc_t
DNS client descriptor.
Definition: fnet_dns.h:88
fnet_address_family_t addr_family
Family of the IP Address which is queried.
Definition: fnet_dns.h:115
fnet_bool_t
Boolean type.
Definition: fnet_stdlib.h:80
fnet_dns_callback_resolved_t callback
Pointer to the callback function defined by fnet_dns_callback_resolved_t. It is called when the DNS-c...
Definition: fnet_dns.h:116
Resolved address structure provided by fnet_dns_callback_resolved_t callback function.
Definition: fnet_dns.h:77
char fnet_char_t
Type representing the charecter.
Definition: fnet_stdlib.h:75
struct fnet_sockaddr dns_server_addr
Socket address of the remote DNS server to connect to. If it is unspecified, any registered DNS ser...
Definition: fnet_dns.h:112
fnet_uint16_t fnet_address_family_t
Address family type.
Definition: fnet_socket.h:137
Socket address structure.
Definition: fnet_socket.h:268
void * cookie
Optional application-specific parameter which is passed to the callback function as input parameter...
Definition: fnet_dns.h:119

© 2005-2020 by Andrej Butok. http://fnet.sourceforge.net