pub struct Smb2Header {
pub credit_charge: u16,
pub channel_sequence_status: u32,
pub command: Command,
pub credit_request_response: u16,
pub flags: u32,
pub next_command: u32,
pub message_id: u64,
pub tail: HeaderTail,
pub session_id: u64,
pub signature: [u8; 16],
}Expand description
SMB2 fixed 64-byte header.
On the wire the layout is (offsets in decimal — total 64 bytes):
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | ProtocolId (0xFE 'S' 'M' 'B') |
| 4 | 2 | StructureSize (always 64) |
| 6 | 2 | CreditCharge |
| 8 | 4 | (Channel)Status |
| 12 | 2 | Command |
| 14 | 2 | CreditRequest/CreditResponse |
| 16 | 4 | Flags |
| 20 | 4 | NextCommand |
| 24 | 8 | MessageId |
| 32 | 8 | Reserved/TreeId (sync) or AsyncId (async) |
| 40 | 8 | SessionId |
| 48 | 16 | Signature |
Fields§
§credit_charge: u16§channel_sequence_status: u32Bytes 8..12: in client→server requests on 3.x this can split into
ChannelSequence(u16) + Reserved(u16); in server→client responses
it carries Status (NTSTATUS). We expose the raw u32 — handlers/
signing code interpret it.
command: Command§credit_request_response: u16On requests this is CreditRequest; on responses, CreditResponse.
flags: u32§next_command: u32Offset to the next header in a compound chain, or 0 for the last.
message_id: u64§tail: HeaderTailSync: (reserved, tree_id). Async: async_id. Discriminated by
flags & SMB2_FLAGS_ASYNC_COMMAND.
session_id: u64§signature: [u8; 16]16-byte signature; zeroed on unsigned messages.
Implementations§
Source§impl Smb2Header
impl Smb2Header
Sourcepub fn is_response(&self) -> bool
pub fn is_response(&self) -> bool
Convenience: is this a server→client response?
Sourcepub fn tree_id(&self) -> Option<u32>
pub fn tree_id(&self) -> Option<u32>
Convenience: tree_id from a sync header (panics if async).
Trait Implementations§
Source§impl Clone for Smb2Header
impl Clone for Smb2Header
impl Copy for Smb2Header
Source§impl Debug for Smb2Header
impl Debug for Smb2Header
Source§impl Default for Smb2Header
impl Default for Smb2Header
impl Eq for Smb2Header
Source§impl PartialEq for Smb2Header
impl PartialEq for Smb2Header
impl StructuralPartialEq for Smb2Header
Auto Trait Implementations§
impl Freeze for Smb2Header
impl RefUnwindSafe for Smb2Header
impl Send for Smb2Header
impl Sync for Smb2Header
impl Unpin for Smb2Header
impl UnsafeUnpin for Smb2Header
impl UnwindSafe for Smb2Header
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more