Skip to main content

Crate smb

Crate smb 

Source
Expand description

§SMB

the smb crate is a pure rust SMB client, supports the SMB2 protocol (including SMB3).

§Basic usage

The most basic functionality that an SMB client should provide is the ability to connect to an SMB server, authenticate, and perform simple file operations.

The Client struct provides a simple interface for interacting with an SMB server. Let’s see how we use it.

use smb::{Client, ClientConfig, UncPath, FileCreateArgs, FileAccessMask};
use std::str::FromStr;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // instantiate the client
    let client = Client::new(ClientConfig::default());

    // Connect to a share
    let target_path = UncPath::from_str(r"\\server\share").unwrap();
    client.share_connect(&target_path, "username", "password".to_string()).await?;

    // And open a file on the server
    let file_to_open = target_path.with_path("file.txt");
    let file_open_args = FileCreateArgs::make_open_existing(FileAccessMask::new().with_generic_read(true));
    let file = client.create_file(&file_to_open, &file_open_args).await?;
    // now, you can do a bunch of operations against `file`, and close it at the end.
    Ok(())
}

Cool! we got ourselves a live connection to an SMB server, and we also got a file open.

But wait… How do we know it’s actually a file? Well, we don’t. The Client::create_file method returns the Resource struct, which is a union to a file, directory, or a pipe - the supported SMB resources in this crate (printers are currently not implemented specifically). What we need to do next, is to find out what type of resource we’ve got:

match &file {
    Resource::File(file) => {
        // We have a file
    }
    Resource::Directory(dir) => {
        // We have a directory
    }
    Resource::Pipe(pipe) => {
        // We have a pipe
    }
}
// Note: we could also use `.unwrap_file()` here,
// or similar method provided by Resource to find out what kind of resource this is!

Cool! Let’s assume we got ourselves a file. Then, we can do the obvious operation of reading or writing a block of data from or to the file:

let file: File = file.unwrap_file();

let mut data: [u8; 1024] = [0; 1024];
file.read_at(&mut data, 0).await?;
file.write_at(&data, 0).await?;

At the end, close the file.

file.close().await?;

§Feature flags

TypeAlgorithmAsyncMulti-threadedSingle-threadedFeature Name
AuthenticationKerberoskerberos
TransportQUICquic
Signing*sign
SigningHMAC_SHA256sign_hmac
SigningAES-128-GCMsign_gmac
SigningAES-128-CCMsign_cmac
Encryption*encrypt
EncryptionAES-128-CCMencrypt_aes128ccm
EncryptionAES-128-GCMencrypt_aes128gcm
EncryptionAES-256-CCMencrypt_aes256ccm
EncryptionAES-256-GCMencrypt_aes256gcm
Compression*compress
CompressionLZ4compress_lz4
CompressionPattern_V1🟡🟡🟡compress_pattern_v1*
CompressionLZNT1/LZ77/+Huffman-
  • The Pattern_V1 compression algorithm currently supports in-bound decompression only.

§Advanced documentation

Re-exports§

pub use client::Client;
pub use client::ClientConfig;
pub use client::UncPath;
pub use connection::Connection;
pub use connection::ConnectionConfig;
pub use error::Error;
pub use resource::Directory;
pub use resource::File;
pub use resource::FileCreateArgs;
pub use resource::GetLen;
pub use resource::Pipe;
pub use resource::PipeRpcConnection;
pub use resource::ReadAt;
pub use resource::ReadAtChannel;
pub use resource::Resource;
pub use resource::ResourceHandle;
pub use resource::WriteAt;
pub use resource::WriteAtChannel;
pub use session::Session;
pub use tree::DfsRootTreeRef;
pub use tree::Tree;
pub use smb_transport as transport;

Modules§

