// PupBSP.decl -- Byte Stream Protocol definitions
// Copyright Xerox Corporation 1979
// Last modified May 24, 1979 8:55 AM by Taft
// Pup0.decl, Pup1.decl, and PupRTP.decl must be compiled before this.
get "Streams.d"
//----------------------------------------------------------------------------
structure BSPStr: // BSP Stream block (parallels PupBSPa.asm)
//----------------------------------------------------------------------------
[
@ST // A standard OS stream
iPBI word // current input buffer. 0 if none
iWordP word // -> word containing next byte
iByteP word // Next byte pos. 0 = left, 1 = right
iByteC word // remaining input byte count
oPBI word // current output buffer. 0 if none
oWordP word // -> word containing next byte
oByteP word // Next byte pos. 0 = left, 1 = right
oByteC word // remaining output byte count
]
manifest lenBSPStr = size BSPStr/16
compileif offset BSPStr.iPBI/16 ne 12 then
[ Barf("BSPStr structure disagrees with assumptions in PupBSPa.asm") ]
// Invariant: iByteC=0 iff iPBI=0, oByteC=0 iff oPBI=0
//----------------------------------------------------------------------------
structure BSPSoc:
//----------------------------------------------------------------------------
[
@RTPSoc =
[
blank word offset RTPSoc.rtpOtherPupProc/16
bspPupProc word // local name for rtpOtherPupProc
bspTimer word // local name for rtpOtherTimer
bspTimerProc word // local name for rtpOtherTimerProc
]
bspOtherPupProc word // proc called for non-RTP and non-BSP pups
userByteID↑1,2 word // ID of packet we are working on
rcvByteID↑1,2 word // first byte beyond what I have acked
rcvIntID↑1,2 word // ID of next incoming interrupt
unReadPups word // Pups from left window edge to first hole
bspIQ: // data and mark pups for local process
[
head word
tail word
]
xmitByteID↑1,2 word // ID of next outgoing packet created
xmitIntID↑1,2 word // ID of next outgoing interrupt
lastAckID↑1,2 word // ID of last received ack
unAckedPups word // outstanding and unacknowledged Pups
unAckedBytes word // outstanding and unacknowledged bytes
bytesPerPup word
pupAlloc word // remaining outgoing Pup allocation
byteAlloc word // remaining outgoing byte allocation
maxPupAlloc word // upper bound on pupAlloc
pupAllocCount word // counter controlling changes to maxPupAlloc
aDataCount word // counter incremented once per AData sent
lastADataTime word // time at which last AData was sent
aDataTimeout word // AData timeout interval now being used
inactivityTimer word // connection inactivity timer
bspTQ: // pups awaiting acknowledgement
[
head word
tail word
]
bspStatus word =
[
markPending bit // encountered Mark in stream
interruptOut bit // unacknowledged Interrupt outstanding
interruptIn bit // Interrupt received
ackPending bit // AData received, need to send Ack
ackRequested bit // AData sent, expecting Ack
sentZeroAlloc bit // need to send gratuitous Ack
noInactivityTimeout bit // don't abort upon inactivity timeout
]
bspStr word lenBSPStr = @BSPStr
]
manifest lenBSPSoc = size BSPSoc/16
manifest
[
// Byte Stream Protocol Pup types
typeData = #20
typeAData = #21
typeAck = #22
typeMark = #23
typeAMark = #26
typeInterrupt = #24
typeInterruptReply = #25
// Error codes for BSP streams
ecBadStateForGets = 2200
ecGetsTimeout = 2201
ecMarkEncountered = 2202
ecBadStateForPuts = 2203
ecPutsTimeout = 2204
ecBadBSPGetMark = 2205
// timeout intervals
// initial value of aDataTimeout
// = time to wait after sending AData before reprobing
initialADataTimeout = 100
// maximum time after sending Data before eliciting Ack
outstandingDataTimeout = 25
// timeout to use when no packets are outstanding
idleTimeout = 1500
// inactivity timeout, expiration of which causes connection to be aborted
inactivityTimeout = 12000
// whenever pupAllocHysteresis outgoing Pups have been successfully
// acknowledged with no congestion errors, attempt to increase
// the outgoing Pup allocation (maxPupAlloc).
pupAllocHysteresis = 50
// initial maximum Pup allocation that the sender will use, regardless
// of the allocation provided by the receiver.
initialMaxPupAlloc = 5
]