aboutsummaryrefslogtreecommitdiffstats
path: root/ui/tap_export_pdu.h
diff options
context:
space:
mode:
authorAndersBroman <anders.broman@ericsson.com>2016-04-29 15:23:28 +0200
committerAnders Broman <a.broman58@gmail.com>2016-05-03 10:17:46 +0000
commit6d2ea733ddedf9850883a2dbec43069b92e129bf (patch)
treed72fb4c216433f40fad65b22dc54a7dbac69f62c /ui/tap_export_pdu.h
parent1489c9e6ff1b98bee792c0cb98eb9e1dc1c1e875 (diff)
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 <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/tap_export_pdu.h')
-rw-r--r--ui/tap_export_pdu.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/ui/tap_export_pdu.h b/ui/tap_export_pdu.h
index df6b5bad45..49e46ebeff 100644
--- a/ui/tap_export_pdu.h
+++ b/ui/tap_export_pdu.h
@@ -32,7 +32,29 @@ typedef struct _exp_pdu_t {
wtap_dumper* wdh;
} exp_pdu_t;
-gboolean do_export_pdu(const char *filter, gchar *tap_name, exp_pdu_t *data);
+/**
+* Registers the tap listener which will add matching packets to the exported
+* file. Must be called before exp_pdu_open.
+*
+* @param tap_name One of the names registered with register_export_pdu_tap().
+* @param filter An tap filter, may be NULL to disable filtering which
+* improves performance if you do not need a filter.
+* @return NULL on success or an error string on failure which must be freed
+* with g_free(). Failure could occur when the filter or tap_name are invalid.
+*/
+char *exp_pdu_pre_open(const char *tap_name, const char *filter,
+ exp_pdu_t *exp_pdu_tap_data);
+
+/**
+* Use the given file descriptor for writing an output file. Can only be called
+* once and exp_pdu_pre_open() must be called before.
+*
+* @return 0 on success or a wtap error code.
+*/
+int exp_pdu_open(exp_pdu_t *data, int fd, char *comment);
+
+/* Stops the PDUs export. */
+int exp_pdu_close(exp_pdu_t *exp_pdu_tap_data);
#ifdef __cplusplus
}