static void snaRmHexDump(int size, void *data)
{
int j;
int i;
int samesw = 0;
int count = 0;
int len;
unsigned char buf[16];
unsigned char bufe[16];
unsigned char hexbuf[16];
unsigned char savebuf[16];
unsigned char *databuf = (unsigned char *)data;
memset(hexbuf, 0, 16);
for(j=0; j < size; j += 16) {
memcpy(savebuf, hexbuf, 16);
memset(hexbuf, 0, 16);
len = size - j;
if(len > 16)
len = 16;
memcpy(hexbuf, &databuf[j], len);
memcpy(buf, hexbuf, 16);
memcpy(bufe, hexbuf, 16);
for(i = 0; i < 16; i++)
if(!isprint(buf[i]) || buf[i] == '\0')
buf[i] = '.';
snaConvert(16, bufe);
for(i = 0; i < 16; i++)
if(!isprint(bufe[i]) || bufe[i] == '\0')
bufe[i] = '.';
if(memcmp(hexbuf, savebuf, 16)) {
fprintf(tracefile, "%5.5x |%2.2x%2.2x%2.2x%2.2x %2.2x%2.2x%2.2x%2.2x %2.2x%2.2x%2.2x%2.2x %2.2x%2.2x%2.2x%2.2x| |%16.16s|%16.16s|\n",
count, hexbuf[0], hexbuf[1], hexbuf[2], hexbuf[3], hexbuf[4],
hexbuf[5], hexbuf[6], hexbuf[7], hexbuf[8], hexbuf[9],
hexbuf[10], hexbuf[11], hexbuf[12], hexbuf[13], hexbuf[14],
hexbuf[15], buf, bufe);
samesw = 0;
}
else
if(samesw == 0) {
samesw = 1;
fprintf(tracefile, " ******SAME*****\n");
}
count += 16;
}
return;
}
{
int j;
int i;
int samesw = 0;
int count = 0;
int len;
unsigned char buf[16];
unsigned char bufe[16];
unsigned char hexbuf[16];
unsigned char savebuf[16];
unsigned char *databuf = (unsigned char *)data;
memset(hexbuf, 0, 16);
for(j=0; j < size; j += 16) {
memcpy(savebuf, hexbuf, 16);
memset(hexbuf, 0, 16);
len = size - j;
if(len > 16)
len = 16;
memcpy(hexbuf, &databuf[j], len);
memcpy(buf, hexbuf, 16);
memcpy(bufe, hexbuf, 16);
for(i = 0; i < 16; i++)
if(!isprint(buf[i]) || buf[i] == '\0')
buf[i] = '.';
snaConvert(16, bufe);
for(i = 0; i < 16; i++)
if(!isprint(bufe[i]) || bufe[i] == '\0')
bufe[i] = '.';
if(memcmp(hexbuf, savebuf, 16)) {
fprintf(tracefile, "%5.5x |%2.2x%2.2x%2.2x%2.2x %2.2x%2.2x%2.2x%2.2x %2.2x%2.2x%2.2x%2.2x %2.2x%2.2x%2.2x%2.2x| |%16.16s|%16.16s|\n",
count, hexbuf[0], hexbuf[1], hexbuf[2], hexbuf[3], hexbuf[4],
hexbuf[5], hexbuf[6], hexbuf[7], hexbuf[8], hexbuf[9],
hexbuf[10], hexbuf[11], hexbuf[12], hexbuf[13], hexbuf[14],
hexbuf[15], buf, bufe);
samesw = 0;
}
else
if(samesw == 0) {
samesw = 1;
fprintf(tracefile, " ******SAME*****\n");
}
count += 16;
}
return;
}