IM2000-Message-Store-Originator-Access-Protocol DEFINITIONS ::=
BEGIN

-- Data types

-- UTF8String ::= [UNIVERSAL 22] IMPLICIT OCTET STRING

MessageIdentifier ::= OCTET STRING (SIZE(16))

ListName ::= OCTET STRING

DomainName ::= SEQUENCE OF UTF8String

RecipientMailBox ::= SEQUENCE {
	localpart [0] IMPLICIT UTF8String,
	domain    [1] IMPLICIT DomainName
}

ResponseStatus ::= ENUMERATED {
	noerror                  (0),
	errormalformedpdu        (1),
	errorcommandtimeout      (2),
	errorunexpectedcommand   (3),
	errorserviceshutdown     (4),
	errorinternalproblem     (5),
	errornotauthenticated    (6),
	errornotpermitted	     (7),
	errornotenoughroom	     (8),
	errorwouldexceedquota    (9),
	errorlifetimetooshort   (10)
}

SubmissionStatus ::= ENUMERATED {
	acceptable				(0),
	submissionaccessdenied	(1)
}

NotificationStatus ::= ENUMERATED {
	unprocessed				(0),
	baddomain				(1),
	noservice				(2),
	noserver				(3),
	protocolerror			(4),
	nouser					(5),
	notifying				(6),
	silenced				(7)
}

ReadStatus ::= ENUMERATED {
	unread		(0),
	summarised	(1),
	readheaders (2),
	readall		(3)
}

DeliveryStatus ::= SEQUENCE {
	notificationstatus	[0] IMPLICIT NotificationStatus,
	read				[1] IMPLICIT ReadStatus,
	pinnned				[2] IMPLICIT BOOLEAN
}

-- Command PDUs

CommandAuthenticate ::= SEQUENCE {
	account  [0] IMPLICIT UTF8String,
	password [1] IMPLICIT UTF8String
}

CommandSubmitEnvelope ::= SEQUENCE {
	recipients [0] IMPLICIT SEQUENCE OF RecipientMailBox OPTIONAL,
	lists      [1] IMPLICIT SEQUENCE OF ListName OPTIONAL,
	lifetime   [2] IMPLICIT INTEGER	(0..MAX)
}

CommandSubmitMsgChunk ::= SEQUENCE {
	islast [0] IMPLICIT BOOLEAN,
	offset [1] IMPLICIT INTEGER (0..MAX),
	data   [2] IMPLICIT OCTET STRING
}

CommandTrack ::= SEQUENCE {
	identifier  [0] IMPLICIT MessageIdentifier
}

CommandCancel ::= SEQUENCE {
	identifier  [0] IMPLICIT MessageIdentifier
}

Command ::= SEQUENCE {
	commanddata [0] IMPLICIT CHOICE {
		[0] IMPLICIT CommandAuthenticate,
		[1] IMPLICIT CommandSubmitEnvelope,
		[2] IMPLICIT CommandSubmitMsgChunk,
		[3] IMPLICIT CommandTrack,
		[4] IMPLICIT CommandCancel
	}
}

-- Response PDUs

ResponseNull ::= SEQUENCE {}

ResponseAuthenticate ::= SEQUENCE {}

ResponseSubmitEnvelope ::= SEQUENCE {
	recipients  [0] IMPLICIT SEQUENCE OF SubmissionStatus OPTIONAL,
	lists       [1] IMPLICIT SEQUENCE OF SubmissionStatus OPTIONAL,
	maxchunk    [2] IMPLICIT INTEGER (0..MAX) OPTIONAL,
	identifier  [3] IMPLICIT MessageIdentifier OPTIONAL
}

ResponseSubmitMsgChunk ::= SEQUENCE {}

ResponseTrack ::= SEQUENCE {
	recipients  [0] IMPLICIT SEQUENCE OF DeliveryStatus
}

ResponseCancel ::= SEQUENCE {}

Response ::= SEQUENCE {
	forceabort   [0] IMPLICIT BOOLEAN,
	status       [1] IMPLICIT ResponseStatus,
	responsedata [2] IMPLICIT CHOICE {
		[0] IMPLICIT ResponseNull,
		[1] IMPLICIT ResponseAuthenticate,
		[2] IMPLICIT ResponseSubmitEnvelope,
		[3] IMPLICIT ResponseSubmitMsgChunk,
		[4] IMPLICIT ResponseTrack,
		[5] IMPLICIT ResponseCancel
	}
}

-- Main PDU Definition

MSOAPDU ::= CHOICE {
	[1] IMPLICIT Command,
	[2] IMPLICIT Response
}

-- (c) Copyright 2004-2004 Jonathan de Boyne Pollard.  All rights reserved.  "Moral" rights asserted.
-- Permission is hereby granted to copy and to distribute this specification in its original, unmodified form as long as its last modification datestamp information is preserved.
-- Permission is hereby granted to create codecs that have been derived from this specification, and to grant copying and distribution rights for them.

END
