| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
tap-dis-common.h
1/* tap-dis-common.h
2 * DIS streams handler functions used by tshark and wireshark.
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef __TAP_DIS_COMMON_H__
8#define __TAP_DIS_COMMON_H__
9
10#include <stdio.h>
11
12#include <glib.h>
13
14#include <epan/address.h>
15#include <epan/epan_dissect.h>
16#include <epan/packet_info.h>
17#include <epan/tap.h>
18
19#ifdef __cplusplus
20 extern "C" {
21#endif /* __cplusplus */
22
26 typedef struct _disstream_id {
27 address src_addr;
28 uint16_t src_port;
29 address dst_addr;
30 uint16_t dst_port;
31 uint16_t radio_id;
32 uint16_t entity_id_site;
33 uint16_t entity_id_appl;
34 uint16_t entity_id_entity;
35} disstream_id_t;
36
37
41 typedef struct _disstream_packet {
42 uint32_t frame_num;
43 nstime_t rel_time;
44 uint8_t payload_type;
45 guint payload_len;
46 guint8 *payload_data;
47 double delta_ms;
48 double jitter_ms;
49 uint32_t estimated_lost_added;
50 bool problem;
51} disstream_packet_t;
52
53
57 typedef struct _disstream_info {
58 disstream_id_t id;
59
60 /* --- Stream metadata --- */
61 uint8_t payload_type;
62 const char *payload_type_str;
63 uint8_t radio_input_source;
64 uint8_t transmit_state;
65
66 /* --- Packet and byte counts --- */
67 uint32_t packet_count;
68 uint32_t signal_packet_count;
69 uint32_t transmitter_packet_count;
70 uint64_t total_payload_bytes;
71 uint32_t estimated_lost_packets;
72
73 /* --- Frame and timing extents --- */
74 uint32_t first_packet_num;
75 uint32_t last_packet_num;
76 uint32_t first_signal_frame_num;
77 uint32_t last_signal_frame_num;
78 nstime_t start_rel_time;
79 nstime_t stop_rel_time;
80
81 /* --- Timing quality statistics --- */
82 double max_delta_ms;
83 double mean_delta_ms;
84 double max_jitter_ms;
85 double mean_jitter_ms;
86
87 /* --- Stream status flags --- */
88 bool transmission_stopped;
89 bool problem;
90
91 /* --- Packet storage --- */
92 GPtrArray *signal_packets;
93
94 /* --- Internal running analysis state (not for external use) --- */
95 bool first_timing_packet;
96 uint32_t timing_packet_count;
97 double start_arrival_ms;
98 double prev_arrival_ms;
99 double prev_nominal_ms;
100 double first_tx_ms;
101 double prev_tx_ms;
102 double filtered_jitter_ms;
103 double excess_codec_time_ms;
104} disstream_info_t;
105
106
110 typedef enum {
111 DISSTREAM_TAP_ANALYSE,
112 DISSTREAM_TAP_SAVE,
113 DISSTREAM_TAP_MARK
114} disstream_tap_mode_t;
115
116 struct _disstream_tapinfo;
117 typedef void (*disstream_tap_draw_cb)(struct _disstream_tapinfo *tapinfo);
118 typedef void (*disstream_tap_reset_cb)(struct _disstream_tapinfo *tapinfo);
119 typedef void (*disstream_tap_error_cb)(GString *error);
120
124 typedef struct _disstream_tapinfo {
125 GList *strinfo_list;
126 GHashTable *strinfo_hash;
127 uint32_t nstreams;
128 uint32_t npackets;
129
130 disstream_tap_mode_t mode;
131 disstream_info_t *filter_stream;
132 FILE *save_file;
133
134 disstream_tap_draw_cb tap_draw;
135 disstream_tap_reset_cb tap_reset;
136 bool is_registered;
137} disstream_tapinfo_t;
138
145 void disstream_id_copy(const disstream_id_t *src, disstream_id_t *dst);
146
154 void disstream_id_copy_pinfo(const packet_info *pinfo, disstream_id_t *dst);
155
165 void disstream_id_copy_pinfo_shallow(const packet_info *pinfo, disstream_id_t *dst);
166
172 void disstream_id_free(disstream_id_t *id);
173
180 unsigned disstream_id_to_hash(const disstream_id_t *id);
181
189 bool disstream_id_equal(const disstream_id_t *id1, const disstream_id_t *id2);
190
196 void disstream_info_init(disstream_info_t *info);
197
203disstream_info_t *disstream_info_malloc_and_init(void);
204
211 void disstream_info_free_data(disstream_info_t *info);
212
218 void disstream_info_free_all(disstream_info_t *info);
219
225 void disstream_packet_free(disstream_packet_t *packet);
226
234 void register_tap_listener_disstream(disstream_tapinfo_t *tapinfo, const char *fstring,
235 disstream_tap_error_cb tap_error);
236
242 void remove_tap_listener_disstream(disstream_tapinfo_t *tapinfo);
243
249 void disstream_reset(disstream_tapinfo_t *tapinfo);
250
256 void disstream_reset_cb(void *arg);
257
268 tap_packet_status disstream_packet_cb(void *arg, packet_info *pinfo, epan_dissect_t *edt,
269 const void *arg2, tap_flags_t flags);
270
271#ifdef __cplusplus
272}
273#endif /* __cplusplus */
274
275#endif /* __TAP_DIS_COMMON_H__ */
address.h
address
struct _address address
Holds a network or link-layer address of any supported type.
epan_dissect_t
struct epan_dissect epan_dissect_t
Opaque type representing a single packet dissection context.
Definition epan.h:62
epan_dissect.h
packet_info
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
packet_info.h
_disstream_id
Uniquely identifies a DIS (Distributed Interactive Simulation) stream by its network and radio addres...
Definition tap-dis-common.h:26
_disstream_id::entity_id_appl
uint16_t entity_id_appl
Definition tap-dis-common.h:33
_disstream_id::src_addr
address src_addr
Definition tap-dis-common.h:27
_disstream_id::entity_id_site
uint16_t entity_id_site
Definition tap-dis-common.h:32
_disstream_id::entity_id_entity
uint16_t entity_id_entity
Definition tap-dis-common.h:34
_disstream_id::src_port
uint16_t src_port
Definition tap-dis-common.h:28
_disstream_id::dst_addr
address dst_addr
Definition tap-dis-common.h:29
_disstream_id::radio_id
uint16_t radio_id
Definition tap-dis-common.h:31
_disstream_id::dst_port
uint16_t dst_port
Definition tap-dis-common.h:30
_disstream_info
Aggregated analysis state and statistics for a single DIS stream.
Definition tap-dis-common.h:57
_disstream_info::start_arrival_ms
double start_arrival_ms
Definition tap-dis-common.h:97
_disstream_info::excess_codec_time_ms
double excess_codec_time_ms
Definition tap-dis-common.h:103
_disstream_info::first_timing_packet
bool first_timing_packet
Definition tap-dis-common.h:95
_disstream_info::payload_type
uint8_t payload_type
Definition tap-dis-common.h:61
_disstream_info::payload_type_str
const char * payload_type_str
Definition tap-dis-common.h:62
_disstream_info::first_packet_num
uint32_t first_packet_num
Definition tap-dis-common.h:74
_disstream_info::last_packet_num
uint32_t last_packet_num
Definition tap-dis-common.h:75
_disstream_info::start_rel_time
nstime_t start_rel_time
Definition tap-dis-common.h:78
_disstream_info::filtered_jitter_ms
double filtered_jitter_ms
Definition tap-dis-common.h:102
_disstream_info::total_payload_bytes
uint64_t total_payload_bytes
Definition tap-dis-common.h:70
_disstream_info::transmit_state
uint8_t transmit_state
Definition tap-dis-common.h:64
_disstream_info::last_signal_frame_num
uint32_t last_signal_frame_num
Definition tap-dis-common.h:77
_disstream_info::estimated_lost_packets
uint32_t estimated_lost_packets
Definition tap-dis-common.h:71
_disstream_info::radio_input_source
uint8_t radio_input_source
Definition tap-dis-common.h:63
_disstream_info::stop_rel_time
nstime_t stop_rel_time
Definition tap-dis-common.h:79
_disstream_info::mean_jitter_ms
double mean_jitter_ms
Definition tap-dis-common.h:85
_disstream_info::problem
bool problem
Definition tap-dis-common.h:89
_disstream_info::id
disstream_id_t id
Definition tap-dis-common.h:58
_disstream_info::signal_packets
GPtrArray * signal_packets
Definition tap-dis-common.h:92
_disstream_info::max_jitter_ms
double max_jitter_ms
Definition tap-dis-common.h:84
_disstream_info::prev_arrival_ms
double prev_arrival_ms
Definition tap-dis-common.h:98
_disstream_info::signal_packet_count
uint32_t signal_packet_count
Definition tap-dis-common.h:68
_disstream_info::prev_tx_ms
double prev_tx_ms
Definition tap-dis-common.h:101
_disstream_info::first_signal_frame_num
uint32_t first_signal_frame_num
Definition tap-dis-common.h:76
_disstream_info::transmitter_packet_count
uint32_t transmitter_packet_count
Definition tap-dis-common.h:69
_disstream_info::transmission_stopped
bool transmission_stopped
Definition tap-dis-common.h:88
_disstream_info::packet_count
uint32_t packet_count
Definition tap-dis-common.h:67
_disstream_info::max_delta_ms
double max_delta_ms
Definition tap-dis-common.h:82
_disstream_info::mean_delta_ms
double mean_delta_ms
Definition tap-dis-common.h:83
_disstream_info::prev_nominal_ms
double prev_nominal_ms
Definition tap-dis-common.h:99
_disstream_info::first_tx_ms
double first_tx_ms
Definition tap-dis-common.h:100
_disstream_info::timing_packet_count
uint32_t timing_packet_count
Definition tap-dis-common.h:96
_disstream_packet
Captures the decoded content and timing metrics for a single DIS stream packet.
Definition tap-dis-common.h:41
_disstream_packet::estimated_lost_added
uint32_t estimated_lost_added
Definition tap-dis-common.h:49
_disstream_packet::payload_data
guint8 * payload_data
Definition tap-dis-common.h:46
_disstream_packet::jitter_ms
double jitter_ms
Definition tap-dis-common.h:48
_disstream_packet::problem
bool problem
Definition tap-dis-common.h:50
_disstream_packet::delta_ms
double delta_ms
Definition tap-dis-common.h:47
_disstream_packet::rel_time
nstime_t rel_time
Definition tap-dis-common.h:43
_disstream_packet::payload_len
guint payload_len
Definition tap-dis-common.h:45
_disstream_packet::payload_type
uint8_t payload_type
Definition tap-dis-common.h:44
_disstream_packet::frame_num
uint32_t frame_num
Definition tap-dis-common.h:42
_disstream_tapinfo
Top-level tap context for DIS stream analysis, holding all discovered streams and tap configuration.
Definition tap-dis-common.h:124
_disstream_tapinfo::strinfo_hash
GHashTable * strinfo_hash
Definition tap-dis-common.h:126
_disstream_tapinfo::strinfo_list
GList * strinfo_list
Definition tap-dis-common.h:125
_disstream_tapinfo::tap_reset
disstream_tap_reset_cb tap_reset
Definition tap-dis-common.h:135
_disstream_tapinfo::filter_stream
disstream_info_t * filter_stream
Definition tap-dis-common.h:131
_disstream_tapinfo::is_registered
bool is_registered
Definition tap-dis-common.h:136
_disstream_tapinfo::tap_draw
disstream_tap_draw_cb tap_draw
Definition tap-dis-common.h:134
_disstream_tapinfo::mode
disstream_tap_mode_t mode
Definition tap-dis-common.h:130
_disstream_tapinfo::save_file
FILE * save_file
Definition tap-dis-common.h:132
_disstream_tapinfo::npackets
uint32_t npackets
Definition tap-dis-common.h:128
_disstream_tapinfo::nstreams
uint32_t nstreams
Definition tap-dis-common.h:127
info
Definition file-pcapng.h:57
nstime_t
Definition nstime.h:26
tap.h
tap_packet_status
tap_packet_status
Definition tap.h:22