Loading...
Searching...
No Matches
sres_async.h File Reference

Asynchronous interface for Sofia DNS Resolver. More...

`#include "sofia-resolv/sres_config.h"`
Include dependency graph for sres_async.h:

Go to the source code of this file.

## Macros

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

## Typedefs

typedef SRES_ASYNC_T | sres_async_t
| Application-defined type for context used by asynchronous operation.
typedef int | sres_update_f(sres_async_t *async, sres_socket_t new_socket, sres_socket_t old_socket)
| Prototype for update function.
typedef int | sres_schedule_f(sres_async_t *async, unsigned long interval)
| Prototype for scheduler function.

## Functions

SRESPUBFUN sres_async_t * | sres_resolver_set_async (sres_resolver_t *res, sres_update_f *update, sres_async_t *async, int update_all)
| Set asynchronous operation data.
SRESPUBFUN sres_async_t * | sres_resolver_get_async (sres_resolver_t const *res, sres_update_f *update)
| Get async operation data.
SRESPUBFUN int | sres_resolver_sockets (sres_resolver_t *, sres_socket_t *sockets, int n)
| Create sockets for resolver.
SRESPUBFUN void | sres_resolver_timer (sres_resolver_t *, int dummy)
| Resolver timer function.
SRESPUBFUN int | sres_resolver_set_timer_cb (sres_resolver_t *res, sres_schedule_f *callback, sres_async_t *async)
| Register resolver timer callback.
SRESPUBFUN int | sres_resolver_receive (sres_resolver_t *, int socket)
| Receive DNS response from socket.
SRESPUBFUN int | sres_resolver_error (sres_resolver_t *, int socket)
| Receive error message from socket.

## Detailed Description

Asynchronous interface for Sofia DNS Resolver.

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.h>
  #include <sofia-resolv/sres_async.h>
  sres.h
  Sofia DNS Resolver.
  sres_async.h
  Asynchronous interface for Sofia DNS Resolver.

## Typedef Documentation

## sres_schedule_f

typedef int sres_schedule_f(sres_async_t *async, unsigned long interval)

Prototype for scheduler function.

This function is called when a timer callback is to be scheduled.

Parameters

  async | asynchronous object (registered with sres_resolver_set_async())
  interval | interval in milliseconds

Return values

  0 | when successful
  -1 | upon an error

## sres_update_f

typedef int sres_update_f(sres_async_t *async, sres_socket_t new_socket, sres_socket_t old_socket)

Prototype for update function.

This kind of function is called when the nameserver configuration has been updated.

If the old_socket is not -1, it indicates that old_socket will be closed and it should be removed from poll() or select() set.

If the new_socket is not -1, it indicates that resolver has created new socket that should be added to the poll() or select() set.

See also
  sres_resolver_set_async(), sres_resolver_get_async()

## Function Documentation

## sres_resolver_get_async()

SRESPUBFUN sres_async_t * sres_resolver_get_async | ( | sres_resolver_t const * | res,
|  | sres_update_f * | callback )

Get async operation data.

Get async operation data.

## sres_resolver_receive()

SRESPUBFUN int sres_resolver_receive | ( | sres_resolver_t * | res,
|  | int | socket )

Receive DNS response from socket.

Receive DNS response from socket.

## sres_resolver_set_async()

SRESPUBFUN sres_async_t * sres_resolver_set_async | ( | sres_resolver_t * | res,
|  | sres_update_f * | callback,
|  | sres_async_t * | async,
|  | int | update_all )

Set asynchronous operation data.

Set asynchronous operation data.

Returns
  Set async object.

Errors:

\n EFAULT res points outside the address space

\n EALREADY different async callback already set

## sres_resolver_sockets()

SRESPUBFUN int sres_resolver_sockets | ( | sres_resolver_t * | res,
|  | sres_socket_t * | return_sockets,
|  | int | n )

Create sockets for resolver.

Create sockets for resolver.

## sres_resolver_timer()

SRESPUBFUN void sres_resolver_timer | ( | sres_resolver_t * | res,
|  | int | dummy )

Resolver timer function.

The function sresolver_timer() should be called in regular intervals. We recommend calling it in 500 ms intervals.

Parameters

  res | pointer to resolver object
  dummy | argument for compatibility

Every time it is called it goes through all query structures, and retransmits all the query messages, which have not been answered yet.

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