pub struct TreeConnectRequest {
pub structure_size: u16,
pub flags: u16,
pub path_offset: u16,
pub path_length: u16,
pub path: Vec<u8>,
}Expand description
SMB2_TREE_CONNECT_REQUEST (MS-SMB2 §2.2.9).
path is UTF-16LE. The wire format gives PathOffset (from the start of
the SMB2 header) and PathLength; path is encoded and decoded
immediately following the fixed prefix, and TreeConnectRequest::path_in
finds it by PathOffset. 3.1.1 tree-connect extensions are not decoded.
Fields§
§structure_size: u16§flags: u163.1.1: flags. 2.x/3.0/3.0.2: reserved.
path_offset: u16§path_length: u16§path: Vec<u8>UTF-16LE share path bytes (e.g. \\server\share).
Implementations§
Source§impl TreeConnectRequest
impl TreeConnectRequest
Sourcepub const FLAG_CLUSTER_RECONNECT: u16 = 0x0001
pub const FLAG_CLUSTER_RECONNECT: u16 = 0x0001
Flag: SMB2_TREE_CONNECT_FLAG_CLUSTER_RECONNECT (3.1.1).
Sourcepub const FLAG_REDIRECT_TO_OWNER: u16 = 0x0002
pub const FLAG_REDIRECT_TO_OWNER: u16 = 0x0002
Flag: SMB2_TREE_CONNECT_FLAG_REDIRECT_TO_OWNER (3.1.1).
Sourcepub const FLAG_EXTENSION_PRESENT: u16 = 0x0004
pub const FLAG_EXTENSION_PRESENT: u16 = 0x0004
Flag: SMB2_TREE_CONNECT_FLAG_EXTENSION_PRESENT (3.1.1).
Sourcepub fn path_str(&self) -> Option<String>
pub fn path_str(&self) -> Option<String>
Decode the UTF-16LE share path into a String. Returns None if the
stored bytes are not an even length (malformed UTF-16LE).
Sourcepub fn path_in<'a>(&self, body: &'a [u8]) -> Option<&'a [u8]>
pub fn path_in<'a>(&self, body: &'a [u8]) -> Option<&'a [u8]>
The share path bytes in body, the request after the SMB2 header,
located by PathOffset and PathLength. With
SMB2_TREE_CONNECT_FLAG_EXTENSION_PRESENT the path follows the
extension and PathOffset points at it. None when the path lies
outside the request’s buffer.
pub fn parse(buf: &[u8]) -> Result<Self, ProtoError>
pub fn write_to(&self, out: &mut Vec<u8>) -> Result<(), ProtoError>
Trait Implementations§
Source§impl BinRead for TreeConnectRequest
impl BinRead for TreeConnectRequest
Source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
T from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for TreeConnectRequest
impl BinWrite for TreeConnectRequest
Source§fn write_options<W: Write + Seek>(
&self,
__binrw_generated_var_writer: &mut W,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<()>
Source§fn write<W>(&self, writer: &mut W) -> Result<(), Error>
fn write<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer using default arguments. Read moreSource§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming little-endian byte order. Read moreSource§fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming native-endian byte order. Read moreSource§fn write_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Self to the writer using the given arguments. Read moreSource§fn write_be_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_be_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Self to the writer, assuming big-endian byte order, using the
given arguments. Read more