2004-10-30 11:44:06 +00:00
|
|
|
/* capture_sync.h
|
2006-05-28 20:28:20 +00:00
|
|
|
* Synchronisation between Wireshark capture parent and child instances
|
2004-10-30 11:44:06 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-10-30 11:44:06 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2004-10-30 11:44:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** @file
|
2007-06-11 03:58:58 +00:00
|
|
|
*
|
2004-10-30 11:44:06 +00:00
|
|
|
* Sync mode capture (internal interface).
|
|
|
|
*
|
2007-06-11 03:58:58 +00:00
|
|
|
* Will start a new Wireshark child instance which will do the actual capture
|
2005-04-11 18:57:19 +00:00
|
|
|
* work.
|
2004-10-30 11:44:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CAPTURE_SYNC_H__
|
|
|
|
#define __CAPTURE_SYNC_H__
|
|
|
|
|
2015-06-11 22:05:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2015-12-17 04:15:03 +00:00
|
|
|
struct _info_data;
|
|
|
|
|
2007-06-11 03:58:58 +00:00
|
|
|
/**
|
2005-03-28 18:04:09 +00:00
|
|
|
* Start a new capture session.
|
2004-10-30 11:44:06 +00:00
|
|
|
* Create a capture child which is doing the real capture work.
|
2007-06-11 03:58:58 +00:00
|
|
|
* The various capture_input_... functions will be called, if something had
|
2005-04-11 18:57:19 +00:00
|
|
|
* happened.
|
2004-10-30 11:44:06 +00:00
|
|
|
*
|
|
|
|
* Most of the parameters are passed through the global capture_opts.
|
|
|
|
*
|
2005-03-28 18:04:09 +00:00
|
|
|
* @param capture_opts the options
|
Clean up handling of --capture-comment.
Don't store the comments in a capture_options structure, because that's
available only if we're being built with capture support, and
--capture-comment can be used in TShark when reading a capture file and
writing another capture file, with no live capture taking place.
This means we don't handle that option in capture_opts_add_opt(); handle
it in the programs that support it.
Support writing multiple comments in dumpcap when capturing.
These changes also fix builds without pcap, and makes --capture-comment
work in Wireshark when a capture is started from the command line with
-k.
Update the help messages to indicate that --capture-comment adds a
capture comment, it doesn't change any comment (much less "the" comment,
as there isn't necessarily a single comment).
Update the man pages:
- not to presume that only pcapng files support file comments (even if
that's true now, it might not be true in the future);
- to note that multiple instances of --capture-comment are supported,
and that multiple comments will be written, whether capturing or reading
one file and writing another;
- clarify that Wireshark doesn't *discard* SHB comments other than the
first one, even though it only displays the first one;
2021-07-15 05:16:30 +00:00
|
|
|
* @param capture_comments if not NULL, a GPtrArray * to a set of comments
|
|
|
|
* to put in the capture file's Section Header Block if it's a pcapng file
|
2013-05-22 07:44:28 +00:00
|
|
|
* @param cap_session a handle for the capture session
|
2016-01-26 08:24:30 +00:00
|
|
|
* @param cap_data a struct with capture info data
|
2013-12-15 19:07:26 +00:00
|
|
|
* @param update_cb update screen
|
2004-10-30 11:44:06 +00:00
|
|
|
* @return TRUE if a capture could be started, FALSE if not
|
|
|
|
*/
|
2007-06-11 03:58:58 +00:00
|
|
|
extern gboolean
|
Clean up handling of --capture-comment.
Don't store the comments in a capture_options structure, because that's
available only if we're being built with capture support, and
--capture-comment can be used in TShark when reading a capture file and
writing another capture file, with no live capture taking place.
This means we don't handle that option in capture_opts_add_opt(); handle
it in the programs that support it.
Support writing multiple comments in dumpcap when capturing.
These changes also fix builds without pcap, and makes --capture-comment
work in Wireshark when a capture is started from the command line with
-k.
Update the help messages to indicate that --capture-comment adds a
capture comment, it doesn't change any comment (much less "the" comment,
as there isn't necessarily a single comment).
Update the man pages:
- not to presume that only pcapng files support file comments (even if
that's true now, it might not be true in the future);
- to note that multiple instances of --capture-comment are supported,
and that multiple comments will be written, whether capturing or reading
one file and writing another;
- clarify that Wireshark doesn't *discard* SHB comments other than the
first one, even though it only displays the first one;
2021-07-15 05:16:30 +00:00
|
|
|
sync_pipe_start(capture_options *capture_opts, GPtrArray *capture_comments,
|
|
|
|
capture_session *cap_session, struct _info_data* cap_data,
|
|
|
|
void(*update_cb)(void));
|
2004-10-30 11:44:06 +00:00
|
|
|
|
|
|
|
/** User wants to stop capturing, gracefully close the capture child */
|
|
|
|
extern void
|
2013-05-22 07:44:28 +00:00
|
|
|
sync_pipe_stop(capture_session *cap_session);
|
2004-10-30 11:44:06 +00:00
|
|
|
|
2005-03-28 18:04:09 +00:00
|
|
|
/** User wants to stop the program, just kill the child as soon as possible */
|
2004-10-30 11:44:06 +00:00
|
|
|
extern void
|
2015-06-10 00:30:15 +00:00
|
|
|
sync_pipe_kill(ws_process_id fork_child);
|
2004-10-30 11:44:06 +00:00
|
|
|
|
2016-09-14 12:13:20 +00:00
|
|
|
/**
|
|
|
|
* Set wireless channel using dumpcap
|
|
|
|
* On success, *data points to a buffer containing the dumpcap output,
|
|
|
|
* *primary_msg and *secondary_msg are NULL, and 0 is returned. *data
|
|
|
|
* must be freed with g_free().
|
|
|
|
*
|
|
|
|
* On failure, *data is NULL, *primary_msg points to an error message,
|
|
|
|
* *secondary_msg either points to an additional error message or is
|
|
|
|
* NULL, and -1 or errno value is returned; *primary_msg, and
|
|
|
|
* *secondary_msg if not NULL must be freed with g_free().
|
|
|
|
*
|
|
|
|
* @param iface (monitor) network interface name
|
|
|
|
* @param freq channel control frequency string (in MHz)
|
|
|
|
* @param type channel type string (or NULL if not used)
|
|
|
|
* @param center_freq1 VHT channel center frequency (or NULL if not used)
|
|
|
|
* @param center_freq2 VHT channel center frequency 2 (or NULL if not used)
|
2019-07-11 10:23:07 +00:00
|
|
|
* @param data On success, *data points to a buffer containing the dumpcap output, On failure *data is NULL
|
|
|
|
* @param primary_msg On success NULL, On failure points to an error message
|
|
|
|
* @param secondary_msg On success NULL, On failure either points to an additional error message or is NULL
|
2019-07-16 08:29:50 +00:00
|
|
|
* @param update_cb update callback
|
2016-09-14 12:13:20 +00:00
|
|
|
* @return 0 on success
|
|
|
|
*/
|
2012-06-20 18:42:45 +00:00
|
|
|
extern int
|
2012-12-29 20:56:11 +00:00
|
|
|
sync_interface_set_80211_chan(const gchar *iface, const char *freq, const gchar *type,
|
2016-02-06 23:40:51 +00:00
|
|
|
const gchar *center_freq1, const gchar *center_freq2,
|
2012-06-20 18:42:45 +00:00
|
|
|
gchar **data, gchar **primary_msg,
|
2013-06-27 17:10:50 +00:00
|
|
|
gchar **secondary_msg, void (*update_cb)(void));
|
2012-06-20 18:42:45 +00:00
|
|
|
|
2007-06-11 03:58:58 +00:00
|
|
|
/** Get an interface list using dumpcap */
|
|
|
|
extern int
|
2010-05-17 18:40:23 +00:00
|
|
|
sync_interface_list_open(gchar **data, gchar **primary_msg,
|
2013-06-27 17:10:50 +00:00
|
|
|
gchar **secondary_msg, void (*update_cb)(void));
|
2007-06-11 03:58:58 +00:00
|
|
|
|
2010-05-13 17:37:39 +00:00
|
|
|
/** Get interface capabilities using dumpcap */
|
2007-07-20 21:43:07 +00:00
|
|
|
extern int
|
2015-07-17 15:01:27 +00:00
|
|
|
sync_if_capabilities_open(const gchar *ifname, gboolean monitor_mode, const gchar* auth,
|
2010-05-17 18:40:23 +00:00
|
|
|
gchar **data, gchar **primary_msg,
|
2013-06-27 17:10:50 +00:00
|
|
|
gchar **secondary_msg, void (*update_cb)(void));
|
2007-06-11 03:58:58 +00:00
|
|
|
|
2007-08-02 21:45:27 +00:00
|
|
|
/** Start getting interface statistics using dumpcap. */
|
|
|
|
extern int
|
2015-06-10 00:30:15 +00:00
|
|
|
sync_interface_stats_open(int *read_fd, ws_process_id *fork_child, gchar **msg, void (*update_cb)(void));
|
2007-08-02 21:45:27 +00:00
|
|
|
|
|
|
|
/** Stop gathering statistics. */
|
|
|
|
extern int
|
2015-06-10 00:30:15 +00:00
|
|
|
sync_interface_stats_close(int *read_fd, ws_process_id *fork_child, gchar **msg);
|
2007-08-02 21:45:27 +00:00
|
|
|
|
|
|
|
/** Read a line from a pipe, similar to fgets. Non-blocking. */
|
|
|
|
extern int
|
2008-06-23 21:27:37 +00:00
|
|
|
sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max);
|
2007-08-02 21:45:27 +00:00
|
|
|
|
2013-06-27 19:00:01 +00:00
|
|
|
/* set a callback to be called after fork with the pid of the forked child */
|
2015-06-10 00:55:03 +00:00
|
|
|
extern void capture_sync_set_fetch_dumpcap_pid_cb(void(*cb)(ws_process_id pid));
|
2013-06-27 19:00:01 +00:00
|
|
|
|
2015-06-11 22:05:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __CAPTURE_SYNC_H__ */
|