message

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Header  *header.Header
	Command command_interface.CommandInterface
}

SMBMessage represents an SMB message Source: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/4d330f4c-151c-4d79-b207-40bd4f754da9

func (*Message) AddCommand

func (m *Message) AddCommand(command command_interface.CommandInterface)

AddCommand adds a command to the message If the command is an AndX, it will add the command and the next command If the command is not an AndX, it will add the command

func (*Message) Marshal

func (m *Message) Marshal() ([]byte, error)

Marshal serializes the Message into a byte slice.

This method marshals the message's components in the following order:

  1. Header - Contains protocol identifier, command code, status, flags, etc.
  2. Parameters and Data blocks - For each ParameterDataBlock in the message: a. Parameters - Contains command-specific parameters b. Data - Contains command-specific data

The marshalled data follows the SMB protocol format as specified in MS-CIFS. For AndX messages, multiple parameter-data blocks will be marshalled sequentially.

Returns: - A byte slice containing the marshalled message - An error if marshalling any component fails

func (*Message) Unmarshal

func (m *Message) Unmarshal(marshalledData []byte) error

Unmarshal deserializes a byte slice into the Message structure.

This method reads the binary representation of the Message structure from the input byte slice according to the SMB protocol format. It processes the components in the following order:

  1. Header - Reads protocol identifier, command code, status, flags, etc.
  2. Parameters and Data blocks - For each ParameterDataBlock in the message: a. Parameters - Reads command-specific parameters b. Data - Reads command-specific data

For AndX messages, multiple parameter-data blocks will be unmarshalled sequentially. The method will continue reading blocks until all data in the input slice is consumed.

Parameters: - marshalledData: The byte slice containing the serialized Message structure

Returns: - An error if unmarshalling any component fails, or nil if successful

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL