diff options
author | Mark Michelson <mmichelson@digium.com> | 2015-04-06 17:05:47 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2015-04-06 17:05:47 +0000 |
commit | 0a26602b8c804db90855dd94fb6ef8aba549c410 (patch) | |
tree | 89e9c364b16d0c0bba4b3868958f8c6503ba611e /include/asterisk | |
parent | edf9da436554973fe830fedea3ff2d059e8883e5 (diff) |
Merge NAPTR support into trunk.
This adds NAPTR record allocation and sorting, as well as
unit tests that verify that NAPTR records are parsed and
sorted correctly.
Review: https://reviewboard.asterisk.org/r/4542
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434068 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/dns_internal.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/include/asterisk/dns_internal.h b/include/asterisk/dns_internal.h index eb149245a..e42e3f7d8 100644 --- a/include/asterisk/dns_internal.h +++ b/include/asterisk/dns_internal.h @@ -35,6 +35,14 @@ struct ast_dns_record { size_t data_len; /*! \brief Linked list information */ AST_LIST_ENTRY(ast_dns_record) list; + /*! \brief pointer to record-specific data. + * + * For certain "subclasses" of DNS records, the + * location of the raw DNS data will differ from + * the generic case. This pointer will reliably + * be set to point to the raw DNS data, no matter + * where in the structure it may lie. + */ char *data_ptr; /*! \brief The raw DNS record */ char data[0]; @@ -74,6 +82,13 @@ struct ast_dns_naptr_record { unsigned short order; /*! \brief The preference of the NAPTR record */ unsigned short preference; + /*! \brief Buffer for NAPTR-specific data + * + * This includes the raw NAPTR record, as well as + * the area where the flags, service, regexp, and + * replacement strings are stored. + */ + char data[0]; }; /*! \brief The result of a DNS query */ @@ -152,6 +167,25 @@ struct ast_sched_context; struct ast_sched_context *ast_dns_get_sched(void); /*! + * \brief Allocate and parse a DNS NAPTR record + * + * \param query The DNS query + * \param data This specific NAPTR record + * \param size The size of the NAPTR record + * + * \retval non-NULL success + * \retval NULL failure + */ +struct ast_dns_record *dns_naptr_alloc(struct ast_dns_query *query, const char *data, const size_t size); + +/*! + * \brief Sort the NAPTR records on a result + * + * \param result The DNS result + */ +void dns_naptr_sort(struct ast_dns_result *result); + +/*! * \brief Allocate and parse a DNS SRV record * * \param query The DNS query @@ -170,4 +204,3 @@ struct ast_dns_record *ast_dns_srv_alloc(struct ast_dns_query *query, const char */ void ast_dns_srv_sort(struct ast_dns_result *result); - |