ares_gethostbyaddr.3 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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_GETHOSTBYADDR 3 "24 July 1998"
  18. .SH NAME
  19. ares_gethostbyaddr \- Initiate a host query by address
  20. .SH SYNOPSIS
  21. .nf
  22. .B #include <ares.h>
  23. .PP
  24. .B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
  25. .B int \fItimeouts\fP, struct hostent *\fIhostent\fP)
  26. .PP
  27. .B void ares_gethostbyaddr(ares_channel \fIchannel\fP, const void *\fIaddr\fP,
  28. .B int \fIaddrlen\fP, int \fIfamily\fP, ares_host_callback \fIcallback\fP,
  29. .B void *\fIarg\fP)
  30. .fi
  31. .SH DESCRIPTION
  32. The
  33. .B ares_gethostbyaddr
  34. function initiates a host query by address on the name service channel
  35. identified by
  36. .IR channel .
  37. The parameters
  38. .I addr
  39. and
  40. .I addrlen
  41. give the address as a series of bytes, and
  42. .I family
  43. gives the type of address. When the query is complete or has failed, the ares
  44. library will invoke \fIcallback\fP. Completion or failure of the query may
  45. happen immediately, or may happen during a later call to
  46. \fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
  47. .PP
  48. The callback argument
  49. .I arg
  50. is copied from the
  51. .B ares_gethostbyaddr
  52. argument
  53. .IR arg .
  54. The callback argument
  55. .I status
  56. indicates whether the query succeeded and, if not, how it failed. It
  57. may have any of the following values:
  58. .TP 19
  59. .B ARES_SUCCESS
  60. The host lookup completed successfully.
  61. .TP 19
  62. .B ARES_ENOTIMP
  63. The ares library does not know how to look up addresses of type
  64. .IR family .
  65. .TP 19
  66. .B ARES_ENOTFOUND
  67. The address
  68. .I addr
  69. was not found.
  70. .TP 19
  71. .B ARES_ENOMEM
  72. Memory was exhausted.
  73. .TP 19
  74. .B ARES_EDESTRUCTION
  75. The name service channel
  76. .I channel
  77. is being destroyed; the query will not be completed.
  78. .PP
  79. The callback argument
  80. .I timeouts
  81. reports how many times a query timed out during the execution of the
  82. given request.
  83. .PP
  84. On successful completion of the query, the callback argument
  85. .I hostent
  86. points to a
  87. .B struct hostent
  88. containing the name of the host returned by the query. The callback
  89. need not and should not attempt to free the memory pointed to by
  90. .IR hostent ;
  91. the ares library will free it when the callback returns. If the query
  92. did not complete successfully,
  93. .I hostent
  94. will be
  95. .BR NULL .
  96. .SH SEE ALSO
  97. .BR ares_process (3),
  98. .BR ares_gethostbyname (3)
  99. .SH AUTHOR
  100. Greg Hudson, MIT Information Systems
  101. .br
  102. Copyright 1998 by the Massachusetts Institute of Technology.