Important: The information in this document is obsolete and should not be used for new development.
Summary of DDP
Pascal Summary
Constants
CONST {.MPP driver unit and reference numbers} mppUnitNum = 9; {MPP unit number} mppRefNum = -10; {MPP reference number} {csCodes} writeDDP = 246; {write out DDP packet, csCode} closeSkt = 247; {close DDP socket, csCode} openSkt = 248; {open DDP socket, csCode}Data Types
The Write-Data Structure
TYPE WDSElement = RECORD entryLength: Integer; entryPtr: Ptr; END;The Address Block Record
TYPE AddrBlock = PACKED RECORD aNet: Integer; {network number} aNode: Byte; {node ID} aSocket: Byte; {socket number} END;MPP Parameter Block
MPPParmType = (...OpenSktParm,CloseSktParm,WriteDDPParm ...) TYPE MPPParamBlock = PACKED RECORD qLink: QElemPtr; {reserved} qType: Integer; {reserved} ioTrap: Integer; {reserved} ioCmdAddr: Ptr; {reserved} ioCompletion: ProcPtr; {completion routine} ioResult: OSErr; {result code} ioNamePtr: StringPtr; {reserved} ioVRefNum: Integer; {reserved} ioRefNum: Integer; {driver reference number} csCode: Integer; {command code} CASE MPPParmType OF OpenSktParm, CloseSktParm, WriteDDPParm: ( socket: Byte; {socket number} checksumFlag: Byte; {checksum flag} listener: Ptr; {For POpenSkt, pointer to socket } { listener routine. For PWriteDDP, } { pointer to write-data structure.} ) END; MPPPBPtr = ^MPPParamBlock;Routines
Opening and Closing DDP Sockets
FUNCTION POpenSkt(thePBptr: MPPPBPtr; async: Boolean): OSErr; FUNCTION PCloseSkt (thePBptr: MPPPBPtr; async: Boolean): OSErr;Sending DDP Datagrams
FUNCTION PWriteDDP (thePBptr: MPPPBPtr; async: Boolean): OSErr; PROCEDURE BuildDDPwds (wdsPtr,headerPtr,dataPtr: Ptr; destAddress: AddrBlock; DDPType: Integer; dataLen: Integer);C Summary
Constants
/*DDP parameter constants*/ #define MPPioCompletion MPP.ioCompletion #define MPPioResult MPP.ioResult #define MPPioRefNum MPP.ioRefNum #define MPPcsCode MPP.csCode #define DDPsocket DDP.socket #define DDPchecksumFlag DDP.checksumFlag #define DDPwdsPointer DDP.DDPptrs.wdsPointer #define DDPlistener DDP.DDPptrs.listener /*.MPP driver unit and reference number*/ enum { mppUnitNum = 9, /*MPP unit number*/ mppRefNum = -10 /*MPP reference number*/ }; /*DDP csCodes*/ enum { writeDDP = 246, /*send DDP packet*/ closeSkt = 247, /*close DDP socket*/ openSkt = 248 /*open DDP socket*/ };Data Types
The Write-Data Structure
struct WDSElement { short entryLength; Ptr entryPtr; } WDSElement;The Address Block Record
struct AddrBlock { short aNet; /*network number*/ unsigned char aNode; /*node ID*/ unsigned char aSocket; /*socket number*/ }; typedef struct AddrBlock AddrBlock;MPP Parameter Block
#define MPPATPHeader\ QElem *qLink; /*reserved*/\ short qType; /*reserved*/\ short ioTrap; /*reserved */\ Ptr ioCmdAddr; /*reserved*/\ ProcPtr ioCompletion; /*completion routine*/\ OSErr ioResult; /*result code*/\ long ioNameptr; /*command result (ATP user bytes)*/\ short ioVRefNum; /*request transaction ID*/\ short ioRefNum; /*driver reference number*/\ short csCode; /*command code*/ typedef struct { MPPATPHeader }MPPparms; union ParamBlockRec { MPPparms MPP; /*general MPP parms*/ DDPparms DDP; /*DDP calls*/ }; typedef MPPParamBlock *MPPPBtr; typedef struct { MPPATPHeader char socket; /*socket number*/ char checksumFlag; /*checksum flag*/ union { Ptr wdsPointer; /*pointer to write-data structure*/ Ptr listener; /*pointer to write-data structure or */ /* pointer to socket listener*/ } DDPptrs; }DDPparms;Routines
Opening and Closing DDP Sockets
pascal OSErr POpenSkt (MPPPBPtr the PBptr, Boolean async); pascal OSErr PCloseSkt (MPPPBPtr thePBptr, Boolean async);Sending DDP Datagrams
pascal OSErr PWriteDDP (MPPPBPtr the PBptr, Boolean async); pascal void BuildDDPwds(Ptr wdsPtr, header Ptr, Ptr dataPtr, const AddrBlock netAddr, short ddpType, short dataLen);Assembly-Language Summary
Constants
mppUnitNum EQU 9 ;MPP unit number ;csCodes for DDP writeDDP EQU 246 ;write out DDP packet closeSkt EQU 247 ;close DDP socket openSkt EQU 248 ;open DDP socket ;long DDP packet header ddpHopCnt EQU 0 ;hop count (byte) ddpLength EQU 0 ;packet length (word) ddpChecksum EQU 2 ;checksum (word) ddpDstNet EQU 4 ;destination network number (word) ddpSrcNet EQU 6 ;source network number (word) ddpDstNode EQU 8 ;destination node address (byte) ddpSrcNode EQU 9 ;source node address (byte) ddpDstSkt EQU 10 ;destination socket number (byte) ddpSrcSkt EQU 11 ;source socket number (byte) ddpType EQU 12 ;DDP protocol type field (byte) ;short DDP packet header sddpDstSkt EQU 2 ;destination socket number (byte) sddpSrcSkt EQU 3 ;source socket number (byte) sddpType EQU 4 ;DDP protocol type field (byte) ;DDP long header size ddphSzLong EQU 13 ;size of extended DDP header DDP short header size ddphSzShort EQU 5 ;size of short DDP header shortDDP EQU $01 ;LAP type code for DDP (short header) longDDP EQU $02 ;LAP type code for DDP (long header) ;DDP miscellaneous ddpMaxWKS EQU $7F ;highest valid well-known socket ddpMaxData EQU 586 ;maximum DDP data size ddpLenMask EQU $03FF ;mask for DDP length rhaSize EQU $18 ;size of read-header area toRHA EQU 1 ;top of the read-header area wdsEntrySz EQU 6 ;size of a write-data structure entry DDPHopsMask EQU $3C00 ;mask hop count bits from field in DDP ; header ;command codes (csCodes) writeDDP EQU 246 ;write out DDP packet closeSkt EQU 247 ;close DDP socket openSkt EQU 248 ;open DDP socketData Structures
MPP Parameter Block Common Fields for DDP Routines
0 qLink long reserved 4 qType word reserved 6 ioTrap word reserved 8 ioCmdAddr long reserved 12 ioCompletion long address of completion routine 16 ioResult word result code 18 ioNamePtr long reserved 22 ioVRefNum word reserved 24 ioRefNum word driver reference number OpenSkt
Parameter Variant
26 csCode word command code; always openSkt
28 socket byte socket number 30 listener long pointer to socket listener CloseSkt
Parameter Variant
26 csCode word command code; always closeSkt
28 socket byte number of socket to be closed WriteDDP
Parameter Variant
26 csCode word command code; always writeDDP
28 socket byte number of socket to write from 30 listener long pointer to write-data structure Result Codes
noErr 0 No error ddpSktErr -91 Bad socket number or socket table is full ddpLenErr -92 Datagram data exceeds 586 bytes noBridgeErr -93 Could not find router to forward packet