home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 21
/
CD_ASCQ_21_040595.iso
/
dos
/
prg
/
pas
/
nwtp06
/
nwpep.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-03-01
|
3KB
|
97 lines
{$B-,V-,X+}
UNIT nwPEP;
{ nwPEP unit as of 950301 / NwTP 0.6 API. (c) 1993,1995, R.Spronk }
INTERFACE
Uses Dos,nwIPX,nwMisc;
{ Primary IPX calls: Subf: Comments:
Secondary calls:
PEPsetupSendECB
PEPsetupListenECB
}
Var Result:word; { unit errorcode variable }
Type TpepHeader=Record
IPXhdr :TipxHeader; { set packettype to $04 }
TransactionID:Longint;
clientType :word;
end;
Procedure PEPSetupListenECB(ESRptr:Pointer; ReceiveSocket:word;
BufPtr:Pointer; BufSize:word;
{out:} Var PepHdr:TpepHeader; Var ecb:Tecb);
{ Clears IPXheader and ECB, sets values of the required fields within
the ecb and IPX header. }
Procedure PEPSetupSendECB(ESRptr:pointer; SourceSocket:word;
DestAddr:TinterNetworkAddress;
BufPtr:pointer; BufSize:word;
{out:} Var PepHdr:TpepHeader; Var ecb:Tecb);
{ Clears IPXheader and ECB, sets values of the required fields within
the ecb and IPX header. }
IMPLEMENTATION {==============================================================}
Procedure PEPSetupListenECB(ESRptr:Pointer;ReceiveSocket:word;
BufPtr:Pointer;BufSize:word;
{out:} Var PepHdr:TpepHeader; Var ecb:Tecb);
{ Clears IPXheader and ECB, sets values of the required fields within
the ecb and IPX header. }
{ ECB: ESR adress field, socket number, fragment count, frag.descriptor fields }
begin
FillChar(ecb,SizeOf(Tecb),#0);
FillChar(pepHdr,SizeOF(TpepHeader),#0);
WITH ECB
do begin
if ESRptr<>NIL
then ESRaddress:=ESRptr;
Fragmentcount:=2;
socketNumber:=swap(ReceiveSocket); {hi-lo}
Fragment[1].Address:=@pepHdr;
Fragment[2].Address:=BufPtr;
Fragment[1].size:=SizeOf(Tpepheader);
Fragment[2].size:=BufSize;
end;
end;
Procedure PEPsetupSendECB(ESRptr:pointer; SourceSocket:word;
DestAddr:TinterNetworkAddress;
BufPtr:pointer; BufSize:word;
{out:} Var PepHdr:TpepHeader; Var ecb:Tecb);
{ Clears IPXheader and ECB, sets values of the required fields within
the ecb and IPX header. }
Var ImmAddr:TnodeAddress;
Ticks:word;
begin
fillchar(pepHdr,SizeOf(TpepHeader),#0);
with pepHdr.IPXhdr
do begin
PacketType:=PEP_PACKET_TYPE;
Move(DestAddr,Destination,10);
destination.socket:=swap(DestAddr.socket); {hi-lo}
end;
IPXGetLocalTarget(DestAddr,ImmAddr,Ticks);
fillchar(ecb,sizeOf(ecb),#0);
With ecb
do begin
if ESRptr<>NIL
then ESRaddress:=ESRptr;
socketNumber:=swap(SourceSocket); {hi-lo}
Move(ImmAddr,ImmediateAddress,6);
FragmentCount:=2;
fragment[1].Address:=@pephdr;
fragment[1].size:=SizeOf(TpepHeader);
fragment[2].Address:=BufPtr;
fragment[2].size:=BufSize;
end;
end;
end.