PacketExchange.mesa (last edited by: AOF on: 24-May-83 13:35:14)
Copyright (C) Xerox Corporation 1982. All rights reserved.
Last Edited by: Willie-Sue, April 4, 1984 1:06:37 pm PST
PacketExchange: DEFINITIONS =
BEGIN
The Packet Exchange Protocol is a request/reply protocol that provides a
little more reliability than raw packets transmitted from a socket, and
less reliabilty than the Sequenced Packet Protocol. Usually one end (the
Replier) 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 (the Requestor) acquires a socket and sends a request.
TYPES AND CONSTANTS.
ExchangeClientType: TYPE = MACHINE DEPENDENT {
unspecified(0), timeService(1), clearinghouseService(2), teledebug(10B),
electronicMailFirstPEType(20B), electronicMailLastPEType(27B),
remoteDebugFirstPEType(30B), remoteDebugLastPEType(37B),
acceptanceTestRegistration(40B), performanceTestData(41B),
protocolCertification(50B), voyeur(51B),
dixieDataPEType(101B), dixieAckPEType(102B),
dixieBusyPEType(103B), dixieErrorPEType(104B),
outsideXeroxFirst(100000B), outsideXeroxLast(LAST[CARDINAL])};
ExchangeID: TYPE = MACHINE DEPENDENT RECORD [a, b: WORD];
END.
ExchangeHandle: TYPE [2];
nullExchangeHandle: READONLY ExchangeHandle;

RequestHandle: TYPE = LONG POINTER TO READONLY RequestObject;
RequestObject: TYPE = RECORD [
nBytes: CARDINAL, --the size (bytes) of the request block received
requestType: ExchangeClientType, --type of request received
requestorsExchangeID: ExchangeID, --unique (at requestor) exchange ID
requestorsAddress: System.NetworkAddress]; --of the requestor

WaitTime: TYPE = LONG CARDINAL;
defaultWaitTime: WaitTime = 60000; --in msecs
defaultRetransmissionInterval: WaitTime = 30000; --in msecs

maxBlockLength: READONLY CARDINAL; --maximum bytes per exchange

--SIGNALS AND ERRORS
Error: ERROR [why: ErrorReason];
ErrorReason: TYPE = {
blockTooBig, blockTooSmall, noDestinationSocket, noRouteToDestination,
noReceiverAtDestination, insufficientResourcesAtDestination,
rejectedByReceiver, hardwareProblem, aborted, timeout};
Timeout: SIGNAL; --this may be RESUMEd

--PROCEDURES
CreateRequestor: PROCEDURE [
waitTime: WaitTime ← defaultWaitTime,
retransmissionInterval: WaitTime ← defaultRetransmissionInterval]
RETURNS [ExchangeHandle];

CreateReplier: PROCEDURE [
local: System.NetworkAddress, requestCount: CARDINAL ← 1,
waitTime: WaitTime ← defaultWaitTime,
retransmissionInterval: WaitTime ← defaultRetransmissionInterval]
RETURNS [ExchangeHandle];

Delete: PROCEDURE [h: ExchangeHandle];

RejectRequest: PUBLIC PROCEDURE [h: ExchangeHandle, rH: RequestHandle];

SendReply: PUBLIC PROCEDURE [
h: ExchangeHandle, rH: RequestHandle, replyBlk: Environment.Block,
replyType: ExchangeClientType ← unspecified];

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

SetWaitTimes: PROCEDURE [
h: ExchangeHandle, waitTime, retransmissionInterval: WaitTime];

WaitForRequest: PROCEDURE [
h: ExchangeHandle, requestBlk: Environment.Block,
requiredRequestType: ExchangeClientType ← unspecified]
RETURNS [rH: RequestHandle];

ExchWords: PROCEDURE [LONG UNSPECIFIED] RETURNS [LONG UNSPECIFIED] =
MACHINE CODE {Mopcodes.zEXCH};

END.