Remove a bunch of duplicate semicolons.
[obnox/wireshark/wip.git] / packet-smb-common.h
1 /* packet-smb-common.h
2  * Routines for SMB packet dissection
3  * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
4  *
5  * $Id: packet-smb-common.h,v 1.24 2003/05/21 10:16:10 sahlberg Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * Copied from packet-pop.c
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  */
27
28 #ifndef __PACKET_SMB_COMMON_H__
29 #define __PACKET_SMB_COMMON_H__
30
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34
35 #include <stdio.h>
36
37 #include <time.h>
38 #include <string.h>
39 #include <glib.h>
40 #include <ctype.h>
41 #include <epan/packet.h>
42 #include <epan/conversation.h>
43 #include "smb.h"
44 #include "alignment.h"
45
46 int dissect_smb_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
47
48 int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data);
49
50 int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data);
51
52 const gchar *get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp,
53     gboolean useunicode, int *len, gboolean nopad, gboolean exactlen,
54     guint16 *bcp);
55
56 int dissect_smb_64bit_time(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_date);
57
58 int dissect_nt_sid(tvbuff_t *tvb, int offset, proto_tree *parent_tree, 
59                    char *name, char **sid_str, int hf_sid);
60
61 /* 
62  * Stuff for dissecting NT access masks 
63  */
64
65 typedef void (nt_access_mask_fn_t)(tvbuff_t *tvb, gint offset,
66                                    proto_tree *tree, guint32 access);
67
68 /* Map generic access permissions to specific permissions */
69
70 struct generic_mapping {
71         guint32 generic_read;
72         guint32 generic_write;
73         guint32 generic_execute;
74         guint32 generic_all;
75 };
76
77 /* Map standard access permissions to specific permissions */
78
79 struct standard_mapping {
80         guint32 std_read;
81         guint32 std_write;
82         guint32 std_execute;
83         guint32 std_all;
84 };
85
86 struct access_mask_info {
87         char *specific_rights_name;
88         nt_access_mask_fn_t *specific_rights_fn;
89         struct generic_mapping *generic_mapping;
90         struct standard_mapping *standard_mapping;
91 };
92
93 int
94 dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo,
95                        proto_tree *tree, char *drep, int hfindex,
96                        struct access_mask_info *ami);
97
98 int
99 dissect_nt_sec_desc(tvbuff_t *tvb, int offset, packet_info *pinfo,
100                     proto_tree *parent_tree, char *drep, int len, 
101                     struct access_mask_info *ami);
102
103 extern const value_string share_type_vals[];
104
105 /* Dissect a ntlmv2 response */
106
107 int
108 dissect_ntlmv2_response(tvbuff_t *tvb, proto_tree *ntlmssp_tree, int offset,
109                         int len);
110
111 void register_smb_common(int proto_smb);
112
113 extern const value_string ntlm_name_types[];
114
115 #define NTLM_NAME_END        0x0000
116 #define NTLM_NAME_NB_HOST    0x0001
117 #define NTLM_NAME_NB_DOMAIN  0x0002
118 #define NTLM_NAME_DNS_HOST   0x0003
119 #define NTLM_NAME_DNS_DOMAIN 0x0004
120
121 #endif