DIRECTORY BasicTime USING [GMT], FS USING [FileType], FSBackdoor USING [Version], IO USING [STREAM], Rope USING [ROPE] ; FSRemoteFileBackdoor: CEDAR DEFINITIONS ~ { GMT: TYPE ~ BasicTime.GMT; ROPE: TYPE ~ Rope.ROPE; Version: TYPE ~ FSBackdoor.Version; FileType: TYPE ~ FS.FileType; ServerHandle: TYPE ~ REF ServerObject; ServerObject: TYPE ~ RECORD [ flavor: ATOM, name: ROPE, -- e.g. "Palain-NFS" procs: ServerProcs, data: REF ]; ServerProcs: TYPE ~ REF ServerProcsObject; ServerProcsObject: TYPE ~ RECORD [ sweep: SweepProc _ NIL, validate: ValidateProc, delete: DeleteProc, do: DoProc, enumerateForInfo: EnumerateForInfoProc, enumerateForNames: EnumerateForNamesProc, getInfo: GetInfoProc, rename: RenameProc, retrieve: RetrieveProc, store: StoreProc, open: OpenProc, close: CloseProc, rw: RWProc ]; SweepProc: TYPE ~ PROC [h: ServerHandle, seconds: CARD]; ValidateProc: TYPE ~ PROC [h: ServerHandle] RETURNS [obsolete: BOOL, downMsg: ROPE]; DeleteProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, wantedCreatedTime: GMT, case: BOOL, proc: ConfirmProc _ NIL]; ConfirmProc: TYPE ~ PROC [version: FSBackdoor.Version] RETURNS [ok: BOOLEAN]; DoProc: TYPE ~ PROC [h: ServerHandle, cmd: ATOM, arg: REF, result: REF]; EnumerateForInfoProc: TYPE ~ PROC [h: ServerHandle, pattern: ROPE, case: BOOL, proc: InfoProc]; InfoProc: TYPE ~ PROC [file: ROPE, bytes: INT, created: GMT, type: FileType] RETURNS [continue: BOOL]; EnumerateForNamesProc: TYPE ~ PROC [h: ServerHandle, pattern: ROPE, case: BOOL, proc: NameProc]; NameProc: TYPE ~ PROC [file: ROPE] RETURNS [continue: BOOL]; GetInfoProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, wantedCreatedTime: GMT, case: BOOL] RETURNS [version: Version, bytes: INT, created: GMT, fileType: FileType]; RenameProc: TYPE ~ PROC [h: ServerHandle, fromFile: ROPE, fromCreated: GMT, toFile: ROPE, case: BOOL, proc: ConfirmProc _ NIL]; RetrieveProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, wantedCreatedTime: GMT, case: BOOL, proc: ConfirmRetrieveProc]; ConfirmRetrieveProc: TYPE ~ PROC [file: ROPE, bytes: INT, created: GMT, type: FileType] RETURNS [IO.STREAM]; StoreProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, case: BOOL, str: IO.STREAM, created: GMT, proc: ConfirmProc _ NIL]; FileHandle: TYPE ~ REF; OpenProc: TYPE ~ PROC [h: ServerHandle, cmd: ATOM, file: ROPE, wantedCreatedTime: GMT, case: BOOL, proc: ConfirmRetrieveProc _ NIL] RETURNS [FileHandle]; CloseProc: TYPE ~ PROC [h: ServerHandle, fileHandle: FileHandle]; RWProc: TYPE ~ PROC [h: ServerHandle, fileHandle: FileHandle, cmd: ATOM, bytePos: CARD, block: REF TEXT] RETURNS [bytesTransferred: CARD]; Register: PROC [flavor: ATOM, getServer: GetServerProc]; GetServerProc: TYPE ~ PROC [server: ROPE] RETURNS [h: ServerHandle, downMsg: ROPE]; GetServer: PROC [server: ROPE] RETURNS [h: ServerHandle]; ErrorNotImplemented: PROC [h: ServerHandle, file, msg: ROPE _ NIL]; SetCachedServer: PROC [server: ROPE, flavor: ATOM]; ClearCachedServer: PROC [server: ROPE]; }... $FSRemoteFileBackdoor.mesa Copyright Ó 1987 by Xerox Corporation. All rights reserved. Demers, October 28, 1987 9:05:07 pm PST Copied Types Server handles Called a few times a minute by this package for miscellaneous housekeeping: Called to validate a handle that might be stale. If obsolete=TRUE, the handle is out of date and should be replaced (by calling appropriate getServerProc). IF downMsg#NIL, the server is known to exist but is down. File Operations None of these procs know anything about pseudo-servers; that knowledge is confined to FSRemoteFileImpl itself. The file or pattern argument should have a version part (possibly !h or !l or just !) if that's desired; otherwise the name on the server is assumed to have no version part (not all servers will support this). The version part "!" should be interpreted as "default": it means "!h" when reading, "!l" when deleting, and "create next higher version" when writing. Note this is NOT THE SAME as leaving out the version part altogether. If case = TRUE then upper/lower case is significant in the file names (not all servers will support this). The file name argument to a callback (InfoProc, NameProc, ...) should not have a server part. All these procs should raise appropriate FS.Error's to indicate failure. Delete the named file. If wantedCreatedTime # nullGMT, then any version info in file name is treated as a hint only  the right file will be found by enumerating the directory if necessary. Catch-all for flavor-specific operations. Enumerate all files matchine pattern. Enumerate all files matchine pattern. If wantedCreatedTime # nullGMT, then any version info in file name is treated as a hint only  the right file will be found by enumerating the directory if necessary. If fromCreated # nullGMT, then any version info in fromFile name is treated as a hint only  the right file will be found by enumerating the directory if necessary. proc is called with the version of fromFile. If fromCreated # nullGMT, then any version info in fromFile name is treated as a hint only  the right file will be found by enumerating the directory if necessary. Data is copied from str to the named remote file. If created is not nullGMT then the createTime of the remote file is set to created. Random-access file operations Many servers don't implement these. Return handle for random-access I/O on named file. Standard values for cmd are $read : file must already exist $write : also allows reading; file must already exist $create : like $write, but creates file if it doesn't exist $exclusiveCreate : like $write, but fails if file already exists Standard values for cmd are $read : behaves like IO.GetBlock, may return a short block. $write : behaves like IO.PutBlock; short transfer is an error. Registration Register an(other) remote file ops implementation. Any existing registration for "flavor" disappears. "getServer" may be NIL, to clear a registration. Tries to find a server of the given name. If successful, creates ServerHandle h and return [h, NIL]. If no server responds and no server is known to exist, returns [NIL, NIL]. If server is known to exist but is not responding, returns [NIL, message], Does not raise FS.Error itself! The caller may Process.Abort a GetServerProc. Tries to find a server of the given name, using the server cache. Raises FS.Error[unknownServer] if unsuccessful. Unimplemented operations Raises FS.Error[[client, $notImplemented]]. Controlling the flavor of a cached server. If this is necessary the network environment is probably screwed up. Force server of given name to be of given flavor. ÊE˜codešœ™K™——K˜—™ šžœœ œ˜8K™˜K˜—š œœœ œœœ˜SK™)K™:K™JK™KK™Kšœ-™-—K˜šž œœ œœ˜9K™AKšœ/™/——™šžœœœœ˜CK™+——™*K™DK˜šžœœ œ œ˜3K™1K˜—Kšžœœ œ˜'—K˜K˜——…— ¬