/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SMB_SMB2_H
#define _SMB_SMB2_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* SMB2 header command codes.
* These are uint16_t on the wire.
*/
typedef enum {
SMB2_NEGOTIATE = 0,
/*
* The above (oplock break) is the last real SMB2 op-code.
* We use one more slot to represent invalid commands, and
* the final enum value is used for array sizes. Keep last!
*/
/*
* SMB2 header flags.
*/
/*
* SERVER_TO_REDIR
* When set, indicates the message is a response rather than
* a request. This MUST be set on responses sent from the
* server to the client, and MUST NOT be set on requests
* sent from the client to the server.
*/
/*
* ASYNC_COMMAND
* When set, indicates that this is an ASYNC SMB2 header.
* Always set for headers of the form described in this
* section.
*/
/*
* RELATED_OPERATIONS
* When set in an SMB2 request, indicates that this request
* is a related operation in a compounded request chain.
* [MS-SMB2 sec. 3.2.4.1.4]
*
* When set in an SMB2 compound response, indicates that
* the request corresponding to this response was part of a
* related operation in a compounded request chain.
* [MS-SMB2 sec. 3.3.5.2.7.2]
*/
/*
* SIGNED
* When set, indicates that this packet has been signed.
* [MS-SMB2 3.1.5.1]
*/
/*
* [MS-SMB2] 3.2.5.3.1 The SessionKey MUST be set to the
* first 16 bytes of the cryptographic key from GSSAPI.
* (Padded with zeros if the GSSAPI key is shorter.)
*/
/*
* DFS_OPERATIONS
* When set, indicates that this command is a Distributed
* File System (DFS) operation. [MS-SMB2 3.3.5.9]
*/
/*
* REPLAY_OPERATION
* This flag is only valid for the SMB 3.0 dialect. When set,
* it indicates that this command is a replay operation.
* The client MUST ignore this bit on receipt.
*/
/*
* SMB2 Netgotiate [MS-SMB2 2.2.3]
*/
/* Added with SMB2.1 */
/*
* LARGE_MTU:
* When set, indicates that the client supports multi-credit operations.
*/
/* Added with SMB3.0 */
/* SMB2 session flags */
/*
* SMB2 Tree connect, disconnect
*/
/* SMB2 sharetype flags */
/* SMB2 share flags */
/* SMB 3.0 */
/* SMB2 share capabilities */
/* SMB 3.0 */
/*
* SMB2 Create (open)
*/
/* SMB2 requested oplock levels */
/* SMB2 impersonation levels */
/*
* Note: ShareAccess, CreateDispositon, CreateOptions,
* all use the same definitions as SMB1 (from MS-FSA).
* Ditto FileAccess flags (as with ACLs)
*/
/* SMB2 Create Context tags */
/*
* The data contains the extended attributes
* that MUST be stored on the created file.
* This value MUST NOT be set for named
* pipes and print files.
*/
/*
* The data contains a security descriptor that
* MUST be stored on the created file.
* This value MUST NOT be set for named
* pipes and print files.
*/
/* The client is requesting the open to be durable */
/*
* The client is requesting to reconnect to a
* durable open after being disconnected
*/
/*
* The data contains the required allocation
* size of the newly created file.
*/
/*
* The client is requesting that the server
* return maximal access information.
*/
/*
* The client is requesting that the server
* open an earlier version of the file identified
* by the provided time stamp.
*/
/*
* The client is requesting that the server return a 32-byte
* opaque BLOB that uniquely identifies the file being opened
* on disk. No data is passed to the server by the client.
*/
/*
* The client is requesting that the server return a lease.
* This value is only supported for the SMB 2.1 and 3.0 dialects.
*/
/* SMB2 create request lease */
/* SMB2 lease break notification flags */
/*
* SMB2 Close
*/
/*
* SMB2 Write
*/
/*
* SMB2 Lock Request
*/
/* SMB2 lock flags */
/*
* SMB2_LOCKFLAG_SHARED_LOCK
* The range MUST be locked shared, allowing other opens
* to read from or take a shared lock on the range. All opens
* MUST NOT be allowed to write within the range. Other
* locks can be requested and taken on this range.
*/
/*
* SMB2_LOCKFLAG_EXCLUSIVE_LOCK
* The range MUST be locked exclusive, not allowing other
* opens to read, write, or lock within the range.
*/
/*
* SMB2_LOCKFLAG_UNLOCK
* The range MUST be unlocked from a previous lock taken
* on this range. The unlock range MUST be identical to the
* lock range. Sub-ranges cannot be unlocked.
*/
/*
* SMB2_LOCKFLAG_FAIL_IMMEDIATELY
* The lock operation MUST fail immediately if it conflicts
* with an existing lock, instead of waiting for the range to
* become available. This can be OR'ed with either of
* shared_lock, exclusive_lock (nothing else).
*/
/*
* SMB2 Ioctl Request
*/
/*
* SMB2 Query Directory
*/
/*
* SMB2 query directory info levels
* Same as SMB1 (see ntifs.h)
*/
/*
* SMB2 Query Directory Flags
* (our own names for these - spec. used poor names)
*/
/*
* SMB2 Query Info Request
*/
/* info type */
/* The file information is requested. */
/* The underlying object store information is requested. */
/* The security information is requested. */
/* The underlying object store quota information is requested. */
/*
* SMB2 Change Nofity Request
*/
#ifdef __cplusplus
}
#endif
#endif /* _SMB_SMB2_H */