From 6d2ea733ddedf9850883a2dbec43069b92e129bf Mon Sep 17 00:00:00 2001 From: AndersBroman Date: Fri, 29 Apr 2016 15:23:28 +0200 Subject: Implement Export PDU for tshark This patch introduces the "-U tap_name[,filter]" tshark option and is similar to the "Export PDUs as file" option in Wireshark. Wireshark implements this feature by reopening a capture file, applying a tap and finally opening the temporary file. Since tshark knows in advance that a PDU export is needed, it can optimize by not creating the temporary file and perform the export at the first opportunity. This patch splits the opening/tapping functionality from error reporting since tshark does not need a temp file and has no dialogs. The capture file comment is now specified explicitly as there is no "current file" anymore if the tap is running without active file. TODO: - Review whether it is acceptable to overwrite save_file in tshark. - Add documentation (tshark manpage). Bug: 3444 Change-Id: Ie159495d42c32c2ba7400f2991b7b8185b3fda09 Reviewed-on: https://code.wireshark.org/review/5890 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/export_pdu_ui_utils.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 ui/export_pdu_ui_utils.h (limited to 'ui/export_pdu_ui_utils.h') diff --git a/ui/export_pdu_ui_utils.h b/ui/export_pdu_ui_utils.h new file mode 100644 index 0000000000..54cbd13063 --- /dev/null +++ b/ui/export_pdu_ui_utils.h @@ -0,0 +1,43 @@ +/* +* export_pdu_ui_utils.h +* Routines for exported_pdu dissection +* Copyright 2013, Anders Broman +* +* Wireshark - Network traffic analyzer +* By Gerald Combs +* Copyright 1998 Gerald Combs +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef EXPORT_PDU_UI_UTILS_H +#define EXPORT_PDU_UI_UTILS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** +* Filters the current opened capture file into a temporary file. On success, +* TRUE is returned and the filtered file is opened into the UI. +*/ +gboolean do_export_pdu(const char *filter, gchar *tap_name, exp_pdu_t *data); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* EXPORT_PDU_UI_UTILS_H */ -- cgit v1.2.3