-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebuglib.c
More file actions
55 lines (51 loc) · 1.15 KB
/
debuglib.c
File metadata and controls
55 lines (51 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include "debuglib.h"
#include "nsu.h"
void memdump(FILE *f, const unsigned char *buf, int size)
{
int len, i, j, c;
for(i=0;i<size;i+=16) {
len = size - i;
if (len > 16)
len = 16;
fprintf(f, "%08x ", i);
for(j=0;j<16;j++) {
if (j < len)
fprintf(f, " %02x", buf[i+j]);
else
fprintf(f, " ");
}
fprintf(f, " ");
for(j=0;j<len;j++) {
c = buf[i+j];
if (c < ' ' || c > '~')
c = '.';
fprintf(f, "%c", c);
}
fprintf(f, "\n");
}
}
void dump_nsu(struct nsu_context *context)
{
printf( "dump struct nsu_context : 0x%x\n"
" proto_l2=%d\n"
" proto_l3=%d\n"
" proto_l4=%d\n"
" struct_protol2=0x%x\n"
" struct_protol3=0x%x\n"
" struct_protol4=0x%x\n"
" buf=0x%x\n"
" bufpos=%d\n"
" ifname=%s\n"
,context
,context->proto_l2
,context->proto_l3
,context->proto_l4
,context->struct_protol2
,context->struct_protol3
,context->struct_protol4
,context->buf
,context->bufpos
,context->ifname
);
}