command_interface
import "github.com/TheManticoreProject/Manticore/network/cifs/message/commands/command_interface"
Index
- type Command
- func (c *Command) AddCommandToChain(nextCommand CommandInterface)
- func (c *Command) GetAndX() *andx.AndX
- func (c *Command) GetChainLength() uint
- func (c *Command) GetCommandCode() codes.CommandCode
- func (c *Command) GetData() *data.Data
- func (c *Command) GetNextCommand() CommandInterface
- func (c *Command) GetParameters() *parameters.Parameters
- func (c *Command) Init()
- func (c *Command) IsAndX() bool
- func (c *Command) Marshal() ([]byte, error)
- func (c *Command) SetAndX(andX *andx.AndX)
- func (c *Command) SetCommandCode(commandCode codes.CommandCode)
- func (c *Command) SetData(data *data.Data)
- func (c *Command) SetNextCommand(nextCommand CommandInterface)
- func (c *Command) SetParameters(parameters *parameters.Parameters)
- func (c *Command) Unmarshal(data []byte) (int, error)
- type CommandInterface
type Command
Command is a struct that implements the CommandInterface
type Command struct {
// Command code
CommandCode codes.CommandCode
// AndX command
AndX *andx.AndX
// Parameters
Parameters *parameters.Parameters
// Data
Data *data.Data
// Next command
NextCommand CommandInterface
}
func (*Command) AddCommandToChain
func (c *Command) AddCommandToChain(nextCommand CommandInterface)
AddCommandToChain adds a command to the chain
Parameters:
- nextCommand: The next command to add to the chain
func (*Command) GetAndX
func (c *Command) GetAndX() *andx.AndX
GetAndX returns the AndX of the command
Returns:
- *andx.AndX: The AndX of the command
func (*Command) GetChainLength
func (c *Command) GetChainLength() uint
GetChainLength returns the length of the chain of commands
Returns:
- uint: The length of the chain of commands
func (*Command) GetCommandCode
func (c *Command) GetCommandCode() codes.CommandCode
GetCommandCode returns the command code
Returns:
- codes.CommandCode: The command code
func (*Command) GetData
func (c *Command) GetData() *data.Data
GetData returns the data of the command
Returns:
- *data.Data: The data of the command
func (*Command) GetNextCommand
func (c *Command) GetNextCommand() CommandInterface
GetNextCommand returns the next command in the chain If the command is not an AndX, it returns nil
Returns:
- CommandInterface: The next command in the chain
func (*Command) GetParameters
func (c *Command) GetParameters() *parameters.Parameters
GetParameters returns the parameters of the command
Returns:
- *parameters.Parameters: The parameters of the command
func (*Command) Init
func (c *Command) Init()
Init initializes the command
Parameters:
- commandCode: The command code to set
func (*Command) IsAndX
func (c *Command) IsAndX() bool
IsAndX returns true if the command is an AndX
Returns:
- bool: True if the command is an AndX, false otherwise
func (*Command) Marshal
func (c *Command) Marshal() ([]byte, error)
Marshal returns the marshalled command
Returns:
- []byte: The marshalled command
- error: An error if the marshalling fails
func (*Command) SetAndX
func (c *Command) SetAndX(andX *andx.AndX)
SetAndX sets the AndX of the command
Parameters:
- andX: The AndX to set
func (*Command) SetCommandCode
func (c *Command) SetCommandCode(commandCode codes.CommandCode)
SetCommandCode sets the command code
Parameters:
- commandCode: The command code to set
func (*Command) SetData
func (c *Command) SetData(data *data.Data)
SetData sets the data of the command
Parameters:
- data: The data to set
func (*Command) SetNextCommand
func (c *Command) SetNextCommand(nextCommand CommandInterface)
SetNextCommand sets the next command in the chain
Parameters:
- nextCommand: The next command to set
func (*Command) SetParameters
func (c *Command) SetParameters(parameters *parameters.Parameters)
SetParameters sets the parameters of the command
Parameters:
- parameters: The parameters to set
func (*Command) Unmarshal
func (c *Command) Unmarshal(data []byte) (int, error)
Unmarshal unmarshals the command
Parameters:
- data: The data to unmarshal
Returns:
- int: The number of bytes unmarshalled
- error: An error if the unmarshalling fails
type CommandInterface
type CommandInterface interface {
// GetCommandCode returns the command code
GetCommandCode() codes.CommandCode
// SetCommandCode sets the command code
SetCommandCode(codes.CommandCode)
// GetAndX returns the AndX of the command
GetAndX() *andx.AndX
// SetAndX sets the AndX of the command
SetAndX(*andx.AndX)
// IsAndX returns true if the command is an AndX
IsAndX() bool
// GetParameters returns the parameters of the command
GetParameters() *parameters.Parameters
// SetParameters sets the parameters of the command
SetParameters(*parameters.Parameters)
// GetData returns the data of the command
GetData() *data.Data
// SetData sets the data of the command
SetData(*data.Data)
// GetNextCommand returns the next command in the chain
// If the command is not an AndX, it returns nil
GetNextCommand() CommandInterface
// SetNextCommand sets the next command in the chain
SetNextCommand(CommandInterface)
// AddCommandToChain adds a command to the chain
AddCommandToChain(CommandInterface)
// GetChainLength returns the length of the chain of commands
GetChainLength() uint
// Marshal returns the marshalled command
Marshal() ([]byte, error)
// Unmarshal unmarshals the command
Unmarshal([]byte) (int, error)
// Init initializes the command
Init()
}