yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | .\" |
| 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. |
| 3 | .\" |
| 4 | .\" Permission to use, copy, modify, and distribute this |
| 5 | .\" software and its documentation for any purpose and without |
| 6 | .\" fee is hereby granted, provided that the above copyright |
| 7 | .\" notice appear in all copies and that both that copyright |
| 8 | .\" notice and this permission notice appear in supporting |
| 9 | .\" documentation, and that the name of M.I.T. not be used in |
| 10 | .\" advertising or publicity pertaining to distribution of the |
| 11 | .\" software without specific, written prior permission. |
| 12 | .\" M.I.T. makes no representations about the suitability of |
| 13 | .\" this software for any purpose. It is provided "as is" |
| 14 | .\" without express or implied warranty. |
| 15 | .\" |
| 16 | .TH ARES_PARSE_SRV_REPLY 3 "4 August 2009" |
| 17 | .SH NAME |
| 18 | ares_parse_srv_reply \- Parse a reply to a DNS query of type SRV |
| 19 | .SH SYNOPSIS |
| 20 | .nf |
| 21 | .B #include <ares.h> |
| 22 | .PP |
| 23 | .B int ares_parse_srv_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP, |
| 24 | .B struct ares_srv_reply** \fIsrv_out\fP); |
| 25 | .fi |
| 26 | .SH DESCRIPTION |
| 27 | The |
| 28 | .B ares_parse_srv_reply |
| 29 | function parses the response to a query of type SRV into a |
| 30 | linked list of |
| 31 | .I struct ares_srv_reply |
| 32 | The parameters |
| 33 | .I abuf |
| 34 | and |
| 35 | .I alen |
| 36 | give the contents of the response. The result is stored in allocated |
| 37 | memory and a pointer to it stored into the variable pointed to by |
| 38 | .IR srv_out . |
| 39 | It is the caller's responsibility to free the resulting |
| 40 | .IR srv_out |
| 41 | structure when it is no longer needed using the function |
| 42 | .B ares_free_data |
| 43 | .PP |
| 44 | The structure |
| 45 | .I ares_srv_reply |
| 46 | contains the following fields: |
| 47 | .sp |
| 48 | .in +4n |
| 49 | .nf |
| 50 | struct ares_srv_reply { |
| 51 | struct ares_srv_reply *next; |
| 52 | unsigned short weight; |
| 53 | unsigned short priority; |
| 54 | unsigned short port; |
| 55 | char *host; |
| 56 | }; |
| 57 | .fi |
| 58 | .in |
| 59 | .PP |
| 60 | .SH RETURN VALUES |
| 61 | .B ares_parse_srv_reply |
| 62 | can return any of the following values: |
| 63 | .TP 15 |
| 64 | .B ARES_SUCCESS |
| 65 | The response was successfully parsed. |
| 66 | .TP 15 |
| 67 | .B ARES_EBADRESP |
| 68 | The response was malformatted. |
| 69 | .TP 15 |
| 70 | .B ARES_ENODATA |
| 71 | The response did not contain an answer to the query. |
| 72 | .TP 15 |
| 73 | .B ARES_ENOMEM |
| 74 | Memory was exhausted. |
| 75 | .SH AVAILABILITY |
| 76 | This function was first introduced in c-ares version 1.7.0. |
| 77 | .SH SEE ALSO |
| 78 | .BR ares_query (3) |
| 79 | .BR ares_free_data (3) |
| 80 | .SH AUTHOR |
| 81 | Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com |