mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
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. svn:r9083
This commit is contained in:
parent
fc125b1ef4
commit
abc1304aef
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user