TODO: packet-smb2: setup decryption keys for kerberos session setups
[metze/wireshark/wip.git] / cfile.h
1 /* cfile.h
2  * capture_file definition & GUI-independent manipulation
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24
25 #ifndef __CFILE_H__
26 #define __CFILE_H__
27
28 #include <epan/epan.h>
29 #include <epan/column-info.h>
30 #include <epan/dfilter/dfilter.h>
31 #include <epan/frame_data.h>
32 #include <epan/frame_data_sequence.h>
33 #include <wiretap/wtap.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38
39 /* Current state of file. */
40 typedef enum {
41   FILE_CLOSED,                  /* No file open */
42   FILE_READ_IN_PROGRESS,        /* Reading a file we've opened */
43   FILE_READ_ABORTED,            /* Read aborted by user */
44   FILE_READ_DONE                /* Read completed */
45 } file_state;
46
47 /* Character set for text search. */
48 typedef enum {
49   SCS_NARROW_AND_WIDE,
50   SCS_NARROW,
51   SCS_WIDE
52   /* add EBCDIC when it's implemented */
53 } search_charset_t;
54
55 typedef enum {
56   SD_FORWARD,
57   SD_BACKWARD
58 } search_direction;
59
60 #ifdef WANT_PACKET_EDITOR
61 /* XXX, where this struct should go? */
62 typedef struct {
63   struct wtap_pkthdr phdr; /**< Modified packet header */
64   char *pd;                /**< Modified packet data */
65 } modified_frame_data;
66 #endif
67
68 typedef struct _capture_file {
69   epan_t      *epan;
70   file_state   state;           /* Current state of capture file */
71   gchar       *filename;        /* Name of capture file */
72   gchar       *source;          /* Temp file source, e.g. "Pipe from elsewhere" */
73   gboolean     is_tempfile;     /* Is capture file a temporary file? */
74   gboolean     unsaved_changes; /* Does the capture file have changes that have not been saved? */
75   gint64       f_datalen;       /* Size of capture file data (uncompressed) */
76   guint16      cd_t;            /* File type of capture file */
77   gboolean     iscompressed;    /* TRUE if the file is compressed */
78   int          lnk_t;           /* File link-layer type; could be WTAP_ENCAP_PER_PACKET */
79   GArray      *linktypes;       /* Array of packet link-layer types */
80   guint32      count;           /* Total number of frames */
81   guint64      packet_comment_count; /* Number of comments in frames (could be >1 per frame... */
82   guint32      displayed_count; /* Number of displayed frames */
83   guint32      marked_count;    /* Number of marked frames */
84   guint32      ignored_count;   /* Number of ignored frames */
85   guint32      ref_time_count;  /* Number of time referenced frames */
86   gboolean     drops_known;     /* TRUE if we know how many packets were dropped */
87   guint32      drops;           /* Dropped packets */
88   nstime_t     elapsed_time;    /* Elapsed time */
89   gboolean     has_snap;        /* TRUE if maximum capture packet length is known */
90   int          snap;            /* Maximum captured packet length */
91   wtap        *wth;             /* Wiretap session */
92   dfilter_t   *rfcode;          /* Compiled read filter program */
93   dfilter_t   *dfcode;          /* Compiled display filter program */
94   gchar       *dfilter;         /* Display filter string */
95   gboolean     redissecting;    /* TRUE if currently redissecting (cf_redissect_packets) */
96   /* search */
97   gchar       *sfilter;         /* Filter, hex value, or string being searched */
98   gboolean     hex;             /* TRUE if "Hex value" search was last selected */
99   gboolean     string;          /* TRUE if "String" search was last selected */
100   gboolean     summary_data;    /* TRUE if "String" search in "Packet list" (Info column) was last selected */
101   gboolean     decode_data;     /* TRUE if "String" search in "Packet details" was last selected */
102   gboolean     packet_data;     /* TRUE if "String" search in "Packet data" was last selected */
103   guint32      search_pos;      /* Byte position of last byte found in a hex search */
104   gboolean     case_type;       /* TRUE if case-insensitive text search */
105   search_charset_t scs_type;    /* Character set for text search */
106   search_direction dir;         /* Direction in which to do searches */
107   gboolean     search_in_progress; /* TRUE if user just clicked OK in the Find dialog or hit <control>N/B */
108   /* packet data */
109   struct wtap_pkthdr phdr;                /* Packet header */
110   Buffer       buf;             /* Packet data */
111   /* frames */
112   frame_data_sequence *frames;  /* Sequence of frames, if we're keeping that information */
113   guint32      first_displayed; /* Frame number of first frame displayed */
114   guint32      last_displayed;  /* Frame number of last frame displayed */
115   column_info  cinfo;           /* Column formatting information */
116   gboolean     columns_changed; /**< Have the columns been changed in the prefs? */
117   frame_data  *current_frame;   /* Frame data for current frame */
118   gint         current_row;     /* Row number for current frame */
119   epan_dissect_t *edt;          /* Protocol dissection for currently selected packet */
120   field_info  *finfo_selected;  /* Field info for currently selected field */
121 #ifdef WANT_PACKET_EDITOR
122   GTree       *edited_frames;   /* BST with modified frames */
123 #endif
124   gpointer     window;          /* Top-level window associated with file */
125   GTree       *frames_user_comments;   /* BST with user comments for frames (key = frame_data) */
126   gulong       computed_elapsed;
127
128   guint32      cum_bytes;
129   const frame_data *ref;
130   frame_data  *prev_dis;
131   frame_data  *prev_cap;
132 } capture_file;
133
134 extern void cap_file_init(capture_file *cf);
135
136 extern const char *cap_file_get_interface_name(void *data, guint32 interface_id);
137
138 #ifdef __cplusplus
139 }
140 #endif /* __cplusplus */
141
142 #endif /* cfile.h */