1/*
2 * Copyright (c) 2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _NETSMB_SMB_PACKETS_2_h
25#define _NETSMB_SMB_PACKETS_2_h
26
27#include <sys/syslog.h>
28
29#define	SMB2_SIGNATURE			"\xFESMB"
30#define	SMB2_SIGLEN				4
31#define	SMB2_HDRLEN				64
32
33typedef uint32_t DWORD;
34
35typedef struct _FILETIME {
36    DWORD dwLowDateTime;
37    DWORD dwHighDateTime;
38} FILETIME;
39
40struct smb2_header
41{
42    uint8_t     protocol_id[4];
43    uint16_t    structure_size;
44    uint16_t    credit_charge;
45    uint32_t    status; /* nt_status */
46    uint16_t    command;
47    uint16_t    credit_reqrsp;
48    uint32_t    flags;
49    uint32_t    next_command;
50    uint64_t    message_id;
51
52    union {
53        /* Async commands have an async ID. */
54        struct {
55            uint64_t    async_id;
56        } async;
57
58        /* Sync command have a tree and process ID. */
59        struct {
60            uint32_t    process_id;
61            uint32_t    tree_id;
62        } sync;
63    };
64
65    uint64_t    session_id;
66    uint8_t     signature[16];
67
68    //enum { minimum_size = 64, maximum_size = 64 };
69    //enum { defined_size = 64 };
70};
71
72#endif
73