Logo Search packages:      
Sourcecode: sofia-sip version File versions

SOFIAPUBFUN sres_resolver_t* sres_resolver_create ( su_root_t root,
char const *  conf_file_path,
tag_type_t  tag,
tag_value_t  value,

Create a resolver object using root reactor.

Create a resolver.

The function sres_resolver_create() is used to allocate and initialize the resolver object using the Sofia asynchronous reactor su_root_t.

Definition at line 100 of file sresolv.c.

References sres_resolver_create(), sres_resolver_destroy(), sres_resolver_new_with_cache(), sres_resolver_set_async(), sres_resolver_set_timer_cb(), SRES_RETRANSMIT_INTERVAL, SU_DEBUG_3, su_root_task(), su_seterrno(), su_timer_create(), su_timer_set_for_ever(), su_zalloc(), ta_args, ta_end, ta_start, TAG_END, and tl_gets().

Referenced by nta_agent_create(), sres_resolver_create(), and stun_dns_lookup().

  sres_resolver_t *res;
  sres_sofia_t *srs;
  sres_cache_t *cache = NULL;
  ta_list ta;

  if (root == NULL)
    return su_seterrno(EFAULT), (void *)NULL;

  ta_start(ta, tag, value);

  res = sres_resolver_new_with_cache(conf_file_path, cache, NULL);
  srs = res ? su_zalloc(0, sizeof *srs) : NULL;

  if (res && srs) {
    su_timer_t *t;

    srs->srs_resolver = res;
    srs->srs_root = root;
    srs->srs_socket = INVALID_SOCKET;

    sres_resolver_set_async(res, sres_sofia_update, srs, 0);
    t = su_timer_create(su_root_task(root), SRES_RETRANSMIT_INTERVAL);
    srs->srs_timer = t;

    if (!srs->srs_timer)
      SU_DEBUG_3(("sres: cannot create timer\n"));
#if nomore
    else if (su_timer_set_for_ever(t, sres_sofia_timer, srs) < 0)
      SU_DEBUG_3(("sres: cannot set timer\n"));
    else if (sres_resolver_set_timer_cb(res, sres_sofia_set_timer, srs) < 0)
      SU_DEBUG_3(("sres: cannot set timer cb\n"));
      return res;       /* Success! */

    sres_resolver_destroy(res), res = NULL;

  return res;

Generated by  Doxygen 1.6.0   Back to index