Commit a3058aae authored by Pekka Pessi's avatar Pekka Pessi
Browse files

Added SRESPUBFUN and sres_config.h to sresolv module.

darcs-hash:20060511163404-65a35-606ae60373f723fbe0ae837eabe2dee1d7dc8bbb.gz
parent db555d76
......@@ -43,6 +43,7 @@
*/
#include <stdarg.h>
#include "sofia-resolv/sres_config.h"
#ifdef __cplusplus
extern "C" {
......@@ -105,36 +106,40 @@ typedef struct sres_query_s sres_query_t;
struct sockaddr;
/** New resolver object. */
sres_resolver_t *sres_resolver_new(char const *resolv_conf_path);
SRESPUBFUN sres_resolver_t *sres_resolver_new(char const *resolv_conf_path);
/** Copy a resolver. */
sres_resolver_t *sres_resolver_copy(sres_resolver_t *);
SRESPUBFUN sres_resolver_t *sres_resolver_copy(sres_resolver_t *);
/** New resolver object. */
SRESPUBFUN
sres_resolver_t *
sres_resolver_new_with_cache(char const *conf_file_path,
sres_cache_t *cache,
char const *options, ...);
/** New resolver object. */
SRESPUBFUN
sres_resolver_t *
sres_resolver_new_with_cache_va(char const *conf_file_path,
sres_cache_t *cache,
char const *options, va_list va);
/** Increase reference count on a resolver object. */
sres_resolver_t *sres_resolver_ref(sres_resolver_t *res);
SRESPUBFUN sres_resolver_t *sres_resolver_ref(sres_resolver_t *res);
/** Decrease the reference count on a resolver object. */
void sres_resolver_unref(sres_resolver_t *res);
SRESPUBFUN void sres_resolver_unref(sres_resolver_t *res);
/** Re-read resolv.conf if needed */
int sres_resolver_update(sres_resolver_t *res, int always);
SRESPUBFUN int sres_resolver_update(sres_resolver_t *res, int always);
/** Set userdata pointer. */
SRESPUBFUN
void *sres_resolver_set_userdata(sres_resolver_t *res, void *userdata);
/** Get userdata pointer. */
SRESPUBFUN
void *sres_resolver_get_userdata(sres_resolver_t const *res);
/** Prototype for callback function.
......@@ -148,13 +153,15 @@ typedef void sres_answer_f(sres_context_t *context,
sres_record_t **answers);
/** Make a DNS query. */
SRESPUBFUN
sres_query_t *sres_query(sres_resolver_t *res,
sres_answer_f *callback,
sres_context_t *context,
uint16_t type,
char const *domain);
/**Search DNS. */
/** Search DNS. */
SRESPUBFUN
sres_query_t *sres_search(sres_resolver_t *res,
sres_answer_f *callback,
sres_context_t *context,
......@@ -162,6 +169,7 @@ sres_query_t *sres_search(sres_resolver_t *res,
char const *name);
/** Make a reverse DNS query. */
SRESPUBFUN
sres_query_t *sres_query_sockaddr(sres_resolver_t *res,
sres_answer_f *callback,
sres_context_t *context,
......@@ -169,6 +177,7 @@ sres_query_t *sres_query_sockaddr(sres_resolver_t *res,
struct sockaddr const *addr);
/** Make a DNS query with socket. @deprecated */
SRESPUBFUN
sres_query_t *sres_query_make(sres_resolver_t *res,
sres_answer_f *callback,
sres_context_t *context,
......@@ -177,6 +186,7 @@ sres_query_t *sres_query_make(sres_resolver_t *res,
char const *domain);
/** Make a reverse DNS query with socket. @deprecated */
SRESPUBFUN
sres_query_t *sres_query_make_sockaddr(sres_resolver_t *res,
sres_answer_f *callback,
sres_context_t *context,
......@@ -185,26 +195,31 @@ sres_query_t *sres_query_make_sockaddr(sres_resolver_t *res,
struct sockaddr const *addr);
/** Rebind a DNS query. */
SRESPUBFUN
void sres_query_bind(sres_query_t *q,
sres_answer_f *callback,
sres_context_t *context);
/**Get a list of matching (type/domain) records from cache. */
SRESPUBFUN
sres_record_t **sres_cached_answers(sres_resolver_t *res,
uint16_t type,
char const *domain);
/**Search for a list of matching (type/name) records from cache. */
SRESPUBFUN
sres_record_t **sres_search_cached_answers(sres_resolver_t *res,
uint16_t type,
char const *name);
/**Get a list of matching (type/domain) records from cache. */
SRESPUBFUN
sres_record_t **sres_cached_answers_sockaddr(sres_resolver_t *res,
uint16_t type,
struct sockaddr const *addr);
/** Send a query, wait for answer, return results. */
SRESPUBFUN
int sres_blocking_query(sres_resolver_t *res,
uint16_t type,
char const *domain,
......@@ -212,6 +227,7 @@ int sres_blocking_query(sres_resolver_t *res,
sres_record_t ***return_records);
/** Search DNS, return results. */
SRESPUBFUN
int sres_blocking_search(sres_resolver_t *res,
uint16_t type,
char const *name,
......@@ -219,6 +235,7 @@ int sres_blocking_search(sres_resolver_t *res,
sres_record_t ***return_records);
/** Send a a reverse DNS query, wait for answer, return results. */
SRESPUBFUN
int sres_blocking_query_sockaddr(sres_resolver_t *res,
uint16_t type,
struct sockaddr const *addr,
......@@ -226,21 +243,22 @@ int sres_blocking_query_sockaddr(sres_resolver_t *res,
sres_record_t ***return_records);
/** Return true (and set resolver in blocking mode) if resolver can block. */
int sres_is_blocking(sres_resolver_t *res);
SRESPUBFUN int sres_is_blocking(sres_resolver_t *res);
/** Sort the list of records */
int sres_sort_answers(sres_resolver_t *res, sres_record_t **answers);
SRESPUBFUN int sres_sort_answers(sres_resolver_t *, sres_record_t **answers);
/** Filter and sort the list of records */
SRESPUBFUN
int sres_filter_answers(sres_resolver_t *res,
sres_record_t **answers,
uint16_t type);
/** Free the list records. */
void sres_free_answers(sres_resolver_t *res, sres_record_t **answers);
SRESPUBFUN void sres_free_answers(sres_resolver_t *, sres_record_t **answers);
/** Free and zero one record. */
void sres_free_answer(sres_resolver_t *res, sres_record_t *answer);
SRESPUBFUN void sres_free_answer(sres_resolver_t *res, sres_record_t *answer);
#ifdef __cplusplus
}
......
......@@ -44,6 +44,8 @@
*
*/
#include "sofia-resolv/sres_config.h"
#ifdef __cplusplus
extern "C" {
#endif
......@@ -70,26 +72,28 @@ typedef int sres_update_f(sres_async_t *async,
int old_socket);
/** Set asynchronous operation data. */
SRESPUBFUN
sres_async_t *sres_resolver_set_async(sres_resolver_t *res,
sres_update_f *update,
sres_async_t *async,
int update_all);
/** Get async operation data. */
SRESPUBFUN
sres_async_t *sres_resolver_get_async(sres_resolver_t const *res,
sres_update_f *update);
/** Create sockets for resolver. */
int sres_resolver_sockets(sres_resolver_t *res, int *sockets, int n);
SRESPUBFUN int sres_resolver_sockets(sres_resolver_t *, int *sockets, int n);
/** Resolver timer function. */
void sres_resolver_timer(sres_resolver_t *res, int dummy);
SRESPUBFUN void sres_resolver_timer(sres_resolver_t *, int dummy);
/** Receive DNS response from socket. */
int sres_resolver_receive(sres_resolver_t *res, int socket);
SRESPUBFUN int sres_resolver_receive(sres_resolver_t *, int socket);
/** Receive error message from socket. */
int sres_resolver_error(sres_resolver_t *res, int socket);
SRESPUBFUN int sres_resolver_error(sres_resolver_t *, int socket);
#ifdef __cplusplus
}
......
......@@ -40,6 +40,8 @@
*
*/
#include "sofia-resolv/sres_config.h"
#ifdef __cplusplus
extern "C" {
#endif
......@@ -63,42 +65,42 @@ enum {
};
/** Create a resolver cache object. */
sres_cache_t *sres_cache_new(int n);
SRESPUBFUN sres_cache_t *sres_cache_new(int n);
/** Increase reference count on a resolver cache object. */
sres_cache_t *sres_cache_ref(sres_cache_t *);
SRESPUBFUN sres_cache_t *sres_cache_ref(sres_cache_t *);
/** Decrease the reference count on a resolver cache object. */
void sres_cache_unref(sres_cache_t *);
SRESPUBFUN void sres_cache_unref(sres_cache_t *);
/** Get a list of matching records from cache. */
int sres_cache_get(sres_cache_t *cache,
uint16_t type,
char const *domain,
sres_record_t ***return_cached);
SRESPUBFUN int sres_cache_get(sres_cache_t *cache,
uint16_t type,
char const *domain,
sres_record_t ***return_cached);
/** Free answers not matching with type */
int sres_cache_filter(sres_cache_t *cache,
sres_record_t **answers,
uint16_t type);
SRESPUBFUN int sres_cache_filter(sres_cache_t *cache,
sres_record_t **answers,
uint16_t type);
/** Free the list records. */
void sres_cache_free_answers(sres_cache_t *cache, sres_record_t **answers);
SRESPUBFUN void sres_cache_free_answers(sres_cache_t *, sres_record_t **);
/** Free and zero one record. */
void sres_cache_free_one(sres_cache_t *cache, sres_record_t *answer);
SRESPUBFUN void sres_cache_free_one(sres_cache_t *, sres_record_t *answer);
/** Allocate a cache record */
sres_record_t *
sres_cache_alloc_record(sres_cache_t *cache,
sres_record_t const *template,
size_t extra);
SRESPUBFUN
sres_record_t *sres_cache_alloc_record(sres_cache_t *cache,
sres_record_t const *template,
size_t extra);
/** Free a record that has not been stored. */
void sres_cache_free_record(sres_cache_t *cache, void *rr);
SRESPUBFUN void sres_cache_free_record(sres_cache_t *cache, void *rr);
/** Store a record to cache */
void sres_cache_store(sres_cache_t *cache, sres_record_t *rr, time_t now);
SRESPUBFUN void sres_cache_store(sres_cache_t *, sres_record_t *, time_t now);
#ifdef __cplusplus
}
......
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SOFIA_RESOLV_SRES_CONFIG_H
/** Defined when <sofia-resolv/sres_config.h> has been included. */
#define SOFIA_RESOLV_SRES_CONFIG_H
/**
* @file sofia-resolv/sres_config.h
*
* Configuration for Sofia DNS Resolver.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*/
/* ---------------------------------------------------------------------- */
/* Macros required by Win32 linkage */
/** SRESPUBFUN declares an exported function */
#define SRESPUBFUN
#if defined(_WIN32) && !defined(LIBSRES_STATIC) && \
(defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__CYGWIN__) || defined(__MINGW32__))
/* Windows platform with MS/Borland/Cygwin/MinGW32 compiler */
#undef SRESPUBFUN
#if defined(IN_LIBSOFIA_SRES)
#define SRESPUBFUN __declspec(dllexport)
#else
#define SRESPUBFUN __declspec(dllimport)
#endif
#endif
#endif /* SOFIA_RESOLV_SRES_CONFIG_H */
......@@ -40,6 +40,8 @@
*
*/
#include "sofia-resolv/sres_config.h"
#ifdef __cplusplus
extern "C" {
#endif
......@@ -241,10 +243,11 @@ enum {
};
/** Convert type to its name. */
char const *sres_record_type(int type, char buffer[8]);
SRESPUBFUN char const *sres_record_type(int type, char buffer[8]);
/** Compare two records. */
int sres_record_compare(sres_record_t const *, sres_record_t const *);
SRESPUBFUN int sres_record_compare(sres_record_t const *,
sres_record_t const *);
#ifdef __cplusplus
}
......
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