Loading...
Searching...
No Matches
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.

## Macros

#define | SOFIA_RESOLV_SRES_CACHE_H
| Defined when <sofia-resolv/sres_cache.h> has been included.

## 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.

## Detailed Description

Sofia DNS Resolver Cache.

Author
  Pekka Pessi Pekka.nosp@m..Pes.nosp@m.si@no.nosp@m.kia..nosp@m.com,

Include Context
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
  #include <sofia-resolv/sres_cache.h>
  sres_cache.h
  Sofia DNS Resolver Cache.

## Enumeration Type Documentation

## anonymous enum

anonymous enum

Enumerator
SRES_CACHE_TIMER_INTERVAL | Cache cleanup interval in seconds.
SRES_CACHE_TIMER_INTERVAL | Cache cleanup interval in seconds.

## Function Documentation

## sres_cache_clean()

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

## sres_cache_copy_answers()

SRESPUBFUN sres_record_t ** sres_cache_copy_answers | ( | sres_cache_t * | cache,
|  | sres_record_t ** | answers )

Copy list of records.

Copy list of records.

## sres_cache_new()

SRESPUBFUN sres_cache_t * sres_cache_new | ( | int | n | ) |

Create a resolver cache object.

Parameters

  n | initial size of cache

## sres_cache_set_srv_priority()

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.

## sres_cache_store()

SRESPUBFUN void sres_cache_store | ( | sres_cache_t * | cache,
|  | sres_record_t * | rr,
|  | time_t | now )

Store a record to cache.

Store a record to cache.

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