2 * Definitions for file structures and routines
4 * $Id: file.h,v 1.4 1998/10/12 01:40:49 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>
34 /* Data file formats */
40 #define CD_NA_UNCOMPR 5
42 /* Data file magic info */
43 #define SNOOP_MAGIC_1 0x736e6f6f /* 'snoop' in ASCII */
44 #define SNOOP_MAGIC_2 0x70000000
45 #define PCAP_MAGIC 0xa1b2c3d4
47 /* Data file format versions we can handle */
48 #define SNOOP_MIN_VERSION 2
49 #define SNOOP_MAX_VERSION 2
51 /* Link types (removed in favor of the DLT_* defines from bpf.h */
53 typedef struct bpf_program bpf_prog;
55 typedef struct _capture_file {
56 FILE *fh; /* Capture file */
57 gchar *filename; /* filename */
58 long f_len; /* File length */
59 int swap; /* Swap data bytes? */
60 guint16 cd_t; /* Capture data type */
61 guint32 vers; /* Version. For tcpdump minor is appended to major */
62 guint32 lnk_t; /* Network link type */
63 guint32 count; /* Packet count */
64 guint32 drops; /* Dropped packets */
65 guint32 esec; /* Elapsed seconds */
66 guint32 eusec; /* Elapsed microseconds */
67 guint32 snap; /* Captured packet length */
68 gchar *iface; /* Interface */
69 gchar *save_file; /* File to write capture data */
70 pcap_t *pfh; /* Pcap session */
71 gchar *dfilter; /* Display filter string */
72 gchar *cfilter; /* Capture filter string */
73 bpf_prog fcode; /* Compiled filter program */
74 guint8 pd[4096]; /* Packet data */
75 GList *plist; /* Packet list */
76 frame_data *cur; /* Current list item */
79 /* Taken from RFC 1761 */
81 typedef struct _snoop_file_hdr {
88 typedef struct _snoop_frame_hdr {
97 int open_cap_file(char *, capture_file *);
98 void close_cap_file(capture_file *, GtkWidget *, guint);
99 int load_cap_file(char *, capture_file *);
100 void pcap_dispatch_cb(u_char *, const struct pcap_pkthdr *, const u_char *);
101 /* size_t read_frame_header(capture_file *); */