Asterisk - The Open Source Telephony Project GIT-master-7921072
dns_recurring.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2015, Digium, Inc.
5 *
6 * Joshua Colp <jcolp@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*! \file
20 * \brief DNS Recurring Resolution API
21 * \author Joshua Colp <jcolp@digium.com>
22 */
23
24#ifndef _ASTERISK_DNS_RECURRING_H
25#define _ASTERISK_DNS_RECURRING_H
26
27#if defined(__cplusplus) || defined(c_plusplus)
28extern "C" {
29#endif
30
31/*! \brief Opaque structure for a recurring DNS query */
33
34/*!
35 * \brief Asynchronously resolve a DNS query, and continue resolving it according to the lowest TTL available
36 *
37 * \param name The name of what to resolve
38 * \param rr_type Resource record type
39 * \param rr_class Resource record class
40 * \param callback The callback to invoke upon completion
41 * \param data User data to make available on the query
42 *
43 * \retval non-NULL success - query has been sent for resolution
44 * \retval NULL failure
45 *
46 * \note The user data passed in to this function must be ao2 allocated
47 *
48 * \note This query will continue to happen according to the lowest TTL unless cancelled using ast_dns_resolve_recurring_cancel
49 *
50 * \note It is NOT possible for the callback to be invoked concurrently for the query multiple times
51 *
52 * \note The query will occur when the TTL expires, not before. This means that there is a period of time where the previous
53 * information can be considered stale.
54 *
55 * \note If the TTL is determined to be 0 (the record specifies 0, or no records exist) this will cease doing a recurring query.
56 * It is the responsibility of the caller to resume querying at an interval they determine.
57 */
59
60/*!
61 * \brief Cancel an asynchronous recurring DNS resolution
62 *
63 * \param recurring The DNS query returned from ast_dns_resolve_recurring
64 *
65 * \retval 0 success - any active query has been cancelled and the query will no longer occur
66 * \retval -1 failure - an active query was in progress and could not be cancelled
67 *
68 * \note If successfully cancelled the callback will not be invoked
69 *
70 * \note This function does NOT drop your reference to the recurring query, this should be dropped using ao2_ref
71 */
73
74#if defined(__cplusplus) || defined(c_plusplus)
75}
76#endif
77
78#endif /* _ASTERISK_DNS_RECURRING_H */
void(* ast_dns_resolve_callback)(const struct ast_dns_query *query)
Callback invoked when a query completes.
Definition: dns_core.h:171
int ast_dns_resolve_recurring_cancel(struct ast_dns_query_recurring *recurring)
Cancel an asynchronous recurring DNS resolution.
struct ast_dns_query_recurring * ast_dns_resolve_recurring(const char *name, int rr_type, int rr_class, ast_dns_resolve_callback callback, void *data)
Asynchronously resolve a DNS query, and continue resolving it according to the lowest TTL available.
static const char name[]
Definition: format_mp3.c:68
A recurring DNS query.
Definition: dns_internal.h:157
ast_dns_resolve_callback callback
Callback to invoke upon completion.
Definition: dns_internal.h:159
int rr_class
Resource record class.
Definition: dns_internal.h:171
int rr_type
Resource record type.
Definition: dns_internal.h:169