api: add ARES_OPT_NOROTATE optmask value

Fix up a couple of problems with configuring whether c-ares rotates
between different name servers between requests.

Firstly, ares_save_options() returns (in *optmask) the value of
(channel->optmask & ARES_OPT_ROTATE), which doesn't necessarily
indicate whether the channel is or is not actually doing rotation.
This can be confusing/incorrect if:
 - the channel was originally configured without ARES_OPT_ROTATE
   (so it appears that the channel is not rotating)
 - the /etc/resolv.conf file includes the 'rotate' option
   (so the channel is actually performing rotation).

Secondly, it is not possible to reliably configure a channel
to not-rotate; leaving off ARES_OPT_ROTATE is not enough, since
a 'rotate' option in /etc/resolv.conf will turn it on again.

Therefore:
 - add an ARES_OPT_NOROTATE optmask value to allow explicit
   configuration of no-rotate behaviour
 - in ares_save_options(), report the value of channel->rotate
   as exactly one of (optmask & ARES_OPT_ROTATE) or
   (optmask & ARES_OPT_NOROTATE).

In terms of back-compatibility:
 - existing apps that set ARES_OPT_ROTATE will continue to rotate,
   and to have ARES_OPT_ROTATE reported back from ares_save_options()
 - existing apps that don't set ARES_OPT_ROTATE will continue to
   use local config/defaults to decide whether to rotate, and will
   now get ARES_OPT_ROTATE or ARES_OPT_NOROTATE reported back from
   ares_save_options() rather than 0.
3 files changed
tree: 88104142af6e25731296b308e9dc881db62e818f
  1. m4/
  2. test/
  3. vc/
  4. .gitignore
  5. .travis.yml
  6. acinclude.m4
  7. acountry.1
  8. acountry.c
  9. adig.1
  10. adig.c
  11. ahost.1
  12. ahost.c
  13. appveyor.yml
  14. ares.h
  15. ares__close_sockets.c
  16. ares__get_hostent.c
  17. ares__read_line.c
  18. ares__timeval.c
  19. ares_build.h.dist
  20. ares_build.h.in
  21. ares_cancel.3
  22. ares_cancel.c
  23. ares_create_query.3
  24. ares_create_query.c
  25. ares_data.c
  26. ares_data.h
  27. ares_destroy.3
  28. ares_destroy.c
  29. ares_destroy_options.3
  30. ares_dns.h
  31. ares_dup.3
  32. ares_expand_name.3
  33. ares_expand_name.c
  34. ares_expand_string.3
  35. ares_expand_string.c
  36. ares_fds.3
  37. ares_fds.c
  38. ares_free_data.3
  39. ares_free_hostent.3
  40. ares_free_hostent.c
  41. ares_free_string.3
  42. ares_free_string.c
  43. ares_get_servers.3
  44. ares_get_servers_ports.3
  45. ares_getenv.c
  46. ares_getenv.h
  47. ares_gethostbyaddr.3
  48. ares_gethostbyaddr.c
  49. ares_gethostbyname.3
  50. ares_gethostbyname.c
  51. ares_gethostbyname_file.3
  52. ares_getnameinfo.3
  53. ares_getnameinfo.c
  54. ares_getopt.c
  55. ares_getopt.h
  56. ares_getsock.3
  57. ares_getsock.c
  58. ares_inet_net_pton.h
  59. ares_inet_ntop.3
  60. ares_inet_pton.3
  61. ares_init.3
  62. ares_init.c
  63. ares_init_options.3
  64. ares_iphlpapi.h
  65. ares_ipv6.h
  66. ares_library_cleanup.3
  67. ares_library_init.3
  68. ares_library_init.c
  69. ares_library_init.h
  70. ares_llist.c
  71. ares_llist.h
  72. ares_mkquery.3
  73. ares_mkquery.c
  74. ares_nowarn.c
  75. ares_nowarn.h
  76. ares_options.c
  77. ares_parse_a_reply.3
  78. ares_parse_a_reply.c
  79. ares_parse_aaaa_reply.3
  80. ares_parse_aaaa_reply.c
  81. ares_parse_mx_reply.3
  82. ares_parse_mx_reply.c
  83. ares_parse_naptr_reply.3
  84. ares_parse_naptr_reply.c
  85. ares_parse_ns_reply.3
  86. ares_parse_ns_reply.c
  87. ares_parse_ptr_reply.3
  88. ares_parse_ptr_reply.c
  89. ares_parse_soa_reply.3
  90. ares_parse_soa_reply.c
  91. ares_parse_srv_reply.3
  92. ares_parse_srv_reply.c
  93. ares_parse_txt_reply.3
  94. ares_parse_txt_reply.c
  95. ares_platform.c
  96. ares_platform.h
  97. ares_private.h
  98. ares_process.3
  99. ares_process.c
  100. ares_query.3
  101. ares_query.c
  102. ares_rules.h
  103. ares_save_options.3
  104. ares_search.3
  105. ares_search.c
  106. ares_send.3
  107. ares_send.c
  108. ares_set_local_dev.3
  109. ares_set_local_ip4.3
  110. ares_set_local_ip6.3
  111. ares_set_servers.3
  112. ares_set_servers_csv.3
  113. ares_set_servers_ports.3
  114. ares_set_servers_ports_csv.3
  115. ares_set_socket_callback.3
  116. ares_set_socket_configure_callback.3
  117. ares_set_sortlist.3
  118. ares_setup.h
  119. ares_strcasecmp.c
  120. ares_strcasecmp.h
  121. ares_strdup.c
  122. ares_strdup.h
  123. ares_strerror.3
  124. ares_strerror.c
  125. ares_timeout.3
  126. ares_timeout.c
  127. ares_version.3
  128. ares_version.c
  129. ares_version.h
  130. ares_writev.c
  131. ares_writev.h
  132. AUTHORS
  133. bitncmp.c
  134. bitncmp.h
  135. buildconf
  136. buildconf.bat
  137. cares.rc
  138. CHANGES
  139. CHANGES.0
  140. config-dos.h
  141. config-win32.h
  142. configure.ac
  143. CONTRIBUTING.md
  144. get_ver.awk
  145. GIT-INFO
  146. git2changes.pl
  147. inet_net_pton.c
  148. inet_ntop.c
  149. INSTALL
  150. install-sh
  151. libcares.pc.in
  152. LICENSE.md
  153. Makefile.am
  154. Makefile.dj
  155. Makefile.inc
  156. Makefile.m32
  157. Makefile.msvc
  158. Makefile.netware
  159. Makefile.Watcom
  160. maketgz
  161. mkinstalldirs
  162. msvc_ver.inc
  163. nameser.h
  164. NEWS
  165. README.cares
  166. README.md
  167. README.msvc
  168. RELEASE-NOTES
  169. SECURITY.md
  170. setup_once.h
  171. TODO
  172. windows_port.c
