Data Structures | Defines | Enumerations | Functions

dns_cache.h File Reference

SIP-router core :: resolver/dns related functions, dns cache and failoverModule: SIP-router core. More...

#include "str.h"
#include "config.h"
#include "timer.h"
#include "ip_addr.h"
#include "atomic_ops.h"
#include "resolve.h"
Include dependency graph for dns_cache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

Defines

dns requests flags

ip blacklist error flags

Enumerations

Functions


Detailed Description

Definition in file dns_cache.h.


Define Documentation

#define DNS_FLAG_BAD_NAME   1

error flag: unresolvable

Definition at line 106 of file dns_cache.h.


Enumeration Type Documentation

enum dns_errors

return -E_DNS_NO_IP)

listed in the order of importance ( if more errors, only the most important is returned)

Enumerator:
E_DNS_EOR 

no more records (not an error) -- returned only by the dns_resolve* functions when called iteratively,; it signals the end of the ip/records list

E_DNS_UNKNOWN 

unkown error

E_DNS_INTERNAL_ERR 

internal error

E_DNS_NO_SRV 

unresolvable srv record

E_DNS_NO_IP 

unresolvable a or aaaa records

E_DNS_BAD_IP 

the ip is invalid

E_DNS_BLACKLIST_IP 

the ip is blacklisted

E_DNS_NAME_TOO_LONG 

try again with a shorter name

E_DNS_AF_MISMATCH 

ipv4 or ipv6 only requested, but name contains an ip addr.

of the opossite type

E_DNS_NO_NAPTR 

unresolvable naptr record

E_DNS_CRITICAL 

critical error, marks the end of the error table (always last)

Definition at line 75 of file dns_cache.h.


Function Documentation

int dns_cache_add_record ( unsigned short  type,
str name,
int  ttl,
str value,
int  priority,
int  weight,
int  port,
int  flags 
)

If there is an existing record with the same name and value (ip address in case of A/AAAA record, name in case of SRV record) only the remaining fields are updated.

Note that permanent records cannot be overwritten unless the new record is also permanent. A permanent record completely replaces a non-permanent one.

Currently only A, AAAA, and SRV records are supported.

int dns_cache_delete_single_record ( unsigned short  type,
str name,
str value,
int  flags 
)

the record with the same name and value (ip address in case of A/AAAA record, name in case of SRV record).

Currently only A, AAAA, and SRV records are supported.

void dns_cache_flush ( int  del_permanent  ) 

If del_permanent is 0, then only the non-permanent entries are deleted.

int dns_get_ip ( str name,
struct ip_addr *  ip,
int  flags 
)

foo.bar) ip - result: first good ip found flags - resolve options (like ipv4 only, ipv6 prefered a.s.o) Returns: < 0 on error (can be passed to dns_strerror(), 0 on success

int dns_sip_resolve ( struct dns_srv_handle *  h,
str name,
struct ip_addr *  ip,
unsigned short *  port,
char *  proto,
int  flags 
)

Can be called multiple times to iterate on all the possible ips, e.g : dns_srv_handle_init(h); ret_code=dns_sip_resolve(h,...); while( dns_srv_handle_next(h, ret_code){ ret_code=dns_sip_resolve(h...); } dns_srv_handle_put(h); WARNING: dns_srv_handle_init() must be called to initialize h and dns_srv_handle_put(h) must be called when h is no longer needed

Referenced by dns_sip_resolve2su().

Here is the caller graph for this function:

int dns_srv_get_ip ( str name,
struct ip_addr *  ip,
unsigned short *  port,
int  flags 
)

_sip._udp.foo.bar) ip - result: first good ip found port - result: corresponding port number flags - resolve options (like ipv4 only, ipv6 prefered a.s.o) Returns: < 0 on error (can be passed to dns_strerror(), 0 on success