1998-09-16 02:39:15 +00:00
|
|
|
/* file.h
|
|
|
|
* Definitions for file structures and routines
|
|
|
|
*
|
1999-07-09 04:18:36 +00:00
|
|
|
* $Id: file.h,v 1.19 1999/07/09 04:18:35 gram 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__
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
1999-07-09 04:18:36 +00:00
|
|
|
#ifndef __WTAP_H__
|
1999-07-07 22:52:57 +00:00
|
|
|
#include <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 */
|
|
|
|
guint32 vers; /* Version. For tcpdump minor is appended to major */
|
|
|
|
guint32 count; /* Packet count */
|
|
|
|
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 */
|
1998-09-16 02:39:15 +00:00
|
|
|
GList *plist; /* Packet list */
|
1999-06-19 01:14:51 +00:00
|
|
|
frame_data *cur; /* Frame data for current list item */
|
1998-11-17 04:29:13 +00:00
|
|
|
column_info cinfo; /* Column formatting information */
|
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-06-22 03:39:07 +00:00
|
|
|
void filter_packets(capture_file *);
|
|
|
|
void change_time_formats(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
|
|
|
|
|
|
|
|
|
|
|
|