README.md

c-ares

Build Status Windows Build Status Coverage Status [CII Best Practices](https://best practices.coreinfrastructure.org/projects/289)

This is c-ares, an asynchronous resolver library. It is intended for applications which need to perform DNS queries without blocking, or need to perform multiple DNS queries in parallel. The primary examples of such applications are servers which communicate with multiple clients and programs with graphical user interfaces.

The full source code is available in the ‘c-ares’ release archives, and in a git repository: http://github.com/c-ares/c-ares

If you find bugs, correct flaws, have questions or have comments in general in regard to c-ares (or by all means the original ares too), get in touch with us on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares

c-ares is of course distributed under the same MIT-style license as the original ares.

You'll find all c-ares details and news here: https://c-ares.haxx.se/

Notes for c-ares hackers

  • The distributed ares_build.h file is only intended to be used on systems which can not run the also distributed configure script.

  • The distributed ares_build.h file is generated as a copy of ares_build.h.dist when the c-ares source code distribution archive file is originally created.

  • If you check out from git on a non-configure platform, you must run the appropriate buildconf* script to set up ares_build.h and other local files before being able to compile the library.

  • On systems capable of running the configure script, the configure process will overwrite the distributed ares_build.h file with one that is suitable and specific to the library being configured and built, this new file is generated from the ares_build.h.in template file.

  • If you intend to distribute an already compiled c-ares library you MUST also distribute along with it the generated ares_build.h which has been used to compile it. Otherwise the library will be of no use for the users of the library that you have built. It is your responsibility to provide this file. No one at the c-ares project can know how you have built the library.

  • File ares_build.h includes platform and configuration dependent info, and must not be modified by anyone. Configure script generates it for you.

  • We cannot assume anything else but very basic compiler features being present. While c-ares requires an ANSI C compiler to build, some of the earlier ANSI compilers clearly can't deal with some preprocessor operators.

  • Newlines must remain unix-style for older compilers' sake.

  • Comments must be written in the old-style /* unnested C-fashion */

  • Try to keep line lengths below 80 columns.