Fix some aclocal warnings during autogen.sh
[obnox/wireshark/wip.git] / capture.h
1 /* capture.h
2  * Definitions for packet capture windows
3  *
4  * $Id: capture.h,v 1.44 2004/03/13 22:49:30 ulfl 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 #ifdef _WIN32
35     int buffer_size;        /* the capture buffer size (MB) */
36 #endif
37         gboolean has_snaplen;           /* TRUE if maximum capture packet
38                                            length is specified */
39         int snaplen;                    /* Maximum captured packet length */
40         int promisc_mode;               /* Capture in promiscuous mode */
41         int linktype;                   /* Data link type to use, or -1 for
42                                            "use default" */
43         int sync_mode;                  /* Fork a child to do the capture,
44                                            and sync between them */
45
46     gboolean multi_files_on;    /* TRUE if ring buffer in use */
47
48         gboolean has_file_duration;     /* TRUE if ring duration specified */
49         gint32 file_duration;     /* Switch file after n seconds */
50         gboolean has_ring_num_files;/* TRUE if ring num_files specified */
51         guint32 ring_num_files;         /* Number of multiple buffer files */
52     gboolean has_autostop_files;/* TRUE if maximum number of capture files
53                                            are specified */
54     gint32 autostop_files;      /* Maximum number of capture files */
55
56     gboolean has_autostop_packets;      /* TRUE if maximum packet count is
57                                            specified */
58         int autostop_packets;           /* Maximum packet count */
59         gboolean has_autostop_filesize; /* TRUE if maximum capture file size
60                                            is specified */
61         gint32 autostop_filesize;       /* Maximum capture file size */
62         gboolean has_autostop_duration; /* TRUE if maximum capture duration
63                                            is specified */
64         gint32 autostop_duration;       /* Maximum capture duration */
65 } capture_options;
66
67 extern capture_options capture_opts;
68
69 extern gboolean quit_after_cap; /* Makes a "capture only mode". Implies -k */
70 extern gboolean capture_child;  /* if this is the child for "-S" */
71
72 /* Open a specified file, or create a temporary file, and start a capture
73    to the file in question.  Returns TRUE if the capture starts
74    successfully, FALSE otherwise. */
75 gboolean do_capture(const char *save_file);
76
77 /* Do the low-level work of a capture. */
78 int    capture(gboolean *stats_known, struct pcap_stat *stats);
79
80 /* Stop a capture from a menu item. */
81 void   capture_stop(void);
82
83 /* Terminate the capture child cleanly when exiting. */
84 void   kill_capture_child(void);
85
86
87 /* XXX: improve this macro (put something like this into epan/packet.h?) */
88 #define CAPTURE_PACKET_COUNTS sizeof(packet_counts) / sizeof (gint)
89
90 typedef struct {
91     /* handles */
92     gpointer        callback_data;  /* capture callback handle */
93     gpointer        ui;             /* user interfaces own handle */
94
95     /* capture info */
96     packet_counts   *counts;        /* protocol specific counters */
97     time_t          running_time;   /* running time since last update */
98     gint            new_packets;    /* packets since last update */
99 } capture_info;
100
101
102 /* create the capture info dialog */
103 extern void capture_info_create(
104 capture_info    *cinfo);
105
106 /* Update the capture info counters in the dialog */
107 extern void capture_info_update(
108 capture_info    *cinfo);
109
110 /* destroy the capture info dialog again */
111 extern void capture_info_destroy(
112 capture_info    *cinfo);
113
114
115 #endif /* HAVE_LIBPCAP */
116
117 #define EMPTY_FILTER ""
118 #endif /* capture.h */