Compartir a través de


2.2.19 SMB2 READ Request

The SMB2 READ Request packet is sent by the client to request a read operation on the file that is specified by the FileId. This request is composed of an SMB2 header, as specified in section 2.2.1, followed by this request structure:


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

StructureSize

Padding

Flags

Length

Offset

...

FileId

...

...

...

MinimumCount

Channel

RemainingBytes

ReadChannelInfoOffset

ReadChannelInfoLength

Buffer (variable)

...

StructureSize (2 bytes): The client MUST set this field to 49, indicating the size of the request structure, not including the header. The client MUST set it to this value regardless of how long Buffer[] actually is in the request being sent.

Padding (1 byte): The requested offset from the start of the SMB2 header, in bytes, at which to place the data read in the SMB2 READ Response (section 2.2.20). This value is provided to optimize data placement on the client and is not binding on the server.

Flags (1 byte): For the SMB 2.0.2, 2.1 and 3.0 dialects, this field MUST NOT be used and MUST be reserved. The client MUST set this field to 0, and the server MUST ignore it on receipt. For the SMB 3.0.2 and SMB 3.1.1 dialects, this field MUST contain zero or more of the following values:

Value

Meaning

SMB2_READFLAG_READ_UNBUFFERED

0x01

The data is read directly from the underlying storage.

SMB2_READFLAG_REQUEST_COMPRESSED

0x02

The server is requested to compress the read response when responding to the request. This flag is not valid for the SMB 2.0.2, 2.1, 3.0 and 3.0.2 dialects<60>.

Length (4 bytes): The length, in bytes, of the data to read from the specified file or pipe. The length of the data being read can be zero bytes.

Offset (8 bytes): The offset, in bytes, into the file from which the data MUST be read. If the read is being executed on a pipe, the Offset MUST be set to 0 by the client and MUST be ignored by the server.

FileId (16 bytes): An SMB2_FILEID, as specified in section 2.2.14.1.

The identifier of the file or pipe on which to perform the read.

MinimumCount (4 bytes): The minimum number of bytes to be read for this operation to be successful.

Channel (4 bytes): For SMB 2.0.2 and 2.1 dialects, this field MUST NOT be used and MUST be reserved. The client MUST set this field to 0, and the server MUST ignore it on receipt. For the SMB 3.x dialect family, this field MUST contain exactly one of the following values:

Value

Meaning

SMB2_CHANNEL_NONE

0x00000000

No channel information is present in the request. The RemainingBytes, ReadChannelInfoOffset, and ReadChannelInfoLength fields MUST be set to 0 by the client and MUST be ignored by the server.

SMB2_CHANNEL_RDMA_V1

0x00000001

One or more SMB_DIRECT_BUFFER_DESCRIPTOR_V1 structures as specified in [MS-SMBD] section 2.2.3.1 are present in the channel information specified by RemainingBytes, ReadChannelInfoOffset, and ReadChannelInfoLength fields.

SMB2_CHANNEL_RDMA_V1_INVALIDATE

0x00000002

This flag is not valid for the SMB 3.0 dialect. One or more SMB_DIRECT_BUFFER_DESCRIPTOR_V1 structures, as specified in [MS-SMBD] section 2.2.3.1, are present in the channel information specified by the RemainingBytes, ReadChannelInfoOffset, and ReadChannelInfoLength fields. The server is requested to perform remote invalidation when responding to the request as specified in [MS-SMBD] section 3.1.4.2.

RemainingBytes (4 bytes): For the SMB 3.x dialect family, if the Channel field of the request contains SMB2_CHANNEL_RDMA_V1 or SMB2_CHANNEL_RDMA_V1_INVALIDATE, this field contains the length, in bytes, of the data to be read.

ReadChannelInfoOffset (2 bytes): For the SMB 3.x dialect family, it contains the offset, in bytes, from the beginning of the SMB2 header to the channel data as specified by the Channel field of the request.

ReadChannelInfoLength (2 bytes): For the SMB 3.x dialect family, it contains the length, in bytes, of the channel data as specified by the Channel field of the request.

Buffer (variable): A variable-length buffer that contains the read channel information, as described by ReadChannelInfoOffset and ReadChannelInfoLength.