Skip to main content

Smb2Header

Struct Smb2Header 

Source
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):

OffsetSizeField
04ProtocolId (0xFE 'S' 'M' 'B')
42StructureSize (always 64)
62CreditCharge
84(Channel)Status
122Command
142CreditRequest/CreditResponse
164Flags
204NextCommand
248MessageId
328Reserved/TreeId (sync) or AsyncId (async)
408SessionId
4816Signature

Fields§

§credit_charge: u16§channel_sequence_status: u32

Bytes 8..12: in client-to-server requests on 3.x this splits into ChannelSequence(u16) + Reserved(u16); in server-to-client responses it carries Status (NTSTATUS). Kept as the raw u32.

§command: Command§credit_request_response: u16

On requests this is CreditRequest; on responses, CreditResponse.

§flags: u32§next_command: u32

Offset to the next header in a compound chain, or 0 for the last.

§message_id: u64§tail: HeaderTail

Sync: (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

Source

pub fn is_async(&self) -> bool

Is this an async-form header?

Source

pub fn is_response(&self) -> bool

Is this a server-to-client response?

Source

pub fn tree_id(&self) -> Option<u32>

TreeId of a sync header, None for async.

Source

pub fn async_id(&self) -> Option<u64>

AsyncId of an async header, None for sync.

Source

pub fn parse(buf: &[u8]) -> Result<(Self, &[u8]), ProtoError>

Parse from a byte slice. Returns the header and the remaining bytes.

Source

pub fn write(&self, out: &mut Vec<u8>) -> Result<(), ProtoError>

Serialize the 64-byte header into out.

Trait Implementations§

Source§

impl Clone for Smb2Header

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Smb2Header

Source§

impl Debug for Smb2Header

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Smb2Header

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Smb2Header

Source§

impl PartialEq for Smb2Header

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Smb2Header

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

The type of the none-equivalent value that NoneValue::null_value produces.
Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more