[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9083: Export DNS types and classes in eventdns.h so that server co (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9083: Export DNS types and classes in eventdns.h so that server co (in tor/trunk: . src/or)
- From: nickm@xxxxxxxx
- Date: Mon, 11 Dec 2006 21:56:35 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Mon, 11 Dec 2006 21:56:42 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2006-12-11 21:56:35 -0500 (Mon, 11 Dec 2006)
New Revision: 9083
Modified:
tor/trunk/
tor/trunk/src/or/eventdns.c
tor/trunk/src/or/eventdns.h
Log:
r11494@Kushana: nickm | 2006-12-11 14:50:20 -0500
Export DNS types and classes in eventdns.h so that server code can use them.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/branches/eventdns [r11494] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c 2006-12-12 02:56:28 UTC (rev 9082)
+++ tor/trunk/src/or/eventdns.c 2006-12-12 02:56:35 UTC (rev 9083)
@@ -317,12 +317,11 @@
#define MAX_ADDRS 4 // maximum number of addresses from a single packet
// which we bother recording
-#define TYPE_A 1
-#define TYPE_CNAME 5
-#define TYPE_PTR 12
-#define TYPE_AAAA 28
+#define TYPE_A EVDNS_TYPE_A
+#define TYPE_PTR EVDNS_TYPE_PTR
+#define TYPE_AAAA EVDNS_TYPE_AAAA
-#define CLASS_INET 1
+#define CLASS_INET EVDNS_CLASS_INET
struct request {
u8 *request; // the dns packet data
@@ -2916,15 +2915,15 @@
/* dummy; give 192.168.11.11 as an answer for all A questions. */
for (i = 0; i < req->nquestions; ++i) {
u32 ans = htonl(0xc0a80b0bUL);
- if (req->questions[i]->type == TYPE_A &&
- req->questions[i]->class == CLASS_INET) {
+ if (req->questions[i]->type == EVDNS_TYPE_A &&
+ req->questions[i]->class == EVDNS_CLASS_INET) {
printf(" -- replying for %s (A)\n", req->questions[i]->name);
r = evdns_request_add_a_reply(req, req->questions[i]->name,
1, &ans, 10);
if (r<0)
printf("eeep, didn't work.\n");
- } else if (req->questions[i]->type == TYPE_PTR &&
- req->questions[i]->class == CLASS_INET) {
+ } else if (req->questions[i]->type == EVDNS_TYPE_PTR &&
+ req->questions[i]->class == EVDNS_CLASS_INET) {
printf(" -- replying for %s (PTR)\n", req->questions[i]->name);
r = evdns_request_add_ptr_reply(req, NULL, req->questions[i]->name,
"foo.bar.example.com", 10);
Modified: tor/trunk/src/or/eventdns.h
===================================================================
--- tor/trunk/src/or/eventdns.h 2006-12-12 02:56:28 UTC (rev 9082)
+++ tor/trunk/src/or/eventdns.h 2006-12-12 02:56:35 UTC (rev 9083)
@@ -89,6 +89,21 @@
#define EVDNS_ANSWER_SECTION 0
#define EVDNS_AUTHORITY_SECTION 1
#define EVDNS_ADDITIONAL_SECTION 2
+
+#define EVDNS_TYPE_A 1
+#define EVDNS_TYPE_NS 2
+#define EVDNS_TYPE_CNAME 5
+#define EVDNS_TYPE_SOA 6
+#define EVDNS_TYPE_PTR 12
+#define EVDNS_TYPE_MX 15
+#define EVDNS_TYPE_TXT 16
+#define EVDNS_TYPE_AAAA 28
+
+#define EVDNS_QTYPE_AXFR 252
+#define EVDNS_QTYPE_ALL 255
+
+#define EVDNS_CLASS_INET 1
+
struct evdns_server_port *evdns_add_server_port(int socket, int is_tcp, evdns_request_callback_fn_type callback, void *user_data);
void evdns_close_server_port(struct evdns_server_port *port);