2 * Definitions for packet capture windows
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
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.
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.
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.
25 /* This file should only be included if libpcap is present */
31 * Capture related things.
34 #include "capture_opts.h"
37 capture_cb_capture_prepared,
38 capture_cb_capture_update_started,
39 capture_cb_capture_update_continue,
40 capture_cb_capture_update_finished,
41 capture_cb_capture_fixed_started,
42 capture_cb_capture_fixed_continue,
43 capture_cb_capture_fixed_finished,
44 capture_cb_capture_stopping
47 typedef void (*capture_callback_t) (gint event, capture_options *capture_opts,
51 capture_callback_add(capture_callback_t func, gpointer user_data);
54 capture_callback_remove(capture_callback_t func);
57 * Start a capture session.
59 * @param capture_opts the numerous capture options
60 * @return TRUE if the capture starts successfully, FALSE otherwise.
62 extern gboolean capture_start(capture_options *capture_opts);
64 /** Stop a capture session (usually from a menu item). */
65 extern void capture_stop(capture_options *capture_opts);
67 /** Restart the current captured packets and start again. */
68 extern void capture_restart(capture_options *capture_opts);
70 /** Terminate the capture child cleanly when exiting. */
71 extern void capture_kill_child(capture_options *capture_opts);
74 * Capture child told us we have a new (or the first) capture file.
76 extern gboolean capture_input_new_file(capture_options *capture_opts, gchar *new_file);
79 * Capture child told us we have new packets to read.
81 extern void capture_input_new_packets(capture_options *capture_opts, int to_read);
84 * Capture child told us how many dropped packets it counted.
86 extern void capture_input_drops(capture_options *capture_opts, guint32 dropped);
89 * Capture child told us that an error has occurred while starting the capture.
91 extern void capture_input_error_message(capture_options *capture_opts, char *error_message, char *secondary_error_msg);
94 * Capture child told us that an error has occurred while parsing a
95 * capture filter when starting/running the capture.
97 extern void capture_input_cfilter_error_message(capture_options *capture_opts, char *error_message);
100 * Capture child closed its side of the pipe, do the required cleanup.
102 extern void capture_input_closed(capture_options *capture_opts);
106 * Fetch the interface list from a child process.
108 extern GList *capture_interface_list(int *err, char **err_str);
111 * Fetch the linktype list for the specified interface from a child process.
113 extern GList *capture_pcap_linktype_list(const char *devname, char **err_str);
116 struct if_stat_cache_s;
117 typedef struct if_stat_cache_s if_stat_cache_t;
120 * Start gathering capture statistics for the interfaces specified.
121 * @param A GList of if_info_t items
122 * @return A pointer to the statistics state data.
124 extern if_stat_cache_t * capture_stat_start(GList *if_list);
127 * Fetch capture statistics, similar to pcap_stats().
129 struct pcap_stat; /* Stub in case we don't or haven't yet included pcap.h */
130 extern gboolean capture_stats(if_stat_cache_t *sc, char *ifname, struct pcap_stat *ps);
133 * Stop gathering capture statistics.
135 void capture_stat_stop(if_stat_cache_t *sc);
136 #endif /* HAVE_LIBPCAP */
138 #endif /* capture.h */