BluejayRegister:
PUBLIC
PROC [bluejayInstance, thrushInstance, serverPassword: Thrush.
ROPE]
RETURNS [partyID: Thrush.PartyHandle←Thrush.nullHandle,
smartsID: Thrush.SmartsHandle←Thrush.nullHandle] = {
myName: ThSmartsRpcControl.InterfaceName ← [
type: "ThSmarts.Lark",
instance: bluejayInstance,
version: ThVersions.JayVR];
serverPasskey: RPC.EncryptionKey ← Names.CurrentPasskey[serverPassword];
thVR: RPC.VersionRange = ThVersions.GetThrushVR;
Export ThSmarts Interface
myName ← [
type: "ThSmarts.Lark",
instance: bluejayInstance,
version: ThVersions.JayVR];
ThSmartsRpcControl.ExportInterface[
interfaceName: myName,
user: bluejayInstance,
password: serverPasskey];
BluejaySmarts.jayShh ← IF NOT BluejaySmarts.encryptionRequested THEN Thrush.unencrypted
ELSE NamesRPC.StartConversation [
caller: bluejayInstance,
callee: thrushInstance --rName--,
key: serverPasskey,
level:
--<<ECB>>--CBCCheck !
RPC.AuthenticateFailed=>GOTO InitFailed];
Import ThParty Interface
ThPartyRpcControl.ImportInterface[
interfaceName: [type: "ThParty.Lark", instance: thrushInstance, version: thVR] !
RPC.ImportFailed=>
IF why=wrongVersion
THEN {
Log.ReportFR["Bluejay version %d too old; import failed",
$Bluejay, NIL, card[ThVersions.JayVersion]];
GOTO InitFailed;
}];
BluejaySmarts.interfaceIsImported←TRUE;
Register First Jay Party.
partyID←ThParty.CreateParty[type: recording, rName: NIL];
IF partyID=Thrush.nullHandle THEN ERROR;
smartsID ← ThParty.Register[
shh: BluejaySmarts.jayShh, partyID: partyID, interface: NEW[ThSmartsRpcControl.InterfaceName←myName],
properties: [x: voiceTerminal[machine: Names.OwnNetAddress[]]]];
IF smartsID=Thrush.nullHandle THEN GOTO InitFailed;
EXITS
InitFailed => IF BluejaySmarts.interfaceIsImported THEN ThPartyRpcControl.UnimportInterface[];
};