Man page - ares_parse_caa_reply(3)
Packages contas this manual
- ares_mkquery(3)
- ares_dns_class_fromstr(3)
- ares_dns_parse(3)
- ares_dns_opt_get_datatype(3)
- ares_parse_srv_reply(3)
- ares_parse_caa_reply(3)
- ares_get_servers_csv(3)
- ares_dns_rr_get_abin_cnt(3)
- ares_freeaddrinfo(3)
- ares_dns_opcode_tostr(3)
- ares_dns_record_rr_get_const(3)
- ares_process_fd(3)
- ares_dns_rr_get_type(3)
- ares_tlsa_match_t(3)
- ares_timeout(3)
- ares_dns_rec_type_fromstr(3)
- ares_fds(3)
- ares_dns_datatype_t(3)
- ares_dns_record_get_flags(3)
- ares_cancel(3)
- ares_queue_active_queries(3)
- ares_dns_rr(3)
- ares_expand_string(3)
- ares_dns_mapping(3)
- ares_dns_rr_set_u8(3)
- ares_set_servers_csv(3)
- ares_dns_rr_get_opt_cnt(3)
- ares_dns_rr_set_addr6(3)
- ares_parse_a_reply(3)
- ares_free_hostent(3)
- ares_dns_rr_key_to_rec_type(3)
- ares_dns_record_get_id(3)
- ares_dns_record_get_opcode(3)
- ares_library_init_android(3)
- ares_dns_rr_get_abin(3)
- ares_dns_rr_key_datatype(3)
- ares_parse_ptr_reply(3)
- ares_dns_rr_get_class(3)
- ares_set_socket_configure_callback(3)
- ares_dns_rr_add_abin(3)
- ares_save_options(3)
- ares_dns_rr_get_ttl(3)
- ares_dns_rr_set_u32(3)
- ares_set_servers_ports_csv(3)
- ares_dns_rec_type_tostr(3)
- ares_dns_rr_get_addr(3)
- ares_dns_record_rr_del(3)
- ares_parse_ns_reply(3)
- ares_send(3)
- ares_inet_pton(3)
- ares_gethostbyname(3)
- ares_opt_param_t(3)
- ares_strerror(3)
- ares_dns_opcode_t(3)
- ares_library_init(3)
- ares_dns_rr_key_t(3)
- ares_dns_rr_del_opt_byid(3)
- ares_set_local_ip6(3)
- ares_dns_rr_get_addr6(3)
- ares_create_query(3)
- ares_destroy_options(3)
- ares_dns_section_t(3)
- ares_library_initialized(3)
- ares_dns_record_query_get(3)
- ares_gethostbyaddr(3)
- ares_version(3)
- ares_expand_name(3)
- ares_get_servers_ports(3)
- ares_dns_record_query_cnt(3)
- ares_dns_record_query_set_type(3)
- ares_process_pending_write(3)
- ares_parse_mx_reply(3)
- ares_init(3)
- ares_set_socket_functions_ex(3)
- ares_dns_record(3)
- ares_queue(3)
- ares_dns_rcode_t(3)
- ares_dns_write(3)
- ares_dns_rr_get_u16(3)
- ares_dns_record_rr_add(3)
- ares_get_servers(3)
- ares_queue_wait_empty(3)
- ares_svcb_param_t(3)
- ares_dns_rr_get_opt_byid(3)
- ares_init_options(3)
- ares_reinit(3)
- ares_dns_rr_set_opt(3)
- ares_set_local_dev(3)
- ares_dns_record_query_add(3)
- ares_set_server_state_callback(3)
- ares_dns_rr_set_bin(3)
- ares_dns_rr_del_abin(3)
- ares_dns_rr_get_bin(3)
- ares_dns_rr_set_addr(3)
- ares_set_servers(3)
- ares_search(3)
- ares_dns_opt_datatype_t(3)
- ares_dns_record_get_rcode(3)
- ares_dns_rr_get_u32(3)
- ares_dns_class_t(3)
- ares_dns_record_duplicate(3)
- ares_dns_rr_set_str(3)
- ares_send_dnsrec(3)
- ares_dns_class_tostr(3)
- ares_dns_rr_get_name(3)
- ares_destroy(3)
- ares_parse_aaaa_reply(3)
- ares_parse_soa_reply(3)
- ares_set_pending_write_cb(3)
- ares_dns_record_rr_cnt(3)
- ares_set_socket_callback(3)
- ares_parse_naptr_reply(3)
- ares_dns_flags_t(3)
- ares_dns_record_rr_get(3)
- ares_getsock(3)
- ares_free_string(3)
- ares_process(3)
- ares_dns_rr_get_opt(3)
- ares_dns_record_create(3)
- ares_dns_rr_get_u8(3)
- ares_threadsafety(3)
- ares_dns_rec_type_t(3)
- ares_query(3)
- ares_dns_rr_get_keys(3)
- ares_library_cleanup(3)
- ares_dup(3)
- ares_dns_opt_get_name(3)
- ares_tlsa_selector_t(3)
- ares_search_dnsrec(3)
- ares_dns_record_destroy(3)
- ares_dns_rcode_tostr(3)
- ares_parse_txt_reply(3)
- ares_getaddrinfo(3)
- ares_gethostbyname_file(3)
- ares_dns_record_set_id(3)
- ares_query_dnsrec(3)
- ares_dns_rr_set_u16(3)
- ares_tlsa_usage_t(3)
- ares_process_fds(3)
- ares_set_sortlist(3)
- ares_getnameinfo(3)
- ares_dns_rr_get_str(3)
- ares_set_servers_ports(3)
- ares_inet_ntop(3)
- ares_parse_uri_reply(3)
- ares_free_data(3)
- ares_dns_section_tostr(3)
- ares_set_local_ip4(3)
- ares_dns_record_query_set_name(3)
- ares_set_socket_functions(3)
- ares_dns_rr_key_tostr(3)
apt-get install libc-ares-dev
Manual
| ARES_PARSE_CAA_REPLY(3) | Library Functions Manual | ARES_PARSE_CAA_REPLY(3) |
NAME
ares_parse_caa_reply - Parse a reply to a DNS query of type CAA
SYNOPSIS
#include <ares.h> int ares_parse_caa_reply(const unsigned char* abuf, int alen,
struct ares_caa_reply **caa_out);
DESCRIPTION
The ares_parse_caa_reply function parses the response to a query of type CAA into a linked list (one element per sub-string) of struct ares_caa_reply The parameters abuf and alen give the contents of the response. The result is stored in allocated memory and a pointer to it stored into the variable pointed to by caa_out. It is the caller's responsibility to free the resulting caa_out structure when it is no longer needed using the function ares_free_data(3)
The structure ares_caa_reply(3) contains the following fields:
struct ares_caa_reply {
struct ares_caa_reply *next;
int critical;
unsigned char *property;
size_t plength; /* plength excludes null */
unsigned char *value;
size_t length; /* length excludes null */
};
RETURN VALUES
ares_parse_caa_reply can return any of the following values:
- ARES_SUCCESS
- The response was successfully parsed.
- ARES_EBADRESP
- The response was malformatted.
- ARES_ENODATA
- The response did not contain an answer to the query.
- ARES_ENOMEM
- Memory was exhausted.
EXAMPLE
#include <arpa/inet.h> #include <time.h> #include <sys/time.h> #include <netdb.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include "ares.h" static void dns_callback(void *arg,
int status,
int timeouts,
unsigned char *abuf,
int alen)
{
struct ares_caa_reply *caa_out;
int err;
err = ares_parse_caa_reply (abuf, alen, &caa_out);
if (err == ARES_SUCCESS)
{
struct ares_caa_reply *caa_curr;
for (caa_curr=caa_out; caa_curr; caa_curr=caa_curr->next)
printf ("%s. CAA %i %s \"%s\"\n", arg,
caa_curr->critical,
caa_curr->property,
caa_curr->value);
}
else
{
printf ("err=%i\n", err);
}
ares_free_data (caa_out);
} static void main_loop(ares_channel_t **channel)
{
int nfds, count;
fd_set readers, writers;
struct timeval tv, *tvp;
while (1)
{
FD_ZERO (&readers);
FD_ZERO (&writers);
nfds = ares_fds (*channel, &readers, &writers);
if (nfds == 0)
break;
tvp = ares_timeout (*channel, NULL, &tv);
count = select (nfds, &readers, &writers, NULL, tvp);
ares_process (*channel, &readers, &writers);
}
} int main(int argc, char **argv)
{
const char *sversion;
int iversion;
int err;
sversion = ares_version (&iversion);
printf ("c-ares version %s\n", sversion);
char *domain = "wikipedia.org";
if (argc > 1)
domain = argv[1];
ares_channel_t *channel;
if ((err = ares_init (&channel)) != ARES_SUCCESS)
{
printf ("ares_init() failed (%i)\n", err);
exit (EXIT_FAILURE);
}
ares_query (channel, domain,
1, /* ns_c_in */
257, /* T_CAA */
dns_callback, domain);
main_loop (&channel);
ares_destroy (channel);
exit (EXIT_SUCCESS);
}
AVAILABILITY
This function was first introduced in c-ares version 1.17.0.
SEE ALSO
ares_query(3) ares_free_data(3)
| 16 September 2020 |