ares_gethostbyaddr.3 3.1 KB

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