<<>> <> <> <> <> <<>> <> Inbasket: PROGRAM 18 VERSION 2 = BEGIN DEPENDS UPON Authentication (14) VERSION 2, BulkData (0) VERSION 1, CHName (2) VERSION 0, MailTransport (17) VERSION 5; <> Credentials: TYPE = Authentication.Credentials; Verifier:TYPE = Authentication.Verifier; Name: TYPE = CHName.Name; Index: TYPE = LONG CARDINAL; -- Names a message; unique until the mailbox is moved. nullIndex: Index = 0; Range: TYPE = RECORD [ low, high: Index ]; MessageStatus: TYPE = RECORD [ userDefinedStatus: CARDINAL, existenceOfMessage: Exist ]; Exist: TYPE = {new(0), known(1)}; BodyPartIndex: TYPE = CARDINAL; <> BodyPartSequence: TYPE = SEQUENCE 500 OF BodyPartIndex; <> <> <> BodyPartsStatus: TYPE = SEQUENCE 500 OF BOOLEAN; <> <> BodyPartStatusChangeSequence: TYPE = SEQUENCE 500 OF BodyPartStatusChange; BodyPartStatusChange: TYPE = RECORD [ bodyPartIndex: BodyPartIndex, deleteable: Del ]; Del: TYPE = {true(0), noChange(1)}; <> Status: TYPE = RECORD [ messageStatus: MessageStatus, bodyPartsStatus: BodyPartsStatus ]; Session: TYPE = RECORD [ token: Two, verifier: Verifier ]; Two: TYPE = ARRAY 2 OF UNSPECIFIED; Anchor: TYPE = ARRAY 5 OF UNSPECIFIED; -- Stored by clients that cache info across sessions. State: TYPE = RECORD [ -- State of the mailbox, used for polling. new: CARDINAL, -- Number of "new" messages in the mailbox. total: CARDINAL -- Total number of messages in the mailbox. ]; <> Logon: PROCEDURE [inbasket: Name, credentials: Credentials, verifier: Verifier] RETURNS [session: Session, state: State, anchor: Anchor] REPORTS [AccessError, AuthenticationError, InbasketInUse, OtherError, ServiceError] = 5; <> Logoff: PROCEDURE [session: Session] REPORTS [AuthenticationError, OtherError, SessionError] = 4; <> MailPoll: PROCEDURE [inbasket:Name, credentials: Credentials, verifier: Verifier] RETURNS [state: State] REPORTS [AccessError, AuthenticationError, OtherError, ServiceError] = 7; <> MailCheck: PROCEDURE [session: Session] RETURNS [state: State] REPORTS [AuthenticationError, OtherError, SessionError, ServiceError] = 6; <> WhichOne: TYPE = {this(0), next(1)}; RetrieveEnvelopes: PROCEDURE [last: Index, whichMsg: WhichOne, session: Session] RETURNS [transportEnvelope: MailTransport.Envelope, status: Status, next: Index] REPORTS [AuthenticationError, IndexError, OtherError, SessionError, ServiceError] = 2; <> RetrieveBodyParts: PROCEDURE [message: Index, bodyParts: BodyPartSequence, contents: BulkData.Sink, session: Session] REPORTS [AuthenticationError, IndexError, OtherError, SessionError, ServiceError, TransferError] = 8; <> ChangeMessageStatus: PROCEDURE [range: Range, changeUserDefinedStatus: BOOLEAN, newUserDefinedStatus: CARDINAL, session: Session] REPORTS [AuthenticationError, IndexError, OtherError, SessionError, ServiceError] = 0; <> ChangeBodyPartsStatus: PROCEDURE [index: Index, setStatusTo: BodyPartStatusChangeSequence, session: Session] RETURNS [deleted: BOOLEAN] REPORTS [AuthenticationError, IndexError, OtherError, SessionError, ServiceError] = 3; <> Delete: PROCEDURE [range: Range, session: Session] REPORTS [AuthenticationError, OtherError, SessionError, ServiceError] = 1; <> <> <> GetSize: PROCEDURE [inbasket: Name, credentials: Credentials, verifier: Verifier] RETURNS [sizeInBytes: LONG CARDINAL] REPORTS [AuthenticationError, AccessError, OtherError, ServiceError] =10; <> <> AccessError: ERROR [problem: AccessProblem] = 0; AccessProblem: TYPE = { accessRightsInsufficient(0), -- the user doesn't have access accessRightsIndeterminate(1), -- cannot determine whether the user has access noSuchInbasket(2), -- no inbasket for this recipient inbasketIndeterminate(3), -- cannot resolve potential alias wrongService(4) -- mailbox does not reside on this service }; AuthenticationError: ERROR [problem: Authentication.Problem] = 1; <<>> <> SessionError: ERROR [problem: SessionProblem] = 5; SessionProblem: TYPE = { tokenInvalid(0) -- the Inbasket.Session is invalid }; ServiceError: ERROR [problem: ServiceProblem] = 6; ServiceProblem: TYPE = { cannotAuthenticate(0), -- generally, an Authentication.CallProblem on the server serviceFull(1), -- no more operations of that type can be accepted serviceUnavailable(2) -- operations of that type are currently disabled }; TransferError: ERROR [problem: TransferProblem] = 7; TransferProblem: TYPE = { aborted(0) -- the transfer was aborted by the source or sink }; OtherError: ERROR [problem: OtherProblem] = 8; OtherProblem: TYPE = { cantExpedite(0), -- the operation cannot be expedited malformedMessage(1), -- the message bodyparts or other portions are malformed invalidOperation(2), -- the sequence of operations is invalid last(65535) -- errors will be added to the protocol here }; IndexError: ERROR [problem: IndexProblem] = 9; IndexProblem: TYPE = { invalidIndex(0), -- the index doesn't name an existing message invalidBodyPartIndex(1) -- the index doesn't name an existing body part }; InbasketInUse: ERROR [user: Name] = 10; -- inbasket is currently in use by "user". <> <> <<>> <> <<>> END.