void PrintPackets(LPPACKET lpPacket)
{ ULONG i, j, ulLines, ulen, ulBytesReceived;
char *pChar, *pLine, *base;
char *buf;
u_int off=;
u_int tlen,tlen1;
struct bpf_hdr *hdr; ulBytesReceived = lpPacket->ulBytesReceived; buf = lpPacket->Buffer; off=; while(off<ulBytesReceived){
if(_kbhit())return;
hdr=(struct bpf_hdr *)(buf+off);
tlen1=hdr->bh_datalen;
tlen=hdr->bh_caplen;
printf("Packet length, captured portion: %ld, %ld\n", tlen1, tlen);
off+=hdr->bh_hdrlen; ulLines = (tlen + ) / ; pChar =(char*)(buf+off);
base=pChar;
off=Packet_WORDALIGN(off+tlen); //if(ulLines >10) ulLines = 10; for ( i=; i<ulLines; i++ )
{ pLine =pChar; printf( "%08lx : ", pChar-base ); ulen=tlen;
ulen = ( ulen > ) ? : ulen;
tlen -= ulen; for ( j=; j<ulen; j++ )
printf( "%02x ", *(BYTE *)pChar++ ); if ( ulen < )
printf( "%*s", (-ulen)*, " " ); pChar = pLine; for ( j=; j<ulen; j++, pChar++ )
printf( "%c", isprint( (unsigned char)*pChar ) ? *pChar : '.' ); printf( "\n" );
} printf( "\n" );
}
}