Expand description
The command table (single source of truth) and the commands migrated onto the typestate pipeline so far. Phase 0 wires only ECHO end to end to prove the machinery; later phases add one line per command here.
Structs§
- Cancel
Cmd - CANCEL handler ([MS-SMB2] §3.3.5.16): signals the targeted pending op to complete with STATUS_CANCELLED. CANCEL itself yields no reply.
- Cancel
Req - SMB2 CANCEL request ([MS-SMB2] §2.2.30): correlated by MessageId/AsyncId from the header, so the body carries nothing we decode.
- Change
Notify Cmd - CHANGE_NOTIFY handler ([MS-SMB2] §3.3.5.19): registers a directory watch and
defers as
Outcome::Interim; the background watcher completes it when the first change (or cancellation) arrives. - Close
Cmd - CLOSE handler ([MS-SMB2] §3.3.5.10): closes a pipe handle, else a file handle and tears down that open’s notifies, byte-range locks, share mode, oplock, lease, and durable-handle state.
- Create
Cmd - CREATE handler ([MS-SMB2] §3.3.5.9): opens a named pipe on IPC$, else a file or directory. A symlink in the path yields a Symbolic Link Error Response ([MS-SMB2] §2.2.2.2.1); the heavy share-mode/oplock/lease/durable logic lives in the existing create().
- EchoCmd
- ECHO handler: a keep-alive, always answered SUCCESS ([MS-SMB2] §3.3.5.17).
- EchoReq
- SMB2 ECHO request ([MS-SMB2] §2.2.28): no meaningful body.
- Flush
Cmd - FLUSH handler ([MS-SMB2] §3.3.5.11): flush the open’s backing file.
- Ioctl
Cmd - IOCTL handler ([MS-SMB2] §3.3.5.15): FSCTL dispatch (validate-negotiate, resiliency, pipe transact, server-side copy, zero-data, interface info, …). A downgrade-detected VALIDATE_NEGOTIATE_INFO terminates the connection and yields no reply.
- LockCmd
- LOCK handler ([MS-SMB2] §3.3.5.14): a byte-range lock/unlock. A conflicting
blocking lock defers as
Outcome::Interim; the parked waiter completes it on the outbound queue when the range frees. - Logoff
Cmd - LOGOFF handler ([MS-SMB2] §3.3.5.6): release the session’s resources but keep the session id and keys so this reply still frames/seals correctly.
- Logoff
Req - SMB2 LOGOFF request ([MS-SMB2] §2.2.7): no fields we act on.
- Negotiate
Cmd - NEGOTIATE handler ([MS-SMB2] §3.3.5.3-4): negotiates the dialect and cipher/compression. A repeat NEGOTIATE on an already-negotiated connection terminates it ([MS-SMB2] §3.3.5.4), yielding no reply.
- Negotiate
Req - SMB2 NEGOTIATE request ([MS-SMB2] §2.2.3): dialects and negotiate contexts are parsed from the frame by the negotiator, so the marker itself decodes nothing.
- Oplock
Break Cmd - OPLOCK_BREAK handler ([MS-SMB2] §3.3.5.22): acknowledges an oplock or lease break. Command 18 dispatches on StructureSize — 36 is a lease-break ack (record the settled state), otherwise an oplock-break ack (echo the level).
- Oplock
Break Req - SMB2 OPLOCK_BREAK acknowledgement ([MS-SMB2] §2.2.24): command 18 carries an oplock (StructureSize 24) or lease (StructureSize 36) ack, dispatched on the size in the handler, so the marker itself decodes nothing.
- Query
DirCmd - QUERY_DIRECTORY handler ([MS-SMB2] §3.3.5.18): enumerates a directory handle.
- Query
Info Cmd - QUERY_INFO handler ([MS-SMB2] §3.3.5.20): file/filesystem/security info.
- ReadCmd
- READ handler ([MS-SMB2] §3.3.5.12): a pipe read on IPC$, else a file read.
- Session
Setup Cmd - SESSION_SETUP handler ([MS-SMB2] §3.3.5.5): runs one NTLM/SPNEGO leg via the existing authenticator. Kept thin so the shared framing tail still folds the pre-auth hash, derives the signing key and registers the session in one place.
- Session
Setup Req - SMB2 SESSION_SETUP request ([MS-SMB2] §2.2.5): the NTLM/SPNEGO blob is parsed from the frame by the authenticator, so the marker itself decodes nothing.
- SetInfo
Cmd - SET_INFO handler ([MS-SMB2] §3.3.5.21): applies file/filesystem info changes.
- Tree
Connect Cmd - TREE_CONNECT handler ([MS-SMB2] §3.3.5.7): resolves the share, installs a fresh TreeId (surfaced to the reply header via conn.resp_tree_id), and answers with the share’s type.
- Tree
Connect Req - SMB2 TREE_CONNECT request ([MS-SMB2] §2.2.9): the share path is parsed from the frame by the handler, so the marker itself decodes nothing.
- Tree
Disconnect Cmd - TREE_DISCONNECT handler ([MS-SMB2] §3.3.5.8): idempotent tree teardown.
- Tree
Disconnect Req - SMB2 TREE_DISCONNECT request ([MS-SMB2] §2.2.11): no fields we act on.
- Write
Cmd - WRITE handler ([MS-SMB2] §3.3.5.13): a pipe write on IPC$, else a file write.
Enums§
- SmbRequest
- Sum type over every client request the server decodes (generated).
Functions§
- complete_
pending_ 🔒notifies - Complete any pending CHANGE_NOTIFY on this handle with STATUS_NOTIFY_CLEANUP ([MS-SMB2] §3.3.5.10) when its open is closed.
- dispatch
- Serve a request by moving it into its owning handler (generated).