Defines | Typedefs | Enumerations | Functions

sofia-resolv/sres_cache.h File Reference

Sofia DNS Resolver Cache. More...

#include "sofia-resolv/sres_config.h"
Include dependency graph for sres_cache.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_tsres_cache_new (int n)
 Create a resolver cache object.
SRESPUBFUN sres_cache_tsres_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_tsres_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.

Detailed Description

Sofia DNS Resolver Cache.

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>,
Include Context
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sofia-resolv/sres_cache.h>

Define Documentation

#define SOFIA_RESOLV_SRES_CACHE_H

Defined when <sofia-resolv/sres_cache.h> has been included.


Typedef Documentation

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.


Enumeration Type Documentation

anonymous enum
Enumerator:
SRES_CACHE_TIMER_INTERVAL 

Cache cleanup interval in seconds.

SRES_CACHE_TIMER_INTERVAL 

Cache cleanup interval in seconds.


Function Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
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)
See also:
sres_set_cached_srv_priority()
Since:
New in 1.12.8

Returns:
number of modified entries or -1 upon an error.

SRESPUBFUN void sres_cache_unref ( sres_cache_t cache  ) 

Decrease the reference count on a resolver cache object.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Sofia-SIP 1.12.11 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.