Names.Mesa
Last modified by Swinehart, November 23, 1983 10:39 am
Last Edited by: Pier, May 1, 1984 11:13:41 am PDT
DIRECTORY
Basics USING [ Comparison ],
BasicTime USING [ GMT ],
GVBasics USING [ Password ],
Rope USING [ ROPE ],
RPC USING [ Conversation, ConversationLevel, EncryptionKey, Principal, ShortROPE ],
RPCPkt USING [ Machine ]
;
Names: CEDAR DEFINITIONS = {
ROPE: TYPE = RPC.ShortROPE;
NetAddress: TYPE = RPCPkt.Machine;
Rname: TYPE = ROPE;
anonymousRname: Rname = NIL;
FileSpec: TYPE = REF FileSpecBody;
FileSpecBody: TYPE = RECORD [
server, name, password, dirName, dirPassword, fileName: Rope.ROPENIL];
Rspec: TYPE = REF RspecBody;
RspecBody: TYPE = RECORD [
simpleName: ROPENIL,
registry: ROPENIL];
Results: TYPE = {ok, notFound, error};
ModeNotFound: TYPE = { ok, create, error }; -- create not available
CacheBehavior: TYPE = { lookupAfter, lookupFirst, lookInCacheOnly };
GVDetails: TYPE = REF GVDetailsR;
GVDetailsR: TYPE= RECORD [
cacheIndex: NAT,
rName: ROPE,
lastTimeValid: BasicTime.GMT,
connect: ROPENIL,
forward: ROPENIL,
prevForward: ROPENIL,
mode: CHAR← 'O,
ringEnable: CHAR ← 'R, -- { R = on (regular), S = subdued, O = off };
system: ROPENIL,
type: ROPENIL,
instance: ROPENIL,
range: ROPENIL,
telephoneExtension: ROPENIL,
key: RPC.EncryptionKey←NULL,
done: CONDITION,
larkSpec: BOOLFALSE,
userSpec: BOOLFALSE,
valid: BOOLFALSE,
canCreate: BOOLFALSE, -- GetDetails can make one if it isn't there.
mustAuthenticate: BOOLFALSE,
authentic: BOOLFALSE,
ringTune: ROPENIL --formatted as a Laurel/Hardy NewMail tune. See Play.df for description
];
ParseFile: PROCEDURE[
server: ROPENIL,
dirName: ROPENIL,
dirPassword: ROPENIL,
fileName: ROPE←] RETURNS [FileSpec];
adds default registry if there's no registry in the input.
Registrize: PROC[name: ROPE] RETURNS [ROPE];
LoggedInName.DefaultRegistry
CurrentRName: PROC RETURNS [ROPE];
Key made from logged in password.
CurrentPasskey: PROC[passwordText: ROPENIL] RETURNS [RPC.EncryptionKey];
CurrentPassword: PROC[passwordText: ROPENIL] RETURNS [GVBasics.Password] = INLINE {
RETURN[LOOPHOLE[CurrentPasskey[passwordText]]]; };
OwnNetAddress: PROC RETURNS [netAddress: NetAddress];
.DefaultRegistry
DefaultRegistry: PROC RETURNS [ROPE];
Determine Internet database values associated with hardware network addresses
Larks are associated by default with individuals, or groups of individuals <<not
yet supported.>> This assignment can be changed dynamically if the system can
determine that the individuals are elsewhere.
The current implementation uses Grapevine (Lark registry) to store the mappings;
they are set using Maintain, retrieved using the following functions.
Given the hardware machine identification of a Lark (a NetAddress), derive the default Rname.
These days, uses GetDefaultDetails, extracts RName -- expected to languish.
GetDefaultRName: PROC[netAddress: NetAddress] RETURNS [name: Rname←NIL];
Raises NetError
GetDefaultInstance: PROC[netAddress: NetAddress, tryForName: BOOLFALSE] RETURNS [instance: ROPE];
Given the hardware machine identification of a Lark, use the inverse name lookup service to
derive a machine name, if possible; otherwise return a string form of the NetAddress
(e.g., "173#125#)
Raises NetError
GetGVDetails: PROC[
rName: ROPE,
mode: ModeNotFound𡤎rror,
behavior: CacheBehavior←lookupAfter,
authenticate: BOOLFALSE,
key: RPC.EncryptionKey←NULL -- must be supplied if authenticate=TRUE
] RETURNS [results: Results←notFound, details: GVDetails←NIL];
Basic access to Grapevine and to a local cache of recent GV name lookups.
SetGVDetails: PROC[details: GVDetails];
Caller shouldn't believe details after call; call Get ... again to re-use.
GetDefaultDetails: PROC[netAddress: NetAddress] RETURNS [results: Results, details: GVDetails];
Uses GetGVDetails to obtain RName and particulars describing a particular Lark.
RestoreGVCache: PROC;
SaveGVCache: PROC;
FlushGVCache: PROC;
WaitForGV: PROC;
Wait for all updates to/from the Grapevine cache to complete. Calls for cooperation on the part of the user/clients, who should not also be launching new actions that will cause Grapevine activities. Used to determine when it's OK to do a RollBack.
StartConversation: PROC[
caller: RPC.Principal, key: RPC.EncryptionKey, callee: RPC.Principal, level: RPC.ConversationLevel]
RETURNS[ conversation: RPC.Conversation];
Parsing Rnames
RnameToRspec: PROC[name: Rname, defaultRegistry: ROPENIL] RETURNS [spec: Rspec]; -- xxxxxxx.rr => Rname
returns NIL if name is not in form xxxxxxx.rr and no default registry is provided.
RspecToRname: PROC[spec: Rspec] RETURNS [name: Rname]; -- Rspec => xxxxxxx.rr
RspecToSortName: PROC[spec: Rspec] RETURNS [name: ROPE]; -- Rspec => rr.xxxxxxx
RNameAtom: PROC[rName: Rname] RETURNS [ATOM];
GMTComp: PROC[t1, t2: BasicTime.GMT] RETURNS [c: Basics.Comparison];
NetProblem: TYPE = {ok, noSuchName, invalidName, noSuchIndex, noSuchFone, badPassword, notAuthenticated, tryLater, notInitialized, cantImportSmarts};
NetError: ERROR[problem: NetProblem];
}....