Add dissection of Class Based Flow Control Pause frames.
[obnox/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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __CFILE_H__
26 #define __CFILE_H__
27
28 /* Current state of file. */
29 typedef enum {
30   FILE_CLOSED,                  /* No file open */
31   FILE_READ_IN_PROGRESS,        /* Reading a file we've opened */
32   FILE_READ_ABORTED,            /* Read aborted by user */
33   FILE_READ_DONE                /* Read completed */
34 } file_state;
35
36 /* Character set for text search. */
37 typedef enum {
38   SCS_ASCII_AND_UNICODE,
39   SCS_ASCII,
40   SCS_UNICODE
41   /* add EBCDIC when it's implemented */
42 } search_charset_t;
43
44 typedef struct _capture_file {
45   file_state   state;           /* Current state of capture file */
46   gchar       *filename;        /* Name of capture file */
47   gchar       *source;          /* Temp file source, e.g. "Pipe from elsewhere" */
48   gboolean     is_tempfile;     /* Is capture file a temporary file? */
49   gboolean     user_saved;      /* If capture file is temporary, has it been saved by user yet? */
50   gint64       f_datalen;       /* Size of capture file data (uncompressed) */
51   guint16      cd_t;            /* File type of capture file */
52   int          lnk_t;           /* Link-layer type with which to save capture */
53   int          count;           /* Total number of frames */
54   int          displayed_count; /* Number of displayed frames */
55   int          marked_count;    /* Number of marked frames */
56   int          ignored_count;   /* Number of ignored frames */
57   gboolean     drops_known;     /* TRUE if we know how many packets were dropped */
58   guint32      drops;           /* Dropped packets */
59   nstime_t     elapsed_time;    /* Elapsed time */
60   gboolean     has_snap;        /* TRUE if maximum capture packet length is known */
61   int          snap;            /* Maximum captured packet length */
62   wtap        *wth;             /* Wiretap session */
63   dfilter_t   *rfcode;          /* Compiled read (display) filter program */
64   gchar       *dfilter;         /* Display filter string */
65   gboolean     redissecting;    /* TRUE if currently redissecting (cf_redissect_packets) */
66   /* search */
67   gchar       *sfilter;         /* Search filter string */
68   gboolean     sbackward;       /* TRUE if search is backward, FALSE if forward */
69   gboolean     hex;             /* TRUE is raw data search is being performed */
70   gboolean     string;          /* TRUE is text search is being performed */
71   guint32      search_pos;      /* Position of last character found in search */
72   search_charset_t scs_type;    /* Character set for text search */
73   gboolean     case_type;       /* TRUE if case-insensitive text search */
74   gboolean     decode_data;     /* TRUE if searching protocol tree text */
75   gboolean     summary_data;    /* TRUE if searching Info column text */
76   /* packet data */
77   union wtap_pseudo_header pseudo_header; /* Packet pseudo_header */
78   guint8       pd[WTAP_MAX_PACKET_SIZE];  /* Packet data */
79   /* memory chunks have been deprecated in favor of the slice allocator,
80    * which has been added in 2.10
81    */
82 #if GLIB_CHECK_VERSION(2,10,0)
83
84 #else
85   GMemChunk   *plist_chunk;     /* Memory chunk for frame_data structures */
86 #endif
87   frame_data  *plist_start;     /* Packet list */
88   frame_data  *plist_end;       /* Last packet in list */
89   frame_data  *first_displayed; /* First frame displayed */
90   frame_data  *last_displayed;  /* Last frame displayed */
91   column_info  cinfo;           /* Column formatting information */
92   frame_data  *current_frame;   /* Frame data for current frame */
93   gint         current_row;     /* Row number for current frame */
94   epan_dissect_t *edt;          /* Protocol dissection for currently selected packet */
95   field_info  *finfo_selected;  /* Field info for currently selected field */
96 } capture_file;
97
98 void cap_file_init(capture_file *cf);
99
100 void cap_file_add_fdata(capture_file *cf, frame_data *fdata);
101
102 #endif /* cfile.h */