1ARES_PARSE_TXT_REPLY(3) Library Functions Manual ARES_PARSE_TXT_REPLY(3)
2
3
4
6 ares_parse_txt_reply - Parse a reply to a DNS query of type TXT
7
9 #include <ares.h>
10
11 int ares_parse_txt_reply(const unsigned char* abuf, int alen,
12 struct ares_txt_reply **txt_out);
13
14 int ares_parse_txt_reply_ext(const unsigned char* abuf, int alen,
15 struct ares_txt_ext **txt_out);
16
18 The ares_parse_txt_reply(3) and ares_parse_txt_reply_ext(3) functions
19 parse the response to a query of type TXT into a linked list (one ele‐
20 ment per sub-string) of struct ares_txt_reply (struct ares_txt_ext) The
21 parameters abuf and alen give the contents of the response. The result
22 is stored in allocated memory and a pointer to it stored into the vari‐
23 able pointed to by txt_out. It is the caller's responsibility to free
24 the resulting txt_out structure when it is no longer needed using the
25 function ares_free_data(3).
26
27 The structure ares_txt_reply contains the following fields:
28 struct ares_txt_reply {
29 struct ares_txt_reply *next;
30 unsigned int length;
31 unsigned char *txt;
32 };
33
34 The structure ares_txt_ext contains the following fields:
35 struct ares_txt_ext {
36 struct ares_txt_ext *next;
37 unsigned int length;
38 unsigned char *txt;
39 unsigned char record_start;
40 };
41 The record_start field in struct ares_txt_ext is 1 if this structure is
42 a start of a TXT record, and 0 if the structure is a continuation of a
43 previous record. The linked list of the struct ares_txt_ext will have
44 at least one item with record_start equal to 1, and may have some items
45 with record_start equal to 0 between them.
46
47 These sequences of struct ares_txt_ext (starting from the item with
48 record_start equal to 1, and ending right before the record start item)
49 may be treated as either components of a single TXT record or as a
50 multi-parted TXT record, depending on particular use case.
51
53 ares_parse_txt_reply (ares_parse_txt_reply_ext) can return any of the
54 following values:
55
56 ARES_SUCCESS The response was successfully parsed.
57
58 ARES_EBADRESP The response was malformatted.
59
60 ARES_ENODATA The response did not contain an answer to the query.
61
62 ARES_ENOMEM Memory was exhausted.
63
65 This function was first introduced in c-ares version 1.7.0.
66
68 ares_query(3) ares_free_data(3)
69
71 Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc
72 http://www.redhat.com
73
74 Amended by Fedor Indutny <fedor@indutny.com>, on behalf of PayPal, Inc
75 https://www.paypal.com
76
77
78
79 27 October 2009 ARES_PARSE_TXT_REPLY(3)