1ARES_PARSE_TXT_REPLY(3)    Library Functions Manual    ARES_PARSE_TXT_REPLY(3)
2
3
4

NAME

6       ares_parse_txt_reply - Parse a reply to a DNS query of type TXT
7

SYNOPSIS

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

DESCRIPTION

18       The ares_parse_txt_reply (ares_parse_txt_reply_ext) function parses the
19       response to a query of type TXT into a linked  list  (one  element  per
20       sub-string)  of struct ares_txt_reply (struct ares_txt_ext) The parame‐
21       ters abuf and alen give the contents of the response.   The  result  is
22       stored in allocated memory and a pointer to it stored into the variable
23       pointed to by txt_out.  It is the caller's responsibility to  free  the
24       resulting txt_out structure when it is no longer needed using the func‐
25       tion ares_free_data
26
27       The structure ares_txt_reply contains the following fields:
28
29           struct ares_txt_reply {
30             struct ares_txt_reply  *next;
31             unsigned int  length;
32             unsigned char *txt;
33           };
34
35       The structure ares_txt_ext contains the following fields:
36
37           struct ares_txt_ext {
38             struct ares_txt_ext  *next;
39             unsigned int  length;
40             unsigned char *txt;
41             unsigned char record_start;
42           };
43
44       The record_start field in struct ares_txt_ext is 1 if this structure is
45       a  start of a TXT record, and 0 if the structure is a continuation of a
46       previous record. The linked list of the struct ares_txt_ext  will  have
47       at least one item with record_start equal to 1, and may have some items
48       with record_start equal to 0 between them.
49
50       These sequences of struct ares_txt_ext (starting  from  the  item  with
51       record_start equal to 1, and ending right before the record start item)
52       may be treated as either components of a single  TXT  record  or  as  a
53       multi-parted TXT record, depending on particular use case.
54

RETURN VALUES

56       ares_parse_txt_reply  (ares_parse_txt_reply_ext)  can return any of the
57       following values:
58
59       ARES_SUCCESS   The response was successfully parsed.
60
61       ARES_EBADRESP  The response was malformatted.
62
63       ARES_ENODATA   The response did not contain an answer to the query.
64
65       ARES_ENOMEM    Memory was exhausted.
66

AVAILABILITY

68       This function was first introduced in c-ares version 1.7.0.
69

SEE ALSO

71       ares_query(3) ares_free_data(3)
72

AUTHOR

74       Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc
75       http://www.redhat.com
76
77       Amended  by Fedor Indutny <fedor@indutny.com>, on behalf of PayPal, Inc
78       https://www.paypal.com
79
80
81
82                                27 October 2009        ARES_PARSE_TXT_REPLY(3)
Impressum