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/network.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 * it. 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 */ 00055 struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct sockaddr_in *result, const char *service); 00056 00057 /*! 00058 * \brief Free a DNS manager entry 00059 * 00060 * \param entry the DNS manager entry to free 00061 * 00062 * \return nothing 00063 */ 00064 void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry); 00065 00066 /*! 00067 * \brief Allocate and initialize a DNS manager entry 00068 * 00069 * \param name the hostname 00070 * \param result where to store the IP address as the DNS manager refreshes it 00071 * \param dnsmgr Where to store the allocate DNS manager entry 00072 * 00073 * This function allocates a new DNS manager entry object, and fills it with 00074 * the provided hostname and IP address. This function _does_ force an initial 00075 * lookup, so it may block for some period of time. 00076 * 00077 * \retval 0 success 00078 * \retval non-zero failure 00079 * \version 1.6.1 result changed from struct in_addr to struct aockaddr_in to store port number 00080 */ 00081 int ast_dnsmgr_lookup(const char *name, struct sockaddr_in *result, struct ast_dnsmgr_entry **dnsmgr, const char *service); 00082 00083 /*! 00084 * \brief Force a refresh of a dnsmgr entry 00085 * 00086 * \retval non-zero if the result is different than the previous result 00087 * \retval zero if the result is the same as the previous result 00088 */ 00089 int ast_dnsmgr_refresh(struct ast_dnsmgr_entry *entry); 00090 00091 /*! 00092 * \brief Check is see if a dnsmgr entry has changed 00093 * 00094 * \retval non-zero if the dnsmgr entry has changed since the last call to 00095 * this function 00096 * \retval zero if the dnsmgr entry has not changed since the last call to 00097 * this function 00098 */ 00099 int ast_dnsmgr_changed(struct ast_dnsmgr_entry *entry); 00100 00101 #if defined(__cplusplus) || defined(c_plusplus) 00102 } 00103 #endif /* c_plusplus */ 00104 00105 #endif /* ASTERISK_DNSMGR_H */