Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Background DNS update manager. More...
Go to the source code of this file.
Typedefs | |
typedef void(* | dns_update_func) (struct ast_sockaddr *old_addr, struct ast_sockaddr *new_addr, void *data) |
Functions | |
int | ast_dnsmgr_changed (struct ast_dnsmgr_entry *entry) |
Check is see if a dnsmgr entry has changed. More... | |
struct ast_dnsmgr_entry * | ast_dnsmgr_get (const char *name, struct ast_sockaddr *result, const char *service) |
Allocate a new DNS manager entry. More... | |
struct ast_dnsmgr_entry * | ast_dnsmgr_get_family (const char *name, struct ast_sockaddr *result, const char *service, unsigned int family) |
Allocate a new DNS manager entry. More... | |
int | ast_dnsmgr_lookup (const char *name, struct ast_sockaddr *result, struct ast_dnsmgr_entry **dnsmgr, const char *service) |
Allocate and initialize a DNS manager entry. More... | |
int | ast_dnsmgr_lookup_cb (const char *name, struct ast_sockaddr *result, struct ast_dnsmgr_entry **dnsmgr, const char *service, dns_update_func func, void *data) |
Allocate and initialize a DNS manager entry, with update callback. More... | |
int | ast_dnsmgr_refresh (struct ast_dnsmgr_entry *entry) |
Force a refresh of a dnsmgr entry. More... | |
void | ast_dnsmgr_release (struct ast_dnsmgr_entry *entry) |
Free a DNS manager entry. More... | |
Background DNS update manager.
Definition in file dnsmgr.h.
typedef void(* dns_update_func) (struct ast_sockaddr *old_addr, struct ast_sockaddr *new_addr, void *data) |
int ast_dnsmgr_changed | ( | struct ast_dnsmgr_entry * | entry | ) |
Check is see if a dnsmgr entry has changed.
non-zero | if the dnsmgr entry has changed since the last call to this function |
zero | if the dnsmgr entry has not changed since the last call to this function |
Definition at line 247 of file dnsmgr.c.
References ast_mutex_lock, and ast_mutex_unlock.
Referenced by iax2_do_register().
struct ast_dnsmgr_entry * ast_dnsmgr_get | ( | const char * | name, |
struct ast_sockaddr * | result, | ||
const char * | service | ||
) |
Allocate a new DNS manager entry.
name | the hostname |
result | where the DNS manager should store the IP address as it refreshes it. |
service |
This function allocates a new DNS manager entry object, and fills it with the provided hostname and IP address. This function does not force an initial lookup of the IP address. So, generally, this should be used when the initial address is already known.
Definition at line 131 of file dnsmgr.c.
References ast_dnsmgr_get_family(), name, result, and service.
struct ast_dnsmgr_entry * ast_dnsmgr_get_family | ( | const char * | name, |
struct ast_sockaddr * | result, | ||
const char * | service, | ||
unsigned int | family | ||
) |
Allocate a new DNS manager entry.
name | the hostname |
result | where the DNS manager should store the IP address as it refreshes it. |
service | |
family | Address family to filter DNS addresses. |
This function allocates a new DNS manager entry object, and fills it with the provided hostname and IP address. This function does not force an initial lookup of the IP address. So, generally, this should be used when the initial address is already known.
Definition at line 106 of file dnsmgr.c.
References ast_calloc, ast_mutex_init, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), ast_dnsmgr_entry::family, name, NULL, result, and service.
Referenced by ast_dnsmgr_get(), and internal_dnsmgr_lookup().
int ast_dnsmgr_lookup | ( | const char * | name, |
struct ast_sockaddr * | result, | ||
struct ast_dnsmgr_entry ** | dnsmgr, | ||
const char * | service | ||
) |
Allocate and initialize a DNS manager entry.
name | the hostname |
result | where to store the IP address as the DNS manager refreshes it. The address family is used as an input parameter to filter the returned addresses. If it is 0, both IPv4 and IPv6 addresses can be returned. |
dnsmgr | Where to store the allocate DNS manager entry |
service |
0 | success |
non-zero | failure |
Definition at line 191 of file dnsmgr.c.
References internal_dnsmgr_lookup(), name, NULL, result, and service.
Referenced by __iax2_do_register_s(), build_peer(), iax2_append_register(), and transport_apply().
int ast_dnsmgr_lookup_cb | ( | const char * | name, |
struct ast_sockaddr * | result, | ||
struct ast_dnsmgr_entry ** | dnsmgr, | ||
const char * | service, | ||
dns_update_func | func, | ||
void * | data | ||
) |
Allocate and initialize a DNS manager entry, with update callback.
name | the hostname |
result | The addr which is intended to be updated in the update callback when DNS manager calls it on refresh. The address family is used as an input parameter to filter the returned addresses. If it is 0, both IPv4 and IPv6 addresses can be returned. |
dnsmgr | Where to store the allocate DNS manager entry |
service | |
func | The update callback function The update callback will be called when DNS manager detects that an IP address has been changed. Instead of updating the addr itself, DNS manager will call this callback function with the old and new addresses. It is the responsibility of the callback to perform any updates |
data | A pointer to data that will be passed through to the callback function |
0 | success |
non-zero | failure |
Definition at line 196 of file dnsmgr.c.
References ast_dnsmgr_entry::data, internal_dnsmgr_lookup(), name, result, and service.
int ast_dnsmgr_refresh | ( | struct ast_dnsmgr_entry * | entry | ) |
Force a refresh of a dnsmgr entry.
non-zero | if the result is different than the previous result |
zero | if the result is the same as the previous result |
Definition at line 239 of file dnsmgr.c.
References dnsmgr_refresh().
Referenced by build_peer(), and iax2_do_register().
void ast_dnsmgr_release | ( | struct ast_dnsmgr_entry * | entry | ) |
Free a DNS manager entry.
entry | the DNS manager entry to free |
Definition at line 136 of file dnsmgr.c.
References ast_debug, ast_free, ast_mutex_destroy, AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, and AST_RWLIST_WRLOCK.
Referenced by delete_users(), destroy_sip_transport_state(), and peer_destructor().