mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 02:02:06 -04:00
hex dump packet
This commit is contained in:
parent
adde461254
commit
6398113e18
1 changed files with 21 additions and 0 deletions
|
|
@ -65,6 +65,25 @@ void got_response(isc_task_t *, isc_event_t *);
|
|||
void start_response(void);
|
||||
static inline void CHECKRESULT(dns_result_t, char *);
|
||||
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
|
||||
CHECKRESULT(dns_result_t result, char *msg)
|
||||
|
|
@ -250,6 +269,8 @@ got_request(isc_task_t *task, isc_event_t *ev_in)
|
|||
return;
|
||||
}
|
||||
|
||||
hex_dump(&ev->buffer);
|
||||
|
||||
msg = NULL;
|
||||
result = dns_message_create(mctx, &msg, DNS_MESSAGE_INTENTPARSE);
|
||||
CHECKRESULT(result, "dns_message_create() failed");
|
||||
|
|
|
|||
Loading…
Reference in a new issue