Fix a URL.
[obnox/wireshark/wip.git] / capture.h
1 /* capture.h
2  * Definitions for packet capture windows
3  *
4  * $Id: capture.h,v 1.36 2003/09/15 23:15:31 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __CAPTURE_H__
26 #define __CAPTURE_H__
27
28 #ifdef HAVE_LIBPCAP
29
30 /* Name we give to the child process when doing a "-S" capture. */
31 #define CHILD_NAME      "ethereal-capture"
32
33 typedef struct {
34         gboolean has_snaplen;           /* TRUE if maximum capture packet
35                                            length is specified */
36         int snaplen;                    /* Maximum captured packet length */
37         int promisc_mode;               /* Capture in promiscuous mode */
38         int sync_mode;                  /* Fork a child to do the capture,
39                                            and sync between them */
40         gboolean has_autostop_count;    /* TRUE if maximum packet count is
41                                            specified */
42         int autostop_count;             /* Maximum packet count */
43         gboolean has_autostop_duration; /* TRUE if maximum capture duration
44                                            is specified */
45         gint32 autostop_duration;       /* Maximum capture duration */
46         gboolean has_autostop_filesize; /* TRUE if maximum capture file size
47                                            is specified */
48         gint32 autostop_filesize;       /* Maximum capture file size */
49         gboolean ringbuffer_on;         /* TRUE if ring buffer in use */
50         guint32 ringbuffer_num_files;   /* Number of ring buffer files */
51         gboolean has_ring_duration;     /* TRUE if ring duration specified */
52         gint32 ringbuffer_duration;     /* Switch file after n seconds */
53 } capture_options;
54
55 extern capture_options capture_opts;
56
57 extern int quit_after_cap; /* Makes a "capture only mode". Implies -k */
58 extern gboolean capture_child;  /* if this is the child for "-S" */
59
60 /* Open a specified file, or create a temporary file, and start a capture
61    to the file in question.  Returns TRUE if the capture starts
62    successfully, FALSE otherwise. */
63 gboolean do_capture(const char *save_file);
64
65 /* Do the low-level work of a capture. */
66 int    capture(gboolean *stats_known, struct pcap_stat *stats);
67
68 /* Stop a capture from a menu item. */
69 void   capture_stop(void);
70
71 /* Terminate the capture child cleanly when exiting. */
72 void   kill_capture_child(void);
73
74 #endif /* HAVE_LIBPCAP */
75
76 #define EMPTY_FILTER ""
77 #endif /* capture.h */