some compilers dont like unnamed unions and structs
[obnox/wireshark/wip.git] / epan / dissectors / packet-smb2.h
1 /* packet-smb2.h
2  * Defines for SMB2 packet dissection
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998, 1999 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __PACKET_SMB2_H__
26 #define __PACKET_SMB2_H__
27
28 /* SMB2 command codes. With MSVC and a 
29  * libwireshark.dll, we need a special declaration.
30  */
31 WS_VAR_IMPORT const value_string smb2_cmd_vals[];
32
33 /* Structure to keep track of information specific to a single
34  * SMB2 transaction. Here we store things we need to remember between
35  * a specific request and a specific response.
36  * 
37  * There is no guarantee we will have this structure available for all
38  * SMB2 packets so a dissector must check this pointer for NULL
39  * before dereferencing it.
40  *
41  * private data is set to NULL when the structure is created.  It is used
42  * for communications between the Request and the Response packets.
43  */
44 typedef struct _smb2_saved_info_t {
45         guint8 class;
46         guint8 infolevel;
47         guint64 seqnum;
48         void *private_data;     
49         guint32 frame_req, frame_res;
50         nstime_t req_time;
51 } smb2_saved_info_t;
52
53 typedef struct _smb2_tid_info_t {
54         guint32 tid;
55         guint32 connect_frame;
56         guint16 share_type;
57         char *name;
58 } smb2_tid_info_t;
59
60 typedef struct _smb2_uid_info_t {
61         guint64 uid;
62         guint32 auth_frame;
63         char *acct_name;
64         char *domain_name;
65         char *host_name;
66         GHashTable *tids;
67 } smb2_uid_info_t;
68
69 /* Structure to keep track of conversations and the hash tables.
70  * There is one such structure for each conversation.
71  */
72 typedef struct _smb2_conv_info_t {
73         /* these two tables are used to match requests with responses */
74         GHashTable *unmatched;
75         GHashTable *matched;
76         GHashTable *uids;
77 } smb2_conv_info_t;
78
79 /* This structure contains information from the SMB2 header
80  * as well as pointers to the conversation and the transaction specific
81  * structures.
82  */
83 #define SMB2_FLAGS_RESPONSE     0x00000001
84 #define SMB2_FLAGS_PID_VALID    0x00000002
85 #define SMB2_FLAGS_SIGNATURE    0x00000008
86 typedef struct _smb2_info_t {
87         guint16 opcode;
88         guint32 ioctl_function;
89         guint32 status;
90         guint32 tid;
91         guint64 uid;
92         gint64  seqnum;
93         guint32 flags;
94         smb2_conv_info_t        *conv;
95         smb2_saved_info_t       *saved;
96         smb2_tid_info_t         *tree;
97         smb2_uid_info_t         *session;
98         proto_tree *top_tree;   
99 } smb2_info_t;
100
101
102 int dissect_smb2_FILE_OBJECTID_BUFFER(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset);
103
104 #endif