1ARES_PARSE_MX_REPLY(3) Library Functions Manual ARES_PARSE_MX_REPLY(3)
2
3
4
6 ares_parse_mx_reply - Parse a reply to a DNS query of type MX
7
9 #include <ares.h>
10
11 int ares_parse_mx_reply(const unsigned char* abuf, int alen,
12 struct ares_mx_reply** mx_out);
13
15 The ares_parse_mx_reply function parses the response to a query of type
16 MX into a linked list of struct ares_mx_reply The parameters abuf and
17 alen give the contents of the response. The result is stored in allo‐
18 cated memory and a pointer to it stored into the variable pointed to by
19 mx_out. It is the caller's responsibility to free the resulting mx_out
20 structure when it is no longer needed using the function ares_free_data
21
22 The structure ares_mx_reply contains the following fields:
23
24 struct ares_mx_reply {
25 struct ares_mx_reply *next;
26 char *host;
27 unsigned short priority;
28 };
29
31 ares_parse_mx_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 This function was first introduced in c-ares version 1.7.2.
43
45 ares_query(3) ares_free_data(3)
46
48 Written by Jeremy Lal <kapouer@melix.org>
49
50
51
52 4 August 2009 ARES_PARSE_MX_REPLY(3)