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_PTR_REPLY 3 "25 July 1998" |
| 17 | .SH NAME |
| 18 | ares_parse_ptr_reply \- Parse a reply to a DNS query of type PTR into a hostent |
| 19 | .SH SYNOPSIS |
| 20 | .nf |
| 21 | .B #include <ares.h> |
| 22 | .PP |
| 23 | .B int ares_parse_ptr_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP, |
| 24 | .B const void *\fIaddr\fP, int \fIaddrlen\fP, int \fIfamily\fP, |
| 25 | .B struct hostent **\fIhost\fP); |
| 26 | .fi |
| 27 | .SH DESCRIPTION |
| 28 | The |
| 29 | .B ares_parse_ptr_reply |
| 30 | function parses the response to a query of type PTR into a |
| 31 | .BR "struct hostent" . |
| 32 | The parameters |
| 33 | .I abuf |
| 34 | and |
| 35 | .I alen |
| 36 | give the contents of the response. The parameters |
| 37 | .IR addr , |
| 38 | .IR addrlen , |
| 39 | and |
| 40 | .I family |
| 41 | specify which address was queried for; they are not used to verify the |
| 42 | response, merely used to fill in the address of the |
| 43 | .BR "struct hostent" . |
| 44 | The resulting |
| 45 | .B struct hostent |
| 46 | is stored in allocated memory and a pointer to it stored into the |
| 47 | variable pointed to by |
| 48 | .IR host . |
| 49 | It is the caller's responsibility to free the resulting host structure |
| 50 | using |
| 51 | .BR ares_free_hostent (3) |
| 52 | when it is no longer needed. |
| 53 | .SH RETURN VALUES |
| 54 | .B ares_parse_ptr_reply |
| 55 | can return any of the following values: |
| 56 | .TP 15 |
| 57 | .B ARES_SUCCESS |
| 58 | The response was successfully parsed. |
| 59 | .TP 15 |
| 60 | .B ARES_EBADRESP |
| 61 | The response was malformatted. |
| 62 | .TP 15 |
| 63 | .B ARES_ENODATA |
| 64 | The response did not contain an answer to the query. |
| 65 | .TP 15 |
| 66 | .B ARES_ENOMEM |
| 67 | Memory was exhausted. |
| 68 | .SH SEE ALSO |
| 69 | .BR ares_gethostbyaddr (3), |
| 70 | .BR ares_free_hostent (3) |
| 71 | .SH AUTHOR |
| 72 | Greg Hudson, MIT Information Systems |
| 73 | .br |
| 74 | Copyright 1998 by the Massachusetts Institute of Technology. |