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
21 ares_free_data(3).
22
23 The structure ares_mx_reply contains the following fields:
24
25 struct ares_mx_reply {
26 struct ares_mx_reply *next;
27 char *host;
28 unsigned short priority;
29 };
30
32 ares_parse_mx_reply can return any of the following values:
33
34 ARES_SUCCESS The response was successfully parsed.
35
36 ARES_EBADRESP The response was malformatted.
37
38 ARES_ENODATA The response did not contain an answer to the query.
39
40 ARES_ENOMEM Memory was exhausted.
41
43 This function was first introduced in c-ares version 1.7.2.
44
46 ares_query(3) ares_free_data(3)
47
49 Written by Jeremy Lal <kapouer@melix.org>
50
51
52
53 4 August 2009 ARES_PARSE_MX_REPLY(3)