-- Grapevine: configuration for Alto reg + mail server --

-- [Indigo]<Grapevine>MS>MServer.config

-- Andrew Birrell  27-Oct-82 12:15:56 --
-- Mark Johnson   May 29, 1981 1:47 PM --
-- Mike Schroeder, 15-Sep-83 10:22:21 --

DIRECTORY
   SLQueueImpl: FROM "SLQueue";

MServer: CONFIGURATION
   LINKS: CODE
   IMPORTS BitBltDefs, BodyDefs, ByteBltDefs, DisplayDefs,
           DriverDefs, FontDefs, FrameDefs, IODefs, FrameOps, ImageDefs,
           Inline, InlineDefs, MaintainDefs, Process, ProcessDefs,
           PupDefs, PupRouterDefs, PupStream, RestartDefs, SegmentDefs,
           Storage, Stream, StreamDefs, String, StringDefs, SwapperOps,
           Time, TimeDefs, VMDefs, --for missing R-Server--EnquiryDefs
-- FTPServer --, VMSpecial, AltoFile
   EXPORTS BTreeDefs, FTPDefs, GlassDefs, HeapDefs, LocateDefs,
           LogDefs, NameInfoDefs, NameInfoSpecialDefs, ObjectDirDefs,
           PolicyDefs, ProtocolDefs, RetrieveDefs, SendDefs, TimeExtraDefs
-- for HeapCount: --, HeapFileDefs, ObjectDir, Policy
   CONTROL Restart, MSMail, FTPServer, NameLookup, Enquiry =
BEGIN


-- ******** GrapevineUser ******** --

-- There are three instances of NameInfoDefs.  Two are required for
-- correctness, the other is just for efficiency.  For correctness,
-- RegServerImpl must use a version not being used by anyone who
-- might use the IsMemberClosure function.  Similarly, Registration
-- must use an instance not being used by anyone who might use the
-- IdentifyCaller function (in practice, only Maintain).
-- For efficiency, those who do large DL expansions or commonly talk to
-- remote RServers use SlowNameInfo, others use NameInfoDefs.  For
-- efficieny, Locate uses its own instance ("LocateInfo").
-- Thus:
--   "LocateInfo" is just for Locate.
--   "SlowNameInfo" is for the R-Server, SiteCache, MTPServer
--   "NameInfoDefs" is for everyone else (and is exported from this config).

GrapevineUser: CONFIGURATION
   IMPORTS FTPDefs, HeapDefs, Process, PupDefs, PupStream, Stream, String,
           Storage, Time
   EXPORTS LocateDefs, NameInfoDefs, SlowNameInfo, NameInfoSpecialDefs,
           ProtocolDefs, RetrieveDefs, RListDefs
           --, not SendDefs: CreateMail in MServer provides that -- =
   BEGIN
   Protocol;
   [LocateDefs] ←
     Locate[LocateInfo, Process, ProtocolDefs, PupDefs, Storage, String];
   [NameInfoDefs, NameInfoPrivate, NameInfoSpecialDefs, NameUpdateDefs] ←
     NameInfo[LocateDefs, ProtocolDefs, PupDefs, RListDefs];
   [SlowNameInfo, Foo1, Foo2, Foo3] ←
     NameInfo[LocateDefs, ProtocolDefs, PupDefs, RListDefs];
   [LocateInfo, Foo4, Foo5, Foo6] ←
     NameInfo[LocateDefs, ProtocolDefs, PupDefs, RListDefs];
   HeapRList;
   RetrieveGV;
   RetrieveInit;
   RetrieveMail;
   RetrieveMTP;
   RetrievePoll;
   END;

[LocateDefs, NameInfoDefs, SlowNameInfo, NameInfoSpecialDefs,
           ProtocolDefs, RetrieveDefs, RListDefs] ←
GrapevineUser[FTPDefs, HeapDefs, Process, PupDefs, PupStream, Stream,
           String, Storage, Time];



-- ******** ServerMisc ******** --

[BitMapDefs, BTreeDefs, EnquiryDefs, FTPDefs, FTPPrivateDefs,
           GlassDefs, HeapDefs, LogDefs, LogWatchDefs, ObjectDirDefs, PolicyDefs,
           LongTermHeap, TimeExtraDefs
-- for HeapCount: --, HeapFileDefs, ObjectDir, Policy] ←
ServerMisc[BitBltDefs, BodyDefs, ByteBltDefs, FontDefs, FrameDefs, Inline,
           FrameOps, ImageDefs, InlineDefs, Process, ProcessDefs,
           ProtocolDefs, PupStream, SegmentDefs, SendDefs, Storage,
           Stream, String, StringDefs, SwapperOps, Time, TimeDefs, VMDefs];




-- ******** M-Server ******** --

MServer: CONFIGURATION
  IMPORTS BitMapDefs, BodyDefs, BTreeDefs, FTPDefs,
    HeapDefs, LocalNameDefs, LogDefs, NameInfoDefs,
     SlowNameInfo: NameInfoDefs,
    ObjectDirDefs, PolicyDefs, Process, ProtocolDefs, PupDefs, PupStream,
    RetrieveDefs, Stream, String, --LongTerm--Storage,
    Time, VMDefs
  EXPORTS EnquiryDefs, MailboxDefs--for Enquiry--, MSMail, SendDefs,
    RestartDefs =
  BEGIN
  -- Server sub-routines --
  CreateMail;
  DLFetcher;
  MailboxAlloc;
  MailboxRestart;
  ReturnMail;
  ServerAlloc;
  ServerInfo;
  [SiteCacheDefs] ←
    SiteCache[BTreeDefs, HeapDefs, SlowNameInfo, ServerDefs, SiteCacheDefs,
              VMDefs];
  SLQueueImpl;
  SLRestart;
  Spiller;
  -- The driving processes --
  MiscSoc;
  MSMail;
  [RestartDefs] ←
    MTPServer[FTPDefs, HeapDefs, LocalNameDefs, LogDefs,
           SlowNameInfo, PolicyDefs, Process,
           ProtocolDefs, PupDefs, ReturnDefs, ServerDefs, SiteCacheDefs,
           SLDefs, Storage, String, Time];
  ReadForward;
  ReadInput;
  ReadMail;
  ReceiveInput;
  ReceiveMail;
  END;

[EnquiryDefs, MailboxDefs, MSMail, SendDefs, RestartDefs] ←
    MServer[BitMapDefs, BodyDefs, BTreeDefs, FTPDefs,
            HeapDefs, LocalNameDefs, LogDefs, NameInfoDefs, SlowNameInfo,
            ObjectDirDefs, PolicyDefs, Process, ProtocolDefs, PupDefs,
            PupStream, RetrieveDefs, Stream, String, LongTermHeap, Time,
            VMDefs];



-- ******** Everything else ******** --

[LocalNameDefs] ←
   LocalName[HeapDefs, IODefs, LocateDefs, NameInfoDefs,
             ObjectDirDefs,
             ProtocolDefs, PupDefs, LongTermHeap, String];

Enquiry;
FTPServer;
NameLookup;



-- ******** Mainline program! ******** --

Restart;


END.