ThNet.mesa
Last modified by D. Swinehart, July 6, 1987 2:30:46 pm PDT
Ephemeral and Persistent data base services for Thrush
DIRECTORY
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: BOOLEANFALSE, -- If TRUE and debug, Lark events reported SOMEwhere.
Otherwise, only reported if LarkControl window up for this Lark and debug=TRUE
autoGVUpdate: BOOLEANFALSE,
Default values for ringing -- too device-dependent, but life is hard.
ringsInvalid: BOOLTRUE, -- 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: BOOLTRUE, -- bad key indices won't kill Lark
pollParties: BOOLTRUE, -- probe Parties at intervals
pollPartiesInterval: INT ← 1, -- per-Parties Interval, in seconds.
pollPartyTypes: LIST OF ATOMNIL, -- possibly LIST[$telephone, $individual]
toSmartsTimeoutOK: BOOLTRUE,
toSmartsTimeout: CARDINAL ← 5 -- How long to give Smarts to respond to an RPC packet.
];
pd: REF PD;
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: BOOLFALSE ] 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: ROPENIL, key: ATOM←$officeNumber,
feep: BOOLFALSE, 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: ROPENIL, howToComplain: VoiceUtils.WhereToReport←$System]
RETURNS[wpState: WPState←NIL];
CloseWhitePagesDatabase: PUBLIC SAFE PROC[
wpState: WPState, howToComplain: VoiceUtils.WhereToReport←$System]
RETURNS[ok: BOOLTRUE];
Telephone number interpretation
PhoneMap: TYPE = LIST OF PhoneMapEntry;
PhoneMapEntry: TYPE = RECORD [
pattern: ROPE,
replacement: ROPE
];
HowToDial: PROC[phoneNumber: ROPE, ownExtension: ROPENIL]
RETURNS [whatToDial: ROPE, isLocalExtension: BOOLEAN];
FeepName: PROC[rName: ROPE] RETURNS [feepName: ROPE];
}.