Commit 6398113e authored by Michael Graff's avatar Michael Graff
Browse files

hex dump packet

parent adde4612
...@@ -65,6 +65,25 @@ void got_response(isc_task_t *, isc_event_t *); ...@@ -65,6 +65,25 @@ void got_response(isc_task_t *, isc_event_t *);
void start_response(void); void start_response(void);
static inline void CHECKRESULT(dns_result_t, char *); static inline void CHECKRESULT(dns_result_t, char *);
void send_done(isc_task_t *, isc_event_t *); void send_done(isc_task_t *, isc_event_t *);
void hex_dump(isc_buffer_t *);
void
hex_dump(isc_buffer_t *b)
{
unsigned int len;
isc_region_t r;
isc_buffer_remaining(b, &r);
printf("Buffer %p: used region base %p, length %d",
b, r.base, r.length);
for (len = 0 ; len < r.length ; len++) {
if (len % 16 == 0)
printf("\n");
printf("%02x ", r.base[len]);
}
printf("\n");
}
static inline void static inline void
CHECKRESULT(dns_result_t result, char *msg) CHECKRESULT(dns_result_t result, char *msg)
...@@ -250,6 +269,8 @@ got_request(isc_task_t *task, isc_event_t *ev_in) ...@@ -250,6 +269,8 @@ got_request(isc_task_t *task, isc_event_t *ev_in)
return; return;
} }
hex_dump(&ev->buffer);
msg = NULL; msg = NULL;
result = dns_message_create(mctx, &msg, DNS_MESSAGE_INTENTPARSE); result = dns_message_create(mctx, &msg, DNS_MESSAGE_INTENTPARSE);
CHECKRESULT(result, "dns_message_create() failed"); CHECKRESULT(result, "dns_message_create() failed");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment