BridgeFTPOps.mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
Demers, October 12, 1990 11:34 am PDT
DIRECTORY
BridgeComm USING [NetworkStreamPair],
IO USING [STREAM],
Rope USING [ROPE];
BridgeFTPOps: CEDAR DEFINITIONS ~ {
ROPE: TYPE ~ Rope.ROPE;
STREAM: TYPE ~ IO.STREAM;
NetworkStreamPair: TYPE ~ BridgeComm.NetworkStreamPair;
ActionProc: TYPE ~ PROC [nsp: NetworkStreamPair, bytesReported: INT, clientData: REF]
RETURNS [quit: BOOLEAN ¬ FALSE];
Callback used by RetrieveStream or StoreStream, below: it's called with a network stream attached to a remote file; the action proc either reads or writes data until the end.
May be UNWOUND (e.g. on network stream errors).
"Feature:" For RetrieveStream the ActionProc is not called if the file being retrieved is empty. BytesReported is the number of bytes given by the data ack ('Dxxx'). -1 is returned if the ack doesn't supply the byte count, or for storing. It is assumed that bytesReported is really only a hint
RetrieveStream: PROC [nsp: NetworkStreamPair, remoteName: ROPE, action: ActionProc, clientData: REF ¬ NIL, msgStream: STREAM ¬ NIL] RETURNS [excuse: ROPE ¬ NIL];
Open a network stream to the named file on the remote host, pass it to the action proc.
StoreStream: PROC [nsp: NetworkStreamPair, remoteName: ROPE, overwrite: BOOL, action: ActionProc, clientData: REF ¬ NIL, msgStream: STREAM ¬ NIL] RETURNS [excuse: ROPE ¬ NIL];
Open a network stream to the named file on the remote host, pass it to the action proc. The semantics of file creation is controlled by the overwrite parameter: If TRUE, do a normal Unix-style create (e.g. store through symbolic links). If FALSE, write the file under a unique temporary id and rename at the end (thus breaking symbolic links and changing ownership, protection modes, etc).
}...