Add the relative time to the frame tree, at the request of Manfred Young.
[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.3 2000/08/11 13:34:00 deniel Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@zing.org>
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 #ifdef HAVE_SYS_TYPES_H
38 # include <sys/types.h>
39 #endif
40
41 #ifdef HAVE_NETINET_IN_H
42 # include <netinet/in.h>
43 #endif
44
45 #include <time.h>
46 #include <string.h>
47 #include <glib.h>
48 #include <ctype.h>
49 #include "packet.h"
50 #include "conversation.h"
51 #include "smb.h"
52 #include "alignment.h"
53
54
55
56
57
58
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;}
62
63 #define MoveAndCheckOffset(X)   {int tmp = X; if (( offset + tmp) > fd->cap_len){ ShortPacketError;} else offset += tmp;}
64
65 #define UnknowData      if (tree) proto_tree_add_text(tree, NullTVB, offset, END_OF_FRAME, "Data (%u bytes)",END_OF_FRAME); 
66
67
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        */
74 };
75
76
77 void display_flags( struct flag_array_type *flag_array, int length,
78         const u_char *pd, int offset, proto_tree *tree);
79
80
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,
88                 proto_tree *tree);
89
90 #endif