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 re‐
21 sponsibility to free the resulting host structure using ares_free_hos‐
22 tent(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 ad‐
26 drttls, and then *naddrttls is set to the number of records so stored.
27 Note that the memory for these records is supplied by the caller.
28
30 ares_parse_a_reply can return any of the following values:
31
32 ARES_SUCCESS The response was successfully parsed.
33
34 ARES_EBADRESP The response was malformatted.
35
36 ARES_ENODATA The response did not contain an answer to the query.
37
38 ARES_ENOMEM Memory was exhausted.
39
41 ares_gethostbyname(3), ares_free_hostent(3)
42
44 Greg Hudson, MIT Information Systems
45 Andrew Selivanov <andrew.selivanov@gmail.com>
46 Copyright 1998 by the Massachusetts Institute of Technology.
47
48
49
50 25 July 1998 ARES_PARSE_A_REPLY(3)