summaryrefslogtreecommitdiff
path: root/src/or/eventdns.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-06-03 19:49:42 +0000
committerNick Mathewson <nickm@torproject.org>2006-06-03 19:49:42 +0000
commit7cb3232ade9c55d26a64bddbd12a92a2a32180cd (patch)
tree97a779a7a4d360f8b06f1d255cd75fa676339820 /src/or/eventdns.h
parent86da3e0a0af5813d6f5eb695d8353b2988f256ff (diff)
downloadtor-7cb3232ade9c55d26a64bddbd12a92a2a32180cd.tar.gz
tor-7cb3232ade9c55d26a64bddbd12a92a2a32180cd.zip
Add async dns code from Adam Langley, tweaked to build on OSX. Long-term, we may want to switch to libevnet/c-ares, if they ever handle 10k fd situations properly. This one still needs work too, but at least it is small. This code is disabled by default, and not integrated with dns.c.
svn:r6524
Diffstat (limited to 'src/or/eventdns.h')
-rw-r--r--src/or/eventdns.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/or/eventdns.h b/src/or/eventdns.h
new file mode 100644
index 0000000000..9c858a1429
--- /dev/null
+++ b/src/or/eventdns.h
@@ -0,0 +1,50 @@
+/* This software is Public Domain. To view a copy of the public domain dedication,
+ * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
+ * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
+ *
+ * I ask and expect, but do not require, that all derivative works contain an
+ * attribution similar to:
+ * Parts developed by Adam Langley <agl@imperialviolet.org>
+ *
+ * You may wish to replace the word "Parts" with something else depending on
+ * the amount of original code.
+ *
+ * (Derivative works does not include programs which link against, run or include
+ * the source verbatim in their source distributions)
+ */
+
+#ifndef EVENTDNS_H
+#define EVENTDNS_H
+
+#define DNS_ERR_NONE 0
+#define DNS_ERR_FORMAT 1
+#define DNS_ERR_SERVERFAILED 2
+#define DNS_ERR_NOTEXIST 3
+#define DNS_ERR_NOTIMPL 4
+#define DNS_ERR_REFUSED 5
+#define DNS_ERR_TRUNCATED 65
+#define DNS_ERR_UNKNOWN 66
+#define DNS_ERR_TIMEOUT 67
+
+#define DNS_IPv4_A 1
+
+#define DNS_QUERY_NO_SEARCH 1
+
+#define DNS_OPTION_SEARCH 1
+#define DNS_OPTION_NAMESERVERS 2
+#define DNS_OPTION_MISC 4
+#define DNS_OPTIONS_ALL 7
+
+typedef void (*eventdns_callback_type) (int result, char type, int count, int ttl, void *addresses, void *arg);
+
+int eventdns_nameserver_add(unsigned long int address);
+int eventdns_nameserver_ip_add(const char *ip_as_string);
+int eventdns_resolve(const char *name, int flags, eventdns_callback_type callback, void *ptr);
+int eventdns_resolv_conf_parse(int flags, const char *);
+void eventdns_search_clear();
+void eventdns_search_add(const char *domain);
+void eventdns_search_ndots_set();
+
+#define DNS_NO_SEARCH 1
+
+#endif // !EVENTDNS_H