Sofia DNS Resolver Cache. More...
#include "sofia-resolv/sres_config.h"
Go to the source code of this file.
Defines | |
#define | SOFIA_RESOLV_SRES_CACHE_H |
Defined when <sofia-resolv/sres_cache.h> has been included. | |
Typedefs | |
typedef struct sres_cache | sres_cache_t |
Opaque type of DNS cache object. | |
typedef union sres_record | sres_record_t |
Type representing any DNS record. | |
Enumerations | |
enum | { SRES_CACHE_TIMER_INTERVAL, SRES_CACHE_TIMER_INTERVAL } |
Functions | |
SRESPUBFUN sres_cache_t * | sres_cache_new (int n) |
Create a resolver cache object. | |
SRESPUBFUN sres_cache_t * | sres_cache_ref (sres_cache_t *) |
Increase reference count on a resolver cache object. | |
SRESPUBFUN void | sres_cache_unref (sres_cache_t *) |
Decrease the reference count on a resolver cache object. | |
SRESPUBFUN int | sres_cache_get (sres_cache_t *cache, uint16_t type, char const *domain, sres_record_t ***return_cached) |
Get a list of matching records from cache. | |
SRESPUBFUN int | sres_cache_filter (sres_cache_t *cache, sres_record_t **answers, uint16_t type) |
Free answers not matching with type. | |
SRESPUBFUN void | sres_cache_free_answers (sres_cache_t *, sres_record_t **) |
Free the list records. | |
SRESPUBFUN void | sres_cache_free_one (sres_cache_t *, sres_record_t *answer) |
Free and zero one record. | |
SRESPUBFUN sres_record_t ** | sres_cache_copy_answers (sres_cache_t *, sres_record_t **) |
Copy list of records. | |
SRESPUBFUN void | sres_cache_clean (sres_cache_t *cache, time_t now) |
Remove old records from cache. | |
SRESPUBFUN sres_record_t * | sres_cache_alloc_record (sres_cache_t *cache, sres_record_t const *template, size_t extra) |
Allocate a cache record. | |
SRESPUBFUN void | sres_cache_free_record (sres_cache_t *cache, void *rr) |
Free a record that has not been stored. | |
SRESPUBFUN void | sres_cache_store (sres_cache_t *, sres_record_t *, time_t now) |
Store a record to cache. | |
SRESPUBFUN int | sres_cache_set_srv_priority (sres_cache_t *, char const *domain, char const *target, uint16_t port, uint32_t newttl, uint16_t newprio) |
Modify the priority in the specified SRV record. |
Sofia DNS Resolver Cache.
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <sofia-resolv/sres_cache.h>
#define SOFIA_RESOLV_SRES_CACHE_H |
Defined when <sofia-resolv/sres_cache.h> has been included.
typedef struct sres_cache sres_cache_t |
Opaque type of DNS cache object.
typedef union sres_record sres_record_t |
Type representing any DNS record.
anonymous enum |
SRESPUBFUN void sres_cache_clean | ( | sres_cache_t * | cache, | |
time_t | now | |||
) |
Remove old records from cache.
Remove entries older than now from the cache.
cache | pointer to DNS cache object | |
now | remove older than this time |
SRESPUBFUN void sres_cache_free_answers | ( | sres_cache_t * | cache, | |
sres_record_t ** | answers | |||
) |
Free the list records.
SRESPUBFUN void sres_cache_free_one | ( | sres_cache_t * | cache, | |
sres_record_t * | answer | |||
) |
Free and zero one record.
SRESPUBFUN void sres_cache_free_record | ( | sres_cache_t * | cache, | |
void * | _sr | |||
) |
Free a record that has not been stored.
SRESPUBFUN int sres_cache_get | ( | sres_cache_t * | cache, | |
uint16_t | type, | |||
char const * | domain, | |||
sres_record_t *** | return_cached | |||
) |
Get a list of matching records from cache.
SRESPUBFUN sres_cache_t* sres_cache_new | ( | int | n | ) |
Create a resolver cache object.
n | initial size of cache |
SRESPUBFUN sres_cache_t* sres_cache_ref | ( | sres_cache_t * | cache | ) |
Increase reference count on a resolver cache object.
SRESPUBFUN int sres_cache_set_srv_priority | ( | sres_cache_t * | cache, | |
char const * | domain, | |||
char const * | target, | |||
uint16_t | port, | |||
uint32_t | ttl, | |||
uint16_t | priority | |||
) |
Modify the priority in the specified SRV record.
Modify the priority in the specified SRV record.
The SRV records with the domain name, target and port are matched and their priority value is adjusted. This function is used to implement greylisting of SIP servers.
cache | pointer to DNS cache object | |
domain | domain name of the SRV record(s) to modify (including final dot) | |
target | SRV target of the SRV record(s) to modify | |
port | port number of SRV record(s) to modify (in host byte order) | |
ttl | new ttl | |
priority | new priority value (0=highest, 65535=lowest) |
SRESPUBFUN void sres_cache_unref | ( | sres_cache_t * | cache | ) |
Decrease the reference count on a resolver cache object.