Wed Apr 6 11:29:44 2011

Asterisk developer's documentation


dnsmgr.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Kevin P. Fleming <kpfleming@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*! \file
00020  * \brief Background DNS update manager
00021  */
00022 
00023 #ifndef _ASTERISK_DNSMGR_H
00024 #define _ASTERISK_DNSMGR_H
00025 
00026 #if defined(__cplusplus) || defined(c_plusplus)
00027 extern "C" {
00028 #endif
00029 
00030 #include "asterisk/netsock2.h"
00031 #include "asterisk/srv.h"
00032 
00033 /*!
00034  * \brief A DNS manager entry
00035  *
00036  * This is an opaque type.
00037  */
00038 struct ast_dnsmgr_entry;
00039 
00040 /*!
00041  * \brief Allocate a new DNS manager entry
00042  *
00043  * \param name the hostname
00044  * \param result where the DNS manager should store the IP address as it refreshes it.
00045  * \param service
00046  *
00047  * This function allocates a new DNS manager entry object, and fills it with the
00048  * provided hostname and IP address.  This function does not force an initial lookup
00049  * of the IP address.  So, generally, this should be used when the initial address
00050  * is already known.
00051  *
00052  * \return a DNS manager entry
00053  * \version 1.6.1 result changed from struct in_addr to struct sockaddr_in to store port number
00054  * \version 1.8.0 result changed from struct ast_sockaddr_in to ast_sockaddr for IPv6 support
00055  */
00056 struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct ast_sockaddr *result, const char *service);
00057 
00058 /*!
00059  * \brief Free a DNS manager entry
00060  *
00061  * \param entry the DNS manager entry to free
00062  *
00063  * \return nothing
00064  */
00065 void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry);
00066 
00067 /*!
00068  * \brief Allocate and initialize a DNS manager entry
00069  *
00070  * \param name the hostname
00071  * \param result where to store the IP address as the DNS manager refreshes it. The address family
00072  * is used as an input parameter to filter the returned adresses. if it is 0, both IPv4 * and IPv6 addresses can be returned.
00073  * \param dnsmgr Where to store the allocate DNS manager entry
00074  * \param service
00075  *
00076  * This function allocates a new DNS manager entry object, and fills it with
00077  * the provided hostname and IP address.  This function _does_ force an initial
00078  * lookup, so it may block for some period of time.
00079  *
00080  * \retval 0 success
00081  * \retval non-zero failure
00082  * \version 1.6.1 result changed from struct in_addr to struct aockaddr_in to store port number
00083  */
00084 int ast_dnsmgr_lookup(const char *name, struct ast_sockaddr *result, struct ast_dnsmgr_entry **dnsmgr, const char *service);
00085 
00086 /*!
00087  * \brief Force a refresh of a dnsmgr entry
00088  *
00089  * \retval non-zero if the result is different than the previous result
00090  * \retval zero if the result is the same as the previous result
00091  */
00092 int ast_dnsmgr_refresh(struct ast_dnsmgr_entry *entry);
00093 
00094 /*!
00095  * \brief Check is see if a dnsmgr entry has changed
00096  *
00097  * \retval non-zero if the dnsmgr entry has changed since the last call to
00098  *                  this function
00099  * \retval zero     if the dnsmgr entry has not changed since the last call to
00100  *                  this function
00101  */
00102 int ast_dnsmgr_changed(struct ast_dnsmgr_entry *entry);
00103 
00104 #if defined(__cplusplus) || defined(c_plusplus)
00105 }
00106 #endif /* c_plusplus */
00107 
00108 #endif /* ASTERISK_DNSMGR_H */

Generated on Wed Apr 6 11:29:44 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7