binrw_util
This module contains utility types for the binrw crate.
cancel
Cancel Request
client
High-level SMB client interface.
compressed
Compressed messages
compression
Implements (de)compression logic.
connection
create
Create & Close (files) requests and responses.
crypto
dfsc
Distributed File System Referral Protocol (MS-DFSC) messages.
dialects
Implements SMB-dialect-specific types and functions.
docs
Additional crate docs are submodules.
echo
Echo request and response messages
encrypted
Encrypted message and header implementation.
error
file
File-related messages: Flush, Read, Write.
guid
header
Plain Message Header and related types.
info
Query and Set Info messages.
ioctl
IOCTL requessts and responses implementation, and FSCTLs.
lock
Classic Lock request & response.
message
Full Request & Response enums, including plain or transformed (encrypted/compressed).
msg_handler
negotiate
notify
Change Notify Request and Response, and Server to Client Notification messages and related types.
oplock
OpLock messages (requests, responses, notifications)
plain
Full plain message implementation.
query_dir
Directory-related messages.
resource
security
MS-DTYP 2.4
session
Session logic module.
session_setup
Session setup messages
smb1
SMBv1 negotiation packet support.
sync_helpers
This is a helper module that allows easy access and usage of Async/Multi-threaded features in the library, according to the features enabled.
tree
tree_connect
Tree (share) connect & disconnect messages
util

Macros§

access_mask
Macro for defining a bitfield for an access mask.
guid
A macro to create a Guid from a string literal at compile time.
make_guid
A macro to create a Guid from a string literal at compile time.

Structs§

