1ARES_PARSE_SRV_REPLY(3) Library Functions Manual ARES_PARSE_SRV_REPLY(3)
2
3
4
6 ares_parse_srv_reply - Parse a reply to a DNS query of type SRV
7
9 #include <ares.h>
10
11 int ares_parse_srv_reply(const unsigned char* abuf, int alen,
12 struct ares_srv_reply** srv_out);
13
15 The ares_parse_srv_reply function parses the response to a query of
16 type SRV into a linked list of struct ares_srv_reply The parameters
17 abuf and alen give the contents of the response. The result is stored
18 in allocated memory and a pointer to it stored into the variable
19 pointed to by srv_out. It is the caller's responsibility to free the
20 resulting srv_out structure when it is no longer needed using the func‐
21 tion ares_free_data
22
23 The structure ares_srv_reply contains the following fields:
24
25 struct ares_srv_reply {
26 struct ares_srv_reply *next;
27 unsigned short weight;
28 unsigned short priority;
29 unsigned short port;
30 char *host;
31 };
32
34 ares_parse_srv_reply can return any of the following values:
35
36 ARES_SUCCESS The response was successfully parsed.
37
38 ARES_EBADRESP The response was malformatted.
39
40 ARES_ENODATA The response did not contain an answer to the query.
41
42 ARES_ENOMEM Memory was exhausted.
43
45 This function was first introduced in c-ares version 1.7.0.
46
48 ares_query(3) ares_free_data(3)
49
51 Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc
52 http://www.redhat.com
53
54
55
56 4 August 2009 ARES_PARSE_SRV_REPLY(3)