ares_parse_mx_reply.3 (1512B)
1 .\" 2 .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 .\" SPDX-License-Identifier: MIT 4 .\" 5 .TH ARES_PARSE_MX_REPLY 3 "4 August 2009" 6 .SH NAME 7 ares_parse_mx_reply \- Parse a reply to a DNS query of type MX 8 .SH SYNOPSIS 9 #include <ares.h> 10 11 int ares_parse_mx_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP, 12 struct ares_mx_reply** \fImx_out\fP); 13 .fi 14 .SH DESCRIPTION 15 The 16 .B ares_parse_mx_reply 17 function parses the response to a query of type MX into a 18 linked list of 19 .I struct ares_mx_reply 20 The parameters 21 .I abuf 22 and 23 .I alen 24 give the contents of the response. The result is stored in allocated 25 memory and a pointer to it stored into the variable pointed to by 26 .IR mx_out . 27 It is the caller's responsibility to free the resulting 28 .IR mx_out 29 structure when it is no longer needed using the function 30 \fBares_free_data(3)\fP. 31 .PP 32 The structure 33 .I ares_mx_reply 34 contains the following fields: 35 .sp 36 .in +4n 37 .nf 38 struct ares_mx_reply { 39 struct ares_mx_reply *next; 40 char *host; 41 unsigned short priority; 42 }; 43 .fi 44 .in 45 .PP 46 .SH RETURN VALUES 47 .B ares_parse_mx_reply 48 can return any of the following values: 49 .TP 15 50 .B ARES_SUCCESS 51 The response was successfully parsed. 52 .TP 15 53 .B ARES_EBADRESP 54 The response was malformatted. 55 .TP 15 56 .B ARES_ENODATA 57 The response did not contain an answer to the query. 58 .TP 15 59 .B ARES_ENOMEM 60 Memory was exhausted. 61 .SH AVAILABILITY 62 This function was first introduced in c-ares version 1.7.2. 63 .SH SEE ALSO 64 .BR ares_query (3) 65 .BR ares_free_data (3)