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

SOFIAPUBFUN su_socket_t sres_resolver_root_socket ( sres_resolver_t res  ) 

Return a socket registered to su_root_t object.

Return values:
sockfd if succesful
INVALID_SOCKET (-1) upon an error
EFAULT Invalid argument passed. EINVAL Resolver is not using su_root_t.

Definition at line 287 of file sresolv.c.

References SRES_MAX_NAMESERVERS, sres_resolver_get_async(), sres_resolver_root_socket(), sres_resolver_set_async(), sres_resolver_sockets(), and su_seterrno().

Referenced by sres_resolver_root_socket().

  sres_sofia_t *srs;

  if (res == NULL)
    return (void)su_seterrno(EFAULT), INVALID_SOCKET;

  srs = sres_resolver_get_async(res, sres_sofia_update);

  if (!srs)
    return su_seterrno(EINVAL);

  if (sres_resolver_set_async(res, sres_sofia_update, srs, 1) == NULL)
    return INVALID_SOCKET;

  if (srs->srs_socket != INVALID_SOCKET)
    return srs->srs_socket;

  for (i = 0; i < N; i++) {
    if (!srs->srs_reg[i].reg_ptr)

  if (i < N) {
    srs->srs_socket = srs->srs_reg[i].reg_socket;
  else {
    su_socket_t socket;
    if (sres_resolver_sockets(res, &socket, 1) < 0)
      return INVALID_SOCKET;

  return srs->srs_socket; 

Generated by  Doxygen 1.6.0   Back to index