-- Transport Mechanism - public DEFS for message body layout --

-- [Juniper]<DMS>MS>BodyDefs.mesa

-- Andrew Birrell  14-Aug-80 10:31:53 --



-- Note that incompatible changes to these definitions may require the
-- cooperation of all mail servers and their clients, and the flushing of
-- the mail server filestores. --

-- The following types are basic to the transport mechanism.
-- "Connect", "Password" and "Remark" don't really occur in message bodies,
-- but this is the most stable defs file for them. They are used by public
-- clients of the transport mechanism.

-- An R-Name (Recipient-name) is the basic name within the transport
-- mechanism.  It is of the form SN.Reg ( Simple-Name . Registry ).  The
-- representation is as a string of up to maxRNameLength characters.
-- In message bodies, R-Names occupy an integral number of words.


maxRNameLength:	CARDINAL = 64;

   { RETURN[SIZE[StringBody[name.length]]] };

-- "Connect" is the representation of a connect-site for an individual
-- (typically a server).  It is a string which is either an NLS name
-- or a PUP address.

Connect:	TYPE = STRING;

maxConnectLength: CARDINAL = 64;

-- "Remark" is the representation of a remark associated with a group,
-- or of a TOC entry in a mailbox.  It is a human readable string.

Remark:		TYPE = STRING;

maxRemarkLength: CARDINAL = 64;

-- "Password" is the representation of an individual's encryption key.
-- It is intended to be used with the DES encryption algorithm.

Password:	TYPE = ARRAY[0..3] OF CARDINAL;

-- The following definitions are concerned with the layout of "message bodies".  A message body is the internal representation of a message within and between mail servers.  It is also sent to the client when he retrieves his mail.  A message body contains a number of "items".  Items are used to represent such things as postmark, recipients, sender, as well as the message text (if any), or other content of the message such as audio or capabilities.  Some items are mandatory and always occur precisely once, others may occur any number of times (including zero).  Each Item has a header, followed by the number of bytes of data specified by the header, followed by an extra byte if its length is odd.  Thus items always start at a word boundary.  A complete message body consists of the mandatory items followed by the optional ones. --

-- Time stamps --

		    net:  [0..256), -- the PUP net number --
		    host: [0..256), -- the PUP host number --
		    time: PackedTime];

		    -- the number of seconds since midnight, January 1,
		    -- 1901 GMT --

oldestTime:	Timestamp = [net:0, host:0, time:0];

-- Layout of items --

		    type:	ItemType,
		    length:	ItemLength ];
		    -- Each item consists of an ItemHeader followed by a
		    -- variable length array, containing the number of
		    -- bytes specified by the length.  The item is
		    -- followed by an extra byte if its length is odd. --

Item:            TYPE = POINTER TO ItemHeader;

ItemLength:      TYPE = LONG CARDINAL;
		    -- Number of data bytes in the item, excluding header--


--- Mandatory items --

-- In each message body, each of these items occurs precisely once, and they occur in the order given here --

PostMark(10B),	-- the item contains a timestamp giving the
		-- originating host and approximate time at which the
		-- message was given to the transport mechanism. --

Sender(20B),	-- the item contains precisely one R-Name, being that
		-- of the sender of this message --

ReturnTo(30B),	-- the item contains precisely one R-Name, being that
		-- of the client to whom non-delivery of the message
		-- should be notified --

Recipients(40B), -- the item contains a sequence of R-Names, being the
		-- intended recipients of this message, as provided by
		-- the sender --

-- Items used solely by clients --

Text(1010B),	-- the item contains a sequence of characters forming
		-- a textual message --

Capability(1020B), -- the item contains a capability --

Audio(1030B),	-- the item is an audio message --

-- Items used in registration server internal mail --

updateItem(2000B), -- the item contains a registration server entry --

reMail(2100B),	-- the item is internal mail to a mail server,
		-- containing precisely one R-Name, indicating that
		-- the corresponding mailbox should be re-mailed --

-- Mandatory last item --

LastItem(LAST[CARDINAL]) -- the item contains no data, and always occurs
		-- as the last item in a message body --