diff options
-rw-r--r-- | src/or/eventdns.c | 17 | ||||
-rw-r--r-- | src/or/eventdns.h | 15 |
2 files changed, 23 insertions, 9 deletions
diff --git a/src/or/eventdns.c b/src/or/eventdns.c index a7b85d998b..84b4a3fb51 100644 --- a/src/or/eventdns.c +++ b/src/or/eventdns.c @@ -317,12 +317,11 @@ typedef unsigned int uint; #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 @@ evdns_server_callback(struct evdns_server_request *req, void *data) /* 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); diff --git a/src/or/eventdns.h b/src/or/eventdns.h index fb5873b1ad..53fcd1dd47 100644 --- a/src/or/eventdns.h +++ b/src/or/eventdns.h @@ -89,6 +89,21 @@ typedef void (*evdns_request_callback_fn_type)(struct evdns_server_request *, vo #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); |