2.2 Message Syntax
The CIFS Protocol is composed of, and driven by, SMB commands. SMB commands are comprised of SMB message exchanges between the client and the server. SMB commands can be categorized by functionality as follows.
File/directory access methods
Query directory information
Query/set attributes methods
CIFS has evolved over time. As a result, some commands have become obsolete and other commands have been proposed but never implemented. The client MUST NOT use the commands listed in the table below. The server SHOULD return implementation-specific error codes in response to receiving any of these command requests.
Reserved but not implemented
Specifications for the commands listed in the preceding tables are located in section 2.2.3.
An SMB message is the payload packet encapsulated in a transport packet. SMB messages are divided into three blocks: a fixed-length SMB Header (section 184.108.40.206), and two variable-length blocks called SMB Parameters (section 220.127.116.11) and SMB Data (section 18.104.22.168).
Unless otherwise specified, multiple-byte fields (SHORT, USHORT, LONG, and so on) in an SMB message MUST be transmitted in little-endian order (least-significant byte first). Unless otherwise indicated, numeric fields are integers of the specified byte length.
In dialects prior to NT LAN Manager, data alignment was not a consideration in SMB messages. Commands introduced in the NT LAN Manager dialect, however, can include fixed or variable-length padding fields used to align succeeding fields to 16-bit or 32-bit boundaries. Unicode strings, also introduced in NT LAN Manager, MUST be aligned to 16-bit boundaries unless otherwise noted.
Unless otherwise noted, fields marked as "reserved" SHOULD be set to zero when sent and MUST be ignored on receipt. These fields are reserved for future protocol expansion and MUST NOT be used for implementation-specific functionality. When it is necessary to insert padding bytes into a buffer for data alignment purposes, such bytes SHOULD be set to 0x00 when sent and MUST be ignored on receipt.
CIFS defines a set of data types and data structures that are commonly used across multiple commands in the protocol. These are specified in section 2.2.1. Some data structures exist that are used only in one or two commands. Those are specified in their respective command's subsection of section 2.2.4. All data types encountered in sections 2 and 3 that are not defined in section 2.2 are found in [MS-DTYP].
Unless otherwise noted, when an error occurs the server MUST return a response SMB message with a proper status code in the header (see section 22.214.171.124). Error responses SHOULD be sent with empty SMB Parameters and SMB Data blocks (WordCount and ByteCount fields set to zero; see sections 126.96.36.199 and 188.8.131.52 respectively).
CIFS defines a number of constants, including CIFS-specific error codes, which are commonly used across multiple commands in the protocol. The CIFS specific error codes include STATUS_INVALID_SMB and all status code constants with names beginning with STATUS_SMB_ and STATUS_OS2. These status codes are specified in section 184.108.40.206. All other constants in section 2 and 3 that begin with STATUS_ are defined in [MS-ERREF] section 2.3.