DIRECTORY Process USING [InitializeCondition, DisableTimeout, SetTimeout, MsecToTicks], ProcessorFace USING [microsecondsPerHundredPulses], CommUtilDefs USING [EnableAborts], PupPktOps, PupStream USING [CloseReason, PupOpenMode], PupPktDefs USING [PupPktStream], PupDefs USING [Pair, defaultPupsToAllocate, DataWordsPerPupBuffer, PupAddress, PupBuffer, PupSocketDestroy, PupSocketKick, PupSocketID, Tocks, veryLongWait, veryShortWait], BufferDefs USING [QueueCleanup, QueueInitialize, QueueObject]; PupPktMgr: PROGRAM IMPORTS ProcessorFace, Process, CommUtilDefs, PupPktOps, PupDefs, BufferDefs EXPORTS PupPktOps, PupStream, PupPktDefs = BEGIN OPEN PupPktOps, PupPktDefs, PupDefs; PupPktStreamObject: PUBLIC TYPE = PupPktOps.InstanceData; myPing: BOOLEAN _ TRUE; myMaxAllocate, myPathMaxAllocate: CARDINAL _ defaultPupsToAllocate; myMaxBufferSize: CARDINAL _ 0; NoBufferToSend: PUBLIC ERROR = CODE; StreamAlreadyOpen: PUBLIC ERROR = CODE; maxRetransmitPulses: PUBLIC PupPktOps.Pulses _ 100*(5000000/ProcessorFace.microsecondsPerHundredPulses); minRetransmitPulses: PUBLIC PupPktOps.Pulses _ 100*(100000/ProcessorFace.microsecondsPerHundredPulses); initialRetransmitPulses: PUBLIC PupPktOps.Pulses _ 100*(5000000/ProcessorFace.microsecondsPerHundredPulses); ctlRetransmitPulses: PUBLIC PupPktOps.Pulses _ 100*(2000000/ProcessorFace.microsecondsPerHundredPulses); pingPulses: PUBLIC PupPktOps.Pulses _ 100*(60000000/ProcessorFace.microsecondsPerHundredPulses); PupPktStreamMake: PUBLIC PROCEDURE [ local: PupSocketID, remote: PupAddress, ticks: Tocks, mode: PupStream.PupOpenMode, id: Pair] RETURNS [PupPktStream] = BEGIN him: Instance _ NEW[PupPktOps.InstanceData]; him.state _ idle; him.c _ NIL; him.dontWait _ FALSE; him.dataBytesPerPup _ 2*DataWordsPerPupBuffer[]; him.outIntPending _ FALSE; him.outEnd _ 0; him.probeCounter _ 0; him.ping _ myPing; him.myMaxAllocate _ myMaxAllocate; him.pathMaxAllocate _ myPathMaxAllocate; him.hisMaxAllocate _ 0; him.throttle _ 0; him.unackedPups _ 0; him.allocatedPups _ 0; him.clumpsSinceBump _ 0; him.sentBuffer _ NIL; him.pleaseDie _ FALSE; him.sameNet _ FALSE; him.sendAck _ FALSE; him.aDataOut _ FALSE; him.retransmitPulses _ initialRetransmitPulses; him.whyClosed _ localClose; him.text _ NIL; him.inputQueue _ NEW[BufferDefs.QueueObject]; him.sentQueue _ NEW[BufferDefs.QueueObject]; BufferDefs.QueueInitialize[him.inputQueue]; BufferDefs.QueueInitialize[him.sentQueue]; Process.InitializeCondition[@him.stateChange, Process.MsecToTicks[1000]]; Process.InitializeCondition[@him.retransmitterReady, Process.MsecToTicks[100]]; Process.InitializeCondition[@him.inputReady, Process.MsecToTicks[5000]]; Process.InitializeCondition[@him.waitingForInterrupt, Process.MsecToTicks[5000]]; Process.DisableTimeout[@him.waitingForInterrupt]; CommUtilDefs.EnableAborts[@him.waitingForInterrupt]; IF myMaxBufferSize # 0 THEN him.dataBytesPerPup _ myMaxBufferSize; SELECT ticks FROM veryShortWait => him.dontWait _ TRUE; veryLongWait => Process.DisableTimeout[@him.inputReady]; ENDCASE => Process.SetTimeout[@him.inputReady, ticks]; MakeLocal[ him, local, remote, mode, id ! UNWIND => PupPktStreamDestroy[him]]; RETURN[him]; END; PupPktStreamDestroy: PUBLIC PROCEDURE [him: Instance] = BEGIN OPEN him; DestroyLocalLocked[him]; JOIN retransmitterFork; PupSocketKick[socket]; JOIN slurpFork; BufferDefs.QueueCleanup[inputQueue]; BufferDefs.QueueCleanup[sentQueue]; PupSocketDestroy[socket]; END; SetMaxAllocation: PUBLIC SAFE PROCEDURE [n: CARDINAL] = CHECKED BEGIN myMaxAllocate _ n; myPathMaxAllocate _ MIN[defaultPupsToAllocate, n]; END; SetMaxBufferSize: PUBLIC SAFE PROCEDURE [n: CARDINAL] = CHECKED BEGIN myMaxBufferSize _ 2*MIN[n, DataWordsPerPupBuffer[]]; END; SetPinging: PUBLIC SAFE PROCEDURE [ping: BOOLEAN] = CHECKED BEGIN myPing _ ping; END; END. ΔPupPktMgr.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Levin 9-Mar-82 10:53:26 Birrell June 22, 1983 5:38 pm IF sentBuffer#NIL THEN ReturnFreePupBuffer[sentBuffer]; Κΐ˜codešœ™Kšœ Οmœ1™K˜—šœ ž˜KšžœE˜LKšžœ#˜*Kšžœžœ ˜*K˜Kšœžœžœ˜9K˜Kšœžœžœ˜Kšœ"žœ˜CKšœžœ˜K˜Kšœžœžœžœ˜$Kšœžœžœžœ˜'K˜šœžœ˜.K˜9—šœžœ˜.K˜8—šœžœ˜2K˜9—šœžœ˜.K˜9—šœ žœ˜%K˜:K˜—šΟnœžœž œ˜$K˜5Kšœ'žœ˜?Kšž˜Kšœžœ˜,K˜Kšœžœ˜ Kšœžœ˜K˜0Kšœžœ˜K˜K˜K˜K˜"K˜(K˜K˜K˜K˜K˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜K˜/K˜Kšœ žœ˜Kšœžœ˜-Kšœžœ˜,K˜+K˜*K˜IK˜OK˜HK˜QK˜1K˜4Kšžœžœ'˜Bšžœž˜Kšœ žœ˜%K˜8Kšžœ/˜6—˜ Kšœžœ˜C—Kšžœ˜ Kšžœ˜K˜—šŸœžœž œ˜7Kšžœžœ˜Kšœ˜Kšžœ˜K˜Kšžœ ˜Kšœ7™7K˜$K˜#K˜Kšžœ˜K˜—š Ÿœžœžœž œžœ˜7Kšžœž˜ K˜Kšœžœ˜2Kšžœ˜K˜—š Ÿœžœžœž œžœ˜7Kšžœžœžœžœ˜GK˜—š Ÿ œžœžœž œžœž˜;Kšžœžœ˜—K˜Kšžœ˜K˜——…—ά`