LarkSmarts.mesa
Last modified by Swinehart and Owicki, May 9, 1986 4:55:22 pm PDT
Last modified by Stewart, October 12, 1982 1:16 pm
External interface to Thrush-based smarts for Lark (Etherphone)
(Lark=>Smarts)
DIRECTORY
BasicTime USING [ GMT, nullGMT ],
Lark USING [ Device, StatusEvents, LarkModel, Machine ],
RPC USING [ Conversation, ShortROPE ]
;
LarkSmarts: CEDAR DEFINITIONS = {
OPEN Lark;
Epoch: TYPE = BasicTime.GMT;
ROPE: TYPE = RPC.ShortROPE;
Machine: TYPE = Lark.Machine;
SmartsHandle: TYPE = LONG CARDINAL;
SHHH: TYPE = RPC.Conversation;
nullHandle: SmartsHandle = LOOPHOLE[NIL[REF], LONG CARDINAL];
Initialization/Registration
Lark uses an Agent, which it obtains using special broadcast techniques, to obtain the information needed to do a default authentication (using a built-in password), get a LarkSmarts interface from an appropriate server, and call Register. See The Agent interface.
On various occasions, Lark calls the Register function. The occasions are:
1. Just after importing the Thrush interface during startup.
2. When communications with Thrush have been lost, to reestablish connections, perhaps with a different Thrush (usually, Lark will have just repeated the Import operation, as well.)
3. In immediate response to Lark.PleaseRegister[]. See that function for more details.
Thrush can reaffirm the old SmartsHandle (if there is one), or supply a new one.
model describes the Lark to its Smarts.
Philosophy. It's the Lark's responsibility to identify itself to some Thrush server,
to keep trying when none are available (resume from Import timeout), and to
renew the association whenever contact is lost.
Register: PROC[
shh: SHHH←, -- encrypts connection; (authentic) Rname is extractable
oldSmartsID: SmartsHandle ← nullHandle, -- If Lark is reregistering without having restarted.
oldEpoch: Epoch ← BasicTime.nullGMT,
machine: Machine, -- Lark's machine; useful in a number of ways
model: LarkModel←,  -- Describes the Lark hardware, switch settings, and the like
authenticated: BOOLFALSE, -- TRUE if user logged in explicitly before registering
(see also Login, below)
clientInstance: ROPE← -- obtained from Identify
]
RETURNS [ smartsID: SmartsHandle, epoch: Epoch ];
Event Reporting
The Lark user has pushed a button or switched a switch. If device is keyboard (event IN CharacterEvent), event should be PUNned to CHAR. If event is enabled/disabled (i.e., onHook, offHook, and the like), device should be one of the transducer devices. A sequence of events can be recorded in a single call.
RecordEvent: PROC[shh: SHHH←, smartsID: SmartsHandle←, whatHappened: StatusEvents←]
RETURNS[success: BOOL];
Will be unsuccessful if the smartsID is unfamiliar.
EventRope: PROC[
shh: SHHH←, smartsID: SmartsHandle←, time: CARDINAL, device: Lark.Device, events: ROPE]
RETURNS[success: BOOL];
Will be unsuccessful if the smartsID is unfamiliar.
The SHHH value should be a new one, based on a recent local login activity. The server can obtain the new RName from the SHHH value. This function can also be used to forget the authenticated individual and reestablish the default, built in password (authenticated←FALSE)
Login: PROC[shh: SHHH←, smartsID: SmartsHandle←, authenticated: BOOLTRUE];
}.