Article View: comp.sys.ibm.pc.net
Article #9Packet Driver Programming Problem
From: Dave Denson
Date: Mon, 16 Nov 1992 06:25
Date: Mon, 16 Nov 1992 06:25
80 lines
2881 bytes
2881 bytes
I am trying to learn how to program using a packet driver, and am having a
very difficult time trying to set up a handler using the "access_type" call to
packet driver. I have some code below, which has been reworked numerous times,
always with the same results. I get a valid handler back with no errors, but
when I ping my pc from a unix box, the far assembly procedure MyRoutine does
not get called. (I am using Turbo Pascal 6.0, BTW. I know C would be better,
but I do not have a decent C compiler at home [yet]).
A few notes:
I have tried TypeLen (CX) set to 0, which, according the packet driver
specs, should call MyRoutine _every_ time a packet is received.
I have tried byte-swapping the word constant IP--no difference.
I _can_ get the thing to generate errors if I purposely set illegal
if{Type,Class,Number} values.
All the other basic packet driver functions (AH={1,2,3,4,5,6,7}) work
fine.
Here is the routine (which has become a bit messy over time). I have coded it
entirely in assembly, BTW, with no luck.
I would greatly appreciate any help. I'm pulling my hair out over this.
function pkt_AccessType;
var
Error: byte;
TypeSeg, TypeOfs, RecSeg, RecOfs, Handle, Temp: word;
r: Registers;
begin
RecSeg := Seg(MyRoutine); {MyRoutine is a far assembly procedure}
RecOfs := Ofs(MyRoutine);
TypeSeg := Seg(IP); {IP is a word containing $0008}
TypeOfs := Ofs(IP);
asm
push DS {I have a hunch that this is needed}
mov AX,RecSeg {RecSeg}
mov ES,AX
mov DI,RecOfs {RecOfs}
mov AX,TypeSeg
mov DS,AX
mov SI,TypeOfs
{I have set the following to constants instead of the passed parameters here}
mov AL,1 {ifClass-DIX Ethernet}
mov BX,14 {ifType-WD8003}
mov DL,0 {ifNumber}
mov CX,2 {TypeLen}
mov AH,2
int $60
pop DS
jnc @NoError
mov Error,DH {Error found}
jmp @exit
@NoError:
mov Error, 0
mov Temp,AX
@exit:
end;
pkt_AccessType := Temp;
pkt_Result := Error; {pkt_result is a global variable}
end;
--
------ Dave Denson (Preferred: densond@storm.cs.orst.edu)
Computer Sciences Corporation (densond@heart.cor.epa.gov)
US EPA Corvallis Environmental Research Lab
The above opinions are by no means whatsoever endorsed by US EPA, CSC, or OSU.
Technical Details
Message-ID:
<1e7eshINNhvt@flop.ENGR.ORST.EDU>Path:
arc1-ca.pugleaf.net!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!usenetShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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 From: densond@xanth.CS.ORST.EDU (Dave Denson) Newsgroups: comp.sys.ibm.pc.net,comp.sys.ibm.pc.programmer,alt.msdos.programmer,comp.os.msdos.programmer Subject: Packet Driver Programming Problem Message-ID: <1e7eshINNhvt@flop.ENGR.ORST.EDU> Date: 16 Nov 92 06:25:21 GMT Organization: CS Dept, Oregon State University Lines: 80 NNTP-Posting-Host: xanth.cs.orst.edu