mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-04 12:12:48 +00:00
res_pjsip: Add external PJSIP resolver implementation using core DNS API.
This change adds the following: 1. A query set implementation. This is an API that allows queries to be executed in parallel and once all have completed a callback is invoked. 2. Unit tests for the query set implementation. 3. An external PJSIP resolver which uses the DNS core API to do NAPTR, SRV, AAAA, and A lookups. For the resolver it will do NAPTR, SRV, and AAAA/A lookups in parallel. If NAPTR or SRV are available it will then do more queries. And so on. Preference is NAPTR > SRV > AAAA/A, with IPv6 preferred over IPv4. For transport it will prefer TLS > TCP > UDP if no explicit transport has been provided. Configured transports on the system are taken into account to eliminate resolved addresses which have no hope of completing. ASTERISK-24947 #close Reported by: Joshua Colp Change-Id: I56cb03ce4f9d3d600776f36928e0b3e379b5d71e
This commit is contained in:
@@ -43,6 +43,8 @@ typedef void (*ast_dns_query_set_callback)(const struct ast_dns_query_set *query
|
||||
*
|
||||
* \retval non-NULL success
|
||||
* \retval NULL failure
|
||||
*
|
||||
* \note The query set must be released upon cancellation or completion using ao2_ref
|
||||
*/
|
||||
struct ast_dns_query_set *ast_dns_query_set_create(void);
|
||||
|
||||
@@ -76,6 +78,8 @@ size_t ast_dns_query_set_num_queries(const struct ast_dns_query_set *query_set);
|
||||
*
|
||||
* \retval non-NULL success
|
||||
* \retval NULL failure
|
||||
*
|
||||
* \note The returned query is only valid for the lifetime of the query set itself
|
||||
*/
|
||||
struct ast_dns_query *ast_dns_query_set_get(const struct ast_dns_query_set *query_set, unsigned int index);
|
||||
|
||||
@@ -106,29 +110,25 @@ void ast_dns_query_set_resolve_async(struct ast_dns_query_set *query_set, ast_dn
|
||||
*
|
||||
* \param query_set The query set
|
||||
*
|
||||
* \retval 0 success
|
||||
* \retval -1 failure
|
||||
*
|
||||
* \note This function will return when all queries have been completed
|
||||
*/
|
||||
void ast_query_set_resolve(struct ast_dns_query_set *query_set);
|
||||
int ast_query_set_resolve(struct ast_dns_query_set *query_set);
|
||||
|
||||
/*!
|
||||
* \brief Cancel an asynchronous DNS query set resolution
|
||||
*
|
||||
* \param query_set The DNS query set
|
||||
*
|
||||
* \retval 0 success
|
||||
* \retval -1 failure
|
||||
* \retval 0 success (all queries have been cancelled)
|
||||
* \retval -1 failure (some queries could not be cancelled)
|
||||
*
|
||||
* \note If successfully cancelled the callback will not be invoked
|
||||
*/
|
||||
int ast_dns_query_set_resolve_cancel(struct ast_dns_query_set *query_set);
|
||||
|
||||
/*!
|
||||
* \brief Free a query set
|
||||
*
|
||||
* \param query_set A DNS query set
|
||||
*/
|
||||
void ast_dns_query_set_free(struct ast_dns_query_set *query_set);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user