ares_parse_a_reply.3 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. .\" $Id$
  2. .\"
  3. .\" Copyright 1998 by the Massachusetts Institute of Technology.
  4. .\"
  5. .\" Permission to use, copy, modify, and distribute this
  6. .\" software and its documentation for any purpose and without
  7. .\" fee is hereby granted, provided that the above copyright
  8. .\" notice appear in all copies and that both that copyright
  9. .\" notice and this permission notice appear in supporting
  10. .\" documentation, and that the name of M.I.T. not be used in
  11. .\" advertising or publicity pertaining to distribution of the
  12. .\" software without specific, written prior permission.
  13. .\" M.I.T. makes no representations about the suitability of
  14. .\" this software for any purpose. It is provided "as is"
  15. .\" without express or implied warranty.
  16. .\"
  17. .TH ARES_PARSE_A_REPLY 3 "25 July 1998"
  18. .SH NAME
  19. ares_parse_a_reply \- Parse a reply to a DNS query of type A into a hostent
  20. .SH SYNOPSIS
  21. .nf
  22. .B #include <ares.h>
  23. .PP
  24. .B int ares_parse_a_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
  25. .B struct hostent **\fIhost\fP,
  26. .B struct addrttl *\fIaddrttls\fB, int *\fInaddrttls\fB);
  27. .fi
  28. .SH DESCRIPTION
  29. The
  30. .B ares_parse_a_reply
  31. function parses the response to a query of type A into a
  32. .BR "struct hostent"
  33. and/or an array of
  34. .BR "struct addrttls" .
  35. The parameters
  36. .I abuf
  37. and
  38. .I alen
  39. give the contents of the response. The result is stored in allocated
  40. memory and a pointer to it stored into the variable pointed to by
  41. .IR host ,
  42. if host is nonnull.
  43. It is the caller's responsibility to free the resulting host structure
  44. using
  45. .BR ares_free_hostent (3)
  46. when it is no longer needed.
  47. .PP
  48. If
  49. .IR addrttls
  50. and
  51. .IR naddrttls
  52. are both nonnull,
  53. then up to *naddrttls
  54. .BR "struct addrttl"
  55. records are stored in the array pointed to by addrttls,
  56. and then *naddrttls is set to the number of records so stored.
  57. Note that the memory for these records is supplied by the caller.
  58. .SH RETURN VALUES
  59. .B ares_parse_a_reply
  60. can return any of the following values:
  61. .TP 15
  62. .B ARES_SUCCESS
  63. The response was successfully parsed.
  64. .TP 15
  65. .B ARES_EBADRESP
  66. The response was malformatted.
  67. .TP 15
  68. .B ARES_ENODATA
  69. The response did not contain an answer to the query.
  70. .TP 15
  71. .B ARES_ENOMEM
  72. Memory was exhausted.
  73. .SH SEE ALSO
  74. .BR ares_gethostbyname (3),
  75. .BR ares_free_hostent (3)
  76. .SH AUTHOR
  77. Greg Hudson, MIT Information Systems
  78. .br
  79. Copyright 1998 by the Massachusetts Institute of Technology.