ares_set_servers.3 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .\"
  2. .\" Copyright 2010 by Ben Greear <[email protected]>
  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_SET_SERVERS 3 "5 March 2010"
  17. .SH NAME
  18. ares_set_servers, ares_set_servers_ports \- Initialize an ares_channel name servers configuration
  19. .SH SYNOPSIS
  20. .nf
  21. .B #include <ares.h>
  22. .PP
  23. .B int ares_set_servers(ares_channel \fIchannel\fP, struct ares_addr_node *\fIservers\fP)
  24. .B int ares_set_servers_ports(ares_channel \fIchannel\fP, struct ares_addr_port_node *\fIservers\fP)
  25. .fi
  26. .SH DESCRIPTION
  27. The \fBares_set_servers(3)\fP function initializes name servers configuration
  28. for the channel data identified by
  29. .IR channel ,
  30. from a
  31. .IR servers
  32. pointer to a linked list of ares_addr_node structs holding name servers
  33. address data.
  34. .PP
  35. The name server linked list pointer argument may be the result of a previous
  36. call to \fBares_get_servers(3)\fP or a linked list of \fBares_addr_node\fP structs
  37. set up by other means.
  38. .PP
  39. The \fBares_set_servers(3)\fP function also allows the specification of UDP and
  40. TCP ports to be used for communication on a per-server basis. The provided
  41. linked list argument may be the result of a previous call to
  42. \fBares_get_servers_ports(3)\fP or a linked list of \fBares_addr_port_node\fP structs
  43. set up by other means.
  44. .PP
  45. This function replaces any potentially previously configured name servers
  46. with the ones given in the linked list. So, in order to configure a channel
  47. with more than one name server all the desired ones must be specified in a
  48. single list.
  49. .PP
  50. The function does not take ownership of the linked list argument.
  51. The caller is responsible for freeing the linked list when no longer needed.
  52. .PP
  53. This function is capable of handling IPv4 and IPv6 name server
  54. addresses simultaneously, rendering \fBares_init_options(3)\fP with
  55. optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
  56. IPv4-only name server usage.
  57. .SH RETURN VALUES
  58. .B ares_set_servers(3)
  59. may return any of the following values:
  60. .TP 15
  61. .B ARES_SUCCESS
  62. The name servers configuration was successfully initialized.
  63. .TP 15
  64. .B ARES_ENOMEM
  65. The process's available memory was exhausted.
  66. .TP 15
  67. .B ARES_ENODATA
  68. The channel data identified by
  69. .IR channel
  70. was invalid.
  71. .TP 15
  72. .B ARES_ENOTINITIALIZED
  73. c-ares library initialization not yet performed.
  74. .TP 15
  75. .B ARES_ENOTIMP
  76. Changing name servers configuration while queries are outstanding is not implemented.
  77. .SH SEE ALSO
  78. .BR ares_set_servers_csv (3),
  79. .BR ares_get_servers (3),
  80. .BR ares_init_options (3),
  81. .BR ares_dup(3)
  82. .SH AVAILABILITY
  83. \fBares_set_servers(3)\fP was added in c-ares 1.7.1;
  84. \fBares_set_servers_ports(3)\fP was added in c-ares 1.11.0.
  85. .SH AUTHOR
  86. Implementation of this function and associated library internals are based
  87. on code, comments and feedback provided in November and December of 2008 by
  88. Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
  89. by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
  90. shuffled all the bits and this function popped out.
  91. .br
  92. Copyright 1998 by the Massachusetts Institute of Technology.
  93. .br
  94. Copyright (C) 2008-2010 by Daniel Stenberg