commands
import "github.com/TheManticoreProject/Manticore/network/smb/smb_v20/message/commands"
Index
- Constants
- func CreateRequestCommand(commandCode codes.CommandCode) (command_interface.CommandInterface, error)
- func CreateResponseCommand(commandCode codes.CommandCode) (command_interface.CommandInterface, error)
- type CancelRequest
- type ChangeNotifyRequest
- type ChangeNotifyResponse
- type CloseRequest
- type CloseResponse
- type CreateRequest
- type CreateResponse
- type EchoRequest
- type EchoResponse
- type FlushRequest
- type FlushResponse
- type IoctlRequest
- type IoctlResponse
- type LockElement
- type LockRequest
- type LockResponse
- type LogoffRequest
- type LogoffResponse
- type NegotiateRequest
- type NegotiateResponse
- type OplockBreakRequest
- type OplockBreakResponse
- type QueryDirectoryRequest
- type QueryDirectoryResponse
- type QueryInfoRequest
- type QueryInfoResponse
- type ReadRequest
- type ReadResponse
- type SessionSetupRequest
- type SessionSetupResponse
- type SetInfoRequest
- type SetInfoResponse
- type TreeConnectRequest
- type TreeConnectResponse
- type TreeDisconnectRequest
- type TreeDisconnectResponse
- type WriteRequest
- type WriteResponse
Constants
const (
// ChangeNotifyRequestStructureSize is the fixed StructureSize value for an SMB2
// CHANGE_NOTIFY Request. The request has no variable buffer, so this equals the
// body size.
ChangeNotifyRequestStructureSize = 32
// SMB2_WATCH_TREE requests that the directory be monitored recursively.
SMB2_WATCH_TREE = 0x0001
)
const (
// CloseRequestStructureSize is the fixed StructureSize value for an SMB2 CLOSE Request.
CloseRequestStructureSize = 24
// SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB requests that the server return file
// attributes in the CLOSE Response.
SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB = 0x0001
)
SMB2 oplock levels (CREATE RequestedOplockLevel / Response OplockLevel).
const (
SMB2_OPLOCK_LEVEL_NONE = 0x00
SMB2_OPLOCK_LEVEL_II = 0x01
SMB2_OPLOCK_LEVEL_EXCLUSIVE = 0x08
SMB2_OPLOCK_LEVEL_BATCH = 0x09
SMB2_OPLOCK_LEVEL_LEASE = 0xFF
)
const (
// IoctlRequestStructureSize is the fixed StructureSize value the client MUST
// set for an SMB2 IOCTL Request (56-byte fixed part + 1).
IoctlRequestStructureSize = 57
// SMB2_0_IOCTL_IS_FSCTL indicates the request is an FSCTL (rather than IOCTL).
SMB2_0_IOCTL_IS_FSCTL = 0x00000001
)
const (
// LockRequestStructureSize is the fixed StructureSize value the client MUST
// set for an SMB2 LOCK Request. It is 48 — the size with a single
// SMB2_LOCK_ELEMENT — regardless of how many lock elements are sent.
LockRequestStructureSize = 48
// LockElementSize is the wire size, in bytes, of one SMB2_LOCK_ELEMENT.
LockElementSize = 24
)
SMB2 lock element flags (SMB2_LOCK_ELEMENT Flags field).
const (
SMB2_LOCKFLAG_SHARED_LOCK = 0x00000001
SMB2_LOCKFLAG_EXCLUSIVE_LOCK = 0x00000002
SMB2_LOCKFLAG_UNLOCK = 0x00000004
SMB2_LOCKFLAG_FAIL_IMMEDIATELY = 0x00000010
)
SMB2 QUERY_DIRECTORY request flags.
const (
SMB2_RESTART_SCANS = 0x01
SMB2_RETURN_SINGLE_ENTRY = 0x02
SMB2_INDEX_SPECIFIED = 0x04
SMB2_REOPEN = 0x10
)
SMB2 QUERY_INFO / SET_INFO information types (InfoType field).
const (
SMB2_0_INFO_FILE = 0x01
SMB2_0_INFO_FILESYSTEM = 0x02
SMB2_0_INFO_SECURITY = 0x03
SMB2_0_INFO_QUOTA = 0x04
)
const (
// SessionSetupRequestStructureSize is the fixed StructureSize value the client
// MUST set for an SMB2 SESSION_SETUP Request (24-byte fixed part + 1).
SessionSetupRequestStructureSize = 25
// SMB2_SESSION_FLAG_BINDING indicates the request binds an existing session to a new connection.
SMB2_SESSION_FLAG_BINDING = 0x01
)
const (
// SessionSetupResponseStructureSize is the fixed StructureSize value the server
// MUST set for an SMB2 SESSION_SETUP Response (8-byte fixed part + 1).
SessionSetupResponseStructureSize = 9
// SMB2_SESSION_FLAG_IS_GUEST indicates the client was authenticated as a guest.
SMB2_SESSION_FLAG_IS_GUEST = 0x0001
// SMB2_SESSION_FLAG_IS_NULL indicates the client was authenticated anonymously.
SMB2_SESSION_FLAG_IS_NULL = 0x0002
// SMB2_SESSION_FLAG_ENCRYPT_DATA indicates the server requires encryption (SMB 3.x only).
SMB2_SESSION_FLAG_ENCRYPT_DATA = 0x0004
)
SMB2 share types (TREE_CONNECT Response ShareType field).
const (
SMB2_SHARE_TYPE_DISK = 0x01
SMB2_SHARE_TYPE_PIPE = 0x02
SMB2_SHARE_TYPE_PRINT = 0x03
)
CancelRequestStructureSize is the fixed StructureSize value for an SMB2 CANCEL Request.
const CancelRequestStructureSize = 4
const (
// ChangeNotifyResponseStructureSize is the fixed StructureSize value the server
// MUST set for an SMB2 CHANGE_NOTIFY Response (8-byte fixed part + 1).
ChangeNotifyResponseStructureSize = 9
)
CloseResponseStructureSize is the fixed StructureSize value for an SMB2 CLOSE Response.
const CloseResponseStructureSize = 60
const (
// CreateRequestStructureSize is the fixed StructureSize value the client MUST
// set for an SMB2 CREATE Request (56-byte fixed part + 1).
CreateRequestStructureSize = 57
)
const (
// CreateResponseStructureSize is the fixed StructureSize value the server MUST
// set for an SMB2 CREATE Response (88-byte fixed part + 1).
CreateResponseStructureSize = 89
)
EchoRequestStructureSize is the fixed StructureSize value for an SMB2 ECHO Request.
const EchoRequestStructureSize = 4
EchoResponseStructureSize is the fixed StructureSize value for an SMB2 ECHO Response.
const EchoResponseStructureSize = 4
FlushRequestStructureSize is the fixed StructureSize value for an SMB2 FLUSH Request.
const FlushRequestStructureSize = 24
FlushResponseStructureSize is the fixed StructureSize value for an SMB2 FLUSH Response.
const FlushResponseStructureSize = 4
const (
// IoctlResponseStructureSize is the fixed StructureSize value the server MUST
// set for an SMB2 IOCTL Response (48-byte fixed part + 1).
IoctlResponseStructureSize = 49
)
LockResponseStructureSize is the fixed StructureSize value for an SMB2 LOCK Response.
const LockResponseStructureSize = 4
LogoffRequestStructureSize is the fixed StructureSize value for an SMB2 LOGOFF Request.
const LogoffRequestStructureSize = 4
LogoffResponseStructureSize is the fixed StructureSize value for an SMB2 LOGOFF Response.
const LogoffResponseStructureSize = 4
const (
// NegotiateRequestStructureSize is the fixed StructureSize value the client
// MUST set for an SMB2 NEGOTIATE Request, regardless of the number of dialects.
NegotiateRequestStructureSize = 36
)
const (
// NegotiateResponseStructureSize is the fixed StructureSize value the server
// MUST set for an SMB2 NEGOTIATE Response (64-byte fixed part + 1).
NegotiateResponseStructureSize = 65
)
OplockBreakRequestStructureSize is the fixed StructureSize value for an SMB2 OPLOCK_BREAK Acknowledgment.
const OplockBreakRequestStructureSize = 24
OplockBreakResponseStructureSize is the fixed StructureSize value for an SMB2 OPLOCK_BREAK Notification and Response.
const OplockBreakResponseStructureSize = 24
const (
// QueryDirectoryRequestStructureSize is the fixed StructureSize value the
// client MUST set for an SMB2 QUERY_DIRECTORY Request (32-byte fixed part + 1).
QueryDirectoryRequestStructureSize = 33
)
const (
// QueryDirectoryResponseStructureSize is the fixed StructureSize value the
// server MUST set for an SMB2 QUERY_DIRECTORY Response (8-byte fixed part + 1).
QueryDirectoryResponseStructureSize = 9
)
const (
// QueryInfoRequestStructureSize is the fixed StructureSize value the client
// MUST set for an SMB2 QUERY_INFO Request (40-byte fixed part + 1).
QueryInfoRequestStructureSize = 41
)
const (
// QueryInfoResponseStructureSize is the fixed StructureSize value the server
// MUST set for an SMB2 QUERY_INFO Response (8-byte fixed part + 1).
QueryInfoResponseStructureSize = 9
)
const (
// ReadRequestStructureSize is the fixed StructureSize value the client MUST
// set for an SMB2 READ Request (48-byte fixed part + 1).
ReadRequestStructureSize = 49
)
const (
// ReadResponseStructureSize is the fixed StructureSize value the server MUST
// set for an SMB2 READ Response (16-byte fixed part + 1).
ReadResponseStructureSize = 17
)
const (
// SetInfoRequestStructureSize is the fixed StructureSize value the client MUST
// set for an SMB2 SET_INFO Request (32-byte fixed part + 1).
SetInfoRequestStructureSize = 33
)
SetInfoResponseStructureSize is the fixed StructureSize value for an SMB2 SET_INFO Response. The response is exactly this 2-byte field.
const SetInfoResponseStructureSize = 2
const (
// TreeConnectRequestStructureSize is the fixed StructureSize value the client
// MUST set for an SMB2 TREE_CONNECT Request (8-byte fixed part + 1).
TreeConnectRequestStructureSize = 9
)
TreeConnectResponseStructureSize is the fixed StructureSize value for an SMB2 TREE_CONNECT Response.
const TreeConnectResponseStructureSize = 16
TreeDisconnectRequestStructureSize is the fixed StructureSize value for an SMB2 TREE_DISCONNECT Request.
const TreeDisconnectRequestStructureSize = 4
TreeDisconnectResponseStructureSize is the fixed StructureSize value for an SMB2 TREE_DISCONNECT Response.
const TreeDisconnectResponseStructureSize = 4
const (
// WriteRequestStructureSize is the fixed StructureSize value the client MUST
// set for an SMB2 WRITE Request (48-byte fixed part + 1).
WriteRequestStructureSize = 49
)
const (
// WriteResponseStructureSize is the fixed StructureSize value the server MUST
// set for an SMB2 WRITE Response (16-byte fixed part + 1).
WriteResponseStructureSize = 17
)
func CreateRequestCommand
func CreateRequestCommand(commandCode codes.CommandCode) (command_interface.CommandInterface, error)
CreateRequestCommand creates a request command for the given command code.
Concrete request commands are wired in as they are implemented (one case per SMB2 command code), mirroring the SMB 1.0 dispatcher. Codes without a structure yet are reported as unsupported.
func CreateResponseCommand
func CreateResponseCommand(commandCode codes.CommandCode) (command_interface.CommandInterface, error)
CreateResponseCommand creates a response command for the given command code.
Concrete response commands are wired in as they are implemented (one case per SMB2 command code), mirroring the SMB 1.0 dispatcher. Codes without a structure yet are reported as unsupported.
type CancelRequest
CancelRequest is the SMB2 CANCEL Request body, sent by the client to cancel a previously sent request. The MessageId of the request to be canceled is set in the SMB2 header. CANCEL has no response.
type CancelRequest struct {
command_interface.Command
// Reserved (2 bytes): The client MUST set this to 0, and the server MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewCancelRequest
func NewCancelRequest() *CancelRequest
NewCancelRequest creates a new SMB2 CANCEL Request.
func (*CancelRequest) Marshal
func (c *CancelRequest) Marshal() ([]byte, error)
Marshal serializes the CANCEL Request body.
func (*CancelRequest) Unmarshal
func (c *CancelRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the CANCEL Request body.
type ChangeNotifyRequest
ChangeNotifyRequest is the SMB2 CHANGE_NOTIFY Request body, sent by the client to be notified of changes to the directory identified by FileId.
type ChangeNotifyRequest struct {
command_interface.Command
// Flags (2 bytes): SMB2_WATCH_TREE to monitor the directory recursively.
Flags types.USHORT
// OutputBufferLength (4 bytes): The maximum number of response bytes desired.
OutputBufferLength types.ULONG
// FileId (16 bytes): The directory to monitor.
FileId types.SMB2_FILEID
// CompletionFilter (4 bytes): The types of changes to monitor (FILE_NOTIFY_CHANGE_*).
CompletionFilter types.ULONG
// Reserved (4 bytes): The client MUST set this to 0.
Reserved types.ULONG
}
func NewChangeNotifyRequest
func NewChangeNotifyRequest() *ChangeNotifyRequest
NewChangeNotifyRequest creates a new SMB2 CHANGE_NOTIFY Request.
func (*ChangeNotifyRequest) Marshal
func (c *ChangeNotifyRequest) Marshal() ([]byte, error)
Marshal serializes the CHANGE_NOTIFY Request body.
func (*ChangeNotifyRequest) Unmarshal
func (c *ChangeNotifyRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the CHANGE_NOTIFY Request body.
type ChangeNotifyResponse
ChangeNotifyResponse is the SMB2 CHANGE_NOTIFY Response body, sent by the server with a buffer of FILE_NOTIFY_INFORMATION change records.
type ChangeNotifyResponse struct {
command_interface.Command
// OutputBuffer holds the FILE_NOTIFY_INFORMATION records, carried verbatim.
// OutputBufferOffset/Length are computed on marshal.
OutputBuffer []byte
}
func NewChangeNotifyResponse
func NewChangeNotifyResponse() *ChangeNotifyResponse
NewChangeNotifyResponse creates a new SMB2 CHANGE_NOTIFY Response.
func (*ChangeNotifyResponse) Marshal
func (c *ChangeNotifyResponse) Marshal() ([]byte, error)
Marshal serializes the CHANGE_NOTIFY Response body.
func (*ChangeNotifyResponse) Unmarshal
func (c *ChangeNotifyResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the CHANGE_NOTIFY Response body.
type CloseRequest
CloseRequest is the SMB2 CLOSE Request body, sent by the client to close an open identified by FileId.
type CloseRequest struct {
command_interface.Command
// Flags (2 bytes): If SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB is set, the server
// returns file attributes in the response.
Flags types.USHORT
// Reserved (4 bytes): The client MUST set this to 0.
Reserved types.ULONG
// FileId (16 bytes): The open to be closed.
FileId types.SMB2_FILEID
}
func NewCloseRequest
func NewCloseRequest() *CloseRequest
NewCloseRequest creates a new SMB2 CLOSE Request.
func (*CloseRequest) Marshal
func (c *CloseRequest) Marshal() ([]byte, error)
Marshal serializes the CLOSE Request body.
func (*CloseRequest) Unmarshal
func (c *CloseRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the CLOSE Request body.
type CloseResponse
CloseResponse is the SMB2 CLOSE Response body, sent by the server to confirm that an SMB2 CLOSE Request was processed. The timestamp, size, and attribute fields are populated only if SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB was set in the request; otherwise they are zero.
type CloseResponse struct {
command_interface.Command
// Flags (2 bytes): Indicates how to process the operation.
Flags types.USHORT
// Reserved (4 bytes): The server MUST set this to 0.
Reserved types.ULONG
// CreationTime (8 bytes): When the file was created, as a 64-bit FILETIME.
CreationTime types.UINT64
// LastAccessTime (8 bytes): When the file was last accessed, as a 64-bit FILETIME.
LastAccessTime types.UINT64
// LastWriteTime (8 bytes): When data was last written, as a 64-bit FILETIME.
LastWriteTime types.UINT64
// ChangeTime (8 bytes): When the file was last changed, as a 64-bit FILETIME.
ChangeTime types.UINT64
// AllocationSize (8 bytes): The allocation size of the file, in bytes.
AllocationSize types.UINT64
// EndOfFile (8 bytes): The end-of-file offset, in bytes.
EndOfFile types.UINT64
// FileAttributes (4 bytes): The attributes of the file.
FileAttributes types.ULONG
}
func NewCloseResponse
func NewCloseResponse() *CloseResponse
NewCloseResponse creates a new SMB2 CLOSE Response.
func (*CloseResponse) Marshal
func (c *CloseResponse) Marshal() ([]byte, error)
Marshal serializes the CLOSE Response body.
func (*CloseResponse) Unmarshal
func (c *CloseResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the CLOSE Response body.
type CreateRequest
CreateRequest is the SMB2 CREATE Request body, sent by a client to create or open a file, named pipe, or printer.
type CreateRequest struct {
command_interface.Command
// SecurityFlags (1 byte): Reserved; the client MUST set this to 0.
SecurityFlags types.UCHAR
// RequestedOplockLevel (1 byte): The requested oplock level.
RequestedOplockLevel types.UCHAR
// ImpersonationLevel (4 bytes): The requested impersonation level.
ImpersonationLevel types.ULONG
// SmbCreateFlags (8 bytes): Reserved; the client SHOULD set this to 0.
SmbCreateFlags types.UINT64
// Reserved (8 bytes): Reserved; ignored by the server.
Reserved types.UINT64
// DesiredAccess (4 bytes): The level of access required.
DesiredAccess types.ULONG
// FileAttributes (4 bytes): The file attributes (MS-FSCC 2.6).
FileAttributes types.ULONG
// ShareAccess (4 bytes): The sharing mode for the open.
ShareAccess types.ULONG
// CreateDisposition (4 bytes): The action to take if the file exists.
CreateDisposition types.ULONG
// CreateOptions (4 bytes): The options to apply when creating/opening.
CreateOptions types.ULONG
// Name is the file name relative to the share (Unicode on the wire). An empty
// name opens the root of the share. NameOffset/NameLength are computed on marshal.
Name string
// CreateContexts is the raw, 8-byte-aligned list of SMB2_CREATE_CONTEXT
// structures, carried verbatim. CreateContextsOffset/Length are computed on
// marshal.
CreateContexts []byte
}
func NewCreateRequest
func NewCreateRequest() *CreateRequest
NewCreateRequest creates a new SMB2 CREATE Request.
func (*CreateRequest) Marshal
func (c *CreateRequest) Marshal() ([]byte, error)
Marshal serializes the CREATE Request body.
func (*CreateRequest) Unmarshal
func (c *CreateRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the CREATE Request body.
type CreateResponse
CreateResponse is the SMB2 CREATE Response body, sent by the server to report the result of an SMB2 CREATE Request and return the open’s FileId.
type CreateResponse struct {
command_interface.Command
// OplockLevel (1 byte): The oplock level granted for this open.
OplockLevel types.UCHAR
// Flags (1 byte): SMB 3.x reparse-point flag; reserved otherwise.
Flags types.UCHAR
// CreateAction (4 bytes): The action taken (superseded/opened/created/overwritten).
CreateAction types.ULONG
// CreationTime (8 bytes): When the file was created, as a 64-bit FILETIME.
CreationTime types.UINT64
// LastAccessTime (8 bytes): When the file was last accessed, as a 64-bit FILETIME.
LastAccessTime types.UINT64
// LastWriteTime (8 bytes): When data was last written, as a 64-bit FILETIME.
LastWriteTime types.UINT64
// ChangeTime (8 bytes): When the file was last modified, as a 64-bit FILETIME.
ChangeTime types.UINT64
// AllocationSize (8 bytes): The allocation size of the file, in bytes.
AllocationSize types.UINT64
// EndOfFile (8 bytes): The size of the file, in bytes.
EndOfFile types.UINT64
// FileAttributes (4 bytes): The attributes of the file.
FileAttributes types.ULONG
// Reserved2 (4 bytes): Reserved; the server SHOULD set this to 0.
Reserved2 types.ULONG
// FileId (16 bytes): The identifier of the established open.
FileId types.SMB2_FILEID
// CreateContexts is the raw list of SMB2_CREATE_CONTEXT response structures,
// carried verbatim. CreateContextsOffset/Length are computed on marshal.
CreateContexts []byte
}
func NewCreateResponse
func NewCreateResponse() *CreateResponse
NewCreateResponse creates a new SMB2 CREATE Response.
func (*CreateResponse) Marshal
func (c *CreateResponse) Marshal() ([]byte, error)
Marshal serializes the CREATE Response body.
func (*CreateResponse) Unmarshal
func (c *CreateResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the CREATE Response body.
type EchoRequest
EchoRequest is the SMB2 ECHO Request body, sent by a client to determine whether a server is still processing requests.
type EchoRequest struct {
command_interface.Command
// Reserved (2 bytes): The client MUST set this to 0, and the server MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewEchoRequest
func NewEchoRequest() *EchoRequest
NewEchoRequest creates a new SMB2 ECHO Request.
func (*EchoRequest) Marshal
func (c *EchoRequest) Marshal() ([]byte, error)
Marshal serializes the ECHO Request body.
func (*EchoRequest) Unmarshal
func (c *EchoRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the ECHO Request body.
type EchoResponse
EchoResponse is the SMB2 ECHO Response body, sent by the server to confirm that an SMB2 ECHO Request was processed.
type EchoResponse struct {
command_interface.Command
// Reserved (2 bytes): The server MUST set this to 0, and the client MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewEchoResponse
func NewEchoResponse() *EchoResponse
NewEchoResponse creates a new SMB2 ECHO Response.
func (*EchoResponse) Marshal
func (c *EchoResponse) Marshal() ([]byte, error)
Marshal serializes the ECHO Response body.
func (*EchoResponse) Unmarshal
func (c *EchoResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the ECHO Response body.
type FlushRequest
FlushRequest is the SMB2 FLUSH Request body, sent by the client to request that a server flush all cached file information for the open identified by FileId.
type FlushRequest struct {
command_interface.Command
// Reserved1 (2 bytes): The client MUST set this to 0.
Reserved1 types.USHORT
// Reserved2 (4 bytes): The client MUST set this to 0.
Reserved2 types.ULONG
// FileId (16 bytes): The open to be flushed.
FileId types.SMB2_FILEID
}
func NewFlushRequest
func NewFlushRequest() *FlushRequest
NewFlushRequest creates a new SMB2 FLUSH Request.
func (*FlushRequest) Marshal
func (c *FlushRequest) Marshal() ([]byte, error)
Marshal serializes the FLUSH Request body.
func (*FlushRequest) Unmarshal
func (c *FlushRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the FLUSH Request body.
type FlushResponse
FlushResponse is the SMB2 FLUSH Response body, sent by the server to confirm that an SMB2 FLUSH Request was processed.
type FlushResponse struct {
command_interface.Command
// Reserved (2 bytes): The server MUST set this to 0, and the client MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewFlushResponse
func NewFlushResponse() *FlushResponse
NewFlushResponse creates a new SMB2 FLUSH Response.
func (*FlushResponse) Marshal
func (c *FlushResponse) Marshal() ([]byte, error)
Marshal serializes the FLUSH Response body.
func (*FlushResponse) Unmarshal
func (c *FlushResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the FLUSH Response body.
type IoctlRequest
IoctlRequest is the SMB2 IOCTL Request body, sent by a client to issue an FSCTL/IOCTL control command. Output fields are 0 in a request; only the input buffer is carried.
type IoctlRequest struct {
command_interface.Command
// Reserved (2 bytes): The client MUST set this to 0.
Reserved types.USHORT
// CtlCode (4 bytes): The FSCTL/IOCTL control code.
CtlCode types.ULONG
// FileId (16 bytes): The file/pipe on which to perform the control.
FileId types.SMB2_FILEID
// MaxInputResponse (4 bytes): Max input bytes the server may return.
MaxInputResponse types.ULONG
// MaxOutputResponse (4 bytes): Max output bytes the server may return.
MaxOutputResponse types.ULONG
// Flags (4 bytes): 0 for an IOCTL, SMB2_0_IOCTL_IS_FSCTL for an FSCTL.
Flags types.ULONG
// Reserved2 (4 bytes): The client MUST set this to 0.
Reserved2 types.ULONG
// Input is the input data buffer. InputOffset/InputCount are computed on marshal.
Input []byte
}
func NewIoctlRequest
func NewIoctlRequest() *IoctlRequest
NewIoctlRequest creates a new SMB2 IOCTL Request.
func (*IoctlRequest) Marshal
func (c *IoctlRequest) Marshal() ([]byte, error)
Marshal serializes the IOCTL Request body.
func (*IoctlRequest) Unmarshal
func (c *IoctlRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the IOCTL Request body.
type IoctlResponse
IoctlResponse is the SMB2 IOCTL Response body, sent by the server with the result of an FSCTL/IOCTL command.
type IoctlResponse struct {
command_interface.Command
// Reserved (2 bytes): The server MUST set this to 0.
Reserved types.USHORT
// CtlCode (4 bytes): The FSCTL/IOCTL control code that was executed.
CtlCode types.ULONG
// FileId (16 bytes): The file/pipe on which the control was performed.
FileId types.SMB2_FILEID
// Flags (4 bytes): Reserved; the server MUST set this to 0.
Flags types.ULONG
// Reserved2 (4 bytes): The server MUST set this to 0.
Reserved2 types.ULONG
// Input is the returned input data buffer (often empty).
Input []byte
// Output is the returned output data buffer.
Output []byte
}
func NewIoctlResponse
func NewIoctlResponse() *IoctlResponse
NewIoctlResponse creates a new SMB2 IOCTL Response.
func (*IoctlResponse) Marshal
func (c *IoctlResponse) Marshal() ([]byte, error)
Marshal serializes the IOCTL Response body. The output buffer, if present, begins at the first 8-byte-aligned offset after the input buffer.
func (*IoctlResponse) Unmarshal
func (c *IoctlResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the IOCTL Response body.
type LockElement
LockElement is a single SMB2_LOCK_ELEMENT describing a byte range to lock or unlock.
type LockElement struct {
// Offset (8 bytes): The byte offset into the file at which the range begins.
Offset types.UINT64
// Length (8 bytes): The length, in bytes, of the range.
Length types.UINT64
// Flags (4 bytes): Whether the range is locked shared/exclusive or unlocked.
Flags types.ULONG
// Reserved (4 bytes): The client MUST set this to 0.
Reserved types.ULONG
}
type LockRequest
LockRequest is the SMB2 LOCK Request body, sent by the client to lock or unlock one or more byte ranges of the file identified by FileId.
type LockRequest struct {
command_interface.Command
// LockSequence (4 bytes): Reserved in SMB 2.0.2; lock sequence number/index otherwise.
LockSequence types.ULONG
// FileId (16 bytes): The file on which to perform the locks/unlocks.
FileId types.SMB2_FILEID
// Locks is the array of byte-range lock elements (at least one).
Locks []LockElement
}
func NewLockRequest
func NewLockRequest() *LockRequest
NewLockRequest creates a new SMB2 LOCK Request.
func (*LockRequest) Marshal
func (c *LockRequest) Marshal() ([]byte, error)
Marshal serializes the LOCK Request body.
func (*LockRequest) Unmarshal
func (c *LockRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the LOCK Request body.
type LockResponse
LockResponse is the SMB2 LOCK Response body, sent by the server to confirm that an SMB2 LOCK Request was processed.
Source: [MS-SMB2] section 2.2.27 SMB2 LOCK Response.
type LockResponse struct {
command_interface.Command
// Reserved (2 bytes): The server MUST set this to 0, and the client MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewLockResponse
func NewLockResponse() *LockResponse
NewLockResponse creates a new SMB2 LOCK Response.
func (*LockResponse) Marshal
func (c *LockResponse) Marshal() ([]byte, error)
Marshal serializes the LOCK Response body.
func (*LockResponse) Unmarshal
func (c *LockResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the LOCK Response body.
type LogoffRequest
LogoffRequest is the SMB2 LOGOFF Request body, used by the client to request termination of a particular session.
type LogoffRequest struct {
command_interface.Command
// Reserved (2 bytes): The client MUST set this to 0, and the server MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewLogoffRequest
func NewLogoffRequest() *LogoffRequest
NewLogoffRequest creates a new SMB2 LOGOFF Request.
func (*LogoffRequest) Marshal
func (c *LogoffRequest) Marshal() ([]byte, error)
Marshal serializes the LOGOFF Request body.
func (*LogoffRequest) Unmarshal
func (c *LogoffRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the LOGOFF Request body.
type LogoffResponse
LogoffResponse is the SMB2 LOGOFF Response body, sent by the server in response to an SMB2 LOGOFF Request.
type LogoffResponse struct {
command_interface.Command
// Reserved (2 bytes): The server MUST set this to 0, and the client MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewLogoffResponse
func NewLogoffResponse() *LogoffResponse
NewLogoffResponse creates a new SMB2 LOGOFF Response.
func (*LogoffResponse) Marshal
func (c *LogoffResponse) Marshal() ([]byte, error)
Marshal serializes the LOGOFF Response body.
func (*LogoffResponse) Unmarshal
func (c *LogoffResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the LOGOFF Response body.
type NegotiateRequest
NegotiateRequest is the SMB2 NEGOTIATE Request body, used by the client to notify the server which SMB 2 Protocol dialects it understands.
type NegotiateRequest struct {
command_interface.Command
// SecurityMode (2 bytes): Whether SMB signing is enabled or required at the client.
SecurityMode securitymode.SecurityMode
// Reserved (2 bytes): The client MUST set this to 0.
Reserved types.USHORT
// Capabilities (4 bytes): Client capabilities (0 unless the SMB 3.x family is implemented).
Capabilities capabilities.Capabilities
// ClientGuid (16 bytes): A GUID generated by the client.
ClientGuid [16]byte
// ClientStartTime (8 bytes): MUST NOT be used; the client sets this to 0. In
// the SMB 3.1.1 dialect this 8-byte span is reinterpreted as the negotiate
// context offset/count/reserved, which is deferred to the SMB 3.x work.
ClientStartTime types.UINT64
// Dialects (variable): The 16-bit dialect revision numbers supported by the
// client. DialectCount is derived from this slice on marshal.
Dialects []dialects.Dialect
}
func NewNegotiateRequest
func NewNegotiateRequest() *NegotiateRequest
NewNegotiateRequest creates a new SMB2 NEGOTIATE Request.
func (*NegotiateRequest) AddDialect
func (c *NegotiateRequest) AddDialect(dialect dialects.Dialect)
AddDialect appends a dialect revision number to the request.
func (*NegotiateRequest) Marshal
func (c *NegotiateRequest) Marshal() ([]byte, error)
Marshal serializes the NEGOTIATE Request body.
func (*NegotiateRequest) Unmarshal
func (c *NegotiateRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the NEGOTIATE Request body.
type NegotiateResponse
NegotiateResponse is the SMB2 NEGOTIATE Response body, sent by the server to notify the client of the preferred common dialect and server capabilities.
type NegotiateResponse struct {
command_interface.Command
// SecurityMode (2 bytes): Whether SMB signing is enabled or required at the server.
SecurityMode securitymode.SecurityMode
// DialectRevision (2 bytes): The preferred common dialect, or the wildcard revision.
DialectRevision dialects.Dialect
// NegotiateContextCount (2 bytes): Number of negotiate contexts (SMB 3.1.1 only; else reserved).
NegotiateContextCount types.USHORT
// ServerGuid (16 bytes): A GUID identifying the server.
ServerGuid [16]byte
// Capabilities (4 bytes): Server protocol capabilities.
Capabilities capabilities.Capabilities
// MaxTransactSize (4 bytes): Max buffer size for QUERY_INFO/QUERY_DIRECTORY/SET_INFO/CHANGE_NOTIFY.
MaxTransactSize types.ULONG
// MaxReadSize (4 bytes): Max READ length the server accepts.
MaxReadSize types.ULONG
// MaxWriteSize (4 bytes): Max WRITE length the server accepts.
MaxWriteSize types.ULONG
// SystemTime (8 bytes): Server system time, as a 64-bit FILETIME value.
SystemTime types.UINT64
// ServerStartTime (8 bytes): Server start time, as a 64-bit FILETIME value.
ServerStartTime types.UINT64
// NegotiateContextOffset (4 bytes): Offset to the first negotiate context (SMB 3.1.1 only; else reserved).
NegotiateContextOffset types.ULONG
// SecurityBuffer (variable): The GSS security token. SecurityBufferOffset and
// SecurityBufferLength are computed from this on marshal.
SecurityBuffer []byte
}
func NewNegotiateResponse
func NewNegotiateResponse() *NegotiateResponse
NewNegotiateResponse creates a new SMB2 NEGOTIATE Response.
func (*NegotiateResponse) Marshal
func (c *NegotiateResponse) Marshal() ([]byte, error)
Marshal serializes the NEGOTIATE Response body.
func (*NegotiateResponse) Unmarshal
func (c *NegotiateResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the NEGOTIATE Response body. The input begins at the command body (immediately after the 64-byte SMB2 header), and the SecurityBufferOffset it carries is header-relative.
type OplockBreakRequest
OplockBreakRequest is the SMB2 OPLOCK_BREAK Acknowledgment, sent by the client in response to an oplock break notification to acknowledge the reduced oplock level. (The lease-break acknowledgment, StructureSize 36, is an SMB 2.1+ feature and is not modeled here.)
type OplockBreakRequest struct {
command_interface.Command
// OplockLevel (1 byte): The lowered oplock level the client accepts.
OplockLevel types.UCHAR
// Reserved (1 byte): The client MUST set this to 0.
Reserved types.UCHAR
// Reserved2 (4 bytes): The client MUST set this to 0.
Reserved2 types.ULONG
// FileId (16 bytes): The open whose oplock is being acknowledged.
FileId types.SMB2_FILEID
}
func NewOplockBreakRequest
func NewOplockBreakRequest() *OplockBreakRequest
NewOplockBreakRequest creates a new SMB2 OPLOCK_BREAK Acknowledgment.
func (*OplockBreakRequest) Marshal
func (c *OplockBreakRequest) Marshal() ([]byte, error)
Marshal serializes the OPLOCK_BREAK Acknowledgment body.
func (*OplockBreakRequest) Unmarshal
func (c *OplockBreakRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the OPLOCK_BREAK Acknowledgment body.
type OplockBreakResponse
OplockBreakResponse is the server-sent SMB2 OPLOCK_BREAK message: both the unsolicited Notification (informing the client its oplock is being broken) and the Response to an Oplock Break Acknowledgment share this layout, which is identical to the acknowledgment. (Lease-break forms are SMB 2.1+ and are not modeled here.)
type OplockBreakResponse struct {
command_interface.Command
// OplockLevel (1 byte): The oplock level the server is breaking to / granting.
OplockLevel types.UCHAR
// Reserved (1 byte): The server MUST set this to 0.
Reserved types.UCHAR
// Reserved2 (4 bytes): The server MUST set this to 0.
Reserved2 types.ULONG
// FileId (16 bytes): The open whose oplock is being broken.
FileId types.SMB2_FILEID
}
func NewOplockBreakResponse
func NewOplockBreakResponse() *OplockBreakResponse
NewOplockBreakResponse creates a new SMB2 OPLOCK_BREAK Notification/Response.
func (*OplockBreakResponse) Marshal
func (c *OplockBreakResponse) Marshal() ([]byte, error)
Marshal serializes the OPLOCK_BREAK Notification/Response body.
func (*OplockBreakResponse) Unmarshal
func (c *OplockBreakResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the OPLOCK_BREAK Notification/Response body.
type QueryDirectoryRequest
QueryDirectoryRequest is the SMB2 QUERY_DIRECTORY Request body, sent by the client to enumerate a directory identified by FileId.
type QueryDirectoryRequest struct {
command_interface.Command
// FileInformationClass (1 byte): The format of the returned entries (MS-FSCC 2.4).
FileInformationClass types.UCHAR
// Flags (1 byte): How to process the enumeration (restart/single/index/reopen).
Flags types.UCHAR
// FileIndex (4 bytes): The resume index when SMB2_INDEX_SPECIFIED is set.
FileIndex types.ULONG
// FileId (16 bytes): The directory to enumerate.
FileId types.SMB2_FILEID
// OutputBufferLength (4 bytes): The maximum number of response bytes desired.
OutputBufferLength types.ULONG
// FileName is the search pattern (Unicode on the wire); empty means "*".
// FileNameOffset/FileNameLength are computed on marshal.
FileName string
}
func NewQueryDirectoryRequest
func NewQueryDirectoryRequest() *QueryDirectoryRequest
NewQueryDirectoryRequest creates a new SMB2 QUERY_DIRECTORY Request.
func (*QueryDirectoryRequest) Marshal
func (c *QueryDirectoryRequest) Marshal() ([]byte, error)
Marshal serializes the QUERY_DIRECTORY Request body.
func (*QueryDirectoryRequest) Unmarshal
func (c *QueryDirectoryRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the QUERY_DIRECTORY Request body.
type QueryDirectoryResponse
QueryDirectoryResponse is the SMB2 QUERY_DIRECTORY Response body, sent by the server with a buffer of directory entries.
type QueryDirectoryResponse struct {
command_interface.Command
// OutputBuffer holds the directory-entry information (MS-FSCC structures),
// carried verbatim. OutputBufferOffset/Length are computed on marshal.
OutputBuffer []byte
}
func NewQueryDirectoryResponse
func NewQueryDirectoryResponse() *QueryDirectoryResponse
NewQueryDirectoryResponse creates a new SMB2 QUERY_DIRECTORY Response.
func (*QueryDirectoryResponse) Marshal
func (c *QueryDirectoryResponse) Marshal() ([]byte, error)
Marshal serializes the QUERY_DIRECTORY Response body.
func (*QueryDirectoryResponse) Unmarshal
func (c *QueryDirectoryResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the QUERY_DIRECTORY Response body.
type QueryInfoRequest
QueryInfoRequest is the SMB2 QUERY_INFO Request body, sent by a client to query information about a file, named pipe, or volume identified by FileId.
type QueryInfoRequest struct {
command_interface.Command
// InfoType (1 byte): The class of information requested (file/filesystem/security/quota).
InfoType types.UCHAR
// FileInfoClass (1 byte): The specific information class within InfoType.
FileInfoClass types.UCHAR
// OutputBufferLength (4 bytes): The maximum number of response bytes desired.
OutputBufferLength types.ULONG
// Reserved (2 bytes): The client MUST set this to 0.
Reserved types.USHORT
// AdditionalInformation (4 bytes): Extra query parameters (security info bits, EA index).
AdditionalInformation types.ULONG
// Flags (4 bytes): EA-scan flags for FileFullEaInformation; 0 otherwise.
Flags types.ULONG
// FileId (16 bytes): The file/pipe/volume to query.
FileId types.SMB2_FILEID
// Input is the optional input buffer (quota info / EA list).
// InputBufferOffset/InputBufferLength are computed on marshal.
Input []byte
}
func NewQueryInfoRequest
func NewQueryInfoRequest() *QueryInfoRequest
NewQueryInfoRequest creates a new SMB2 QUERY_INFO Request.
func (*QueryInfoRequest) Marshal
func (c *QueryInfoRequest) Marshal() ([]byte, error)
Marshal serializes the QUERY_INFO Request body.
func (*QueryInfoRequest) Unmarshal
func (c *QueryInfoRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the QUERY_INFO Request body.
type QueryInfoResponse
QueryInfoResponse is the SMB2 QUERY_INFO Response body, sent by the server with the requested information in its output buffer.
type QueryInfoResponse struct {
command_interface.Command
// OutputBuffer holds the queried information (MS-FSCC / security descriptor /
// quota structures), carried verbatim. OutputBufferOffset/Length are computed
// on marshal.
OutputBuffer []byte
}
func NewQueryInfoResponse
func NewQueryInfoResponse() *QueryInfoResponse
NewQueryInfoResponse creates a new SMB2 QUERY_INFO Response.
func (*QueryInfoResponse) Marshal
func (c *QueryInfoResponse) Marshal() ([]byte, error)
Marshal serializes the QUERY_INFO Response body.
func (*QueryInfoResponse) Unmarshal
func (c *QueryInfoResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the QUERY_INFO Response body.
type ReadRequest
ReadRequest is the SMB2 READ Request body, sent by the client to read from the file or pipe identified by FileId.
type ReadRequest struct {
command_interface.Command
// Padding (1 byte): Requested placement offset of the data in the response.
Padding types.UCHAR
// Flags (1 byte): Read flags (SMB 3.x only; else 0).
Flags types.UCHAR
// Length (4 bytes): The number of bytes to read.
Length types.ULONG
// Offset (8 bytes): The byte offset into the file to read from.
Offset types.UINT64
// FileId (16 bytes): The file or pipe to read from.
FileId types.SMB2_FILEID
// MinimumCount (4 bytes): The minimum number of bytes for the read to succeed.
MinimumCount types.ULONG
// Channel (4 bytes): RDMA channel selector (SMB 3.x only; else 0).
Channel types.ULONG
// RemainingBytes (4 bytes): RDMA read length (SMB 3.x only; else 0).
RemainingBytes types.ULONG
// ReadChannelInfo is the raw RDMA channel-info buffer.
// ReadChannelInfoOffset/Length are computed on marshal.
ReadChannelInfo []byte
}
func NewReadRequest
func NewReadRequest() *ReadRequest
NewReadRequest creates a new SMB2 READ Request.
func (*ReadRequest) Marshal
func (c *ReadRequest) Marshal() ([]byte, error)
Marshal serializes the READ Request body.
func (*ReadRequest) Unmarshal
func (c *ReadRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the READ Request body.
type ReadResponse
ReadResponse is the SMB2 READ Response body, sent by the server with the data read from a file or pipe.
type ReadResponse struct {
command_interface.Command
// Reserved (1 byte): The server MUST set this to 0.
Reserved types.UCHAR
// DataRemaining (4 bytes): The number of bytes remaining to be sent on the channel.
DataRemaining types.ULONG
// Flags (4 bytes): Reserved2 for SMB < 3.1.1; read-response flags for SMB 3.1.1.
Flags types.ULONG
// Data is the data read. DataOffset/DataLength are computed on marshal.
Data []byte
}
func NewReadResponse
func NewReadResponse() *ReadResponse
NewReadResponse creates a new SMB2 READ Response.
func (*ReadResponse) Marshal
func (c *ReadResponse) Marshal() ([]byte, error)
Marshal serializes the READ Response body.
func (*ReadResponse) Unmarshal
func (c *ReadResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the READ Response body.
type SessionSetupRequest
SessionSetupRequest is the SMB2 SESSION_SETUP Request body, sent by the client to request a new authenticated session.
type SessionSetupRequest struct {
command_interface.Command
// Flags (1 byte): Session binding flags (SMB 3.x only; else 0).
Flags types.UCHAR
// SecurityMode (1 byte): Whether SMB signing is enabled or required at the client.
SecurityMode securitymode.SecurityMode
// Capabilities (4 bytes): Client capabilities.
Capabilities capabilities.Capabilities
// Channel (4 bytes): MUST NOT be used; the client sets this to 0.
Channel types.ULONG
// PreviousSessionId (8 bytes): A previously established session identifier, or 0.
PreviousSessionId types.UINT64
// SecurityBuffer (variable): The GSS authentication token. SecurityBufferOffset
// and SecurityBufferLength are computed from this on marshal.
SecurityBuffer []byte
}
func NewSessionSetupRequest
func NewSessionSetupRequest() *SessionSetupRequest
NewSessionSetupRequest creates a new SMB2 SESSION_SETUP Request.
func (*SessionSetupRequest) Marshal
func (c *SessionSetupRequest) Marshal() ([]byte, error)
Marshal serializes the SESSION_SETUP Request body.
func (*SessionSetupRequest) Unmarshal
func (c *SessionSetupRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the SESSION_SETUP Request body.
type SessionSetupResponse
SessionSetupResponse is the SMB2 SESSION_SETUP Response body, sent by the server in response to an SMB2 SESSION_SETUP Request.
type SessionSetupResponse struct {
command_interface.Command
// SessionFlags (2 bytes): Additional information about the session (guest/null/encrypt).
SessionFlags types.USHORT
// SecurityBuffer (variable): The GSS authentication token. SecurityBufferOffset
// and SecurityBufferLength are computed from this on marshal.
SecurityBuffer []byte
}
func NewSessionSetupResponse
func NewSessionSetupResponse() *SessionSetupResponse
NewSessionSetupResponse creates a new SMB2 SESSION_SETUP Response.
func (*SessionSetupResponse) Marshal
func (c *SessionSetupResponse) Marshal() ([]byte, error)
Marshal serializes the SESSION_SETUP Response body.
func (*SessionSetupResponse) Unmarshal
func (c *SessionSetupResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the SESSION_SETUP Response body.
type SetInfoRequest
SetInfoRequest is the SMB2 SET_INFO Request body, sent by a client to set information on the file, named pipe, or volume identified by FileId. The InfoType values are shared with QUERY_INFO (SMB2_0_INFO_*).
type SetInfoRequest struct {
command_interface.Command
// InfoType (1 byte): The class of information being set (file/filesystem/security/quota).
InfoType types.UCHAR
// FileInfoClass (1 byte): The specific information class within InfoType.
FileInfoClass types.UCHAR
// AdditionalInformation (4 bytes): Security-info bits when setting security; 0 otherwise.
AdditionalInformation types.ULONG
// Reserved (2 bytes): The client MUST set this to 0.
Reserved types.USHORT
// FileId (16 bytes): The file/pipe/volume on which to set the information.
FileId types.SMB2_FILEID
// Buffer is the information to set (MS-FSCC / security-descriptor structures).
// BufferOffset/BufferLength are computed on marshal.
Buffer []byte
}
func NewSetInfoRequest
func NewSetInfoRequest() *SetInfoRequest
NewSetInfoRequest creates a new SMB2 SET_INFO Request.
func (*SetInfoRequest) Marshal
func (c *SetInfoRequest) Marshal() ([]byte, error)
Marshal serializes the SET_INFO Request body.
func (*SetInfoRequest) Unmarshal
func (c *SetInfoRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the SET_INFO Request body.
type SetInfoResponse
SetInfoResponse is the SMB2 SET_INFO Response body, sent by the server to confirm that an SMB2 SET_INFO Request was processed. It carries no fields beyond StructureSize.
Source: [MS-SMB2] section 2.2.40 SMB2 SET_INFO Response.
type SetInfoResponse struct {
command_interface.Command
}
func NewSetInfoResponse
func NewSetInfoResponse() *SetInfoResponse
NewSetInfoResponse creates a new SMB2 SET_INFO Response.
func (*SetInfoResponse) Marshal
func (c *SetInfoResponse) Marshal() ([]byte, error)
Marshal serializes the SET_INFO Response body.
func (*SetInfoResponse) Unmarshal
func (c *SetInfoResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the SET_INFO Response body.
type TreeConnectRequest
TreeConnectRequest is the SMB2 TREE_CONNECT Request body, sent by the client to request access to a share. The share path is a Unicode string of the form “\\server\share”.
type TreeConnectRequest struct {
command_interface.Command
// Flags (2 bytes): Tree-connect flags (SMB 3.1.1 only; else reserved, 0).
Flags types.USHORT
// Path is the full share path. PathOffset and PathLength are computed from its
// UTF-16LE encoding on marshal.
Path string
}
func NewTreeConnectRequest
func NewTreeConnectRequest() *TreeConnectRequest
NewTreeConnectRequest creates a new SMB2 TREE_CONNECT Request.
func (*TreeConnectRequest) Marshal
func (c *TreeConnectRequest) Marshal() ([]byte, error)
Marshal serializes the TREE_CONNECT Request body.
func (*TreeConnectRequest) Unmarshal
func (c *TreeConnectRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the TREE_CONNECT Request body.
type TreeConnectResponse
TreeConnectResponse is the SMB2 TREE_CONNECT Response body, sent by the server when a TREE_CONNECT request succeeds.
type TreeConnectResponse struct {
command_interface.Command
// ShareType (1 byte): The type of share being accessed (disk/pipe/print).
ShareType types.UCHAR
// Reserved (1 byte): The server MUST set this to 0.
Reserved types.UCHAR
// ShareFlags (4 bytes): Properties for this share (caching, DFS, encryption, ...).
ShareFlags types.ULONG
// Capabilities (4 bytes): Capabilities for this share.
Capabilities types.ULONG
// MaximalAccess (4 bytes): The maximal access for the user on this share.
MaximalAccess types.ULONG
}
func NewTreeConnectResponse
func NewTreeConnectResponse() *TreeConnectResponse
NewTreeConnectResponse creates a new SMB2 TREE_CONNECT Response.
func (*TreeConnectResponse) Marshal
func (c *TreeConnectResponse) Marshal() ([]byte, error)
Marshal serializes the TREE_CONNECT Response body.
func (*TreeConnectResponse) Unmarshal
func (c *TreeConnectResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the TREE_CONNECT Response body.
type TreeDisconnectRequest
TreeDisconnectRequest is the SMB2 TREE_DISCONNECT Request body, used by the client to request that the tree connect identified by the TreeId in the SMB2 header be disconnected.
type TreeDisconnectRequest struct {
command_interface.Command
// Reserved (2 bytes): The client MUST set this to 0, and the server MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewTreeDisconnectRequest
func NewTreeDisconnectRequest() *TreeDisconnectRequest
NewTreeDisconnectRequest creates a new SMB2 TREE_DISCONNECT Request.
func (*TreeDisconnectRequest) Marshal
func (c *TreeDisconnectRequest) Marshal() ([]byte, error)
Marshal serializes the TREE_DISCONNECT Request body.
func (*TreeDisconnectRequest) Unmarshal
func (c *TreeDisconnectRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the TREE_DISCONNECT Request body.
type TreeDisconnectResponse
TreeDisconnectResponse is the SMB2 TREE_DISCONNECT Response body, sent by the server in response to an SMB2 TREE_DISCONNECT Request.
type TreeDisconnectResponse struct {
command_interface.Command
// Reserved (2 bytes): The server MUST set this to 0, and the client MUST
// ignore it on receipt.
Reserved types.USHORT
}
func NewTreeDisconnectResponse
func NewTreeDisconnectResponse() *TreeDisconnectResponse
NewTreeDisconnectResponse creates a new SMB2 TREE_DISCONNECT Response.
func (*TreeDisconnectResponse) Marshal
func (c *TreeDisconnectResponse) Marshal() ([]byte, error)
Marshal serializes the TREE_DISCONNECT Response body.
func (*TreeDisconnectResponse) Unmarshal
func (c *TreeDisconnectResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the TREE_DISCONNECT Response body.
type WriteRequest
WriteRequest is the SMB2 WRITE Request body, sent by the client to write data to the file or pipe identified by FileId.
type WriteRequest struct {
command_interface.Command
// Offset (8 bytes): The byte offset in the destination file to write at.
Offset types.UINT64
// FileId (16 bytes): The file or pipe to write to.
FileId types.SMB2_FILEID
// Channel (4 bytes): RDMA channel selector (SMB 3.x only; else 0).
Channel types.ULONG
// RemainingBytes (4 bytes): RDMA write length (SMB 3.x only; else 0).
RemainingBytes types.ULONG
// Flags (4 bytes): Write flags (write-through / unbuffered; SMB > 2.0.2).
Flags types.ULONG
// Data is the data to write. DataOffset/Length are computed on marshal.
Data []byte
// WriteChannelInfo is the raw RDMA channel-info buffer (placed after Data).
WriteChannelInfo []byte
}
func NewWriteRequest
func NewWriteRequest() *WriteRequest
NewWriteRequest creates a new SMB2 WRITE Request.
func (*WriteRequest) Marshal
func (c *WriteRequest) Marshal() ([]byte, error)
Marshal serializes the WRITE Request body.
func (*WriteRequest) Unmarshal
func (c *WriteRequest) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the WRITE Request body.
type WriteResponse
WriteResponse is the SMB2 WRITE Response body, sent by the server to report how many bytes of an SMB2 WRITE Request were written.
type WriteResponse struct {
command_interface.Command
// Reserved (2 bytes): The server MUST set this to 0.
Reserved types.USHORT
// Count (4 bytes): The number of bytes written.
Count types.ULONG
// Remaining (4 bytes): Reserved; the server MUST set this to 0.
Remaining types.ULONG
// WriteChannelInfoOffset (2 bytes): Reserved; the server MUST set this to 0.
WriteChannelInfoOffset types.USHORT
// WriteChannelInfoLength (2 bytes): Reserved; the server MUST set this to 0.
WriteChannelInfoLength types.USHORT
}
func NewWriteResponse
func NewWriteResponse() *WriteResponse
NewWriteResponse creates a new SMB2 WRITE Response.
func (*WriteResponse) Marshal
func (c *WriteResponse) Marshal() ([]byte, error)
Marshal serializes the WRITE Response body. A single trailing byte follows the 16-byte fixed part to honor the StructureSize off-by-one convention.
func (*WriteResponse) Unmarshal
func (c *WriteResponse) Unmarshal(data []byte) (int, error)
Unmarshal deserializes the WRITE Response body.