diff options
author | Gerald Combs <gerald@wireshark.org> | 1998-09-16 02:39:15 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 1998-09-16 02:39:15 +0000 |
commit | 86534f46e150856fcce76af5c7598d354fb32ca9 (patch) | |
tree | 681b71cababcf54c865c4dfa3c52a98b1d793231 /file.h | |
download | wireshark-86534f46e150856fcce76af5c7598d354fb32ca9.tar.gz wireshark-86534f46e150856fcce76af5c7598d354fb32ca9.tar.bz2 wireshark-86534f46e150856fcce76af5c7598d354fb32ca9.zip |
svn path=/trunk/; revision=2
Diffstat (limited to 'file.h')
-rw-r--r-- | file.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/file.h b/file.h new file mode 100644 index 0000000000..8f1ef9b0dc --- /dev/null +++ b/file.h @@ -0,0 +1,99 @@ +/* file.h + * Definitions for file structures and routines + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@zing.org> + * Copyright 1998 Gerald Combs + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __FILE_H__ +#define __FILE_H__ + +#include <sys/types.h> +#include <sys/time.h> + +#include <pcap.h> + +/* Data file formats */ +#define CD_UNKNOWN 0 +#define CD_WIRE 1 +#define CD_SNOOP 2 +#define CD_PCAP_BE 3 +#define CD_PCAP_LE 4 +#define CD_NA_UNCOMPR 5 + +/* Data file magic info */ +#define SNOOP_MAGIC_1 0x736e6f6f /* 'snoop' in ASCII */ +#define SNOOP_MAGIC_2 0x70000000 +#define PCAP_MAGIC 0xa1b2c3d4 + +/* Data file format versions we can handle */ +#define SNOOP_MIN_VERSION 2 +#define SNOOP_MAX_VERSION 2 + +/* Link types (removed in favor of the DLT_* defines from bpf.h */ + +typedef struct bpf_program bpf_prog; + +typedef struct _capture_file { + FILE *fh; /* Capture file */ + long f_len; /* File length */ + int swap; /* Swap data bytes? */ + guint16 cd_t; /* Capture data type */ + guint32 vers; /* Version. For tcpdump minor is appended to major */ + guint32 lnk_t; /* Network link type */ + guint32 count; /* Packet count */ + guint32 drops; /* Dropped packets */ + guint32 esec; /* Elapsed seconds */ + guint32 eusec; /* Elapsed microseconds */ + guint32 snap; /* Captured packet length */ + gchar *iface; /* Interface */ + gchar *save_file; /* File to write capture data */ + pcap_t *pfh; /* Pcap session */ + gchar *filter; /* Pcap filter string */ + bpf_prog fcode; /* Compiled filter program */ + guint8 pd[4096]; /* Packet data */ + GList *plist; /* Packet list */ + frame_data *cur; /* Current list item */ +} capture_file; + +/* Taken from RFC 1761 */ + +typedef struct _snoop_file_hdr { + guint32 magic1; + guint32 magic2; + guint32 vers; + guint32 s_lnk_t; +} snoop_file_hdr; + +typedef struct _snoop_frame_hdr { + guint32 orig_len; + guint32 inc_len; + guint32 pr_len; + guint32 drops; + guint32 secs; + guint32 usecs; +} snoop_frame_hdr; + +int open_cap_file(char *, capture_file *); +void close_cap_file(capture_file *, GtkWidget *, guint); +int load_cap_file(char *, capture_file *); +void pcap_dispatch_cb(u_char *, const struct pcap_pkthdr *, const u_char *); +/* size_t read_frame_header(capture_file *); */ + +#endif /* file.h */ |