home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / ibm / pc / programm / 586 < prev    next >
Encoding:
Internet Message Format  |  1992-11-15  |  2.8 KB

  1. Xref: sparky comp.sys.ibm.pc.programmer:586 alt.msdos.programmer:2743 comp.os.msdos.programmer:10654
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!wupost!cs.utexas.edu!sun-barr!rutgers!flop.ENGR.ORST.EDU!flop.ENGR.ORST.EDU!usenet
  3. From: densond@xanth.CS.ORST.EDU (Dave Denson)
  4. Newsgroups: comp.sys.ibm.pc.net,comp.sys.ibm.pc.programmer,alt.msdos.programmer,comp.os.msdos.programmer
  5. Subject: Packet Driver Programming Problem
  6. Message-ID: <1e7eshINNhvt@flop.ENGR.ORST.EDU>
  7. Date: 16 Nov 92 06:25:21 GMT
  8. Organization: CS Dept, Oregon State University
  9. Lines: 80
  10. NNTP-Posting-Host: xanth.cs.orst.edu
  11.  
  12.  
  13. I am trying to learn how to program using a packet driver, and am having a
  14. very difficult time trying to set up a handler using the "access_type" call to
  15. packet driver.  I have some code below, which has been reworked numerous times,
  16. always with the same results.  I get a valid handler back with no errors, but
  17. when I ping my pc from a unix box, the far assembly procedure MyRoutine does
  18. not get called.  (I am using Turbo Pascal 6.0, BTW.  I know C would be better,
  19. but I do not have a decent C compiler at home [yet]).
  20.  
  21. A few notes: 
  22.     I have tried TypeLen (CX) set to 0, which, according the packet driver
  23.     specs, should call MyRoutine _every_ time a packet is received. 
  24.  
  25.     I have tried byte-swapping the word constant IP--no difference.
  26.  
  27.     I _can_ get the thing to generate errors if I purposely set illegal
  28.     if{Type,Class,Number} values.
  29.  
  30.     All the other basic packet driver functions (AH={1,2,3,4,5,6,7}) work
  31.     fine.
  32.  
  33. Here is the routine (which has become a bit messy over time).  I have coded it
  34. entirely in assembly, BTW, with no luck.
  35.  
  36. I would greatly appreciate any help.  I'm pulling my hair out over this.
  37.  
  38.  
  39.  
  40. function pkt_AccessType;
  41.  
  42. var
  43.     Error: byte;
  44.     TypeSeg, TypeOfs, RecSeg, RecOfs, Handle, Temp: word;
  45.     r: Registers;
  46.  
  47. begin
  48.     RecSeg := Seg(MyRoutine);    {MyRoutine is a far assembly procedure}
  49.     RecOfs := Ofs(MyRoutine);
  50.  
  51.     TypeSeg := Seg(IP);        {IP is a word containing $0008}
  52.     TypeOfs := Ofs(IP);
  53.  
  54.     asm
  55.         push    DS        {I have a hunch that this is needed}
  56.         mov    AX,RecSeg    {RecSeg}
  57.         mov    ES,AX
  58.         mov    DI,RecOfs    {RecOfs}
  59.  
  60.         mov    AX,TypeSeg
  61.         mov    DS,AX
  62.         mov    SI,TypeOfs
  63.  
  64. {I have set the following to constants instead of the passed parameters here}
  65.         mov    AL,1        {ifClass-DIX Ethernet}
  66.         mov    BX,14        {ifType-WD8003}
  67.         mov    DL,0        {ifNumber}
  68.  
  69.         mov    CX,2        {TypeLen}
  70.  
  71.         mov    AH,2
  72.         int    $60
  73.         pop    DS
  74.  
  75.         jnc    @NoError
  76.         mov    Error,DH    {Error found}
  77.         jmp @exit
  78.  
  79.      @NoError:
  80.         mov    Error, 0
  81.         mov    Temp,AX
  82.      @exit:
  83.     end;
  84.     pkt_AccessType := Temp;    
  85.     pkt_Result := Error;        {pkt_result is a global variable}
  86. end;
  87. -- 
  88. ------ Dave Denson                      (Preferred:  densond@storm.cs.orst.edu)
  89. Computer Sciences Corporation                       (densond@heart.cor.epa.gov)
  90. US EPA Corvallis Environmental Research Lab
  91. The above opinions are by no means whatsoever endorsed by US EPA, CSC, or OSU.
  92.