pub enum RequestInner<'a> {
Show 25 variants
Open(OpenFileRequest<'a>),
Close(Cow<'a, Handle>),
Read {
handle: Cow<'a, Handle>,
offset: u64,
len: u32,
},
Remove(Cow<'a, Path>),
Rename {
oldpath: Cow<'a, Path>,
newpath: Cow<'a, Path>,
},
Mkdir {
path: Cow<'a, Path>,
attrs: FileAttrs,
},
Rmdir(Cow<'a, Path>),
Opendir(Cow<'a, Path>),
Readdir(Cow<'a, Handle>),
Stat(Cow<'a, Path>),
Lstat(Cow<'a, Path>),
Fstat(Cow<'a, Handle>),
Setstat {
path: Cow<'a, Path>,
attrs: FileAttrs,
},
Fsetstat {
handle: Cow<'a, Handle>,
attrs: FileAttrs,
},
Readlink(Cow<'a, Path>),
Symlink {
linkpath: Cow<'a, Path>,
targetpath: Cow<'a, Path>,
},
Realpath(Cow<'a, Path>),
Limits,
ExpandPath(Cow<'a, Path>),
Lsetstat(Cow<'a, Path>, FileAttrs),
Fsync(Cow<'a, Handle>),
HardLink {
oldpath: Cow<'a, Path>,
newpath: Cow<'a, Path>,
},
PosixRename {
oldpath: Cow<'a, Path>,
newpath: Cow<'a, Path>,
},
Cp {
read_from_handle: Cow<'a, Handle>,
read_from_offset: u64,
read_data_length: u64,
write_to_handle: Cow<'a, Handle>,
write_to_offset: u64,
},
Write {
handle: Cow<'a, Handle>,
offset: u64,
data: Cow<'a, [u8]>,
},
}
Variants§
Open(OpenFileRequest<'a>)
The response to this message will be either
crate::response::ResponseInner::Handle
(if the operation is successful) or
crate::response::ResponseInner::Status
(if the operation fails).
Close(Cow<'a, Handle>)
Response will be crate::response::ResponseInner::Status
.
Read
In response to this request, the server will read as many bytes as it can from the file (up to `len’), and return them in a ResponseInner::Data message.
If an error occurs or EOF is encountered before reading any
data, the server will respond with crate::response::ResponseInner::Status
.
For normal disk files, it is guaranteed that this will read the specified number of bytes, or up to end of file.
For e.g. device files this may return fewer bytes than requested.
Remove(Cow<'a, Path>)
Responds with a crate::response::ResponseInner::Status
message.
Rename
Responds with a crate::response::ResponseInner::Status
message.
Mkdir
Responds with a crate::response::ResponseInner::Status
message.
Rmdir(Cow<'a, Path>)
Responds with a crate::response::ResponseInner::Status
message.
Opendir(Cow<'a, Path>)
Responds with a crate::response::ResponseInner::Handle
or a crate::response::ResponseInner::Status
message.
Readdir(Cow<'a, Handle>)
Responds with a crate::response::ResponseInner::Name
or
a crate::response::ResponseInner::Status
message
Stat(Cow<'a, Path>)
Responds with crate::response::ResponseInner::Attrs
or
crate::response::ResponseInner::Status
.
Lstat(Cow<'a, Path>)
Responds with crate::response::ResponseInner::Attrs
or
crate::response::ResponseInner::Status
.
Does not follow symlink.
Fstat(Cow<'a, Handle>)
Responds with crate::response::ResponseInner::Attrs
or
crate::response::ResponseInner::Status
.
Setstat
Responds with a crate::response::ResponseInner::Status
message.
Fsetstat
Responds with a crate::response::ResponseInner::Status
message.
Readlink(Cow<'a, Path>)
Responds with crate::response::ResponseInner::Name
with a name and
dummy attribute value or crate::response::ResponseInner::Status
on error.
Symlink
Responds with a crate::response::ResponseInner::Status
message.
Realpath(Cow<'a, Path>)
Responds with crate::response::ResponseInner::Name
with a name and
dummy attribute value or crate::response::ResponseInner::Status
on error.
Limits
Responds with extended reply, with payload crate::response::Limits
.
Extension, only available if it is [crate::response::Extensions::limits
]
is returned by crate::response::ServerVersion
.
ExpandPath(Cow<'a, Path>)
Same response as RequestInner::Realpath
.
Extension, only available if it is [crate::response::Extensions::expand_path
]
is returned by crate::response::ServerVersion
.
This supports canonicalisation of relative paths and those that need
tilde-expansion, i.e. “”, “/…” and “~user/…”.
These paths are expanded using shell-lilke rules and the resultant path
is canonicalised similarly to RequestInner::Realpath
.
Lsetstat(Cow<'a, Path>, FileAttrs)
Same response as RequestInner::Setstat
.
Extension, only available if it is [crate::response::Extensions::lsetstat
]
is returned by crate::response::ServerVersion
.
Fsync(Cow<'a, Handle>)
Responds with a crate::response::ResponseInner::Status
message.
Extension, only available if it is [crate::response::Extensions::fsync
]
is returned by crate::response::ServerVersion
.
HardLink
Responds with a crate::response::ResponseInner::Status
message.
Extension, only available if it is [crate::response::Extensions::hardlink
]
is returned by crate::response::ServerVersion
.
PosixRename
Responds with a crate::response::ResponseInner::Status
message.
Extension, only available if it is [crate::response::Extensions::posix_rename
]
is returned by crate::response::ServerVersion
.
Cp
Responds with a crate::response::ResponseInner::Status
message.
Extension, only available if it is [crate::response::Extensions::posix_rename
]
is returned by crate::response::ServerVersion
.
For openssh-portable, this is available from V_9_0_P1.
The server MUST copy the data exactly as if the client had issued a
series of RequestInner::Read
requests on the read_from_handle
starting at read_from_offset
and totaling read_data_length
bytes,
and issued a series of RequestInner::Write
packets on the
write_to_handle
, starting at the write_from_offset
, and totaling
the total number of bytes read by the RequestInner::Read
packets.
The server SHOULD allow read_from_handle
and write_to_handle
to
be the same handle as long as the range of data is not overlapping.
This allows data to efficiently be moved within a file.
If data_length
is 0
, this imples data should be read until EOF is
encountered.
There are no protocol restictions on this operation; however, the server MUST ensure that the user does not exceed quota, etc. The server is, as always, free to complete this operation out of order if it is too large to complete immediately, or to refuse a request that is too large.
Fields
Write
The write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
Responds with a crate::response::ResponseInner::Status
message.
The Write also includes any amount of custom data and its size is included in the size of the entire packet sent.