Qt: Replace the toolbar extension icon.
[metze/wireshark/wip.git] / ui / tap_export_pdu.h
1 /* tap_export_pdu.h
2  * Routines for exporting PDUs to file
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later*/
9
10 #ifndef __TAP_EXPORT_PDU_H__
11 #define __TAP_EXPORT_PDU_H__
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif /* __cplusplus */
16
17 typedef struct _exp_pdu_t {
18     int          pkt_encap;
19     wtap_dumper* wdh;
20 } exp_pdu_t;
21
22 /**
23 * Registers the tap listener which will add matching packets to the exported
24 * file. Must be called before exp_pdu_open.
25 *
26 * @param tap_name  One of the names registered with register_export_pdu_tap().
27 * @param filter    An tap filter, may be NULL to disable filtering which
28 * improves performance if you do not need a filter.
29 * @return NULL on success or an error string on failure which must be freed
30 * with g_free(). Failure could occur when the filter or tap_name are invalid.
31 */
32 char *exp_pdu_pre_open(const char *tap_name, const char *filter,
33     exp_pdu_t *exp_pdu_tap_data);
34
35 /**
36 * Use the given file descriptor for writing an output file. Can only be called
37 * once and exp_pdu_pre_open() must be called before.
38 *
39 * @return 0 on success or a wtap error code.
40 */
41 int exp_pdu_open(exp_pdu_t *data, int fd, char *comment);
42
43 /* Stops the PDUs export. */
44 int exp_pdu_close(exp_pdu_t *exp_pdu_tap_data);
45
46 #ifdef __cplusplus
47 }
48 #endif /* __cplusplus */
49
50 #endif /* __TAP_EXPORT_PDU_H__ */
51
52 /*
53  * Editor modelines
54  *
55  * Local Variables:
56  * c-basic-offset: 4
57  * tab-width: 8
58  * indent-tabs-mode: nil
59  * End:
60  *
61  * ex: set shiftwidth=4 tabstop=8 expandtab:
62  * :indentSize=4:tabSize=8:noTabs=true:
63  */