-- Transport Mechanism - DEFS for site cache --

-- [Indigo]<Grapevine>MS>SiteCacheDefs.mesa

-- Andrew Birrell  20-Jan-81 14:38:43 --
-- Mike Schroeder  18-Nov-82 11:14:48 --

DIRECTORY
BodyDefs	USING[ RName ],
HeapDefs	USING[ ReaderHandle ],
NameInfoDefs	USING[ RListHandle ],
ServerDefs	USING[ ServerHandle ];


SiteCacheDefs:	DEFINITIONS = BEGIN

SelectiveFlush:	PROCEDURE[ server: ServerDefs.ServerHandle ];
		    -- Flushes from the site cache those entries which are
		    -- non-primary and indicate a server other than the
		    -- given one.  That is, the only entries not flushed
		    -- are those which are primary and those which are for
		    -- the given server.  This is called by UpServer. --

SingleFlush:	PROCEDURE[ who: BodyDefs.RName ];
		    -- removes from the site cache any entry for "who". --

RecipientInfo:	TYPE = RECORD[
		    SELECT type: * FROM
		       allDown =>  NULL,
		       notFound => NULL,
		       dl =>       [ members: NameInfoDefs.RListHandle ],
                       foreign =>  [ members: HeapDefs.ReaderHandle ],
		       local =>    NULL,
		       found =>    [ server: ServerDefs.ServerHandle ],
		    ENDCASE ];
		-- "allDown": the validity of the R-Name is not known;
		-- "notFound": the R-Name is not valid;
		-- "dl": the R-Name is a group, contents as given;
		-- "local": the R-Name is an individual, best mbx is here;
		-- "found": R-Name is an individual, best mbx as given.

FindMBXSite:	PROCEDURE[ who: BodyDefs.RName ]
		RETURNS[ i: RecipientInfo ];
		    -- checks validity and meaning of R-Name --

RemailInfo:     TYPE = {invalid, remail, stillLocal};
                -- "invalid" means that the inbox may be flushed
                -- "remail" means inbox must be remailed
                -- "stillLocal" means remailing is not necessary

NeedToRemail:   PROCEDURE [ who: BodyDefs.RName ]
                RETURNS [ RemailInfo ];

ValidateRName:	PROCEDURE[ who: BodyDefs.RName ]
		RETURNS[ BOOLEAN ];
		    -- checks validity of R-Name as either recipient or
		    -- distribution list by calling FindMBXSite. --

CheckPrimary:	PROCEDURE[ who: BodyDefs.RName,
			   server: ServerDefs.ServerHandle ]
		RETURNS[ BOOLEAN ];
   -- verifies whether that server is the recipient's primary mailbox --
   -- in case of doubt, replies FALSE --

ForeignDL:	PROC[who: BodyDefs.RName,
		     oldInfo: RecipientInfo]
		RETURNS[ newInfo: RecipientInfo ];
   -- called from "FindMBXSite" to fetch MTP DL's --

END.