Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
exported_pdu.h
Go to the documentation of this file.
1
12#ifndef EXPORTED_PDU_H
13#define EXPORTED_PDU_H
14
15#include "ws_symbol_export.h"
16#include "ws_attributes.h"
17
18#include <epan/tvbuff.h>
19#include <epan/packet_info.h>
20
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
27/*
28 * Define different common tap names to extract PDUs at different layers,
29 * otherwise one packet may be exported several times at different layers
30 * if all taps are run.
31 */
32#define EXPORT_PDU_TAP_NAME_LAYER_3 "OSI layer 3"
33#define EXPORT_PDU_TAP_NAME_LAYER_4 "OSI layer 4"
34#define EXPORT_PDU_TAP_NAME_LAYER_7 "OSI layer 7"
35
36/* To add dynamically an export name, call the following function
37 It returns the registered tap */
38WS_DLL_PUBLIC int register_export_pdu_tap(const char *name);
39/* Same as above, but for export taps that use an encapsulation other
40 * than WTAP_ENCAP_WIRESHARK_UPPER_PDU */
41WS_DLL_PUBLIC int register_export_pdu_tap_with_encap(const char *name, int encap);
42WS_DLL_PUBLIC GSList *get_export_pdu_tap_list(void);
43
44WS_DLL_PUBLIC int export_pdu_tap_get_encap(const char* name);
45
52typedef int (*exp_pdu_get_size)(packet_info *pinfo, void* data);
53
62typedef int (*exp_pdu_populate_data)(packet_info *pinfo, void* data, uint8_t *tlv_buffer, uint32_t tlv_buffer_size);
63
64typedef struct exp_pdu_data_item
65{
66 exp_pdu_get_size size_func;
67 exp_pdu_populate_data populate_data;
68 void* data;
70
71/*
72 * This struct is used as the data part of tap_queue_packet() and contains a
73 * buffer with metadata of the protocol PDU included in the tvb in the struct.
74 *
75 * The metadata is a sequence of TLVs in the format for the header of
76 * LINKTYPE_WIRESHARK_UPPER_PDU packets in pcap pcapng files.
77 */
78typedef struct _exp_pdu_data_t {
79 unsigned tlv_buffer_len;
80 uint8_t *tlv_buffer;
81 unsigned tvb_captured_length;
82 unsigned tvb_reported_length;
83 tvbuff_t *pdu_tvb;
85
97WS_DLL_PUBLIC exp_pdu_data_t *export_pdu_create_tags(packet_info *pinfo, const char* proto_name, uint16_t tag_type, const exp_pdu_data_item_t **items);
98
114WS_DLL_PUBLIC exp_pdu_data_t *export_pdu_create_common_tags(packet_info *pinfo, const char *proto_name, uint16_t tag_type);
115
116WS_DLL_PUBLIC int exp_pdu_data_dissector_table_num_value_size(packet_info *pinfo, void* data);
117WS_DLL_PUBLIC int exp_pdu_data_dissector_table_num_value_populate_data(packet_info *pinfo, void* data, uint8_t *tlv_buffer, uint32_t buffer_size);
118
119WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_src_ip;
120WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_dst_ip;
121WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_port_type;
122WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_src_port;
123WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_dst_port;
124WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_orig_frame_num;
125
126extern void export_pdu_init(void);
127
128extern void export_pdu_cleanup(void);
129
130#ifdef __cplusplus
131}
132#endif /* __cplusplus */
133
134#endif /* EXPORTED_PDU_H */
int(* exp_pdu_get_size)(packet_info *pinfo, void *data)
Definition exported_pdu.h:52
int(* exp_pdu_populate_data)(packet_info *pinfo, void *data, uint8_t *tlv_buffer, uint32_t tlv_buffer_size)
Definition exported_pdu.h:62
WS_DLL_PUBLIC exp_pdu_data_t * export_pdu_create_common_tags(packet_info *pinfo, const char *proto_name, uint16_t tag_type)
Definition exported_pdu.c:197
WS_DLL_PUBLIC exp_pdu_data_t * export_pdu_create_tags(packet_info *pinfo, const char *proto_name, uint16_t tag_type, const exp_pdu_data_item_t **items)
Definition exported_pdu.c:218
Definition exported_pdu.h:78
Definition packet_info.h:43
Definition exported_pdu.h:65
Definition tvbuff-int.h:35