3 * Definitions for packet capture windows
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 /* This file should only be included if libpcap is present */
18 * Capture related things.
21 #include "capture_opts.h"
22 #include "capture_info.h"
24 #include "capture/capture_session.h"
28 #endif /* __cplusplus */
31 capture_cb_capture_prepared
,
32 capture_cb_capture_update_started
,
33 capture_cb_capture_update_continue
,
34 capture_cb_capture_update_finished
,
35 capture_cb_capture_fixed_started
,
36 capture_cb_capture_fixed_continue
,
37 capture_cb_capture_fixed_finished
,
38 capture_cb_capture_stopping
,
39 capture_cb_capture_failed
42 typedef void (*capture_callback_t
) (int event
, capture_session
*cap_session
,
46 capture_callback_add(capture_callback_t func
, void *user_data
);
49 capture_callback_remove(capture_callback_t func
, void *user_data
);
52 * Initialize a capture session.
54 * @param cap_session the handle for the capture session
55 * @param cf the capture_file for the file
58 capture_input_init(capture_session
*cap_session
, capture_file
*cf
);
61 * Start a capture session.
63 * @param capture_opts the numerous capture options
64 * @param capture_comments if not NULL, a GPtrArray * to a set of comments
65 * to put in the capture file's Section Header Block if it's a pcapng file
66 * @param cap_session the handle for the capture session
67 * @param cap_data a struct with capture info data
68 * @param update_cb update screen
69 * @return true if the capture starts successfully, false otherwise.
72 capture_start(capture_options
*capture_opts
, GPtrArray
*capture_comments
,
73 capture_session
*cap_session
, info_data_t
* cap_data
,
74 void(*update_cb
)(void));
76 /** Stop a capture session (usually from a menu item). */
78 capture_stop(capture_session
*cap_session
);
80 /** Terminate the capture child cleanly when exiting. */
82 capture_kill_child(capture_session
*cap_session
);
84 struct if_stat_cache_s
;
85 typedef struct if_stat_cache_s if_stat_cache_t
;
88 * Start gathering capture statistics for the interfaces specified.
89 * @param capture_opts A structure containing options for the capture.
90 * @return A pointer to the statistics state data.
92 extern WS_RETNONNULL if_stat_cache_t
* capture_stat_start(capture_options
*capture_opts
);
95 * Retrieve the list of interfaces and their capabilities, and start
96 * gathering capture statistics for the interfaces.
97 * @param capture_opts A structure containing options for the capture.
98 * @param[out] if_list A pointer that will store a GList of if_info_t.
99 * @return A pointer to the statistics state data.
101 extern WS_RETNONNULL if_stat_cache_t
* capture_interface_stat_start(capture_options
*capture_opts
, GList
**if_list
);
104 * Fetch capture statistics, similar to pcap_stats().
106 struct pcap_stat
; /* Stub in case we don't or haven't yet included pcap.h */
107 extern bool capture_stats(if_stat_cache_t
*sc
, char *ifname
, struct pcap_stat
*ps
);
110 * Stop gathering capture statistics.
112 void capture_stat_stop(if_stat_cache_t
*sc
);
116 #endif /* __cplusplus */
118 #endif /* capture.h */