Dillo v3.1.1-46-g8a360e32
Loading...
Searching...
No Matches
dns.h File Reference
#include <netinet/in.h>
Include dependency graph for dns.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DilloHost
 

Macros

#define DILLO_ADDR_MAX   sizeof(struct in_addr)
 

Typedefs

typedef void(* DnsCallback_t) (int status, Dlist *addr_list, void *data)
 

Functions

void a_Dns_init (void)
 Initializer function.
 
void a_Dns_freeall (void)
 Dns memory-deallocation.
 
void a_Dns_resolve (const char *hostname, DnsCallback_t cb_func, void *cb_data)
 Return the IP for the given hostname using a callback.
 
void a_Dns_dillohost_to_string (DilloHost *host, char *dst, size_t size)
 Writes a string representation of the given DilloHost into dst.
 

Macro Definition Documentation

◆ DILLO_ADDR_MAX

#define DILLO_ADDR_MAX   sizeof(struct in_addr)

Definition at line 20 of file dns.h.

Typedef Documentation

◆ DnsCallback_t

typedef void(* DnsCallback_t) (int status, Dlist *addr_list, void *data)

Definition at line 11 of file dns.h.

Function Documentation

◆ a_Dns_dillohost_to_string()

void a_Dns_dillohost_to_string ( DilloHost host,
char *  dst,
size_t  size 
)

Writes a string representation of the given DilloHost into dst.

dst will be \0 terminated. Please note that dst must be at least 40 bytes long for IPv6 addresses.

Definition at line 502 of file dns.c.

References DilloHost::af, and DilloHost::data.

Referenced by Dns_server().

◆ a_Dns_freeall()

void a_Dns_freeall ( void  )

Dns memory-deallocation.

(Call this one at exit time) The Dns_queue is deallocated at execution time (no need to do that here) 'dns_cache' is the only one that grows dynamically

Definition at line 480 of file dns.c.

References a_IOwatch_remove_fd(), dClose(), dFree(), DIO_READ, dList_free(), dList_length(), dList_nth_data(), dns_cache, dns_cache_size, and dns_notify_pipe.

Referenced by main().

◆ a_Dns_init()

◆ a_Dns_resolve()

void a_Dns_resolve ( const char *  hostname,
DnsCallback_t  cb_func,
void *  cb_data 
)

Return the IP for the given hostname using a callback.

Side effect: a thread is spawned when hostname is not cached.

Definition at line 361 of file dns.c.

References dns_cache, dns_cache_size, dns_queue, Dns_queue_add(), Dns_queue_find(), dns_server, DNS_SERVER_IDLE, Dns_server_req(), dStrAsciiCasecmp(), and num_servers.

Referenced by Http_get().