ares_search.3 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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_SEARCH 3 "24 July 1998"
  17. .SH NAME
  18. ares_search \- Initiate a DNS query with domain search
  19. .SH SYNOPSIS
  20. .nf
  21. #include <ares.h>
  22. typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
  23. int \fItimeouts\fP, unsigned char *\fIabuf\fP,
  24. int \fIalen\fP)
  25. void ares_search(ares_channel \fIchannel\fP, const char *\fIname\fP,
  26. int \fIdnsclass\fP, int \fItype\fP,
  27. ares_callback \fIcallback\fP, void *\fIarg\fP)
  28. .fi
  29. .SH DESCRIPTION
  30. The
  31. .B ares_search
  32. function initiates a series of single-question DNS queries on the name
  33. service channel identified by
  34. .IR channel ,
  35. using the channel's search domains as well as a host alias file given
  36. by the HOSTALIAS environment variable. The parameter
  37. .I name
  38. gives the alias name or the base of the query name as a NUL-terminated
  39. C string of period-separated labels; if it ends with a period, the
  40. channel's search domains will not be used. Periods and backslashes
  41. within a label must be escaped with a backslash. The parameters
  42. .I dnsclass
  43. and
  44. .I type
  45. give the class and type of the query using the values defined in
  46. .BR <arpa/nameser.h> .
  47. When the query sequence is complete or has failed, the ares library
  48. will invoke
  49. .IR callback .
  50. Completion or failure of the query sequence may happen immediately, or
  51. may happen during a later call to
  52. .BR ares_process (3)
  53. or
  54. .BR ares_destroy (3).
  55. .PP
  56. The callback argument
  57. .I arg
  58. is copied from the
  59. .B ares_search
  60. argument
  61. .IR arg .
  62. The callback argument
  63. .I status
  64. indicates whether the query sequence ended with a successful query
  65. and, if not, how the query sequence failed. It may have any of the
  66. following values:
  67. .TP 19
  68. .B ARES_SUCCESS
  69. A query completed successfully.
  70. .TP 19
  71. .B ARES_ENODATA
  72. No query completed successfully; when the query was tried without a
  73. search domain appended, a response was returned with no answers.
  74. .TP 19
  75. .B ARES_EFORMERR
  76. A query completed but the server claimed that the query was
  77. malformatted.
  78. .TP 19
  79. .B ARES_ESERVFAIL
  80. No query completed successfully; when the query was tried without a
  81. search domain appended, the server claimed to have experienced a
  82. failure. (This code can only occur if the
  83. .B ARES_FLAG_NOCHECKRESP
  84. flag was specified at channel initialization time; otherwise, such
  85. responses are ignored at the
  86. .BR ares_send (3)
  87. level.)
  88. .TP 19
  89. .B ARES_ENOTFOUND
  90. No query completed successfully; when the query was tried without a
  91. search domain appended, the server reported that the queried-for
  92. domain name was not found.
  93. .TP 19
  94. .B ARES_ENOTIMP
  95. A query completed but the server does not implement the operation
  96. requested by the query. (This code can only occur if the
  97. .B ARES_FLAG_NOCHECKRESP
  98. flag was specified at channel initialization time; otherwise, such
  99. responses are ignored at the
  100. .BR ares_send (3)
  101. level.)
  102. .TP 19
  103. .B ARES_EREFUSED
  104. A query completed but the server refused the query. (This code can
  105. only occur returned if the
  106. .B ARES_FLAG_NOCHECKRESP
  107. flag was specified at channel initialization time; otherwise, such
  108. responses are ignored at the
  109. .BR ares_send (3)
  110. level.)
  111. .TP 19
  112. .B ARES_TIMEOUT
  113. No name servers responded to a query within the timeout period.
  114. .TP 19
  115. .B ARES_ECONNREFUSED
  116. No name servers could be contacted.
  117. .TP 19
  118. .B ARES_ENOMEM
  119. Memory was exhausted.
  120. .TP 19
  121. .B ARES_ECANCELLED
  122. The query was cancelled.
  123. .TP 19
  124. .B ARES_EDESTRUCTION
  125. The name service channel
  126. .I channel
  127. is being destroyed; the query will not be completed.
  128. .PP
  129. The callback argument
  130. .I timeouts
  131. reports how many times a query timed out during the execution of the
  132. given request.
  133. .PP
  134. If a query completed successfully, the callback argument
  135. .I abuf
  136. points to a result buffer of length
  137. .IR alen .
  138. If the query did not complete successfully,
  139. .I abuf
  140. will usually be NULL and
  141. .I alen
  142. will usually be 0, but in some cases an unsuccessful query result may
  143. be placed in
  144. .IR abuf .
  145. .SH SEE ALSO
  146. .BR ares_process (3)
  147. .SH AUTHOR
  148. Greg Hudson, MIT Information Systems
  149. .br
  150. Copyright 1998 by the Massachusetts Institute of Technology.