STPFSRemoteFile.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Demers, October 27, 1987 0:45:23 am PST
DIRECTORY
BasicTime USING [GMT],
FSBackdoor USING [Version],
FSRemoteFileBackdoor USING [ServerHandle],
Rope USING [ROPE],
STP USING [Handle]
;
STPFSRemoteFile: CEDAR DEFINITIONS
~ {
Types
ROPE: TYPE ~ Rope.ROPE;
Server cache
ServerData: TYPE ~ REF ServerDataObject;
ServerDataObject: TYPE ~ RECORD [
ttl: CARD,  -- server entry time-to-live (significant only if down)
downMsg: ROPE, -- non-NIL => server is down
connectionTTL: CARD, -- connection time-to-live
stpH: STP.Handle, -- cached STP handle for server
serverPupName: ROPE-- for STP.Open
];
Public procedures
FTPTimeToGMT: PROCEDURE [t: Rope.ROPE] RETURNS [BasicTime.GMT];
Convert an FTP format time string into a BasicTime.GMT.
GetServerPupName: PROC [server: Rope.ROPE] RETURNS [pupServer: Rope.ROPE];
Convert the server name to a Pup Server name. For an IFS or other name know by the Pup gateways, this mapping is trivial. For Grapevine names (those with "." in them), the mapping is made through Grapevine.
Private procedure
LookupResult: TYPE = {noResponse, noSuchPort, noSuchServer, noSuchFile, ok};
Lookup: PROCEDURE [h: FSRemoteFileBackdoor.ServerHandle, file: ROPE] RETURNS [result: LookupResult, version: FSBackdoor.Version, create: BasicTime.GMT, count: INT];
This procedure uses the LookupFile packet exchange protocol to obtain the version number, create time, and byte length of a file on a remote file server. The file name may be specified complete with version number, with "!h", with "!l", or with no version. The "file" must be specified with brackets syntax.
If the result is "ok" then the requested file exists with the returned version number, create time, and byte length. "noSuchName" means that either the "server" was nonsense or that the "file" does not exist on that server. "noSuchPort" means that the "server" responded with a no-such-port error packet when prodded on the LookupFile socket. "noResponse" means that either the NLS didn't respond to the server name lookup, the LookupFile packet didn't get to the server, or the server did not respond to it.
LookupFile caches the state of the server as derived from previous lookup attempts. If the cached state for a server is either "noResponse" or "noSuchPort" then LookupFile immediately returns that result without attempting any communication. Such negative cache entries are flushed after five minutes. Positive cache entries contain the Pup address of the server, eliminating the need to do a NLS lookup on the server name.
The longest that you should have to wait for a response is ~ 4*(2 + 0.5*MIN[8,hopCount]) seconds. This is the time it will take to decided that a server isn't going to respond in the case of an uncached down server. Most answers are determined much more quickly.
}...