2 * Routines for smb packet dissection
3 * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
5 * $Id: packet-smb-common.h,v 1.3 2000/08/11 13:34:00 deniel Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@zing.org>
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__
37 #ifdef HAVE_SYS_TYPES_H
38 # include <sys/types.h>
41 #ifdef HAVE_NETINET_IN_H
42 # include <netinet/in.h>
50 #include "conversation.h"
52 #include "alignment.h"
59 #define ShortPacketError proto_tree_add_text(tree, NullTVB, offset, 0, "****FRAME TOO SHORT***"); return;
60 #define IncAndCheckOffset if ( ++offset > fd->cap_len) {ShortPacketError;}
61 #define CheckPacketLength(X) if ((offset+X) > fd->cap_len) {ShortPacketError;}
63 #define MoveAndCheckOffset(X) {int tmp = X; if (( offset + tmp) > fd->cap_len){ ShortPacketError;} else offset += tmp;}
65 #define UnknowData if (tree) proto_tree_add_text(tree, NullTVB, offset, END_OF_FRAME, "Data (%u bytes)",END_OF_FRAME);
68 struct flag_array_type {
69 guint32 mask; /* bit mask to test for bit set */
70 char *pre_string; /* string for front of description */
71 char *true_string; /* description string if flag is set */
72 char *false_string; /* description string if flag is not set */
73 char *post_string; /* string for end of description */
77 void display_flags( struct flag_array_type *flag_array, int length,
78 const u_char *pd, int offset, proto_tree *tree);
81 int display_ms_value( char *Name, int len, const u_char *pd, int offset,
82 frame_data *fd, proto_tree *tree);
83 int display_ms_string( char *Name, const u_char *pd, int offset,
84 frame_data *fd, proto_tree *tree);
85 int display_unicode_string( char *Name, const u_char *pd, int offset,
86 frame_data *fd, proto_tree *tree);
87 void dissect_smb_unknown( const u_char *pd, int offset, frame_data *fd,