2 * Definitions for file structures and routines
4 * $Id: file.h,v 1.7 1998/11/17 04:28:47 gerald Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include <sys/types.h>
38 /* Data file formats */
44 #define CD_NA_UNCOMPR 5
46 /* Data file magic info */
47 #define SNOOP_MAGIC_1 0x736e6f6f /* 'snoop' in ASCII */
48 #define SNOOP_MAGIC_2 0x70000000
49 #define PCAP_MAGIC 0xa1b2c3d4
51 /* Data file format versions we can handle */
52 #define SNOOP_MIN_VERSION 2
53 #define SNOOP_MAX_VERSION 2
55 /* Link types (removed in favor of the DLT_* defines from bpf.h */
58 typedef struct bpf_program bpf_prog;
60 typedef struct _capture_file {
61 FILE *fh; /* Capture file */
62 gchar *filename; /* filename */
63 long f_len; /* File length */
64 int swap; /* Swap data bytes? */
65 guint16 cd_t; /* Capture data type */
66 guint32 vers; /* Version. For tcpdump minor is appended to major */
67 guint32 lnk_t; /* Network link type */
68 guint32 count; /* Packet count */
69 guint32 drops; /* Dropped packets */
70 guint32 esec; /* Elapsed seconds */
71 guint32 eusec; /* Elapsed microseconds */
72 guint32 snap; /* Captured packet length */
73 gchar *iface; /* Interface */
74 gchar *save_file; /* File to write capture data */
76 wtap *wth; /* Wiretap session */
78 pcap_t *pfh; /* Pcap session */
80 gchar *dfilter; /* Display filter string */
81 gchar *cfilter; /* Capture filter string */
82 bpf_prog fcode; /* Compiled filter program */
83 guint8 pd[4096]; /* Packet data */
84 GList *plist; /* Packet list */
85 frame_data *cur; /* Current list item */
86 column_info cinfo; /* Column formatting information */
89 /* Taken from RFC 1761 */
91 typedef struct _snoop_file_hdr {
98 typedef struct _snoop_frame_hdr {
107 int open_cap_file(char *, capture_file *);
108 void close_cap_file(capture_file *, GtkWidget *, guint);
109 int load_cap_file(char *, capture_file *);
110 /* size_t read_frame_header(capture_file *); */