DIRECTORY Arpa USING [ Address ], ArpaUDP USING [ Port ], Commander USING [ Handle ], IO USING [ STREAM, Value ], Rope USING [ ROPE ], RPC USING [ EncryptionKey, Password, NetAddress, PupSocket, nullSocket, nullNetAddress ] ; VoiceUtils: CEDAR DEFINITIONS = { PD: TYPE = RECORD [ attended: BOOLEAN¬FALSE, defaultReportStream: IO.STREAM _ NIL, reportLimit: NAT¬1000, -- If 200 (say) reports of any kind, or 10 problem reports, are problemLimit: NAT¬10, -- issued in any 60 second period, report that (high priority), and limitInterval: NAT¬60, -- then inhibit all reports until these limits have not been exceeded reportingEnabled: BOOL¬TRUE, -- whether the limits have been reached reportMethods: ARRAY ProblemPriority OF ReportMethod ¬ ALL[], maximumMailReportInterval: INT ¬ 60*15 -- mailed reports no more frequently than 4/hr. ]; pd: REF PD; ROPE: TYPE=Rope.ROPE; Rname: TYPE = ROPE; NetAddress: TYPE = RPC.NetAddress; nullSocket: RPC.PupSocket = RPC.nullSocket; nullNetAddress: NetAddress = RPC.nullNetAddress; WhereToReport: TYPE=ATOM; WhereProc: TYPE = PROC[fixedWhereData: REF, whereData: REF] RETURNS[s: IO.STREAM¬NIL]; nullValue: IO.Value = [null[]]; DNFProc: TYPE = PROC[fixedWhereData: REF, whereData: REF] RETURNS[default: BOOL]; RegisterWhereToReport: PROC[ proc: WhereProc¬NIL, where: WhereToReport, fixedWhereData: REF¬NIL, defaultIfNotFound: DNFProc¬NIL]; FindWhere: PROC[where: WhereToReport, whereData: REF] RETURNS [s: IO.STREAM¬NIL]; ReportMethod: TYPE = RECORD [ reportByMail: BOOL¬FALSE, reportTo: ROPE ]; Report: PROC[remark: ROPE, where: WhereToReport¬NIL, whereData: REF ¬NIL]; ReportFR: PROC[remark: ROPE, where: WhereToReport¬NIL, whereData: REF ¬NIL, a1, a2, a3: IO.Value ¬ nullValue]; ProblemPriority: TYPE = { minimal, low, medium, high, maximum }; Problem: PROC[ remark: ROPE¬NIL, where: WhereToReport¬NIL, whereData: REF ¬NIL, priority: ProblemPriority ¬ maximum]; ProblemFR: PROC[ remark: ROPE¬NIL, where: WhereToReport¬NIL, whereData: REF ¬NIL, a1, a2: IO.Value ¬ nullValue, priority: ProblemPriority ¬ maximum]; Registrize: PROC[name: ROPE] RETURNS [ROPE]; CurrentRName: PROC RETURNS [ROPE]; CurrentPasskey: PROC[passwordText: ROPE¬NIL] RETURNS [RPC.EncryptionKey]; CurrentPassword: PROC[passwordText: ROPE¬NIL] RETURNS [RPC.Password] = INLINE { RETURN[LOOPHOLE[CurrentPasskey[passwordText]]]; }; OwnNetAddress: PROC RETURNS [netAddress: NetAddress]; Rspec: TYPE = REF RspecBody; RspecBody: TYPE = RECORD [ simpleName: ROPE¬NIL, registry: ROPE¬NIL]; RNameStyle: TYPE = { rName, nameDotLark, rNameDotLark }; InstanceFromNetAddress: PROC[netAddress: NetAddress, suffix: ROPE¬NIL] RETURNS [instance: Rname]; RnameToRspec: PROC[name: Rname, defaultRegistry: ROPE¬NIL] RETURNS [spec: Rspec]; RspecToRname: PROC[spec: Rspec] RETURNS [name: Rname]; RspecToSortName: PROC[spec: Rspec] RETURNS [name: ROPE]; MakeAtom: PROC[rName: Rname, case: BOOL¬FALSE] RETURNS [ATOM]; MakeRName: PROC[name: ROPE, style: RNameStyle¬ rNameDotLark] RETURNS[rName: ROPE]; LowerCaseRope: PROC[r: ROPE] RETURNS [ROPE]; CmdOrToken: PROC[cmd: Commander.Handle, key: ROPE, default: ROPE¬NIL] RETURNS [value: ROPE]; SunProtocol: PROC [netAddressRope: Rope.ROPE] RETURNS [BOOL]; SunAddrFromRope: PROC [netAddressRope: Rope.ROPE] RETURNS [address: Arpa.Address, port: ArpaUDP.Port]; RopeFromSunAddr: PROC[address: Rope.ROPE¬NIL, port: CARD32] RETURNS [netAddressRope: Rope.ROPE]; GetUniqueID: PROC RETURNS [CARD32]; }. ψ VoiceUtils.mesa Copyright Σ 1985, 1987, 1992 by Xerox Corporation. All rights reserved. Last modified by D. Swinehart, August 10, 1992 9:36 am PDT This interface implements a number of utility routines used by all of the voice system components. Variables Control over system death due to excess report logging Control over mailing of problem reports for various priorities Types Status reporting, Error reporting and management Report finds an appropriate stream and prints a time-stamped version of remark. Clients can register procedures to interpret the WhereToReport atoms and obtain the appropriate stream for a given call, aided by the whereData supplied in the Report call. Problem is intended for reporting unexpected errors and conditions. It will raise an internal SIGNAL if the system is currently attended (there's an executive command.) In any case, it will Report the remark argument. It will return automatically or if the operator proceeds from the signal, so the caller needs to do what is necessary to recover after calling Problem. The defaultIfNotFound parameter to the registration procedure indicates whether the message should be ignored (FALSE) or printed (TRUE) when the corresponding stream-finding procedure returns NIL. IF defaultIfNotFound=NIL, answer assumed TRUE Simple RName, password, net address manipulations. These just look at local machine global information or do various kinds of parsing; they don't do any communicating. Adds the Default registry to the name if the name doesn't have a registry field. Current logged-in name. Keys made from logged in password. The two types are based on client needs. Returns instance name, concatenated with suffix. Suffix could be "0" to complete a text version of a socket ID, or ".lark" to complete an RName. Takes the fields of an Rname apart. Puts one back together. Produces a rope of the form registry.name Produces a case-independent (if case=FALSE) unique atom from the RName CommandTool parsing aid Sun RPC addresses should look like "sun#[1.2.3.4]#5", where [1.2.3.4] is the Arpa address, and 5 is the port. if address is NIL, will use Arpa address of this machine. Unique within a session. May get reused due to rollback or reboot. Swinehart, July 19, 1985 2:34:21 pm PDT Clean up, eliminate SLOG stuff (Break Tool, Spy, Celtics dominate), DIRECTORY, Log Swinehart, October 24, 1985 3:48:07 pm PDT This was always Log until now. Eliminate CLog stuff, GetBinding stuff, combine with Names (also pruned severely), CurrentPasskey, ROPE, NetAddress, Rname Swinehart, October 28, 1985 10:02:53 am PST Eliminate ProblemBool, ProblemHandle changes to: WhereToReport, ProblemFR Swinehart, February 8, 1987 9:22:33 am PST Add Problem, ProblemFR priorities -- determines how hard to work in order to report them. changes to: ProblemPriority, Problem, ProblemFR, PD, ReportMethod, Report, DIRECTORY Dan Swinehart June 4, 1992 7:51:47 am PDT Eliminate all direct Pup references, remove unneeded functions to extent possible. changes to: DIRECTORY, OwnNetAddress Dan Swinehart June 4, 1992 7:51:47 am PDT Import VoiceUtilsExtras (Sun stuff) changes to: DIRECTORY, OwnNetAddress Dan Swinehart August 10, 1992 9:36:32 am PDT Modify pd to include only a default output stream; see VoiceUtilsImpl for the underlying change. ΚΕ•NewlineDelimiter –(cedarcode) style™šœ™Icodešœ Οeœ=™HJ™:—K˜J™bJ™šΟk ˜ Kšœžœ ˜Kšœžœ ˜Kšœ žœ ˜Kšžœžœžœ ˜Kšœžœžœ˜KšžœžœO˜XK˜K˜—Kšœ žœž œ˜!K˜šΟc ™ K˜šžœžœžœ˜Kšœ žœžœ˜Kšœžœžœžœ˜%™6Kšœ žœŸ?˜VKšœžœŸC˜YKšœžœŸE˜\Kšœžœžœ)˜D—™>Kšœžœžœ˜=Kšœžœ Ÿ/˜V—K˜—Kšœžœžœ˜ K˜—™K˜Kšžœžœžœ˜Kšœžœžœ˜šœ žœžœ ˜"Kšœ žœ žœ ˜+Kšœžœ˜0—K˜—™0Jš ΟnœB œ4  œH  œ œ™ύJš  œXžœ[ œ œ› œ™τJšœΟbœYžœžœ:ž™ΔK˜Kšœžœžœ˜Kš  œžœžœžœ žœžœžœžœžœ˜VKšœ žœ˜Kš œžœžœžœ žœžœ žœ˜Qš œžœ˜Kš œžœ(žœžœžœ˜dJšžœžœž™-—Kš  œžœ"žœžœžœžœžœ˜QK˜šœžœžœ˜Kšœžœžœ˜Kšœ ž˜K˜K˜—Kš  œžœ žœžœ žœžœ˜Jš  œžœ žœžœ žœžœ˜KKšœ žœ˜"—K˜Kšœžœ+˜@K˜š œžœ˜Kš œžœžœžœ žœžœ˜@K˜%—š  œžœ˜š œžœžœžœ žœžœ˜@Kšœžœ9˜C——K˜—™¨K˜š   œžœžœžœžœ˜,J™P—K˜š  œžœžœžœ˜"J™—Kš  œžœžœžœžœžœ˜Iš œžœžœžœžœžœ žœ˜OKšžœžœ#˜2JšœL™L—K˜Kš  œžœžœ˜5K˜Kšœžœžœ ˜šœ žœžœ˜Kšœ žœžœ˜Kšœ žœžœ˜K˜—Kšœ žœ(˜8K˜š œžœ!žœžœ˜FKšžœ˜J™0J™_K˜—š   œžœžœžœžœ˜QJšŸ"œ™#—š  œžœžœ˜6J™—š œžœžœžœ˜8J™)—š  œžœžœžœžœžœ˜>Jšœ%žœ™F—Kš   œžœžœ"žœžœ˜RKš   œžœžœžœžœ˜,—J™™J™š   œžœžœ žœžœ˜EKšžœ žœ˜K˜——K™m™Kš   œžœžœžœžœ˜=K˜Kš œžœžœžœ-˜fK˜š œžœžœžœžœžœžœ˜`J™9—K˜š  œžœžœžœ˜#K™B——K˜™'KšœBΟr™R—K™™*K™KšœQ’)™z—K™™+K™$Kšœ ’™$—™*K™YKšœ ’H™T—™)K™RKšœ ’™$—™)K™#Kšœ ’™$—™,K™`—K™K™K™—…— t!1