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
| Type | Algorithm | Async | Multi-threaded | Single-threaded | Feature Name |
|---|---|---|---|---|---|
| Authentication | Kerberos | ✅ | ✅ | ✅ | kerberos |
| Transport | QUIC | ✅ | ❌ | ❌ | quic |
| Signing | * | sign | |||
| Signing | HMAC_SHA256 | ✅ | ✅ | ✅ | sign_hmac |
| Signing | AES-128-GCM | ✅ | ✅ | ✅ | sign_gmac |
| Signing | AES-128-CCM | ✅ | ✅ | ✅ | sign_cmac |
| Encryption | * | encrypt | |||
| Encryption | AES-128-CCM | ✅ | ✅ | ✅ | encrypt_aes128ccm |
| Encryption | AES-128-GCM | ✅ | ✅ | ✅ | encrypt_aes128gcm |
| Encryption | AES-256-CCM | ✅ | ✅ | ✅ | encrypt_aes256ccm |
| Encryption | AES-256-GCM | ✅ | ✅ | ✅ | encrypt_aes256gcm |
| Compression | * | compress | |||
| Compression | LZ4 | ✅ | ✅ | ✅ | compress_lz4 |
| Compression | Pattern_V1 | 🟡 | 🟡 | 🟡 | compress_pattern_v1* |
| Compression | LZNT1/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
Guidfrom a string literal at compile time. - make_
guid - A macro to create a
Guidfrom a string literal at compile time.
Structs§
- ACE
- ACL
- Access
Ace - Access
Callback Ace - Access
Mask - This struct was partially generated by the
smb_dtyp::access_mask!macro. Read more about generic access rights and standard access rights - Access
Object Ace - Access
Object Callback Ace - AceFlags
- Additional
Info - Allocation
Size - Specifies the allocation size for a newly created or overwritten file.
- AppInstance
Id - Application instance identifier (SMB 3.x dialect family only).
- AppInstance
Version - Application instance version (SMB 3.1.1 dialect only).
- Array
Data - Array data structure for variable-length arrays
- Blob
Data - BLOB_DATA structure containing variable-length binary data
- Cancel
Request - SMB2 CANCEL Request structure
- Chained
Item List - Implements a chained item list.
- Change
Notify Request - 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.
- Change
Notify Response - 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.
- Claim
Security Attribute Relative V1 - Close
Flags - Flags indicating how to process the CLOSE operation.
- Close
Request - 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.
- Close
Response - The SMB2 CLOSE Response packet is sent by the server to indicate that an SMB2 CLOSE Request was processed successfully.
- Compressed
Chained Item - SMB2 compression chained payload header.
- Compressed
Chained Message - SMB2 compression transform header for chained compressed messages.
- Compressed
Unchained Message - SMB2 compression transform header for unchained compressed messages.
- Compression
Capabilities - (Context) Compression capabilities.
- Compression
Caps Flags - Flags to indicate compression capabilities.
- Create
Context Request - 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.
- Create
Context Response - 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.
- Create
Options - Options to be applied when creating or opening the file.
- Create
Request - 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.
- Create
Response - The SMB2 CREATE Response packet is sent by the server to notify the client of the status of its SMB2 CREATE Request.
- Create
Response Flags - Response flags indicating properties of the opened file. Only valid for SMB 3.x dialect family.
- DH2Q
Resp - Response for SMB 3.x durable or persistent handle request. Indicates successful creation of a durable/persistent handle.
- DfsRequest
Data - RequestData is part of the REQ_GET_DFS_REFERRAL_EX message (section 2.2.3).
- DfsRequest
Flags - DirAccess
Mask - Directory Access Mask
- Durable
Handle Reconnect - Request to reestablish a durable open after being disconnected.
- Durable
Handle Reconnect V2 - Request to reestablish a durable open (SMB 3.x dialect family only).
- Durable
Handle Request - Request for a durable handle that can survive brief network disconnections.
- Durable
Handle Request V2 - Request for a durable or persistent handle (SMB 3.x dialect family only).
- Durable
Handle Response - Response indicating the server has marked the open as durable.
- Durable
Handle V2Flags - Flags for durable handle v2 requests.
- EaFlags
- Extended Attribute (EA) Flags
- Echo
Message - SMB2 Echo request/response.
- Echo
Request - SMB2 Echo request/response.
- Echo
Response - SMB2 Echo request/response.
- Encrypted
Header - This header is used by the client or server when sending encrypted messages
- Encrypted
Message - An entirely encrypted SMB2 message, that includes both the encrypted header and the encrypted message.
- Encryption
Capabilities - (Context) Encryption capabilities.
- Entry
V3DC Refs - 2.2.5.3.2 NameListReferral Flag Set to 1
- Entry
V3V4 DfsPaths - 2.2.5.3.1 NameListReferral Flag Set to 0
- Error
Response - The SMB2 ERROR Response packet is sent by the server to respond to a request that has failed or encountered an error.
- Error
Response Context - 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.
- FciClaim
Security Attributes - File
Access Information - Query the access rights of a file that were granted when the file was opened.
- File
Access Mask - File Access Mask
- File
AllInformation - Query a collection of file information structures.
- File
Allocation Information - Set the allocation size for a file.
- File
Alternate Name Information - Query the alternate name (8.3 short name) of a file.
- File
Attribute TagInformation - Query file attribute and reparse tag information for a file.
- File
Attributes - Attributes of a file or directory.
- File
Basic Information - Query or Set file information.
- File
Both Directory Information - Query detailed information for the files in a directory.
- File
Compression Information - Query compression information for a file.
- File
Directory Information - Query detailed information for the files in a directory.
- File
Disposition Information - Mark a file for deletion.
- File
EaInformation - Query the size of the extended attributes (EA) for a file.
- File
EndOf File Information - Set end-of-file information for a file.
- File
FsAttribute Information - Query attribute information for a file system.
- File
FsControl Information - Query or Set quota and content indexing control information for a file system volume.
- File
FsDevice Information - File
FsFull Size Information - Query sector size information for a file system volume.
- File
FsObject IdInformation - 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.
- File
FsSector Size Information - Query for the extended sector size and alignment information for a volume.
- File
FsSize Information - Query sector size information for a file system volume.
- File
FsVolume Information - Query information on a volume on which a file system is mounted.
- File
Full Directory Information - Query detailed information for the files in a directory.
- File
Full EaInformation Inner - Query or Set extended attribute (EA) information for a file.
- File
GetEa Information - Query extended attributes for a file.
- File
GetQuota Information - This structure is used to provide the list of SIDs for which quota query information is requested.
- FileId
- 2.2.14.1: SMB2_FILEID
- File
Id64 Extd Both Directory Information - Query detailed information for the files in a directory.
- File
Id64 Extd Directory Information - Query detailed information for the files in a directory.
- File
IdAll Extd Both Directory Information - Query detailed information for the files in a directory.
- File
IdAll Extd Directory Information - Query detailed information for the files in a directory.
- File
IdBoth Directory Information - Query detailed information for the files in a directory.
- File
IdExtd Directory Information - Query detailed information for the files in a directory.
- File
IdFull Directory Information - Query detailed information for the files in a directory.
- File
IdInformation - Query the file system’s 8-byte file reference number for a file.
- File
Internal Information - Query the file system’s 8-byte file reference number for a file.
- File
Level Trim Range - MSDN
- File
Level Trim Request - File
Level Trim Response - MS-FSCC 2.3.14
- File
Link Information - Create a hard link to an existing file via the SMB Version 2 Protocol, as specified in [MS-SMB2].
- File
Mode Information - Query or Set file mode information.
- File
Name Information - Query the name of a file.
- File
Names Information - Query the names of the files in a directory.
- File
Network Open Information - Query network file open information for a file.
- File
Normalized Name Information - Query the normalized name of a file.
- File
Notify Information - FILE_NOTIFY_INFORMATION - MS-FSCC 2.7.1
- File
Pipe Information - Query or Set named pipe information.
- File
Pipe Local Information - Query information associated with a named pipe that is not specific to one end of the pipe or another.
- File
Pipe Remote Information - Query information that is associated with the remote end of a named pipe.
- File
Position Information - Query or Set the current byte offset of the file pointer.
- File
Quota Information - Query or to set file quota information for a volume.
- File
Rename Information - Rename a file within the SMB2 protocol.
- File
Short Name Information - change a file’s short name.
- File
Standard Information - Query standard information for a file.
- File
Stream Information Inner - Enumerate the data streams for a file.
- File
System Attributes - File system attributes.
- File
System Control Flags - File system control flags.
- File
Valid Data Length Information - set the valid data length information for a file.
- Flush
Request - SMB2 FLUSH Request.
- Flush
Response - SMB2 FLUSH Response.
- FsDevice
Characteristics - Characteristics of a file system volume.
- GetEa
Info List - Global
Capabilities - Global capabilities flags for SMB2/SMB3.
- Guid
- Represents a standard, 16-byte GUID.
- Header
- SMB2 Packet Header.
- Header
Flags - SMB2 header flags.
- Ioctl
Buffer - Utility structure to represent inner value of Ioctl requests that have no defined struct (i.e. they are treated as raw byte buffers).
- Ioctl
Request - SMB2 IOCTL request packet for issuing file system control or device control commands.
- Ioctl
Request Flags - Flags field indicating how to process the IOCTL operation.
- Ioctl
Response - SMB2 IOCTL response packet containing results of an IOCTL request.
- Lease
Break AckResponse - Lease Break Acknowledgment/Response message.
- Lease
Break Notify - Lease Break Notification message.
- Lease
Flags - Flags for lease requests and responses.
- Lease
State - Lease state bitfield representing different types of caching permissions.
- LmrRequest
Resiliency Response - Lock
Element - SMB2_LOCK_ELEMENT structure used to indicate segments of files that are locked or unlocked in SMB2 LOCK requests.
- Lock
Flag - 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.
- Lock
Request - 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.
- Lock
Response - SMB2 LOCK Response packet sent by the server in response to an SMB2 LOCK Request.
- Lock
Sequence - 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.
- Logoff
Request - SMB2 LOGOFF Request packet sent by the client to request termination of a particular session.
- Logoff
Response - SMB2 LOGOFF Response packet sent by the server in response to a LOGOFF Request.
- Luid
Attr Data - LUID_ATTR_DATA structure containing LUID and attributes
- Mandatory
Label Access Mask - This struct was partially generated by the
smb_dtyp::access_mask!macro. Read more about generic access rights and standard access rights - Negotiate
Capabilities - Protocol capabilities for the client.
- Negotiate
Context - A single negotiate context item.
- Negotiate
Request - SMB2 NEGOTIATE Request.
- Negotiate
Response - SMB2 NEGOTIATE Response.
- Negotiate
Security Mode - Flags for SMB2 negotiation security mode.
- Netname
Negotiate Context Id - Netname negotiate context.
- Network
Interface Capability - Capability flags for network interfaces indicating supported features. Used in the NetworkInterfaceInfo structure to specify interface capabilities.
- Network
Interface Info - Network interface information structure returned by FSCTL_QUERY_NETWORK_INTERFACE_INFO. Contains details about a specific network interface on the server.
- Network
Resiliency Request - 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.
- Notify
Filter - 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.
- Notify
Flags - Flags for SMB2 CHANGE_NOTIFY Request indicating how the operation must be processed.
- Notify
Session Closed - SMB2_NOTIFY_SESSION_CLOSED structure embedded within the SMB2_SERVER_TO_CLIENT_NOTIFICATION structure when the notification type is SmbNotifySessionClosed.
- Null
Byte - Single null (0) byte.
- Object
Access Mask - This struct was partially generated by the
smb_dtyp::access_mask!macro. Read more about generic access rights and standard access rights - Object
AceFlags - Offload
Read Request - MS-FSCC 2.3.41
- Offload
Read Response - MS-FSCC 2.3.42
- Oplock
Break Msg - Oplock Break Notification/Acknowledgment/Response message.
- Pipe
Peek Request - Pipe
Peek Response - MS-FSCC 2.3.46
- Pipe
Transceive Request - Pipe
Transceive Response - Pipe
Wait Request - 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.
- Pipe
Wait Response - Plain
Request - A plain, single, SMB2 message.
- Plain
Response - A plain, single, SMB2 message.
- Preauth
Integrity Capabilities - (Context) Pre-authentication integrity capabilities.
- Query
Alloc Ranges Item - Query
Alloc Ranges Result - Query
Directory Flags - Flags indicating how the query directory operation must be processed.
- Query
Directory Request - SMB2 QUERY_DIRECTORY Request packet for obtaining directory enumeration.
- Query
Directory Response - SMB2 QUERY_DIRECTORY Response packet containing directory enumeration results.
- Query
Info Flags - Query
Info Request - Request to query information on a file, named pipe, or underlying volume.
- Query
Info Response - Response to a query information request, containing the requested data.
- Query
Info Response Data - A helper structure containing raw response data that can be parsed into specific information types.
- Query
Maximal Access Request - Request for the server to retrieve maximal access information.
- Query
Maximal Access Response - Query
Network Interface Info Request - Query
OnDisk IdReq - Request for the server to return an identifier for the open file.
- Query
OnDisk IdResp - Response containing disk file and volume identifiers for the opened file.
- Query
Quota Info - Specifies the quota information to query.
- RawQuery
Info Data - RawSet
Info Data - Rdma
Transform Capabilities - (Context) RDMA transform capabilities.
- Read
Flags - Flags for read operations.
- Read
Request - SMB2 READ Request.
- Read
Response - SMB2 READ Response.
- Referral
Entry - Referral
Entry Flags - Referral
Entry Value V1 - Referral
Entry Value V2 - DO NOT use this struct directly when bin read/writing.
Use an instance of
ReferralEntryinstead. - Referral
Entry Value V3 - Referral
Entry Value V4 - Referral
Header Flags - Remoted
Identity Tree Connect - SMB2_REMOTED_IDENTITY_TREE_CONNECT Context
- ReqGet
DfsReferral - 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.
- ReqGet
DfsReferral Ex - Request
Lease V1 - Version 1 lease request and response (SMB 2.1 and 3.x dialect family). Contains the lease key, state, flags, and duration.
- Request
Lease V2 - Version 2 lease request and response (SMB 3.x dialect family only). Includes parent lease key and epoch tracking for lease state changes.
- Resp
GetDfs Referral - NOTE: This struct currently implements
BinWriteonly as a placeholder (calling it will panic).BinReadis implemented and can be used to read DFS referral responses. - SID
- SID (Security identifier)
- Sector
Size Info Flags - File system sector flags.
- Security
Descriptor - Security Descriptor - MS-DTYP 2.4.6
- Security
Descriptor Control - Server
ToClient Notification - SMB2 Server to Client Notification packet sent by the server to indicate an implementation-specific intent without expecting any response from the client.
- Session
Flags - Flags indicating additional information about the session.
- Session
Security Mode - Security mode field specifying whether SMB signing is enabled or required at the client.
- Session
Setup Request - 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.
- Session
Setup Response - SMB2 SESSION_SETUP Response packet sent by the server in response to a SESSION_SETUP Request.
- SetInfo
Request - SMB2 SET_INFO request packet for setting information on a file or object store.
- SetInfo
Response - SMB2 SET_INFO response packet indicating successful completion.
- SetReparse
Point Request - Stores data for a reparse point.
- SetReparse
Point Response - Setup
Request Flags - Flags field for SESSION_SETUP request (SMB 3.x dialect family only).
- Share
Access Flags - Specifies the sharing mode for the open.
- Share
Flags - Share flags indicating various share properties
- SidAttr
Data - SID_ATTR_DATA structure containing SID and attributes
- SidAttr
SeGroup - SE_GROUP attributes for SID
- Signing
Capabilities - (Context) Signing capabilities.
- Socket
Addr Storage V4 - Socket
Addr Storage V6 - SrvCopy
Chunk Copy Write - SrvCopychunk
Copy - 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.
- SrvCopychunk
Item - 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.
- SrvCopychunk
Response - 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.
- SrvEnumerate
Snapshots Request - SrvEnumerate
Snapshots Response - MS-SMB 2.2.7.2.2.1
- SrvHash
Retrieve File Based - 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.
- SrvHash
Retrieve Hash Based - 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.
- SrvRead
Hash Req - 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.
- SrvRead
Hash Res - 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.
- SrvRequest
Resume Key - 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.
- SrvRequest
Resume KeyRequest - SrvSnapshot
Array - 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.
- Svhdx
Open Device Context V1 - Version 1 context for opening a shared virtual disk file.
- Svhdx
Open Device Context V2 - Version 2 context for opening a shared virtual disk file.
- System
Mandatory Label Ace - System
Resource Attribute Ace - Timewarp
Token - Request to open a version of the file at a previous point in time.
- Transport
Capabilities - (Context) Transport capabilities.
- Tree
Capabilities - Tree capabilities indicating various share capabilities
- Tree
Connect Context - SMB2 TREE_CONNECT_CONTEXT Request structure
- Tree
Connect Request - SMB2 TREE_CONNECT Request
- Tree
Connect Request Flags - Flags for SMB2 TREE_CONNECT Request
- Tree
Connect Response - SMB2 TREE_CONNECT Response
- Tree
Disconnect Request - SMB2 TREE_DISCONNECT Request
- Tree
Disconnect Response - SMB2 TREE_DISCONNECT Response
- Validate
Negotiate Info Request - 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.
- Validate
Negotiate Info Response - 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.
- Write
Flags - Flags for write operations.
- Write
Request - SMB2 WRITE Request.
- Write
Response - SMB2 WRITE Response.
Enums§
- AceType
- AceValue
- AclRevision
- Claim
Security Attribute Type - Command
- SMB2/SMB3 protocol command codes.
- Communication
Channel - Communication channel types for SMB Direct.
- Compressed
Message - SMB2 compression transform header variants for compressed messages.
- Compression
Algorithm - Compression algorithm identifiers.
- Create
Action - The action taken in establishing the open.
- Create
Context Request Data - The
CreateRequestContext data enum. - Create
Context Response Data - The
CreateResponseContext data enum. - Create
Context Type - This enum contains all the types of create contexts.
- Create
Disposition - 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.
- DfsServer
Type - Type of server hosting the target
- Dialect
- SMB2/SMB3 protocol dialect revisions.
- Encryption
Cipher - Encryption cipher identifiers.
- Entry
V3Value - ErrorId
- An identifier for the error context in SMB2 ERROR Context structures.
- File
Alignment Information - Query the buffer alignment required by the underlying device.
- File
Compression Format - Compression format values for file compression.
- FsDevice
Type - Fsctl
Codes - GetInfo
Request Data - Input data for query information requests that require additional parameters.
- Hash
Algorithm - Hash algorithms for pre-authentication integrity.
- Impersonation
Level - The impersonation level requested by the application issuing the create request.
- Info
Type - Ioctl
ReqData - Named
Pipe Configuration - Named pipe configuration values.
- Named
Pipe End - Named pipe end values.
- Named
Pipe State - Named pipe state values.
- Named
Pipe Type - Named pipe type values.
- Negotiate
Context Type - Negotiate context type identifiers.
- Negotiate
Context Value - Negotiate context values.
- Negotiate
Dialect - Dialects that may be used in the SMB Negotiate Response.
- Notification
- Notification structure containing the specific notification data based on the notification type.
- Notification
Type - SMB_NOTIFICATION_ID enumeration values for server to client notifications.
- Notify
Action - See
FileNotifyInformation - Oplock
Level - Oplock level values used in oplock break operations.
- Pipe
Completion Mode - Named pipe completion mode values.
- Pipe
Read Mode - Named pipe read mode values.
- Query
Directory Info - Query (list) directory information classes.
- Query
Directory Info Class - Information class IDs for
QueryDirectoryInfo - Query
File Info - Query file information classes.
- Query
File Info Class - Information class IDs for
QueryFileInfo - Query
File System Info - Query file system information classes.
- Query
File System Info Class - Information class IDs for
QueryFileSystemInfo - Query
Info Class - Helper enum to specify the information class for query info requests, when it is applicable.
- Query
Info Data - Enum to hold the different info types for QueryInfoData, that are used within SMB requests for querying or setting information.
- Rdma
Transform Id - RDMA transform identifiers.
- Referral
Entry Value - Referral
Level - The DFS referral version supported by the client.
See
ReqGetDfsReferral::max_referral_level. - Reparse
Tag - Reparse Tag Values
- Request
- This struct represents all the Requestmessage types.
- Request
Content - Contains all the variants for a plain SMB2 request message.
- Request
Lease - 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.
- Response
Content - Contains all the variants for a plain SMB2 response message.
- SetFile
Info - Set file information classes.
- SetFile
Info Class - Information class IDs for
SetFileInfo - SetFile
System Info - Set file system information classes.
- SetFile
System Info Class - Information class IDs for
SetFileSystemInfo - SetInfo
Class - Information class specifying the type of information to set.
- SetInfo
Data - Enum to hold the different info types for SetInfoData, that are used within SMB requests for querying or setting information.
- Share
Cache Mode - Share caching mode for offline file access
- Share
Type - Type of share being accessed
- Signing
Algorithm Id - Signing algorithm identifiers.
- SmbFscc
Error - Errors specific to the smb-fscc crate.
- SmbMsg
Error - SMB Message related errors
- Socket
Addr Storage - SrvHash
Retrieval Type - 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.
- Svhdx
Open Device Context - 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§
- Create
Context Data Request Value - This trait is automatically implemented for all
CreateRequestcreate context values. - Create
Context Data Response Value - This trait is automatically implemented for all
CreateResponsecreate context values. - File
Info Type - Trait for file information types. This trait contains all types of all file info types and classes, specified in MS-FSCC.
- Fsctl
Request - This is a helper trait that defines, for a certain FSCTL request type, the response type and their matching FSCTL code.
- Fsctl
Response Content - A trait that helps parsing FSCTL responses by matching the FSCTL code.
- Ioctl
Request Content - A trait that helps calculating the size of the buffer for IOCTL requests.
- Query
Directory Info Value - Trait for inner values in
QueryDirectoryInfo. - Query
File Info Value - Trait for inner values in
QueryFileInfo. - Query
File System Info Value - Trait for inner values in
QueryFileSystemInfo. - SetFile
Info Value - Trait for inner values in
SetFileInfo. - SetFile
System Info Value - Trait for inner values in
SetFileSystemInfo.
Type Aliases§
- Encryption
Nonce - 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.
- File
Full EaInformation - File
Stream Information - Lease
Break Ack - Lease Break Acknowledgment - sent by client in response to lease break notification.
- Lease
Break Response - Lease Break Response - sent by server in response to lease break acknowledgment.
- Network
Interfaces Info - Oplock
Break Ack - Oplock Break Acknowledgment - sent by client in response to oplock break notification.
- Oplock
Break Notify - Oplock Break Notification - sent by server when an oplock is being broken.
- Oplock
Break Response - Oplock Break Response - sent by server in response to oplock break acknowledgment.
- Query
File Full EaInformation - Result
- SMB Result type
Attribute Macros§
- mbitfield
- A helper macro that invokes
modular_bitfieldandbinrwderives for bitfield structs. Those must be installed as dependencies in the crate where this macro is used.