Add Compile BPF to the capture options dialog description.
[obnox/wireshark/wip.git] / capture_sync.h
1 /* capture_sync.h
2  * Synchronisation between Wireshark capture parent and child instances
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
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
26 /** @file
27  *
28  *  Sync mode capture (internal interface).
29  *
30  *  Will start a new Wireshark child instance which will do the actual capture
31  *  work.
32  */
33
34 #ifndef __CAPTURE_SYNC_H__
35 #define __CAPTURE_SYNC_H__
36
37
38 /**
39  * Start a new capture session.
40  *  Create a capture child which is doing the real capture work.
41  *  The various capture_input_... functions will be called, if something had
42  *  happened.
43  *
44  *  Most of the parameters are passed through the global capture_opts.
45  *
46  *  @param capture_opts the options
47  *  @return             TRUE if a capture could be started, FALSE if not
48  */
49 extern gboolean
50 sync_pipe_start(capture_options *capture_opts);
51
52 /** User wants to stop capturing, gracefully close the capture child */
53 extern void
54 sync_pipe_stop(capture_options *capture_opts);
55
56 /** User wants to stop the program, just kill the child as soon as possible */
57 extern void
58 sync_pipe_kill(int fork_child);
59
60 /** Has the parent signalled the child to stop? */
61 #define SIGNAL_PIPE_CTRL_ID_NONE "none"
62 #ifdef _WIN32
63 #define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
64 #endif
65
66 /** Get an interface list using dumpcap */
67 extern int
68 sync_interface_list_open(gchar **data, gchar **primary_msg,
69                          gchar **secondary_msg);
70
71 /** Get interface capabilities using dumpcap */
72 extern int
73 sync_if_capabilities_open(const gchar *ifname, gboolean monitor_mode,
74                           gchar **data, gchar **primary_msg,
75                           gchar **secondary_msg);
76
77 /** Start getting interface statistics using dumpcap. */
78 extern int
79 sync_interface_stats_open(int *read_fd, int *fork_child, gchar **msg);
80
81 /** Stop gathering statistics. */
82 extern int
83 sync_interface_stats_close(int *read_fd, int *fork_child, gchar **msg);
84
85 /** Read a line from a pipe, similar to fgets.  Non-blocking. */
86 extern int
87 sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max);
88
89
90 #endif /* capture_sync.h */