[H248 3GPP] Add dissection of IP transport package.
[metze/wireshark/wip.git] / ui / capture.h
1 /* capture.h
2  * Definitions for packet capture windows
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 /* This file should only be included if libpcap is present */
24
25 #ifndef __CAPTURE_H__
26 #define __CAPTURE_H__
27
28 /** @file
29  *  Capture related things.
30  */
31
32 #include "capture_opts.h"
33 #include "capture_info.h"
34 #include "capchild/capture_session.h"
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40 typedef enum {
41   capture_cb_capture_prepared,
42   capture_cb_capture_update_started,
43   capture_cb_capture_update_continue,
44   capture_cb_capture_update_finished,
45   capture_cb_capture_fixed_started,
46   capture_cb_capture_fixed_continue,
47   capture_cb_capture_fixed_finished,
48   capture_cb_capture_stopping,
49   capture_cb_capture_failed
50 } capture_cbs;
51
52 typedef void (*capture_callback_t) (gint event, capture_session *cap_session,
53                                     gpointer user_data);
54
55 extern void
56 capture_callback_add(capture_callback_t func, gpointer user_data);
57
58 extern void
59 capture_callback_remove(capture_callback_t func, gpointer user_data);
60
61 /**
62  * Start a capture session.
63  *
64  * @param capture_opts the numerous capture options
65  * @param cap_session a handle for the capture session
66  * @param cap_data a struct with capture info data
67  * @param update_cb update screen
68  * @return TRUE if the capture starts successfully, FALSE otherwise.
69  */
70 extern gboolean
71 capture_start(capture_options *capture_opts, capture_session *cap_session, info_data_t* cap_data, void(*update_cb)(void));
72
73 /** Stop a capture session (usually from a menu item). */
74 extern void
75 capture_stop(capture_session *cap_session);
76
77 /** Restart the current captured packets and start again. */
78 extern void
79 capture_restart(capture_session *cap_session);
80
81 /** Terminate the capture child cleanly when exiting. */
82 extern void
83 capture_kill_child(capture_session *cap_session);
84
85 struct if_stat_cache_s;
86 typedef struct if_stat_cache_s if_stat_cache_t;
87
88 /**
89  * Start gathering capture statistics for the interfaces specified.
90  * @param capture_opts A structure containing options for the capture.
91  * @return A pointer to the statistics state data.
92  */
93 extern if_stat_cache_t * capture_stat_start(capture_options *capture_opts);
94
95 /**
96  * Fetch capture statistics, similar to pcap_stats().
97  */
98 struct pcap_stat; /* Stub in case we don't or haven't yet included pcap.h */
99 extern gboolean capture_stats(if_stat_cache_t *sc, char *ifname, struct pcap_stat *ps);
100
101 /**
102  * Stop gathering capture statistics.
103  */
104 void capture_stat_stop(if_stat_cache_t *sc);
105
106 #ifdef __cplusplus
107 }
108 #endif /* __cplusplus */
109
110 #endif /* capture.h */
111
112 /*
113  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
114  *
115  * Local Variables:
116  * c-basic-offset: 2
117  * tab-width: 8
118  * indent-tabs-mode: nil
119  * End:
120  *
121  * vi: set shiftwidth=2 tabstop=8 expandtab:
122  * :indentSize=2:tabSize=8:noTabs=true:
123  */