-- PacketExchangeInternal.mesa (last edited by: BLyon on: January 20, 1981 2:50 PM)

DIRECTORY
BufferDefs USING [OisBuffer],
OISCP USING [ReturnFreeOisBuffer],
OISCPTypes USING [ExchangeClientType, WaitTime],
PacketExchange USING [defaultWaitTime, ExchangeHandle],
SpecialSystem USING [SocketNumber];

PacketExchangeInternal: DEFINITIONS
IMPORTS OISCP =
BEGIN

-- The Packet Exchange Protocol is a request/reply protocol that provides a little more
-- reliability than raw packets transmitetd from a socket, and less reliabilty than the
-- Sequenced Packet Protocol. Usually one end will provide some service at a
-- well known socket or at a network address that is available through a binding
-- process involving the Clearinghouse. The other end acquires a socket and sends a
-- request. The request will be retransmitted a number of times with the interval
-- between retransmissions based on the delay to the remote entity.

-- procedures
Create: PROCEDURE [localSocket: SpecialSystem.SocketNumber,
receiveRequestCount: CARDINAL ← 1,
privateBuffers: BOOLEAN ← TRUE,
waitTime: OISCPTypes.WaitTime ← PacketExchange.defaultWaitTime]
RETURNS [
PacketExchange.ExchangeHandle]; -- receiveRequestCount is estimate of number of "to be queued" requests; privateBuffers TRUE mean the buffers will be allocated, FALSE mean buffer will be shared with the system buffer pool.

CreateTypicalServer: PROCEDURE [localSocket: SpecialSystem.SocketNumber,
privateBuffers: BOOLEAN ← FALSE] RETURNS [PacketExchange.ExchangeHandle] = INLINE
{RETURN[Create[localSocket, 2,
privateBuffers]]};

CreateTypicalUser: PROCEDURE [localSocket: SpecialSystem.SocketNumber]
RETURNS [
PacketExchange.ExchangeHandle] = INLINE
{RETURN[Create[localSocket, 1,
TRUE]]};

Delete: PROCEDURE [PacketExchange.ExchangeHandle];

-- in SendRequestPacket, user is responsible for requestB and replyB when not NIL;
-- the user CANNOT depend on the value of requestB.requeueProcedure!!
SendRequestPacket: PROCEDURE [h: PacketExchange.ExchangeHandle,
requestB: BufferDefs.OisBuffer,
replyFilter: OISCPTypes.ExchangeClientType ← unspecified]
RETURNS [replyB: BufferDefs.OisBuffer];

WaitForRequestPacket: PROCEDURE [h: PacketExchange.ExchangeHandle,
request: OISCPTypes.ExchangeClientType ← unspecified]
RETURNS [requestB: BufferDefs.OisBuffer];

-- in SendReplyPacket, caller loses ownership of replyB (he can get it back via
-- replyB.requeueProcedure
SendReplyPacket: PROCEDURE [h: PacketExchange.ExchangeHandle, replyB: BufferDefs.OisBuffer];

GetFreeSendPacket: PROCEDURE [h: PacketExchange.ExchangeHandle] RETURNS [BufferDefs.OisBuffer];

ReturnFreeSendPacket: PROCEDURE [b: BufferDefs.OisBuffer] = INLINE
{OISCP.ReturnFreeOisBuffer[b]};

END.

LOG

Time: October 23, 1980 1:50 PM By: Dalal Action: created file.
Time: January 13, 1981 5:30 PM By: BLyon Action: moved to Pilot Communication.