Commit 978d7df4 authored by Pekka Pessi's avatar Pekka Pessi

Added SRESTAG_CACHE() to <sofia-sip/sresolv.h>.

darcs-hash:20060421024147-65a35-586ca5ff6849e5a08a6d26c0c075c003dd0329a5.gz
parent 9f0ab5f3
......@@ -56,6 +56,11 @@ extern tag_typedef_t srestag_resolv_conf;
extern tag_typedef_t srestag_resolv_conf_ref;
#define SRESTAG_RESOLV_CONF_REF(x) srestag_resolv_conf_ref, tag_str_vr(&(x))
extern tag_typedef_t srestag_cache;
#define SRESTAG_CACHE(x) srestag_cache, tag_ptr_v((x))
extern tag_typedef_t srestag_cache_ref;
#define SRESTAG_CACHE_REF(x) srestag_cache_ref, tag_ptr_vr(&(x), (x))
/** Create a resolver object using @a root reactor. */
sres_resolver_t *sres_resolver_create(su_root_t *root,
char const *resolv_conf,
......
......@@ -130,6 +130,10 @@ HTABLE_PROTOS(sres_htable, ht, sres_rr_hash_entry_t);
/* ---------------------------------------------------------------------- */
/* Public functions */
/** Create a resolver cache object.
*
* @param n initial size of cache
*/
sres_cache_t *sres_cache_new(int n)
{
sres_cache_t *cache = su_home_new(sizeof *cache);
......
......@@ -58,6 +58,9 @@ tag_typedef_t srestag_any = NSTAG_TYPEDEF(*);
tag_typedef_t srestag_resolv_conf = STRTAG_TYPEDEF(resolv_conf);
tag_typedef_t srestag_resolv_conf_ref = REFTAG_TYPEDEF(srestag_resolv_conf);
tag_typedef_t srestag_cache = PTRTAG_TYPEDEF(cache);
tag_typedef_t srestag_cache_ref = REFTAG_TYPEDEF(srestag_cache);
typedef struct sres_sofia_s sres_sofia_t;
typedef struct sres_sofia_register_s sres_sofia_register_t;
......@@ -98,6 +101,7 @@ sres_resolver_create(su_root_t *root,
{
sres_resolver_t *res;
sres_sofia_t *srs;
sres_cache_t *cache = NULL;
ta_list ta;
if (root == NULL)
......@@ -106,10 +110,11 @@ sres_resolver_create(su_root_t *root,
ta_start(ta, tag, value);
tl_gets(ta_args(ta),
SRESTAG_RESOLV_CONF_REF(conf_file_path),
SRESTAG_CACHE_REF(cache),
TAG_END());
ta_end(ta);
res = sres_resolver_new_with_cache(conf_file_path, NULL, NULL);
res = sres_resolver_new_with_cache(conf_file_path, cache, NULL);
srs = res ? su_zalloc(0, sizeof *srs) : NULL;
if (res && srs) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment