ares_mkquery.3 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .\"
  2. .\" Copyright 1998, 2000 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_MKQUERY 3 "20 Nov 2009"
  17. .SH NAME
  18. ares_mkquery \- Compose a single-question DNS query buffer
  19. .SH SYNOPSIS
  20. .nf
  21. .B #include <ares.h>
  22. .PP
  23. .B int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
  24. .B unsigned short \fIid\fP, int \fIrd\fP, unsigned char **\fIbuf\fP,
  25. .B int *\fIbuflen\fP)
  26. .fi
  27. .SH DESCRIPTION
  28. Deprecated function. See \fIares_create_query(3)\fP instead!
  29. The
  30. .B ares_mkquery
  31. function composes a DNS query with a single question.
  32. The parameter
  33. .I name
  34. gives the query name as a NUL-terminated C string of period-separated
  35. labels optionally ending with a period; periods and backslashes within
  36. a label must be escaped with a backlash. The parameters
  37. .I dnsclass
  38. and
  39. .I type
  40. give the class and type of the query using the values defined in
  41. .BR <arpa/nameser.h> .
  42. The parameter
  43. .I id
  44. gives a 16-bit identifier for the query. The parameter
  45. .I rd
  46. should be nonzero if recursion is desired, zero if not. The query
  47. will be placed in an allocated buffer, a pointer to which will be
  48. stored in the variable pointed to by
  49. .IR buf ,
  50. and the length of which will be stored in the variable pointed to by
  51. .IR buflen .
  52. It is the caller's responsibility to free this buffer using
  53. \fIares_free_string(3)\fP when it is no longer needed.
  54. Usage of \fIares_mkquery(3)\fP is deprecated, whereas the function is
  55. equivalent to \fIares_create_query(3)\fP with \fBmax_udp_size\fP set to
  56. 0.
  57. .SH RETURN VALUES
  58. .B ares_mkquery
  59. can return any of the following values:
  60. .TP 15
  61. .B ARES_SUCCESS
  62. Construction of the DNS query succeeded.
  63. .TP 15
  64. .B ARES_ENOTFOUND
  65. The query name
  66. .I name
  67. refers to a
  68. .I .onion
  69. domain name. See RFC 7686.
  70. .TP 15
  71. .B ARES_EBADNAME
  72. The query name
  73. .I name
  74. could not be encoded as a domain name, either because it contained a
  75. zero-length label or because it contained a label of more than 63
  76. characters.
  77. .TP 15
  78. .B ARES_ENOMEM
  79. Memory was exhausted.
  80. .SH SEE ALSO
  81. .BR ares_expand_name (3),
  82. .BR ares_free_string (3)
  83. .SH AUTHOR
  84. Greg Hudson, MIT Information Systems
  85. .br
  86. Copyright 1998, 2000 by the Massachusetts Institute of Technology.