home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!ira.uka.de!math.fu-berlin.de!unidus.rz.uni-duesseldorf.de!mueller.rz.uni-duesseldorf.de!dvs
- From: dvs@ze8.rz.uni-duesseldorf.de (Wolfgang R. Mueller)
- Newsgroups: comp.protocols.tcp-ip.ibmpc
- Subject: Re: TCP/IP Packet analyser
- Date: Mon, 16 Nov 1992 08:38:18 GMT
- Organization: Computing Centre, Heinrich-Heine-University, Duesseldorf, Germany
- Lines: 60
- Message-ID: <dvs.21.721903098@ze8.rz.uni-duesseldorf.de>
- References: <1992Nov11.152717.1@ccla.demon.co.uk>
- NNTP-Posting-Host: mueller.rz.uni-duesseldorf.de
-
- In article <1992Nov11.152717.1@ccla.demon.co.uk> dblack@ccla.demon.co.uk (David Black) writes:
- > Is there a Public domain IP packet analyser that I can run on a
- > PC through the packet driver i/f. I need it for debugging purposes.
- Perhaps this may help:
- --------------------------------------------------------------------
- #include <stdio.h>
- #include <conio.h>
- #include <alloc.h>
- #include <dos.h>
- #include <bios.h>
-
- #define PKI 0x70 /* constant packet int no makes program simpler */
- static unsigned int bufseg,bufoff=0,
- bufrdr=0,lact=1;static void interrupt prx(unsigned bp,unsigned di,unsigned
- si, unsigned ds,unsigned es,unsigned dx,unsigned cx,unsigned bx,unsigned
- ax) { if(!ax) {
- if((bufoff+64)!=bufrdr) {
- poke(bufseg,bufoff,peek(0x40,0x6c)); poke(bufseg,bufoff+2,cx);
- es = bufseg; di = bufoff+4; cx = ax; bufoff+=64;
- return;
- } else { es = di = 0;
- } } return;
- }
- static struct { unsigned char pushf; unsigned char callf;
- void interrupt (*farpt)(); unsigned char retf; } pkrec={0x9c,0x9a,prx,0xcb};
-
- static unsigned char eta[]={0x01,0x02,0x03,0x04,0x05,0x06};
- static unsigned char *bw=0xb0000000, atr=0x07; static int xy=0;
- static char hextab[]="0123456789ABCDEF";
- static void tinit() { clrscr();
- if(*((unsigned char *)(0x00400049))!=7) bw=(unsigned char *)0xb8000000; }
- static void hexout(xy,c) int xy; unsigned char c; { unsigned char *bp;
- bp=bw+xy+xy; *(bp++)=hextab[c>>4]; *(bp++)=atr;
- *(bp++)=hextab[c&15]; *bp=atr; }
- void evaltrace() { int i,j; unsigned char *p; unsigned int bo=bufoff;
- j=1920; atr=0x07; hexout(j,bo>>8); hexout(j+2,bo&255);
- hexout(j+5,bufrdr>>8); hexout(j+7,bufrdr&255);
- if(bo==bufrdr) return;
- gotoxy(1,1+xy); j=xy*80; atr=7;
- p=(unsigned char *)MK_FP(bufseg,bufrdr);
- /* if(memcmp(p+4,&(eta[0]),6) && memcmp(p+10,&(eta[0]),6)) { bufrdr+=64; return; }*/
- hexout(j,*(p+1)); hexout(j+2,*p);
- hexout(j+5,*(p+3)); hexout(j+7,*(p+2)); j+=10; p+=4;
- for(i=0;i<14;i++,p++) { hexout(j,*p); j+=2; if((i%6)==5) j++; } p+=12;
- for(i=0;i<12;i++,p++) { if((i%4)==0) j++; if(i==10) j++; hexout(j,*p); j+=2;}
- if((++xy)==24) xy=0;
- bufrdr+=64; return;
- }
- void main() { int hdl; bufseg=1+FP_SEG(farmalloc(0x10010)); tinit();
- _BX=0; hdl=_DS; _AX=0x01ff; geninterrupt(PKI); _DS=hdl; /*driver_info*/
- _ES=FP_SEG(&pkrec); _DI=FP_OFF(&pkrec); _AL=_CH; _AH=0x02;
- _BX=0xffff; _CX=0; _DX=0; geninterrupt(PKI); hdl=_AX; /*access_type*/
- _BX=hdl; _AX=0x1400; _CX=6; geninterrupt(PKI); /*set_rcv_mode*/
- while(!bioskey(1)) evaltrace();
- _BX=hdl; _AX=0x0300; geninterrupt(PKI); /*release_type*/
- }
- ----------------------------------------------------------------------
- Have fun,
- Wolfgang R. Mueller <dvs@ze8.rz.uni-duesseldorf.de>,
- Computing Centre, Heinrich-Heine-University, Duesseldorf, Germany.
-