summaryrefslogtreecommitdiff
path: root/ares.h
diff options
context:
space:
mode:
authorBen Greear <greearb@candelatech.com>2010-07-18 21:58:39 (GMT)
committerDaniel Stenberg <daniel@haxx.se>2010-07-18 21:58:39 (GMT)
commite3b04e5a4796215d2483aba3cb75c72ba337ac14 (patch)
tree3671ebcef566e0e32f00a50b0557b88bd8b67475 /ares.h
parent45a09b7efba9665bdc08e227f4baf51fab3862ae (diff)
downloadc-ares-e3b04e5a4796215d2483aba3cb75c72ba337ac14.zip
c-ares-e3b04e5a4796215d2483aba3cb75c72ba337ac14.tar.gz
c-ares-e3b04e5a4796215d2483aba3cb75c72ba337ac14.tar.bz2
local-bind: Support binding to local interface/IPs
Add 3 new functions to set the local binding for the out-going socket connection, and add ares_set_servers_csv() to set a list of servers at once as a comma-separated string. Signed-off-by: Ben Greear <greearb@candelatech.com>
Diffstat (limited to 'ares.h')
-rw-r--r--ares.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/ares.h b/ares.h
index 368c73a..3b4ff13 100644
--- a/ares.h
+++ b/ares.h
@@ -313,6 +313,20 @@ CARES_EXTERN void ares_destroy(ares_channel channel);
CARES_EXTERN void ares_cancel(ares_channel channel);
+/* These next 3 configure local binding for the out-going socket
+ * connection. Use these to specify source IP and/or network device
+ * on multi-homed systems.
+ */
+CARES_EXTERN void ares_set_local_ip4(ares_channel channel, uint32_t local_ip);
+
+/* local_ip6 should be 16 bytes in length */
+CARES_EXTERN void ares_set_local_ip6(ares_channel channel,
+ const unsigned char* local_ip6);
+
+/* local_dev_name should be null terminated. */
+CARES_EXTERN void ares_set_local_dev(ares_channel channel,
+ const char* local_dev_name);
+
CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
ares_sock_create_callback callback,
void *user_data);
@@ -496,6 +510,7 @@ CARES_EXTERN void ares_free_data(void *dataptr);
CARES_EXTERN const char *ares_strerror(int code);
+/* TODO: Hold port here as well. */
struct ares_addr_node {
struct ares_addr_node *next;
int family;
@@ -508,6 +523,10 @@ struct ares_addr_node {
CARES_EXTERN int ares_set_servers(ares_channel channel,
struct ares_addr_node *servers);
+/* Incomming string format: host[:port][,host[:port]]... */
+CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
+ const char* servers);
+
CARES_EXTERN int ares_get_servers(ares_channel channel,
struct ares_addr_node **servers);