1998-09-16 02:39:15 +00:00
|
|
|
/* file.h
|
|
|
|
* Definitions for file structures and routines
|
|
|
|
*
|
1999-08-10 04:13:37 +00:00
|
|
|
* $Id: file.h,v 1.27 1999/08/10 04:13:37 guy Exp $
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* 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__
|
|
|
|
|
1999-07-13 02:53:26 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
1998-09-16 02:39:15 +00:00
|
|
|
#include <sys/types.h>
|
1999-07-13 02:53:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
1998-09-16 02:39:15 +00:00
|
|
|
#include <sys/time.h>
|
1999-07-13 02:53:26 +00:00
|
|
|
#endif
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-07-09 04:18:36 +00:00
|
|
|
#ifndef __WTAP_H__
|
1999-08-07 17:28:21 +00:00
|
|
|
#include <wiretap/wtap.h>
|
1999-07-09 04:18:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBPCAP
|
|
|
|
#ifndef lib_pcap_h
|
1999-07-07 22:52:57 +00:00
|
|
|
#include <pcap.h>
|
1999-07-09 04:18:36 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
typedef struct bpf_program bpf_prog;
|
|
|
|
|
|
|
|
typedef struct _capture_file {
|
|
|
|
FILE *fh; /* Capture file */
|
1998-09-17 03:12:28 +00:00
|
|
|
gchar *filename; /* filename */
|
1998-09-16 02:39:15 +00:00
|
|
|
long f_len; /* File length */
|
|
|
|
guint16 cd_t; /* Capture data type */
|
Check in Olivier Abad's patch to add dissectors for LAP-B and X.25, and
wiretap support for RADCOM Ltd.'s WAN/LAN analyzers (see
http://www.radcom-inc.com/
). Note: as I remember, IEEE 802.2/ISO 8022 LLC has somewhat of an SDLC
flavor to it, just as I think LAP, LAPB, LAPD, and so on do, so we may
be able to combine some of the LLC dissection and the LAPB dissection
into common code that could, conceivably be used for other SDLC-flavored
protocols.
Make "S" a mnemonic for "Summary" in the "Tools" menu.
Move the routine, used for the "Tools/Summary" display, that turns a
wiretap file type into a descriptive string for it into the wiretap
library itself, expand on some of its descriptions, and add an entry for
files from a RADCOM analyzer.
Have "Tools/Summary" display the snapshot length for the capture.
svn path=/trunk/; revision=416
1999-08-02 02:04:38 +00:00
|
|
|
const gchar *cd_t_desc;/* Description of that data type */
|
1998-09-16 02:39:15 +00:00
|
|
|
guint32 vers; /* Version. For tcpdump minor is appended to major */
|
|
|
|
guint32 count; /* Packet count */
|
1999-08-05 16:46:04 +00:00
|
|
|
gfloat unfiltered_count; /* used for dfilter progress bar */
|
1998-09-16 02:39:15 +00:00
|
|
|
guint32 drops; /* Dropped packets */
|
|
|
|
guint32 esec; /* Elapsed seconds */
|
|
|
|
guint32 eusec; /* Elapsed microseconds */
|
|
|
|
guint32 snap; /* Captured packet length */
|
|
|
|
gchar *iface; /* Interface */
|
1999-04-06 16:24:50 +00:00
|
|
|
gchar *save_file; /* File that user saved capture to */
|
|
|
|
gint user_saved;/* Was capture file saved by user yet? */
|
1999-07-07 22:52:57 +00:00
|
|
|
wtap *wth; /* Wiretap session */
|
1998-10-12 01:40:57 +00:00
|
|
|
gchar *dfilter; /* Display filter string */
|
1999-07-09 04:18:36 +00:00
|
|
|
GNode *dfcode; /* Compiled display filter program */
|
|
|
|
#ifdef HAVE_LIBPCAP
|
1998-10-12 01:40:57 +00:00
|
|
|
gchar *cfilter; /* Capture filter string */
|
1999-07-07 22:52:57 +00:00
|
|
|
bpf_prog fcode; /* Compiled capture filter program */
|
1999-07-09 04:18:36 +00:00
|
|
|
#endif
|
1999-03-23 03:14:46 +00:00
|
|
|
/* XXX - I'm cheating for now. I'll hardcode 65536 here until I re-arrange
|
|
|
|
* more header files so that ethereal.h is split up into two files, a
|
|
|
|
* generic header and a gtk+-speficic header (or the gtk+ definitions are
|
|
|
|
* moved to different header files) --gilbert
|
|
|
|
*/
|
|
|
|
/*guint8 pd[MAX_PACKET_SIZE];*/ /* Packet data */
|
|
|
|
guint8 pd[65536]; /* Packet data */
|
1999-08-10 04:13:37 +00:00
|
|
|
frame_data *plist; /* Packet list */
|
|
|
|
frame_data *plist_end; /* Last packet in list */
|
1998-11-17 04:29:13 +00:00
|
|
|
column_info cinfo; /* Column formatting information */
|
Have "close_cap_file()" disable all menu items that make sense only if
you have a capture.
Leave the job of enabling and disabling menu items that make sense only
if you have a capture (except for "File/Save" and "File/Save As...", for
now) up to "load_cap_file()", "close_cap_file()", and the like - don't
scatter that stuff throughout the code.
Disable "File/Print Packet" if no packet is selected; enable it only if
a packet is selected.
If there's a selected packet, and a display filter is run:
if the selected packet passed the filter, re-select it;
if the selected packet didn't pass the filter, un-select it.
If we've opened a live "pcap" capture, but can't do the capture because
we can't get the netmask info, or can't parse the capture filter string,
or can't install the filter, close the live capture and the dump and
delete the dump file.
If we failed to open a live "pcap" capture, don't try to read the
capture file - it doesn't exist.
svn path=/trunk/; revision=384
1999-07-24 02:42:52 +00:00
|
|
|
int selected_packet; /* Index in packet list of currently selected packet, if any */
|
|
|
|
int selected_row; /* Row in packet display of currently selected packet, if any */
|
1999-07-24 03:22:50 +00:00
|
|
|
frame_data *fd; /* Frame data for currently selected packet */
|
|
|
|
proto_tree *protocol_tree; /* Protocol tree for currently selected packet */
|
1999-07-23 08:29:24 +00:00
|
|
|
FILE *print_fh; /* File we're printing to */
|
1998-09-16 02:39:15 +00:00
|
|
|
} capture_file;
|
|
|
|
|
|
|
|
|
Improve the alert boxes put up for file open/read/write errors. (Some
influence came from
http://developer.apple.com/techpubs/mac/HIGuidelines/HIGuidelines-232.html
which has a section on dialog box and alert box messages. However,
we're largely dealing with technoids, not with The Rest Of Us, so I
didn't go as far as one perhaps should.)
Unfortunately, it looks like it's a bit more work to arrange that, if
you give a bad file name to the "-r" flag, the dialog box pop up only
*after* the main window pops up - it has the annoying habit of popping
up *before* the main window pops up, and sometimes getting *obscured* by
it, when I do that. The removal of the dialog box stuff from
"load_cap_file()" was intended to facilitate that work. (It might also
be nice if, when an open from the "File/Open" menu item fails, we keep
the file selection box open, and give the user a chance to correct
typos, choose another file name, etc.)
svn path=/trunk/; revision=310
1999-06-12 09:10:20 +00:00
|
|
|
/*
|
|
|
|
* "open_cap_file()" can return:
|
|
|
|
*
|
|
|
|
* 0 on success;
|
|
|
|
*
|
|
|
|
* a positive "errno" value on an open failure;
|
|
|
|
*
|
|
|
|
* a negative number, indicating the type of error, on other failures.
|
|
|
|
*/
|
|
|
|
#define OPEN_CAP_FILE_NOT_REGULAR -1 /* not a plain file */
|
|
|
|
#define OPEN_CAP_FILE_UNKNOWN_FORMAT -2 /* not a capture file in a known format */
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
int open_cap_file(char *, capture_file *);
|
1999-03-23 03:14:46 +00:00
|
|
|
void close_cap_file(capture_file *, void *, guint);
|
1998-09-16 02:39:15 +00:00
|
|
|
int load_cap_file(char *, capture_file *);
|
1999-05-11 18:51:10 +00:00
|
|
|
int tail_cap_file(char *, capture_file *);
|
1998-09-16 02:39:15 +00:00
|
|
|
/* size_t read_frame_header(capture_file *); */
|
|
|
|
|
1999-07-23 08:29:24 +00:00
|
|
|
int print_packets(capture_file *cf, int to_file, const char *dest);
|
1999-06-22 03:39:07 +00:00
|
|
|
void filter_packets(capture_file *);
|
|
|
|
void change_time_formats(capture_file *);
|
1999-07-24 03:22:50 +00:00
|
|
|
void select_packet(capture_file *, int);
|
Have "close_cap_file()" disable all menu items that make sense only if
you have a capture.
Leave the job of enabling and disabling menu items that make sense only
if you have a capture (except for "File/Save" and "File/Save As...", for
now) up to "load_cap_file()", "close_cap_file()", and the like - don't
scatter that stuff throughout the code.
Disable "File/Print Packet" if no packet is selected; enable it only if
a packet is selected.
If there's a selected packet, and a display filter is run:
if the selected packet passed the filter, re-select it;
if the selected packet didn't pass the filter, un-select it.
If we've opened a live "pcap" capture, but can't do the capture because
we can't get the netmask info, or can't parse the capture filter string,
or can't install the filter, close the live capture and the dump and
delete the dump file.
If we failed to open a live "pcap" capture, don't try to read the
capture file - it doesn't exist.
svn path=/trunk/; revision=384
1999-07-24 02:42:52 +00:00
|
|
|
void unselect_packet(capture_file *);
|
1999-06-19 01:14:51 +00:00
|
|
|
|
Improve the alert boxes put up for file open/read/write errors. (Some
influence came from
http://developer.apple.com/techpubs/mac/HIGuidelines/HIGuidelines-232.html
which has a section on dialog box and alert box messages. However,
we're largely dealing with technoids, not with The Rest Of Us, so I
didn't go as far as one perhaps should.)
Unfortunately, it looks like it's a bit more work to arrange that, if
you give a bad file name to the "-r" flag, the dialog box pop up only
*after* the main window pops up - it has the annoying habit of popping
up *before* the main window pops up, and sometimes getting *obscured* by
it, when I do that. The removal of the dialog box stuff from
"load_cap_file()" was intended to facilitate that work. (It might also
be nice if, when an open from the "File/Open" menu item fails, we keep
the file selection box open, and give the user a chance to correct
typos, choose another file name, etc.)
svn path=/trunk/; revision=310
1999-06-12 09:10:20 +00:00
|
|
|
/* Moves or copies a file. Returns 0 on failure, 1 on success */
|
|
|
|
int file_mv(char *from, char *to);
|
|
|
|
|
|
|
|
/* Copies a file. Returns 0 on failure, 1 on success */
|
|
|
|
int file_cp(char *from, char *to);
|
|
|
|
|
|
|
|
char *file_open_error_message(int, int);
|
|
|
|
char *file_read_error_message(int);
|
|
|
|
char *file_write_error_message(int);
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
#endif /* file.h */
|
1999-06-22 22:02:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|