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