-- GrapevineUser (Cedar) - public DEFS for basic types --

-- GVBasics.mesa

-- Andrew Birrell August 27, 1982 3:40 pm

DIRECTORY
Rope USING[ ROPE ],
BodyDefs USING[ ItemHeader, ItemType, Password, Timestamp ];

GVBasics: CEDAR DEFINITIONS =

BEGIN

-- 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.



-- Most strings occurring inside Grapevine are restricted in length.

GVString: TYPE = Rope.ROPE;

maxGVStringLength: CARDINAL = 64;



-- An R-Name (Recipient-name) is the basic name within Grapevine. 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.

RName: TYPE = GVString;

maxRNameLength: CARDINAL = maxGVStringLength;



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

Connect: TYPE = GVString;

maxConnectLength: CARDINAL = maxGVStringLength;



-- "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 = GVString;

maxRemarkLength: CARDINAL = maxGVStringLength;



-- "Password" is the representation of an individual's encryption key.

Password: TYPE = BodyDefs.Password;
-- Note that this is not the same as DESFace.Key (today), not
-- even if you use LOOPHOLE. --

MakeKey: PROC[Rope.ROPE] RETURNS[ Password ];



-- Time stamps are used as UID's for messages and for database updates --

Timestamp: TYPE = BodyDefs.Timestamp;
-->>> MACHINE DEPENDENT RECORD[
-->>>  net: [0..256),    the PUP net number --
-->>>  host: [0..256),    the PUP host number --
-->>>  time: PackedTime ];

PackedTime: TYPE = LONG CARDINAL;
-- The number of seconds since midnight, January 1, 1901 GMT. This
-- meaning is defined in the Grapevine protocols. It is bitwise
-- identical with the Pilot and Alto time standards. --

oldestTime: Timestamp = [net:0, host:0, time:0];
-- A useful default vallue for timestamps. --

RopeFromTimestamp: PROC[Timestamp] RETURNS[Rope.ROPE];
-- Returns "3#14@123456789", for example. --




-- 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. --


ItemHeader: TYPE = BodyDefs.ItemHeader;
-->>> MACHINE DEPENDENT RECORD[
-->>>  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 = REF ItemHeader;

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

ItemType: TYPE = BodyDefs.ItemType;
-->>> { PostMark(10B), Sender(20B), ReturnTo(30B), Recipients(40B),
-->>> Text(1010B), Capability(1020B), Audio(1030B), updateItem(2000B),
-->>> reMail(2100B), LastItem(LAST[CARDINAL]) };

END.