ACE
ACL
AccessAce
AccessCallbackAce
AccessMask
This struct was partially generated by the smb_dtyp::access_mask! macro. Read more about generic access rights and standard access rights
AccessObjectAce
AccessObjectCallbackAce
AceFlags
AdditionalInfo
AllocationSize
Specifies the allocation size for a newly created or overwritten file.
AppInstanceId
Application instance identifier (SMB 3.x dialect family only).
AppInstanceVersion
Application instance version (SMB 3.1.1 dialect only).
ArrayData
Array data structure for variable-length arrays
BlobData
BLOB_DATA structure containing variable-length binary data
CancelRequest
SMB2 CANCEL Request structure
ChainedItemList
Implements a chained item list.
ChangeNotifyRequest
SMB2 CHANGE_NOTIFY Request packet sent by the client to request change notifications on a directory. The client can monitor changes on any file or directory contained beneath the specified directory.
ChangeNotifyResponse
SMB2 CHANGE_NOTIFY Response packet sent by the server to transmit the results of a client’s SMB2 CHANGE_NOTIFY Request. Contains an array of FILE_NOTIFY_INFORMATION structures describing the changes.
ClaimSecurityAttributeRelativeV1
CloseFlags
Flags indicating how to process the CLOSE operation.
CloseRequest
The SMB2 CLOSE Request packet is used by the client to close an instance of a file that was opened previously with a successful SMB2 CREATE Request.
CloseResponse
The SMB2 CLOSE Response packet is sent by the server to indicate that an SMB2 CLOSE Request was processed successfully.
CompressedChainedItem
SMB2 compression chained payload header.
CompressedChainedMessage
SMB2 compression transform header for chained compressed messages.
CompressedUnchainedMessage
SMB2 compression transform header for unchained compressed messages.
CompressionCapabilities
(Context) Compression capabilities.
CompressionCapsFlags
Flags to indicate compression capabilities.
CreateContextRequest
The common definition that wrap around all create contexts, for both request and response. Create contexts are used to pass additional information to the server or receive additional information from the server in the CREATE request and response.
CreateContextResponse
The common definition that wrap around all create contexts, for both request and response. Create contexts are used to pass additional information to the server or receive additional information from the server in the CREATE request and response.
CreateOptions
Options to be applied when creating or opening the file.
CreateRequest
The SMB2 CREATE Request packet is sent by a client to request either creation of or access to a file. In case of a named pipe or printer, the server creates a new file.
CreateResponse
The SMB2 CREATE Response packet is sent by the server to notify the client of the status of its SMB2 CREATE Request.
CreateResponseFlags
Response flags indicating properties of the opened file. Only valid for SMB 3.x dialect family.
DH2QResp
Response for SMB 3.x durable or persistent handle request. Indicates successful creation of a durable/persistent handle.
DfsRequestData
RequestData is part of the REQ_GET_DFS_REFERRAL_EX message (section 2.2.3).
DfsRequestFlags
DirAccessMask
Directory Access Mask
DurableHandleReconnect
Request to reestablish a durable open after being disconnected.
DurableHandleReconnectV2
Request to reestablish a durable open (SMB 3.x dialect family only).
DurableHandleRequest
Request for a durable handle that can survive brief network disconnections.
DurableHandleRequestV2
Request for a durable or persistent handle (SMB 3.x dialect family only).
DurableHandleResponse
Response indicating the server has marked the open as durable.
DurableHandleV2Flags
Flags for durable handle v2 requests.
EaFlags
Extended Attribute (EA) Flags
EchoMessage
SMB2 Echo request/response.
EchoRequest
SMB2 Echo request/response.
EchoResponse
SMB2 Echo request/response.
EncryptedHeader
This header is used by the client or server when sending encrypted messages
EncryptedMessage
An entirely encrypted SMB2 message, that includes both the encrypted header and the encrypted message.
EncryptionCapabilities
(Context) Encryption capabilities.
EntryV3DCRefs
2.2.5.3.2 NameListReferral Flag Set to 1
EntryV3V4DfsPaths
2.2.5.3.1 NameListReferral Flag Set to 0
ErrorResponse
The SMB2 ERROR Response packet is sent by the server to respond to a request that has failed or encountered an error.
ErrorResponseContext
For SMB dialect 3.1.1, error data is formatted as an array of SMB2 ERROR Context structures. Each error context contains an identifier for the error context followed by the error data. Each context must start at an 8-byte aligned boundary relative to the start of the SMB2 ERROR Response.
FciClaimSecurityAttributes
FileAccessInformation
Query the access rights of a file that were granted when the file was opened.
FileAccessMask
File Access Mask
FileAllInformation
Query a collection of file information structures.
FileAllocationInformation
Set the allocation size for a file.
FileAlternateNameInformation
Query the alternate name (8.3 short name) of a file.
FileAttributeTagInformation
Query file attribute and reparse tag information for a file.
FileAttributes
Attributes of a file or directory.
FileBasicInformation
Query or Set file information.
FileBothDirectoryInformation
Query detailed information for the files in a directory.
FileCompressionInformation
Query compression information for a file.
FileDirectoryInformation
Query detailed information for the files in a directory.
FileDispositionInformation
Mark a file for deletion.
FileEaInformation
Query the size of the extended attributes (EA) for a file.
FileEndOfFileInformation
Set end-of-file information for a file.
FileFsAttributeInformation
Query attribute information for a file system.
FileFsControlInformation
Query or Set quota and content indexing control information for a file system volume.
FileFsDeviceInformation
FileFsFullSizeInformation
Query sector size information for a file system volume.
FileFsObjectIdInformation
Query or Set the object ID for a file system data element. The operation MUST fail if the file system does not support object IDs.
FileFsSectorSizeInformation
Query for the extended sector size and alignment information for a volume.
FileFsSizeInformation
Query sector size information for a file system volume.
FileFsVolumeInformation
Query information on a volume on which a file system is mounted.
FileFullDirectoryInformation
Query detailed information for the files in a directory.
FileFullEaInformationInner
Query or Set extended attribute (EA) information for a file.
FileGetEaInformation
Query extended attributes for a file.
FileGetQuotaInformation
This structure is used to provide the list of SIDs for which quota query information is requested.
FileId
2.2.14.1: SMB2_FILEID
FileId64ExtdBothDirectoryInformation
Query detailed information for the files in a directory.
FileId64ExtdDirectoryInformation
Query detailed information for the files in a directory.
FileIdAllExtdBothDirectoryInformation
Query detailed information for the files in a directory.
FileIdAllExtdDirectoryInformation
Query detailed information for the files in a directory.
FileIdBothDirectoryInformation
Query detailed information for the files in a directory.
FileIdExtdDirectoryInformation
Query detailed information for the files in a directory.
FileIdFullDirectoryInformation
Query detailed information for the files in a directory.
FileIdInformation
Query the file system’s 8-byte file reference number for a file.
FileInternalInformation
Query the file system’s 8-byte file reference number for a file.
FileLevelTrimRange
MSDN
FileLevelTrimRequest
FileLevelTrimResponse
MS-FSCC 2.3.14
FileLinkInformation
Create a hard link to an existing file via the SMB Version 2 Protocol, as specified in [MS-SMB2].
FileModeInformation
Query or Set file mode information.
FileNameInformation
Query the name of a file.
FileNamesInformation
Query the names of the files in a directory.
FileNetworkOpenInformation
Query network file open information for a file.
FileNormalizedNameInformation
Query the normalized name of a file.
FileNotifyInformation
FILE_NOTIFY_INFORMATION - MS-FSCC 2.7.1
FilePipeInformation
Query or Set named pipe information.
FilePipeLocalInformation
Query information associated with a named pipe that is not specific to one end of the pipe or another.
FilePipeRemoteInformation
Query information that is associated with the remote end of a named pipe.
FilePositionInformation
Query or Set the current byte offset of the file pointer.
FileQuotaInformation
Query or to set file quota information for a volume.
FileRenameInformation
Rename a file within the SMB2 protocol.
FileShortNameInformation
change a file’s short name.
FileStandardInformation
Query standard information for a file.
FileStreamInformationInner
Enumerate the data streams for a file.
FileSystemAttributes
File system attributes.
FileSystemControlFlags
File system control flags.
FileValidDataLengthInformation
set the valid data length information for a file.
FlushRequest
SMB2 FLUSH Request.
FlushResponse
SMB2 FLUSH Response.
FsDeviceCharacteristics
Characteristics of a file system volume.
GetEaInfoList
GlobalCapabilities
Global capabilities flags for SMB2/SMB3.
Guid
Represents a standard, 16-byte GUID.
Header
SMB2 Packet Header.
HeaderFlags
SMB2 header flags.
IoctlBuffer
Utility structure to represent inner value of Ioctl requests that have no defined struct (i.e. they are treated as raw byte buffers).
IoctlRequest
SMB2 IOCTL request packet for issuing file system control or device control commands.
IoctlRequestFlags
Flags field indicating how to process the IOCTL operation.
IoctlResponse
SMB2 IOCTL response packet containing results of an IOCTL request.
LeaseBreakAckResponse
Lease Break Acknowledgment/Response message.
LeaseBreakNotify
Lease Break Notification message.
LeaseFlags
Flags for lease requests and responses.
LeaseState
Lease state bitfield representing different types of caching permissions.
LmrRequestResiliencyResponse
LockElement
SMB2_LOCK_ELEMENT structure used to indicate segments of files that are locked or unlocked in SMB2 LOCK requests.
LockFlag
Lock flags describing how the range is being locked or unlocked. Valid combinations are: shared lock, exclusive lock, unlock, or any of shared/exclusive combined with fail_immediately.
LockRequest
SMB2 LOCK Request packet used to lock or unlock portions of a file. Multiple segments of the file can be affected with a single request, but they all must be within the same file.
LockResponse
SMB2 LOCK Response packet sent by the server in response to an SMB2 LOCK Request.
LockSequence
Lock sequence information containing sequence number and index. In SMB 2.0.2 dialect, this field is unused and must be reserved. In all other dialects, contains sequence number and index fields.
LogoffRequest
SMB2 LOGOFF Request packet sent by the client to request termination of a particular session.
LogoffResponse
SMB2 LOGOFF Response packet sent by the server in response to a LOGOFF Request.
LuidAttrData
LUID_ATTR_DATA structure containing LUID and attributes
MandatoryLabelAccessMask
This struct was partially generated by the smb_dtyp::access_mask! macro. Read more about generic access rights and standard access rights
NegotiateCapabilities
Protocol capabilities for the client.
NegotiateContext
A single negotiate context item.
NegotiateRequest
SMB2 NEGOTIATE Request.
NegotiateResponse
SMB2 NEGOTIATE Response.
NegotiateSecurityMode
Flags for SMB2 negotiation security mode.
NetnameNegotiateContextId
Netname negotiate context.
NetworkInterfaceCapability
Capability flags for network interfaces indicating supported features. Used in the NetworkInterfaceInfo structure to specify interface capabilities.
NetworkInterfaceInfo
Network interface information structure returned by FSCTL_QUERY_NETWORK_INTERFACE_INFO. Contains details about a specific network interface on the server.
NetworkResiliencyRequest
Request packet for requesting resiliency for a specified open file. Sent in an SMB2 IOCTL Request using FSCTL_LMR_REQUEST_RESILIENCY. This request is not valid for the SMB 2.0.2 dialect.
NotifyFilter
Completion filter specifying the types of changes to monitor. Multiple trigger conditions can be chosen. If any condition is met, the client is notified and the CHANGE_NOTIFY operation is completed.
NotifyFlags
Flags for SMB2 CHANGE_NOTIFY Request indicating how the operation must be processed.
NotifySessionClosed
SMB2_NOTIFY_SESSION_CLOSED structure embedded within the SMB2_SERVER_TO_CLIENT_NOTIFICATION structure when the notification type is SmbNotifySessionClosed.
NullByte
Single null (0) byte.
ObjectAccessMask
This struct was partially generated by the smb_dtyp::access_mask! macro. Read more about generic access rights and standard access rights
ObjectAceFlags
OffloadReadRequest
MS-FSCC 2.3.41
OffloadReadResponse
MS-FSCC 2.3.42
OplockBreakMsg
Oplock Break Notification/Acknowledgment/Response message.
PipePeekRequest
PipePeekResponse
MS-FSCC 2.3.46
PipeTransceiveRequest
PipeTransceiveResponse
PipeWaitRequest
The FSCTL_PIPE_WAIT Request requests that the server wait until either a time-out interval elapses, or an instance of the specified named pipe is available for connection.
PipeWaitResponse
PlainRequest
A plain, single, SMB2 message.
PlainResponse
A plain, single, SMB2 message.
PreauthIntegrityCapabilities
(Context) Pre-authentication integrity capabilities.
QueryAllocRangesItem
QueryAllocRangesResult
QueryDirectoryFlags
Flags indicating how the query directory operation must be processed.
QueryDirectoryRequest
SMB2 QUERY_DIRECTORY Request packet for obtaining directory enumeration.
QueryDirectoryResponse
SMB2 QUERY_DIRECTORY Response packet containing directory enumeration results.
QueryInfoFlags
QueryInfoRequest
Request to query information on a file, named pipe, or underlying volume.
QueryInfoResponse
Response to a query information request, containing the requested data.
QueryInfoResponseData
A helper structure containing raw response data that can be parsed into specific information types.
QueryMaximalAccessRequest
Request for the server to retrieve maximal access information.
QueryMaximalAccessResponse
QueryNetworkInterfaceInfoRequest
QueryOnDiskIdReq
Request for the server to return an identifier for the open file.
QueryOnDiskIdResp
Response containing disk file and volume identifiers for the opened file.
QueryQuotaInfo
Specifies the quota information to query.
RawQueryInfoData
RawSetInfoData
RdmaTransformCapabilities
(Context) RDMA transform capabilities.
ReadFlags
Flags for read operations.
ReadRequest
SMB2 READ Request.
ReadResponse
SMB2 READ Response.
ReferralEntry
ReferralEntryFlags
ReferralEntryValueV1
ReferralEntryValueV2
DO NOT use this struct directly when bin read/writing. Use an instance of ReferralEntry instead.
ReferralEntryValueV3
ReferralEntryValueV4
ReferralHeaderFlags
RemotedIdentityTreeConnect
SMB2_REMOTED_IDENTITY_TREE_CONNECT Context
ReqGetDfsReferral
MS-DFSC 2.2.2: DFS referral requests are sent in the form of an REQ_GET_DFS_REFERRAL message, by using an appropriate transport as specified in section 2.1.
ReqGetDfsReferralEx
RequestLeaseV1
Version 1 lease request and response (SMB 2.1 and 3.x dialect family). Contains the lease key, state, flags, and duration.
RequestLeaseV2
Version 2 lease request and response (SMB 3.x dialect family only). Includes parent lease key and epoch tracking for lease state changes.
RespGetDfsReferral
NOTE: This struct currently implements BinWrite only as a placeholder (calling it will panic). BinRead is implemented and can be used to read DFS referral responses.
SID
SID (Security identifier)
SectorSizeInfoFlags
File system sector flags.
SecurityDescriptor
Security Descriptor - MS-DTYP 2.4.6
SecurityDescriptorControl
ServerToClientNotification
SMB2 Server to Client Notification packet sent by the server to indicate an implementation-specific intent without expecting any response from the client.
SessionFlags
Flags indicating additional information about the session.
SessionSecurityMode
Security mode field specifying whether SMB signing is enabled or required at the client.
SessionSetupRequest
SMB2 SESSION_SETUP Request packet sent by the client to request a new authenticated session within a new or existing SMB 2 Protocol transport connection.
SessionSetupResponse
SMB2 SESSION_SETUP Response packet sent by the server in response to a SESSION_SETUP Request.
SetInfoRequest
SMB2 SET_INFO request packet for setting information on a file or object store.
SetInfoResponse
SMB2 SET_INFO response packet indicating successful completion.
SetReparsePointRequest
Stores data for a reparse point.
SetReparsePointResponse
SetupRequestFlags
Flags field for SESSION_SETUP request (SMB 3.x dialect family only).
ShareAccessFlags
Specifies the sharing mode for the open.
ShareFlags
Share flags indicating various share properties
SidAttrData
SID_ATTR_DATA structure containing SID and attributes
SidAttrSeGroup
SE_GROUP attributes for SID
SigningCapabilities
(Context) Signing capabilities.
SocketAddrStorageV4
SocketAddrStorageV6
SrvCopyChunkCopyWrite
SrvCopychunkCopy
Request packet for initiating a server-side copy of data. Sent in an SMB2 IOCTL Request using FSCTL_SRV_COPYCHUNK or FSCTL_SRV_COPYCHUNK_WRITE.
SrvCopychunkItem
Individual data range descriptor for server-side copy operations. Sent in the chunks array of a SRV_COPYCHUNK_COPY packet to describe an individual data range to copy.
SrvCopychunkResponse
Response packet for server-side copy operations. Returned by the server in an SMB2 IOCTL Response for FSCTL_SRV_COPYCHUNK or FSCTL_SRV_COPYCHUNK_WRITE requests to provide the results of the copy operation.
SrvEnumerateSnapshotsRequest
SrvEnumerateSnapshotsResponse
MS-SMB 2.2.7.2.2.1
SrvHashRetrieveFileBased
File-based response format for SRV_READ_HASH when HashRetrievalType is SRV_HASH_RETRIEVE_FILE_BASED. Valid for servers implementing the SMB 3.x dialect family. Contains hash information for a specified range of file data.
SrvHashRetrieveHashBased
Hash-based response format for SRV_READ_HASH when HashRetrievalType is SRV_HASH_RETRIEVE_HASH_BASED. Contains a portion of the Content Information File retrieved from a specified offset.
SrvReadHashReq
Request packet for retrieving data from the Content Information File associated with a specified file. Sent in an SMB2 IOCTL Request using FSCTL_SRV_READ_HASH. The request is not valid for the SMB 2.0.2 dialect.
SrvReadHashRes
Response packet for SRV_READ_HASH requests. Returned by the server in an SMB2 IOCTL Response for FSCTL_SRV_READ_HASH request. The response is not valid for the SMB 2.0.2 dialect.
SrvRequestResumeKey
Response packet containing a resume key for server-side copy operations. Returned by the server in an SMB2 IOCTL Response for FSCTL_SRV_REQUEST_RESUME_KEY request. The resume key can be used to uniquely identify the source file in subsequent copy operations.
SrvRequestResumeKeyRequest
SrvSnapshotArray
Response packet containing snapshots associated with a share. Returned by the server in an SMB2 IOCTL Response for FSCTL_SRV_ENUMERATE_SNAPSHOTS request. Contains all revision timestamps associated with the Tree Connect share.
SvhdxOpenDeviceContextV1
Version 1 context for opening a shared virtual disk file.
SvhdxOpenDeviceContextV2
Version 2 context for opening a shared virtual disk file.
SystemMandatoryLabelAce
SystemResourceAttributeAce
TimewarpToken
Request to open a version of the file at a previous point in time.
TransportCapabilities
(Context) Transport capabilities.
TreeCapabilities
Tree capabilities indicating various share capabilities
TreeConnectContext
SMB2 TREE_CONNECT_CONTEXT Request structure
TreeConnectRequest
SMB2 TREE_CONNECT Request
TreeConnectRequestFlags
Flags for SMB2 TREE_CONNECT Request
TreeConnectResponse
SMB2 TREE_CONNECT Response
TreeDisconnectRequest
SMB2 TREE_DISCONNECT Request
TreeDisconnectResponse
SMB2 TREE_DISCONNECT Response
ValidateNegotiateInfoRequest
Request packet for validating a previous SMB 2 NEGOTIATE. Used in FSCTL_VALIDATE_NEGOTIATE_INFO to ensure the negotiation was not tampered with. Valid for clients and servers implementing SMB 3.0 and SMB 3.0.2 dialects.
ValidateNegotiateInfoResponse
Response for validating a previous SMB 2 NEGOTIATE. Returned in an SMB2 IOCTL response for FSCTL_VALIDATE_NEGOTIATE_INFO request. Valid for servers implementing the SMB 3.x dialect family, optional for others.
WriteFlags
Flags for write operations.
WriteRequest
SMB2 WRITE Request.
WriteResponse
SMB2 WRITE Response.

