ThNet.mesa
Last modified by D. Swinehart, November 8, 1986 1:36:43 pm PST
Ephemeral and Persistent data base services for Thrush
DIRECTORY
BTree,
BTreeSimple,
BTreeVM,
FS,
LoganBerry USING [ Entry, OpenDB ],
RefID USING [ nullID ],
Rope USING [ ROPE ],
VoiceUtils USING [ WhereToReport ]
;
ThNet: CEDAR DEFINITIONS = {
Thrush-wide system control parameters.
PD:
TYPE =
RECORD [
debug: BOOLEAN, -- Diagnostic and progress display
encryptionRequested: BOOLEAN, -- Encrypt RPC
encryptVoice: BOOLEAN, -- Separate decision; false for debugging only, please!
defaultLarkReports:
BOOLEAN←
FALSE,
-- If TRUE and debug, Lark events reported SOMEwhere.
Otherwise, only reported if LarkControl window up for this Lark and debug=TRUE
autoGVUpdate: BOOLEAN←FALSE,
Default values for ringing -- too device-dependent, but life is hard.
ringsInvalid: BOOL←TRUE, -- set to cause recreation of standard ring tunes
tonesVolume: CARDINAL ← 2,
defaultRingVolume: CARDINAL ← 2,
subduedVolumeInterval: CARDINAL𡤁,
feepVolume: CARDINAL ← 0,
serviceGuaranteedReservationTime: INT𡤃,
postIdleTimeout: NAT ← 10, -- in seconds (see ThPartyOpsImpl)
nullKeyCorrectParity: BOOL ← TRUE -- bad key indices won't kill Lark.
];
Types
ROPE: TYPE=Rope.ROPE;
WPListing: TYPE = LoganBerry.Entry; -- a list of keys and values.
WPState: TYPE = REF WPStateBody; -- a handle for the database.
WPStateBody:
TYPE =
RECORD [
db: LoganBerry.OpenDB←RefID.nullID,
dbName: ROPE,
howToComplain: VoiceUtils.WhereToReport←NIL
];
WhitePages
These functions provide access to a simple "White Pages"
database. This one is assumed to be keyed and sorted by RName and Name.
They are at present used primarily for access by RName diddling.
WhitePagesLookup:
PROC[ wpState: WPState, name:
ROPE, feep:
BOOL←
FALSE ]
RETURNS [ listing: WPListing ];
name must be in form rr.xxxxxxx
Returns first listing for which name is a substring, case unimportant, of the listing
WhitePagesEntry:
PROC[
wpState: WPState, name: ROPE←NIL, key: ATOM←$officeNumber,
feep: BOOL←FALSE, listing: WPListing←NIL
] RETURNS [fullRName: ROPE, entry: ROPE, newListing: WPListing];
If listing is provided, the appropriate field is extracted. Otherwise, a listing is first obtained from the database.
WhitePagesEnter:
PROC[wpState: WPState, listing: WPListing];
Put in something new, or replace something old.
WhitePagesPrint: PUBLIC SAFE PROC[wpState: WPState, listing: WPListing];
NewListing:
PROC
RETURNS [WPListing] =
INLINE {
RETURN[
NIL]; };
This and the following provide a way to build database entries.
List:
PROC[listing: WPListing, key:
ATOM, value: Rope.
ROPE];
Include an enumerator here, if anybody ends up wanting it outside the implementation.
InitWhitePagesDatabase:
PUBLIC
SAFE
PROC[
NIL for fileName defaults to User Profile values
fileName: ROPE←NIL, howToComplain: VoiceUtils.WhereToReport←$System]
RETURNS[wpState: WPState←NIL];
CloseWhitePagesDatabase:
PUBLIC
SAFE
PROC[
wpState: WPState, howToComplain: VoiceUtils.WhereToReport←$System]
RETURNS[ok: BOOL←TRUE];
Telephone number interpretation
PhoneMap: TYPE = LIST OF PhoneMapEntry;
PhoneMapEntry:
TYPE =
RECORD [
pattern: ROPE,
replacement: ROPE
];
HowToDial:
PROC[phoneNumber:
ROPE, ownExtension:
ROPE←
NIL]
RETURNS [whatToDial: ROPE, isLocalExtension: BOOLEAN];
FeepName: PROC[rName: ROPE] RETURNS [feepName: ROPE];
}.