f6939e39f032aa7945f98ed802b460257b45c944
[metze/wireshark/wip.git] / cfile.h
1 /* cfile.h
2  * capture_file definition & GUI-independent manipulation
3  *
4  * $Id: cfile.h,v 1.2 2003/07/22 23:08:47 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
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 typedef struct _capture_file {
37   file_state   state;     /* Current state of capture file */
38   int          filed;     /* File descriptor of capture file */
39   gchar       *filename;  /* Name of capture file */
40   gboolean     is_tempfile; /* Is capture file a temporary file? */
41   gboolean     user_saved;/* If capture file is temporary, has it been saved by user yet? */
42   long         f_len;     /* Length of capture file */
43   guint16      cd_t;      /* File type of capture file */
44   int          lnk_t;     /* Link-layer type with which to save capture */
45   guint32      vers;      /* Version.  For tcpdump minor is appended to major */
46   int          count;     /* Total number of frames */
47   int          marked_count; /* Number of marked frames */
48   gboolean     drops_known; /* TRUE if we know how many packets were dropped */
49   guint32      drops;     /* Dropped packets */
50   guint32      esec;      /* Elapsed seconds */
51   guint32      eusec;     /* Elapsed microseconds */
52   gboolean     has_snap;  /* TRUE if maximum capture packet length is known */
53   int          snap;      /* Maximum captured packet length */
54   long         progbar_quantum; /* Number of bytes read per progress bar update */
55   long         progbar_nextstep; /* Next point at which to update progress bar */
56   gchar       *iface;     /* Interface */
57   gchar       *save_file; /* File that user saved capture to */
58   int          save_file_fd; /* File descriptor for saved file */
59   wtap        *wth;       /* Wiretap session */
60   dfilter_t   *rfcode;    /* Compiled read filter program */
61   gchar       *dfilter;   /* Display filter string */
62   dfilter_t   *dfcode;    /* Compiled display filter program */
63 #ifdef HAVE_LIBPCAP
64   gchar       *cfilter;   /* Capture filter string */
65 #endif
66   gchar       *sfilter;   /* Search filter string */
67   gboolean     sbackward;  /* TRUE if search is backward, FALSE if forward */
68   gboolean     hex;        /* TRUE is Hex search is being performed */
69   gboolean     ascii;      /* TRUE is ASCII search is being performed */
70   char         *ftype;      /* Find Frame String Type */
71   union wtap_pseudo_header pseudo_header;      /* Packet pseudo_header */
72   guint8       pd[WTAP_MAX_PACKET_SIZE];  /* Packet data */
73   GMemChunk   *plist_chunk; /* Memory chunk for frame_data structures */
74   frame_data  *plist;     /* Packet list */
75   frame_data  *plist_end; /* Last packet in list */
76   frame_data  *first_displayed; /* First frame displayed */
77   frame_data  *last_displayed;  /* Last frame displayed */
78   column_info  cinfo;    /* Column formatting information */
79   frame_data  *current_frame;  /* Frame data for current frame */
80   epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
81   FILE        *print_fh;  /* File we're printing to */
82   struct ph_stats_s* pstats; /* accumulated stats (reset on redisplay in GUI)*/
83 } capture_file;
84
85 void init_cap_file(capture_file *);
86
87 #endif /* cfile.h */