1ARES_PARSE_A_REPLY(3) Library Functions Manual ARES_PARSE_A_REPLY(3)
2
3
4
6 ares_parse_a_reply - Parse a reply to a DNS query of type A
7
9 #include <ares.h>
10
11 int ares_parse_a_reply(const unsigned char *abuf, int alen,
12 struct hostent **host,
13 struct ares_addrttl *addrttls, int *naddrttls);
14
16 The ares_parse_a_reply function parses the response to a query of type
17 A into a struct hostent and/or an array of struct ares_addrttls. The
18 parameters abuf and alen give the contents of the response. The result
19 is stored in allocated memory and a pointer to it stored into the vari‐
20 able pointed to by host, if host is nonnull. It is the caller's
21 responsibility to free the resulting host structure using
22 ares_free_hostent(3) when it is no longer needed.
23
24 If addrttls and naddrttls are both nonnull, then up to *naddrttls
25 struct ares_addrttl records are stored in the array pointed to by
26 addrttls, and then *naddrttls is set to the number of records so
27 stored. Note that the memory for these records is supplied by the
28 caller.
29
31 ares_parse_a_reply can return any of the following values:
32
33 ARES_SUCCESS The response was successfully parsed.
34
35 ARES_EBADRESP The response was malformatted.
36
37 ARES_ENODATA The response did not contain an answer to the query.
38
39 ARES_ENOMEM Memory was exhausted.
40
42 ares_gethostbyname(3), ares_free_hostent(3)
43
45 Greg Hudson, MIT Information Systems
46 Copyright 1998 by the Massachusetts Institute of Technology.
47
48
49
50 25 July 1998 ARES_PARSE_A_REPLY(3)