suricata
app-layer-smb2.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2010 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Kirby Kuehl <kkuehl@gmail.com>
22  */
23 
24 #ifndef __APP_LAYER_SMB2_H__
25 #define __APP_LAYER_SMB2_H__
26 
27 #include "suricata-common.h"
28 #include "app-layer-protos.h"
29 #include "app-layer-parser.h"
30 #include "app-layer-nbss.h"
31 #include "flow.h"
32 #include "stream.h"
33 
34 typedef struct SMB2Hdr {
35  uint32_t Protocol; /**< Contains 0xFE,'SMB' */
36  uint16_t StructureSize;
37  uint16_t CreditCharge;
38  uint32_t Status;
39  uint16_t Command;
41  uint32_t Flags;
42  uint32_t NextCommand;
43  uint64_t MessageId;
44  uint32_t ProcessId;
45  uint32_t TreeId;
46  uint64_t SessionId;
47  uint8_t Signature[16];
48 } SMB2Hdr;
49 
50 #define SMB2_HDR_LEN 64
51 
52 typedef struct SMB2State_ {
55  uint16_t bytesprocessed;
56 } SMB2State;
57 
58 /** from http://msdn.microsoft.com/en-us/library/cc246528(PROT.13).aspx */
59 #define SMB2_NEGOTIATE 0x0000
60 #define SMB2_SESSION_SETUP 0x0001
61 #define SMB2_LOGOFF 0x0002
62 #define SMB2_TREE_CONNECT 0x0003
63 #define SMB2_TREE_DISCONNECT 0x0004
64 #define SMB2_CREATE 0x0005
65 #define SMB2_CLOSE 0x0006
66 #define SMB2_FLUSH 0x0007
67 #define SMB2_READ 0x0008
68 #define SMB2_WRITE 0x0009
69 #define SMB2_LOCK 0x000A
70 #define SMB2_IOCTL 0x000B
71 #define SMB2_CANCEL 0x000C
72 #define SMB2_ECHO 0x000D
73 #define SMB2_QUERY_DIRECTORY 0x000E
74 #define SMB2_CHANGE_NOTIFY 0x000F
75 #define SMB2_QUERY_INFO 0x0010
76 #define SMB2_SET_INFO 0x0011
77 #define SMB2_OPLOCK_BREAK 0x0012
78 
79 void RegisterSMB2Parsers(void);
80 void SMB2ParserRegisterTests(void);
81 
82 #endif /* __APP_LAYER_SMB2_H__ */
83 
uint32_t NextCommand
uint32_t TreeId
uint32_t Flags
uint32_t Status
uint16_t CreditRequestResponse
uint64_t MessageId
uint16_t CreditCharge
Signature container.
Definition: detect.h:492
struct SMB2Hdr SMB2Hdr
uint16_t Command
struct SMB2State_ SMB2State
NBSSHdr nbss
void SMB2ParserRegisterTests(void)
uint32_t Protocol
SMB2Hdr smb2
uint32_t ProcessId
uint16_t bytesprocessed
uint64_t SessionId
uint16_t StructureSize
void RegisterSMB2Parsers(void)