Enums§

AceType
AceValue
AclRevision
ClaimSecurityAttributeType
Command
SMB2/SMB3 protocol command codes.
CommunicationChannel
Communication channel types for SMB Direct.
CompressedMessage
SMB2 compression transform header variants for compressed messages.
CompressionAlgorithm
Compression algorithm identifiers.
CreateAction
The action taken in establishing the open.
CreateContextRequestData
The CreateRequest Context data enum.
CreateContextResponseData
The CreateResponse Context data enum.
CreateContextType
This enum contains all the types of create contexts.
CreateDisposition
Defines the action the server must take if the file already exists. For opening named pipes, this field can be set to any value and is ignored by the server.
DfsServerType
Type of server hosting the target
Dialect
SMB2/SMB3 protocol dialect revisions.
EncryptionCipher
Encryption cipher identifiers.
EntryV3Value
ErrorId
An identifier for the error context in SMB2 ERROR Context structures.
FileAlignmentInformation
Query the buffer alignment required by the underlying device.
FileCompressionFormat
Compression format values for file compression.
FsDeviceType
FsctlCodes
GetInfoRequestData
Input data for query information requests that require additional parameters.
HashAlgorithm
Hash algorithms for pre-authentication integrity.
ImpersonationLevel
The impersonation level requested by the application issuing the create request.
InfoType
IoctlReqData
NamedPipeConfiguration
Named pipe configuration values.
NamedPipeEnd
Named pipe end values.
NamedPipeState
Named pipe state values.
NamedPipeType
Named pipe type values.
NegotiateContextType
Negotiate context type identifiers.
NegotiateContextValue
Negotiate context values.
NegotiateDialect
Dialects that may be used in the SMB Negotiate Response.
Notification
Notification structure containing the specific notification data based on the notification type.
NotificationType
SMB_NOTIFICATION_ID enumeration values for server to client notifications.
NotifyAction
See FileNotifyInformation
OplockLevel
Oplock level values used in oplock break operations.
PipeCompletionMode
Named pipe completion mode values.
PipeReadMode
Named pipe read mode values.
QueryDirectoryInfo
Query (list) directory information classes.
QueryDirectoryInfoClass
Information class IDs for QueryDirectoryInfo
QueryFileInfo
Query file information classes.
QueryFileInfoClass
Information class IDs for QueryFileInfo
QueryFileSystemInfo
Query file system information classes.
QueryFileSystemInfoClass
Information class IDs for QueryFileSystemInfo
QueryInfoClass
Helper enum to specify the information class for query info requests, when it is applicable.
QueryInfoData
Enum to hold the different info types for QueryInfoData, that are used within SMB requests for querying or setting information.
RdmaTransformId
RDMA transform identifiers.
ReferralEntryValue
ReferralLevel
The DFS referral version supported by the client. See ReqGetDfsReferral::max_referral_level.
ReparseTag
Reparse Tag Values
Request
This struct represents all the Requestmessage types.
RequestContent
Contains all the variants for a plain SMB2 request message.
RequestLease
Request for the server to return a lease on a file or directory. Also used by the server to respond with a granted lease.
Response
This struct represents all the Responsemessage types.
ResponseContent
Contains all the variants for a plain SMB2 response message.
SetFileInfo
Set file information classes.
SetFileInfoClass
Information class IDs for SetFileInfo
SetFileSystemInfo
Set file system information classes.
SetFileSystemInfoClass
Information class IDs for SetFileSystemInfo
SetInfoClass
Information class specifying the type of information to set.
SetInfoData
Enum to hold the different info types for SetInfoData, that are used within SMB requests for querying or setting information.
ShareCacheMode
Share caching mode for offline file access
ShareType
Type of share being accessed
SigningAlgorithmId
Signing algorithm identifiers.
SmbFsccError
Errors specific to the smb-fscc crate.
SmbMsgError
SMB Message related errors
SocketAddrStorage
SrvHashRetrievalType
Enum specifying the nature of the offset field in SRV_READ_HASH requests. Determines how the offset field should be interpreted for hash retrieval.
Status
NT Status codes for SMB.
SvhdxOpenDeviceContext
Context for opening a shared virtual disk file.

