Package Name: appletalk

Return to: Package List


with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions; use Interfaces.C.Extensions;
with Types; use Types;
with OSUtils; use OSUtils;

package AppleTalk is
   --  
   --  File:       AppleTalk.h
   --  
   --  Contains:   AppleTalk Interfaces.
   --  
   --  Version:    Technology: System 7.5
   --              Package:    Universal Interfaces 2.0 in ÒMPW LatestÓ on ETO #17
   --  
   --  Copyright:  © 1984-1995 by Apple Computer, Inc.
   --              All rights reserved.

   --  
   --  Driver unit and reference numbers (ADSP is dynamic)
  mppUnitNum : Constant Integer :=   9;   --  MPP unit number
  atpUnitNum : Constant Integer :=  10;   -- ATP unit number
  xppUnitNum : Constant Integer :=  40;   -- XPP unit number
  mppRefNum  : Constant Integer := -10;   -- MPP reference number
  atpRefNum  : Constant Integer := -11;   -- ATP reference number

  xppRefNum  : Constant Integer := -41;   -- XPP reference number
   --  .MPP csCodes
  lookupReply : Constant Integer := 242;    -- This command queued to ourself
  writeLAP    : Constant Integer := 243;    -- Write out LAP packet
  detachPH    : Constant Integer := 244;    -- Detach LAP protocol handler
  attachPH    : Constant Integer := 245;    -- Attach LAP protocol handler
  writeDDP    : Constant Integer := 246;    -- Write out DDP packet
  closeSkt    : Constant Integer := 247;    -- Close DDP socket
  openSkt     : Constant Integer := 248;    -- Open DDP socket
  loadNBP     : Constant Integer := 249;    -- Load NBP command-executing code
  lastResident: Constant Integer := 249;    -- Last resident command
  confirmName : Constant Integer := 250;    -- Confirm name
  lookupName  : Constant Integer := 251;    -- Look up name on internet
  removeName  : Constant Integer := 252;    -- Remove name from Names Table
  registerName: Constant Integer := 253;    -- Register name in Names Table

  killNBP     : Constant Integer := 254;    -- Kill outstanding NBP request
  unloadNBP     : Constant Integer := 255;  -- Unload NBP command code
  setSelfSend   : Constant Integer := 256;  -- MPP: Set to allow writes to self
  SetMyZone     : Constant Integer := 257;  -- Set my zone name
  GetATalkInfo  : Constant Integer := 258;  -- get AppleTalk information

  ATalkClosePrep: Constant Integer := 259;  -- AppleTalk close query
  --  .ATP csCodes
  nSendRequest  : Constant Integer := 248;  --  NSendRequest code
  relRspCB      : Constant Integer := 249;  --  Release RspCB
  closeATPSkt   : Constant Integer := 250;  --  Close ATP socket
  addResponse   : Constant Integer := 251;  --  Add response code | Require open skt
  sendResponse  : Constant Integer := 252;  --  Send response code
  getRequest    : Constant Integer := 253;  --  Get request code
  openATPSkt    : Constant Integer := 254;  --  Open ATP socket
  sendRequest   : Constant Integer := 255;  --  Send request code
  relTCB        : Constant Integer := 256;  --  Release TCB
  killGetReq    : Constant Integer := 257;  --  Kill GetRequest 
  killSendReq   : Constant Integer := 258;  --  Kill SendRequest 

  killAllGetReq : Constant Integer := 259;  --  Kill all getRequests for a skt 
   --  .XPP csCodes
  openSess    : Constant Integer := 255;  -- Open session }
  closeSess   : Constant Integer := 254;  -- Close session }
  userCommand : Constant Integer := 253;  -- User command }
  
  userWrite   : Constant Integer := 252;  -- User write
  getStatus   : Constant Integer := 251;  -- Get status
  afpCall     : Constant Integer := 250;  -- AFP command (buffer has command code)
  getParms    : Constant Integer := 249;  -- Get parameters
  abortOS     : Constant Integer := 248;  -- Abort open session request
  closeAll    : Constant Integer := 247;  -- Close all open sessions

  xCall       : Constant Integer := 246;  -- .XPP extended calls
  --  Transition Queue transition types
  ATTransOpen      : Constant Integer := 0;  -- AppleTalk has opened
  ATTransClose     : Constant Integer := 2;  -- AppleTalk is about to close
  ATTransClosePrep : Constant Integer := 3;  -- Is it OK to close AppleTalk ?
  ATTransCancelClose  : Constant Integer := 4;  -- Cancel the ClosePrep transition
  afpByteRangeLock : Constant Integer := 1;  -- AFPCall command codes
  afpVolClose      : Constant Integer := 2;  -- AFPCall command codes
  afpDirClose      : Constant Integer := 3;  -- AFPCall command codes
  afpForkClose     : Constant Integer := 4;  -- AFPCall command codes
  afpCopyFile      : Constant Integer := 5;  -- AFPCall command codes
  afpDirCreate     : Constant Integer := 6;  -- AFPCall command codes
  afpFileCreate    : Constant Integer := 7;  -- AFPCall command codes
  afpDelete        : Constant Integer := 8;  -- AFPCall command codes
  afpEnumerate     : Constant Integer := 9;  -- AFPCall command codes
  
  afpFlush         : Constant Integer := 10; -- AFPCall command codes
  afpForkFlush     : Constant Integer := 11; -- AFPCall command codes
  afpGetDirParms   : Constant Integer := 12; -- AFPCall command codes
  afpGetFileParms  : Constant Integer := 13; -- AFPCall command codes
  afpGetForkParms  : Constant Integer := 14; -- AFPCall command codes
  afpGetSInfo      : Constant Integer := 15; -- AFPCall command codes
  afpGetSParms     : Constant Integer := 16; -- AFPCall command codes
  afpGetVolParms   : Constant Integer := 17; -- AFPCall command codes
  afpLogin         : Constant Integer := 18; -- AFPCall command codes
  afpContLogin     : Constant Integer := 19; -- AFPCall command codes
  afpLogout        : Constant Integer := 20; -- AFPCall command codes
  afpMapID         : Constant Integer := 21; -- AFPCall command codes
  afpMapName       : Constant Integer := 22; -- AFPCall command codes
  afpMove          : Constant Integer := 23; -- AFPCall command codes
  afpOpenVol       : Constant Integer := 24; -- AFPCall command codes
  afpOpenDir       : Constant Integer := 25; -- AFPCall command codes
  afpOpenFork      : Constant Integer := 26; -- AFPCall command codes
  afpRead          : Constant Integer := 27; -- AFPCall command codes
  afpRename        : Constant Integer := 28; -- AFPCall command codes
  afpSetDirParms   : Constant Integer := 29; -- AFPCall command codes
  
  afpSetFileParms  : Constant Integer := 30; -- AFPCall command codes
  afpSetForkParms  : Constant Integer := 31; -- AFPCall command codes
  afpSetVolParms   : Constant Integer := 32; -- AFPCall command codes
  afpWrite         : Constant Integer := 33; -- AFPCall command codes
  afpGetFlDrParms  : Constant Integer := 34; -- AFPCall command codes
  afpSetFlDrParms  : Constant Integer := 35; -- AFPCall command codes
  afpDTOpen        : Constant Integer := 48; -- AFPCall command codes
  afpDTClose       : Constant Integer := 49; -- AFPCall command codes
  afpGetIcon       : Constant Integer := 51; -- AFPCall command codes
  afpGtIcnInfo     : Constant Integer := 52; -- AFPCall command codes
  afpAddAPPL       : Constant Integer := 53; -- AFPCall command codes
  afpRmvAPPL       : Constant Integer := 54; -- AFPCall command codes
  afpGetAPPL       : Constant Integer := 55; -- AFPCall command codes
  afpAddCmt        : Constant Integer := 56; -- AFPCall command codes
  afpRmvCmt        : Constant Integer := 57; -- AFPCall command codes
  afpGetCmt        : Constant Integer := 58; -- AFPCall command codes
  afpAddIcon       : Constant Integer := 192;  -- Special code for ASP Write commands
  xppLoadedBit     : Constant Integer := 5;  --  XPP bit in PortBUse
  scbMemSize       : Constant Integer := 192;  --  Size of memory for SCB
  xppFlagClr       : Constant Integer := 0;  --  Cs for AFPCommandBlock
  
  xppFlagSet       : Constant Integer := 128;  --  StartEndFlag & NewLineFlag fields.
  lapSize          : Constant Integer := 20;
  ddpSize          : Constant Integer := 26;
  nbpSize          : Constant Integer := 26;
  atpSize          : Constant Integer := 56;
  atpXOvalue       : Constant Integer := 32; -- ATP exactly-once bit
  atpEOMvalue      : Constant Integer := 16; -- ATP End-Of-Message bit
  atpSTSvalue      : Constant Integer := 8;  -- ATP Send-Transmission-Status bit
  atpTIDValidvalue : Constant Integer := 2;  -- ATP trans. ID valid bit
  atpSendChkvalue  : Constant Integer := 1;  -- ATP send checksum bit
  zipGetLocalZones : Constant Integer := 5;
  zipGetZoneList   : Constant Integer := 6;
  zipGetMyZone     : Constant Integer := 7;
  LAPMgrPtr        : Constant Integer := 16#B18#;  -- Entry point for LAP Manager
  LAPMgrCall       : Constant Integer := 2;  -- Offset to LAP routines
  LAddAEQ          : Constant Integer := 23; -- LAPAddATQ routine selector
  LRmvAEQ          : Constant Integer := 24; -- LAPRmvATQ routine selector
  
  tLAPRead       : Constant Integer := 0;
  tLAPWrite      : Constant Integer := 1;
  tDDPRead       : Constant Integer := 2;
  tDDPWrite      : Constant Integer := 3;
  tNBPLookup     : Constant Integer := 4;
  tNBPConfirm    : Constant Integer := 5;
  tNBPRegister   : Constant Integer := 6;
  tATPSndRequest : Constant Integer := 7;
  tATPGetRequest : Constant Integer := 8;
  tATPSdRsp      : Constant Integer := 9;
  tATPAddRsp     : Constant Integer := 10;
  tATPRequest    : Constant Integer := 11;

  tATPResponse   : Constant Integer := 12;

   subtype ABCallType is SInt8;
  lapProto      : Constant Integer := 0;
  ddpProto      : Constant Integer := 1;
  nbpProto      : Constant Integer := 2;

  atpProto      : Constant Integer := 3;

   subtype ABProtoType is UInt8;

   subtype ABByte is Byte;
   type LAPAdrBlock is 
      record
         dstNodeID : UInt8;
         srcNodeID : UInt8;
         lapProtType : ABByte;

         filler : UInt8;                          --  Filler for proper byte alignmen

      end record;
   type ATQEntry;
   type ATQEntry_Ptr is Access ATQEntry;
   subtype ATalkTransitionEventUPP is UniversalProcPtr;
   type ATQEntry is 
      record
         qLink : ATQEntry_Ptr;                    --  next queue entr
         qType : Short_Integer;                   --  queue typ

         CallAddr : ATalkTransitionEventUPP;      --  your routine descripto
      end record;

   type ATQEntryPtr is Access ATQEntry;
   type ATalkTransitionEventProcPtr is access      function (eventCode
                         : in     Long_Integer; qElem
                         : in     ATQEntryPtr; eventParameter


                         : in     Void_Ptr) return Long_Integer;

   subtype ATalkTransitionEvent is ATalkTransitionEventUPP;
   type AddrBlock is 
      record
         aNet : UInt16;
         aNode : UInt8;
         aSocket : UInt8;

      end record;
   --  /* Real definition of EntityName is 3 PACKED strings of any length (32 is just an example). No
   --  offests for Asm since each String address must be calculated by adding length byte to last string ptr.
   --  In Pascal, String(32) will be 34 bytes long since fields never start on an odd byte unless they are
   --  only a byte long. So this will generate correct looking interfaces for Pascal and C, but they will not
   --  /* Real definition of EntityName is 3 PACKED strings of any length (32 is just an example). No
   type EntityName is 
      record
         objStr : Str32;
         pad1 : SInt8;                            --  Str32's aligned on even word boundries
         typeStr : Str32;
         pad2 : SInt8;
         zoneStr : Str32;
         pad3 : SInt8;
      end record;


   type EntityPtr is Access EntityName;
   type RetransType is 
      record
         retransInterval : UInt8;
         retransCount : UInt8;

      end record;
   type BDSElement is 
      record
         buffSize : Short_Integer;
         buffPtr : Ptr;
         dataSize : Short_Integer;
         userBytes : Long_Integer;
      end record;
   type BDSPtr is Access BDSElement;

   type BDSElement_Vec_8 is array (0 .. 7) of BDSElement;


   subtype BDSType is BDSElement_Vec_8;

   subtype BitMapType is char;
   type ATLAPRec is 
      record
         abOpcode : ABCallType;
         filler : SInt8;                          --  Filler for proper byte alignmen
         abResult : Short_Integer;
         abUserReference : Long_Integer;
         lapAddress : LAPAdrBlock;
         lapReqCount : Short_Integer;
         lapActCount : Short_Integer;
         lapDataPtr : Ptr;
      end record;
   type ATLAPRecPtr is Access ATLAPRec;


   type ATLAPRecHandle is Access ATLAPRecPtr;
   type ATDDPRec is 
      record
         abOpcode : ABCallType;
         filler : SInt8;                          --  Filler for proper byte alignmen
         abResult : Short_Integer;
         abUserReference : Long_Integer;
         ddpType : Short_Integer;
         ddpSocket : Short_Integer;
         ddpAddress : AddrBlock;
         ddpReqCount : Short_Integer;
         ddpActCount : Short_Integer;
         ddpDataPtr : Ptr;
         ddpNodeID : Short_Integer;
      end record;
   type ATDDPRecPtr is Access ATDDPRec;


   type ATDDPRecHandle is Access ATDDPRecPtr;
   type ATNBPRec is 
      record
         abOpcode : ABCallType;
         filler : SInt8;                          --  Filler for proper byte alignmen
         abResult : Short_Integer;
         abUserReference : Long_Integer;
         nbpEntityPtr : EntityPtr;
         nbpBufPtr : Ptr;
         nbpBufSize : Short_Integer;
         nbpDataField : Short_Integer;
         nbpAddress : AddrBlock;
         nbpRetransmitInfo : RetransType;
      end record;
   type ATNBPRecPtr is Access ATNBPRec;


   type ATNBPRecHandle is Access ATNBPRecPtr;
   type ATATPRec is 
      record
         abOpcode : ABCallType;
         filler1 : SInt8;                         --  Filler for proper byte alignmen
         abResult : Short_Integer;
         abUserReference : Long_Integer;
         atpSocket : Short_Integer;
         atpAddress : AddrBlock;
         atpReqCount : Short_Integer;
         atpDataPtr : Ptr;
         atpRspBDSPtr : BDSPtr;
         atpBitMap : BitMapType;
         filler2 : UInt8;                         --  Filler for proper byte alignmen
         atpTransID : Short_Integer;
         atpActCount : Short_Integer;
         atpUserData : Long_Integer;
         atpXO : Boolean;
         atpEOM : Boolean;
         atpTimeOut : Short_Integer;
         atpRetries : Short_Integer;
         atpNumBufs : Short_Integer;
         atpNumRsp : Short_Integer;
         atpBDSSize : Short_Integer;
         atpRspUData : Long_Integer;
         atpRspBuf : Ptr;
         atpRspSize : Short_Integer;
      end record;
   type ATATPRecPtr is Access ATATPRec;


   type ATATPRecHandle is Access ATATPRecPtr;
   type AFPCommandBlock is 
      record
         cmdByte : UInt8;
         startEndFlag : UInt8;
         forkRefNum : Short_Integer;
         rwOffset : Long_Integer;
         reqCount : Long_Integer;
         newLineFlag : UInt8;
         newLineChar : char;

      end record;
   type MPPParamBlock is array (0 .. 87) of char;
   type MPPPBPtr is Access MPPParamBlock;
   subtype ATPCompletionUPP is UniversalProcPtr;
   type MPPparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
      end record;

   subtype MPPParamBlock_MPP is MPPparms;         --  General MPP parm
   type Union_1 is array (0 .. 3) of char;

   subtype Union_1_wdsPointer is Ptr;             --  -> write data structur
   subtype MPPProtocolHandlerUPP is UniversalProcPtr;
   subtype Union_1_handler is MPPProtocolHandlerUPP;

                                                  --  -> protocol handler routin
   type LAPparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         protType : UInt8;                        --  ALAP protocol Type
         filler : UInt8;
         u : Union_1;
      end record;

   subtype MPPParamBlock_LAP is LAPparms;         --  ALAP call
   type Union_2 is array (0 .. 3) of char;

   subtype Union_2_wdsPointer is Ptr;             --  -> write data structur
   subtype DDPSocketListenerUPP is UniversalProcPtr;
   subtype Union_2_listener is DDPSocketListenerUPP;

                                                  --  ->write data structure or -> Listene
   type DDPparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         socket : UInt8;                          --  socket number
         checksumFlag : UInt8;                    --  check sum flag
         u : Union_2;
      end record;

   subtype MPPParamBlock_DDP is DDPparms;         --  DDP call
   type NBPPtrs is array (0 .. 3) of char;
   subtype NBPPtrs_ntQElPtr is Ptr;
   subtype NBPPtrs_entityPtr is Ptr;
   type LookupConfirmParams is array (0 .. 11) of char;
   subtype LookupConfirmParams_verifyFlag is UInt8;
   type anon_struct_1 is 
      record
         retBuffPtr : Ptr;
         retBuffSize : Short_Integer;
         maxToGet : Short_Integer;
         numGotten : Short_Integer;
      end record;
   subtype LookupConfirmParams_Lookup is anon_struct_1;
   type anon_struct_2 is 
      record
         confirmAddr : AddrBlock;
         newSocket : UInt8;

         filler : UInt8;                          --  Filler for proper byte alignmen
      end record;
   subtype LookupConfirmParams_Confirm is anon_struct_2;
   type NBPparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         interval : UInt8;                        --  retry interval
         count : UInt8;                           --  retry count
         nbpPtrs_comp : NBPPtrs;
         parm : LookupConfirmParams;
      end record;

   subtype MPPParamBlock_NBP is NBPparms;         --  NBP call
   type SetSelfparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         newSelfFlag : UInt8;                     --  self-send toggle flag

         oldSelfFlag : UInt8;                     --  previous self-send state
      end record;
   subtype MPPParamBlock_SETSELF is SetSelfparms;
   type NBPKillparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;

         nKillQEl : Ptr;                          --  ptr to i/o queue element to cancel
      end record;
   subtype MPPParamBlock_NBPKILL is NBPKillparms;
   type GetAppleTalkInfoParm is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         version : Short_Integer;
         varsPtr : Ptr;
         DCEPtr : Ptr;
         portID : Short_Integer;
         configuration : Long_Integer;
         selfSend : Short_Integer;
         netLo : Short_Integer;
         netHi : Short_Integer;
         ourAdd : Long_Integer;
         routerAddr : Long_Integer;
         numOfPHs : Short_Integer;
         numOfSkts : Short_Integer;
         numNBPEs : Short_Integer;
         nTQueue : Ptr;
         LAlength : Short_Integer;
         linkAddr : Ptr;
         zoneName : Ptr;
      end record;
   subtype MPPParamBlock_GAIINFO is GetAppleTalkInfoParm;
   type ATalkClosePrepParm is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;

         appName : Ptr;                           --  pointer to application name in buffe
      end record;

   subtype MPPParamBlock_ATALKCLOSE is ATalkClosePrepParm;
   type ATPParamBlock is array (0 .. 55) of char;
   type ATPPBPtr is Access ATPParamBlock;
   type ATPparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         atpSocket : UInt8;
         atpFlags : UInt8;
         addrBlock_comp : AddrBlock;
         reqLength : Short_Integer;
         reqPointer : Ptr;
         bdsPointer : Ptr;
      end record;

   subtype ATPParamBlock_ATP is ATPparms;         --  General ATP parm
   type SendReqparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         atpSocket : UInt8;
         atpFlags : UInt8;
         addrBlock_comp : AddrBlock;
         reqLength : Short_Integer;
         reqPointer : Ptr;
         bdsPointer : Ptr;
         numOfBuffs : UInt8;
         timeOutVal : UInt8;
         numOfResps : UInt8;
         retryCount : UInt8;
         intBuff : Short_Integer;
         TRelTime : UInt8;
         filler0 : SInt8;
      end record;

   subtype ATPParamBlock_SREQ is SendReqparms;    --  sendrequest parm
   type Union_3 is array (0 .. 0) of char;

   subtype Union_3_bitMap is UInt8;               --  bitmap received

   subtype Union_3_numOfBuffs is UInt8;           --  number of responses being sen

   subtype Union_3_rspNum is UInt8;               --  sequence numbe
   type ATPmisc1 is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         atpSocket : UInt8;
         atpFlags : UInt8;
         addrBlock_comp : AddrBlock;
         reqLength : Short_Integer;
         reqPointer : Ptr;
         bdsPointer : Ptr;
         u : Union_3;
      end record;

   subtype ATPParamBlock_OTH1 is ATPmisc1;        --  and a few other
   type ATPmisc2 is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         atpSocket : UInt8;
         atpFlags : UInt8;
         addrBlock_comp : AddrBlock;
         reqLength : Short_Integer;
         reqPointer : Ptr;
         bdsPointer : Ptr;
         filler : UInt8;
         bdsSize : UInt8;
         transID : Short_Integer;
      end record;

   subtype ATPParamBlock_OTH2 is ATPmisc2;        --  and a few other
   type Killparms is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : ATPCompletionUPP;
         ioResult : OSErr;
         userData : Long_Integer;
         reqTID : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         atpSocket : UInt8;
         atpFlags : UInt8;
         addrBlock_comp : AddrBlock;
         reqLength : Short_Integer;
         reqPointer : Ptr;
         bdsPointer : Ptr;
         aKillQEl : Ptr;
      end record;


   subtype ATPParamBlock_KILL is Killparms;       --  and a few other
   type XPPParamBlock is array (0 .. 351) of char;
   type XPPParmBlkPtr is Access XPPParamBlock;
   subtype XPPCompletionUPP is UniversalProcPtr;
   type XPPPrmBlk is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : XPPCompletionUPP;
         ioResult : OSErr;
         cmdResult : Long_Integer;
         ioVRefNum : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         sessRefnum : Short_Integer;
         aspTimeout : UInt8;
         aspRetry : UInt8;
         cbSize : Short_Integer;
         cbPtr : Ptr;
         rbSize : Short_Integer;
         rbPtr : Ptr;
         wdSize : Short_Integer;
         wdPtr : Ptr;
         ccbStart : UInt8_Vec_296;
      end record;
   subtype XPPParamBlock_XPP is XPPPrmBlk;
   type ASPGetparmsBlk is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : XPPCompletionUPP;
         ioResult : OSErr;
         cmdResult : Long_Integer;
         ioVRefNum : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         aspMaxCmdSize : Short_Integer;
         aspQuantumSize : Short_Integer;
         numSesss : Short_Integer;
      end record;
   subtype XPPParamBlock_GETPARM is ASPGetparmsBlk;
   type ASPAbortPrm is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : XPPCompletionUPP;
         ioResult : OSErr;
         cmdResult : Long_Integer;
         ioVRefNum : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;

         abortSCBPtr : Ptr;                       --  SCB pointer for AbortOS
      end record;
   subtype XPPParamBlock_ABORT_Id is ASPAbortPrm;
   subtype AttnRoutineUPP is UniversalProcPtr;
   type ASPOpenPrm is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : XPPCompletionUPP;
         ioResult : OSErr;
         cmdResult : Long_Integer;
         ioVRefNum : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         sessRefnum : Short_Integer;
         aspTimeout : UInt8;
         aspRetry : UInt8;
         serverAddr : AddrBlock;
         scbPointer : Ptr;
         attnRoutine : AttnRoutineUPP;
      end record;
   type ASPOpenPrmPtr is Access ASPOpenPrm;
   subtype XPPParamBlock_OPEN is ASPOpenPrm;
   type AFPLoginPrm is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : XPPCompletionUPP;
         ioResult : OSErr;
         cmdResult : Long_Integer;
         ioVRefNum : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         sessRefnum : Short_Integer;
         aspTimeout : UInt8;
         aspRetry : UInt8;
         cbSize : Short_Integer;
         cbPtr : Ptr;
         rbSize : Short_Integer;
         rbPtr : Ptr;
         afpAddrBlock : AddrBlock;
         afpSCBPtr : Ptr;
         afpAttnRoutine : Ptr;

         ccbFill : UInt8_Vec_144;                 --  CCB memory allocated for driver  Login needs only 150 bytes BUT CCB really starts in the middle of AFPSCBPtr and also clobbers AFPAttnRoutine.
      end record;
   subtype XPPParamBlock_LOGIN is AFPLoginPrm;
   type XCallParam is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         ioTrap : Short_Integer;
         ioCmdAddr : Ptr;
         ioCompletion : XPPCompletionUPP;
         ioResult : OSErr;
         cmdResult : Long_Integer;
         ioVRefNum : Short_Integer;
         ioRefNum : Short_Integer;
         csCode : Short_Integer;
         xppSubCode : Short_Integer;
         xppTimeout : UInt8;
         xppRetry : UInt8;
         filler1 : Short_Integer;
         zipBuffPtr : Ptr;
         zipNumZones : Short_Integer;
         zipLastFlag : UInt8;
         filler2 : UInt8;
         zipInfoField : UInt8_Vec_70;
      end record;

   subtype XPPParamBlock_XCALL is XCallParam;
   --  
   --  MPPCompletionProcPtr uses register based parameters on the 68k and cannot
   --  be written in or called from a high-level language without the help of
   --  mixed mode or assembly glue.
   --  
   --      typedef pascal void (*MPPCompletionProcPtr)(MPPPBPtr thePBptr);
   --  
   --  In:
   --   => thePBptr        A0.L
   --  
   --  
   --  ATPCompletionProcPtr uses register based parameters on the 68k and cannot
   --  be written in or called from a high-level language without the help of
   --  mixed mode or assembly glue.
   --  
   --      typedef pascal void (*ATPCompletionProcPtr)(ATPPBPtr thePBptr);
   --  
   --  In:
   --   => thePBptr        A0.L
   --  
   --  
   --  XPPCompletionProcPtr uses register based parameters on the 68k and cannot
   --  be written in or called from a high-level language without the help of
   --  mixed mode or assembly glue.
   --  
   --      typedef pascal void (*XPPCompletionProcPtr)(XPPParmBlkPtr thePBptr);
   --  
   --  In:
   --   => thePBptr        A0.L
   --  
   --  
   --  AttnRoutineProcPtr uses register based parameters on the 68k and cannot
   --  be written in or called from a high-level language without the help of
   --  mixed mode or assembly glue.
   --  
   --      typedef pascal void (*AttnRoutineProcPtr)(short sessRefnum, short attnBytes);
   --  
   --  In:
   --   => sessRefnum      D0.W
   --   => attnBytes       D1.W

   --  

   subtype MPPCompletionUPP is UniversalProcPtr;
   type WDSElement is 
      record
         entryLength : Short_Integer;
         entryPtr : Ptr;

      end record;
   type NTElement is 
      record
         nteAddress : AddrBlock;                  --  network address of entit
         filler : SInt8;

         entityData : SInt8_Vec_99;               --  Object, Type & Zon

      end record;
   type NamesTableEntry is 
      record
         qNext : Ptr;                             --  ptr to next NT
         nt : NTElement;

      end record;
   type MPPProtocolHandlerProcPtr is access function
     (SCCAddr1 : in     Ptr;
      SCCAddr2 : in     Ptr;
      MPPLocalVars               : in     Ptr;
      nextFreeByteInRHA          : in     Ptr;
      ReadPacketAndReadRestPtr   : in     Ptr;
      numBytesLeftToReadInPacket : in     Short_Integer) return Boolean;
   type DDPSocketListenerProcPtr is access function
     (SCCAddr1 : in     Ptr;
      SCCAddr2 : in     Ptr;
      MPPLocalVars               : in     Ptr;
      nextFreeByteInRHA          : in     Ptr;
      ReadPacketAndReadRestPtr   : in     Ptr;
      packetDestinationNumber    : in     UInt8;

      numBytesLeftToReadInPacket : in     Short_Integer) return Boolean;
   --  (*MPPCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager
   --  (*ATPCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager
   --  (*XPPCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager
   --  (*AttnRoutineProcPtr) cannot be called from a high-level language without the Mixed Mode Manager
   --  (*MPPProtocolHandlerProcPtr) cannot be called from a high-level language without the Mixed Mode Manager

   --  (*DDPSocketListenerProcPtr) cannot be called from a high-level language without the Mixed Mode Manager
   function OpenXPP
     (xppRefnum          : access Short_Integer)
      return                      OSErr;

   pragma Import (C, OpenXPP, "OpenXPP", "OpenXPP");
   function ASPOpenSession
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPOpenSession, "ASPOpenSession", "ASPOpenSession");
   function ASPCloseSession
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPCloseSession, "ASPCloseSession", "ASPCloseSession");
   function ASPAbortOS
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPAbortOS, "ASPAbortOS", "ASPAbortOS");
   function ASPGetParms
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPGetParms, "ASPGetParms", "ASPGetParms");
   function ASPCloseAll
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPCloseAll, "ASPCloseAll", "ASPCloseAll");
   function ASPUserWrite
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPUserWrite, "ASPUserWrite", "ASPUserWrite");
   function ASPUserCommand
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPUserCommand, "ASPUserCommand", "ASPUserCommand");
   function ASPGetStatus
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ASPGetStatus, "ASPGetStatus", "ASPGetStatus");
   function AFPCommand
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, AFPCommand, "AFPCommand", "AFPCommand");
   function GetLocalZones
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, GetLocalZones, "GetLocalZones", "GetLocalZones");
   function GetZoneList
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, GetZoneList, "GetZoneList", "GetZoneList");
   function GetMyZone
     (thePBptr           : in     XPPParmBlkPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, GetMyZone, "GetMyZone", "GetMyZone");
   function PAttachPH
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PAttachPH, "PAttachPH", "PAttachPH");
   function PDetachPH
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PDetachPH, "PDetachPH", "PDetachPH");
   function PWriteLAP
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PWriteLAP, "PWriteLAP", "PWriteLAP");
   function POpenSkt
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, POpenSkt, "POpenSkt", "POpenSkt");
   function PCloseSkt
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PCloseSkt, "PCloseSkt", "PCloseSkt");
   function PWriteDDP
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PWriteDDP, "PWriteDDP", "PWriteDDP");
   function PRegisterName
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PRegisterName, "PRegisterName", "PRegisterName");
   function PLookupName
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PLookupName, "PLookupName", "PLookupName");
   function PConfirmName
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PConfirmName, "PConfirmName", "PConfirmName");
   function PRemoveName
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PRemoveName, "PRemoveName", "PRemoveName");
   function PSetSelfSend
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PSetSelfSend, "PSetSelfSend", "PSetSelfSend");
   function PKillNBP
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PKillNBP, "PKillNBP", "PKillNBP");
   function PGetAppleTalkInfo
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PGetAppleTalkInfo, "PGetAppleTalkInfo", "PGetAppleTalkInfo");
   function PATalkClosePrep
     (thePBptr           : in     MPPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PATalkClosePrep, "PATalkClosePrep", "PATalkClosePrep");
   function POpenATPSkt
     (thePBptr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, POpenATPSkt, "POpenATPSkt", "POpenATPSkt");
   function PCloseATPSkt
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PCloseATPSkt, "PCloseATPSkt", "PCloseATPSkt");
   function PSendRequest
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PSendRequest, "PSendRequest", "PSendRequest");
   function PGetRequest
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PGetRequest, "PGetRequest", "PGetRequest");
   function PSendResponse
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PSendResponse, "PSendResponse", "PSendResponse");
   function PAddResponse
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PAddResponse, "PAddResponse", "PAddResponse");
   function PRelTCB
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PRelTCB, "PRelTCB", "PRelTCB");
   function PRelRspCB
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PRelRspCB, "PRelRspCB", "PRelRspCB");
   function PNSendRequest
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PNSendRequest, "PNSendRequest", "PNSendRequest");
   function PKillSendReq
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PKillSendReq, "PKillSendReq", "PKillSendReq");
   function PKillGetReq
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, PKillGetReq, "PKillGetReq", "PKillGetReq");
   function ATPKillAllGetReq
     (thePBPtr           : in     ATPPBPtr;
      async              : in     Boolean)
      return                      OSErr;

   pragma Import (C, ATPKillAllGetReq, "ATPKillAllGetReq", "ATPKillAllGetReq");
   procedure BuildLAPwds
     (wdsPtr             : in     Ptr;
      dataPtr            : in     Ptr;
      destHost           : in     Short_Integer;
      prototype          : in     Short_Integer;
      frameLen           : in     Short_Integer);

   pragma Import (C, BuildLAPwds, "BuildLAPwds", "BuildLAPwds");
   procedure BuildDDPwds
     (wdsPtr             : in     Ptr;
      headerPtr          : in     Ptr;
      dataPtr            : in     Ptr;
      netAddr            : in     AddrBlock;
      ddpType            : in     Short_Integer;
      dataLen            : in     Short_Integer);

   pragma Import (C, BuildDDPwds, "BuildDDPwds", "BuildDDPwds");
   procedure NBPSetEntity
     (buffer             : in     Ptr;
      nbpObject          : access Str32;
      nbpType            : access Str32;
      nbpZone            : access Str32);

   pragma Import (C, NBPSetEntity, "NBPSetEntity", "NBPSetEntity");
   procedure NBPSetNTE
     (ntePtr             : in     Ptr;
      nbpObject          : access Str32;
      nbpType            : access Str32;
      nbpZone            : access Str32;
      socket             : in     Short_Integer);

   pragma Import (C, NBPSetNTE, "NBPSetNTE", "NBPSetNTE");
   function GetBridgeAddress
      return                      Short_Integer;

   pragma Import (C, GetBridgeAddress, "GetBridgeAddress", "GetBridgeAddress");
   function BuildBDS
     (buffPtr            : in     Ptr;
      bdsPtr             : in     Ptr;
      buffSize           : in     Short_Integer)
      return                      Short_Integer;

   pragma Import (C, BuildBDS, "BuildBDS", "BuildBDS");
   function MPPOpen
      return                      OSErr;

   pragma Import (C, MPPOpen, "MPPOpen", "MPPOpen");
   function LAPAddATQ
     (theATQEntry        : in     ATQEntryPtr)
      return                      OSErr;

   pragma Import (C, LAPAddATQ, "LAPAddATQ", "LAPAddATQ");
   function LAPRmvATQ
     (theATQEntry        : in     ATQEntryPtr)
      return                      OSErr;

   pragma Import (C, LAPRmvATQ, "LAPRmvATQ", "LAPRmvATQ");
   function ATPLoad
      return                      OSErr;

   pragma Import (C, ATPLoad, "ATPLoad", "ATPLoad");
   function ATPUnload
      return                      OSErr;

   pragma Import (C, ATPUnload, "ATPUnload", "ATPUnload");
   function NBPExtract
     (theBuffer          : in     Ptr;
      numInBuf           : in     Short_Integer;
      whichOne           : in     Short_Integer;
      abEntity           : access EntityName;
      address            : access AddrBlock)
      return                      OSErr;

   pragma Import (C, NBPExtract, "NBPExtract", "NBPExtract");
   function GetNodeAddress
     (myNode             : access Short_Integer;
      myNet              : access Short_Integer)
      return                      OSErr;

   pragma Import (C, GetNodeAddress, "GetNodeAddress", "GetNodeAddress");
   function IsMPPOpen
      return                      Boolean;

   pragma Import (C, IsMPPOpen, "IsMPPOpen", "IsMPPOpen");
   function IsATPOpen
      return                      Boolean;

   pragma Import (C, IsATPOpen, "IsATPOpen", "IsATPOpen");
   procedure ATEvent
     (event              : in     Long_Integer;
      infoPtr            : in     Ptr);

   pragma Import (C, ATEvent, "ATEvent", "ATEvent");
   function ATPreFlightEvent
     (event              : in     Long_Integer;
      cancel             : in     Long_Integer;
      infoPtr            : in     Ptr)
      return                      OSErr;

   pragma Import (C, ATPreFlightEvent, "ATPreFlightEvent", "ATPreFlightEvent");
end AppleTalk;