3 * Routines for exporting PDUs to file
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 #ifndef __TAP_EXPORT_PDU_H__
13 #define __TAP_EXPORT_PDU_H__
17 #endif /* __cplusplus */
19 typedef struct _exp_pdu_t
{
24 wtapng_iface_descriptions_t
* idb_inf
;
29 * Registers the tap listener which will add matching packets to the exported
30 * file. Must be called before exp_pdu_open.
32 * @param tap_name One of the names registered with register_export_pdu_tap().
33 * @param filter An tap filter, may be NULL to disable filtering which
34 * improves performance if you do not need a filter.
35 * @return NULL on success or an error string on failure which must be freed
36 * with g_free(). Failure could occur when the filter or tap_name are invalid.
38 char *exp_pdu_pre_open(const char *tap_name
, const char *filter
,
39 exp_pdu_t
*exp_pdu_tap_data
);
42 * Use the given file descriptor for writing an output file. Can only be called
43 * once and exp_pdu_pre_open() must be called before.
45 * @param[out] err Will be set to an error code on failure.
46 * @param[out] err_info for some errors, a string giving more details of
48 * @return true on success or false on failure.
50 bool exp_pdu_open(exp_pdu_t
*data
, char *pathname
, int file_type_subtype
,
51 int fd
, const char *comment
, int *err
, char **err_info
);
53 /* Stops the PDUs export. */
54 bool exp_pdu_close(exp_pdu_t
*exp_pdu_tap_data
, int *err
, char **err_info
);
58 #endif /* __cplusplus */
60 #endif /* __TAP_EXPORT_PDU_H__ */