Constants§

CHAINED_ITEM_PREFIX_SIZE
The size of added fields to the size of each entry in ChainedItemList<T>, when bin-writing the data, before the actual T data.

Traits§

CreateContextDataRequestValue
This trait is automatically implemented for all CreateRequest create context values.
CreateContextDataResponseValue
This trait is automatically implemented for all CreateResponse create context values.
FileInfoType
Trait for file information types. This trait contains all types of all file info types and classes, specified in MS-FSCC.
FsctlRequest
This is a helper trait that defines, for a certain FSCTL request type, the response type and their matching FSCTL code.
FsctlResponseContent
A trait that helps parsing FSCTL responses by matching the FSCTL code.
IoctlRequestContent
A trait that helps calculating the size of the buffer for IOCTL requests.
QueryDirectoryInfoValue
Trait for inner values in QueryDirectoryInfo.
QueryFileInfoValue
Trait for inner values in QueryFileInfo.
QueryFileSystemInfoValue
Trait for inner values in QueryFileSystemInfo.
SetFileInfoValue
Trait for inner values in SetFileInfo.
SetFileSystemInfoValue
Trait for inner values in SetFileSystemInfo.

Type Aliases§

EncryptionNonce
The nonce used for encryption. Depending on the encryption algorithm, the nonce may be trimmed to a smaller size when used, or padded with zeroes to match the required size. When transmitted, the full 16 bytes are used.
FileFullEaInformation
FileStreamInformation
LeaseBreakAck
Lease Break Acknowledgment - sent by client in response to lease break notification.
LeaseBreakResponse
Lease Break Response - sent by server in response to lease break acknowledgment.
NetworkInterfacesInfo
OplockBreakAck
Oplock Break Acknowledgment - sent by client in response to oplock break notification.
OplockBreakNotify
Oplock Break Notification - sent by server when an oplock is being broken.
OplockBreakResponse
Oplock Break Response - sent by server in response to oplock break acknowledgment.
QueryFileFullEaInformation
Result
SMB Result type

Attribute Macros§

mbitfield
A helper macro that invokes modular_bitfield and binrw derives for bitfield structs. Those must be installed as dependencies in the crate where this macro is used.