-- PacketExchange.mesa (last edited by: BLyon on: January 20, 1981 3:00 PM)

DIRECTORY
OISCPTypes USING [ExchangeClientType, ExchangeID, maxDataBytePerExchange, WaitTime],
PrincOps USING [ByteBltBlock],
NSAddress USING [NetworkAddress, SocketNumber];

PacketExchange: D
EFINITIONS =
B
EGIN

-- The Packet Exc
hange 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.

-- definitions
-- types and constants.
Block: TYPE = Pri
ncOps.ByteBltBlock;
ExchangeHandle: TYPE = REF PacketExchangeObject;
PacketEx
changeObject: TYPE;
RequestHand
le: TYPE = REF RequestObject; -- returned by WaitForRequest
RequestObject: TYPE = RECORD
[
nBytes: CARDINAL, -- the byte size of the
request Block
requestType: OISCPTypes.ExchangeClientType,
-- the next to fi
elds are used in the reply; clients should not touch these.
requestersExchangeID: PRIVATE OISCPTypes.Exch
angeID,
requestersAddress: PRIVATE NSAddress.NetworkAddress];

maxBlockLe
ngth: CARDINAL = OISCPTypes.maxDataBytePerExchange; -- in bytes
ErrorReason: TYPE = {
blockTooBig, blockTooSmall, noDestinationSocket,
noRouteToDestination, hardwareProblem, ab
orted, timeout};
defaultWaitTime: OISCPTypes.Wai
tTime = 60000; -- in msecs

-- i
nterface
-- error
s and signals
Error: ERRO
R [why: ErrorReason];
Timeout:
SIGNAL; -- this may be RESUMEd

-- procedures
-- the requestor
CreateRequesto
r: PROCEDURE [waitTime: OISCPTypes.WaitTime ← defaultWaitTime] RETURNS [ExchangeHandle]; -- at any socket number

SendRequest: PUBLIC PROCEDURE [h: ExchangeHandle, remote: NSAddress.NetworkAddress,
requestBlk, replyBlk: Block,
requestType: OISCPTypes.ExchangeClientType ← unspecified]
RETURNS [nBytes:
CARDINAL, replyType: OISCPTypes.ExchangeClientType];

-- the replyer
CreateReplyer: PROCEDURE [localSocket: NS
Address.SocketNumber,
requestCount: CARDINAL ←
1, waitTime: OISCPTypes.WaitTime ← defaultWaitTime]
RETURNS [ExchangeHandle]; -- requestCoun
t is estimate of number of "to be queued" requests

-- user m
ust save rH inorder to send a reply
WaitForRequest: PROCEDURE [h: ExchangeHandle, requestBlk: Block,
requiredRequestType: OISCPTypes.ExchangeClientType ← unspec
ified]
RETURNS [rH: RequestHandle];

-- upon succe
ss return of SendReply, rH is invalid.
SendReply: PUBLIC PROCEDURE [h: ExchangeHandle, rH: RequestHandle, replyBlk: Block, replyType: OISCPTypes.ExchangeC
lientType ← unspecified];

-- request and reply can both point to t
he same piece of storage.
Delete: PR
OCEDURE [h: ExchangeHandle];
SetWaitTime: PROCEDURE [h: ExchangeHandle, wai
tTime: OISCPTypes.WaitTime];
END.

LOG

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