Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
exported_pdu.h
Go to the documentation of this file.
1
11#pragma once
12#include "ws_symbol_export.h"
13#include "ws_attributes.h"
14
15#include <epan/tvbuff.h>
16#include <epan/packet_info.h>
17
19
20#ifdef __cplusplus
21extern "C" {
22#endif /* __cplusplus */
23
24/*
25 * Define different common tap names to extract PDUs at different layers,
26 * otherwise one packet may be exported several times at different layers
27 * if all taps are run.
28 */
29#define EXPORT_PDU_TAP_NAME_LAYER_3 "OSI layer 3"
30#define EXPORT_PDU_TAP_NAME_LAYER_4 "OSI layer 4"
31#define EXPORT_PDU_TAP_NAME_LAYER_7 "OSI layer 7"
32
33/* To add dynamically an export name, call the following function
34 It returns the registered tap */
41WS_DLL_PUBLIC int register_export_pdu_tap(const char *name);
42/* Same as above, but for export taps that use an encapsulation other
43 * than WTAP_ENCAP_WIRESHARK_UPPER_PDU */
44
52WS_DLL_PUBLIC int register_export_pdu_tap_with_encap(const char *name, int encap);
53
59WS_DLL_PUBLIC GSList *get_export_pdu_tap_list(void);
60
67WS_DLL_PUBLIC int export_pdu_tap_get_encap(const char* name);
68
76typedef int (*exp_pdu_get_size)(packet_info *pinfo, void* data);
77
87typedef int (*exp_pdu_populate_data)(packet_info *pinfo, void* data, uint8_t *tlv_buffer, uint32_t tlv_buffer_size);
88
98
115
127WS_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);
128
145WS_DLL_PUBLIC exp_pdu_data_t *export_pdu_create_common_tags(packet_info *pinfo, const char *proto_name, uint16_t tag_type);
146
154WS_DLL_PUBLIC int exp_pdu_data_dissector_table_num_value_size(packet_info *pinfo, void* data);
155
165WS_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);
166
167WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_src_ip;
168WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_dst_ip;
169WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_port_type;
170WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_src_port;
171WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_dst_port;
172WS_DLL_PUBLIC exp_pdu_data_item_t exp_pdu_data_orig_frame_num;
173
179extern void export_pdu_init(void);
180
187extern void export_pdu_cleanup(void);
188
189#ifdef __cplusplus
190}
191#endif /* __cplusplus */
struct exp_pdu_data_item exp_pdu_data_item_t
Bundles the size and populate callbacks with their associated data for a single exported PDU metadata...
WS_DLL_PUBLIC int export_pdu_tap_get_encap(const char *name)
Get the encapsulation type for a given export PDU tap name.
Definition exported_pdu.c:312
WS_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)
Populate data for an exported PDU using a dissector table.
WS_DLL_PUBLIC int register_export_pdu_tap(const char *name)
Register an export PDU tap with a default encapsulation.
Definition exported_pdu.c:284
void export_pdu_cleanup(void)
Cleans up resources used by exported PDU handling.
Definition exported_pdu.c:327
WS_DLL_PUBLIC GSList * get_export_pdu_tap_list(void)
Get a list of all registered export PDU taps.
Definition exported_pdu.c:305
struct _exp_pdu_data_t exp_pdu_data_t
Holds a protocol PDU and its associated metadata buffer for export via tap_queue_packet().
int(* exp_pdu_get_size)(packet_info *pinfo, void *data)
Compute the size (in bytes) of a pdu item.
Definition exported_pdu.h:76
int(* exp_pdu_populate_data)(packet_info *pinfo, void *data, uint8_t *tlv_buffer, uint32_t tlv_buffer_size)
Populate a buffer with pdu item data.
Definition exported_pdu.h:87
WS_DLL_PUBLIC int register_export_pdu_tap_with_encap(const char *name, int encap)
Register an export PDU tap with a specific encapsulation type.
Definition exported_pdu.c:275
WS_DLL_PUBLIC exp_pdu_data_t * export_pdu_create_common_tags(packet_info *pinfo, const char *proto_name, uint16_t tag_type)
Allocates and fills the exp_pdu_data_t struct with a common list of items.
Definition exported_pdu.c:197
WS_DLL_PUBLIC int exp_pdu_data_dissector_table_num_value_size(packet_info *pinfo, void *data)
Get the size of a value in the dissector table.
void export_pdu_init(void)
Initializes the PDU export system.
Definition exported_pdu.c:322
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)
Allocates and fills the exp_pdu_data_t struct according to the list of items.
Definition exported_pdu.c:218
Holds a protocol PDU and its associated metadata buffer for export via tap_queue_packet().
Definition exported_pdu.h:108
unsigned tlv_buffer_len
Definition exported_pdu.h:109
uint8_t * tlv_buffer
Definition exported_pdu.h:110
tvbuff_t * pdu_tvb
Definition exported_pdu.h:113
unsigned tvb_captured_length
Definition exported_pdu.h:111
unsigned tvb_reported_length
Definition exported_pdu.h:112
Represents the metadata and indexing information for a single captured frame.
Definition packet_info.h:43
Bundles the size and populate callbacks with their associated data for a single exported PDU metadata...
Definition exported_pdu.h:93
exp_pdu_populate_data populate_data
Definition exported_pdu.h:95
exp_pdu_get_size size_func
Definition exported_pdu.h:94
void * data
Definition exported_pdu.h:96
Core tvbuff (testy virtual buffer) structure representing a region of packet data,...
Definition tvbuff-int.h:95