2 * Routines for SMB packet dissection
3 * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
5 * $Id: packet-smb-common.h,v 1.24 2003/05/21 10:16:10 sahlberg Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from packet-pop.c
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.
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.
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.
28 #ifndef __PACKET_SMB_COMMON_H__
29 #define __PACKET_SMB_COMMON_H__
41 #include <epan/packet.h>
42 #include <epan/conversation.h>
44 #include "alignment.h"
46 int dissect_smb_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
48 int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data);
50 int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data);
52 const gchar *get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp,
53 gboolean useunicode, int *len, gboolean nopad, gboolean exactlen,
56 int dissect_smb_64bit_time(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_date);
58 int dissect_nt_sid(tvbuff_t *tvb, int offset, proto_tree *parent_tree,
59 char *name, char **sid_str, int hf_sid);
62 * Stuff for dissecting NT access masks
65 typedef void (nt_access_mask_fn_t)(tvbuff_t *tvb, gint offset,
66 proto_tree *tree, guint32 access);
68 /* Map generic access permissions to specific permissions */
70 struct generic_mapping {
72 guint32 generic_write;
73 guint32 generic_execute;
77 /* Map standard access permissions to specific permissions */
79 struct standard_mapping {
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;
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);
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);
103 extern const value_string share_type_vals[];
105 /* Dissect a ntlmv2 response */
108 dissect_ntlmv2_response(tvbuff_t *tvb, proto_tree *ntlmssp_tree, int offset,
111 void register_smb_common(int proto_smb);
113 extern const value_string ntlm_name_types[];
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