3 * RTP streams summary addition for Wireshark
5 * Copyright 2003, Alcatel Business Systems
6 * By Lars Ruoff <lars.ruoff@gmx.net>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #ifndef __RTP_STREAM_H__
16 #define __RTP_STREAM_H__
20 #include "tap-rtp-analysis.h"
25 #include <epan/address.h>
28 #include "ui/rtp_stream_id.h"
31 * "RTP Streams" dialog box common routines.
32 * @ingroup main_ui_group
37 #endif /* __cplusplus */
39 /** Defines an rtp stream */
40 typedef struct _rtpstream_info
{
43 uint8_t first_payload_type
; /**< Numeric payload type */
44 const char *first_payload_type_name
; /**< Payload type name */
45 const char *payload_type_names
[256]; /**< Seen payload type names. Array index is payload type (byte), filled only during TAP_ANALYSE */
46 char *all_payload_type_names
; /**< All seen payload names for a stream in one string */
49 uint32_t packet_count
;
50 bool end_stream
; /**< Used to track streams across payload types */
53 int call_num
; /**< Used to match call_num in voip_calls_info_t */
54 uint32_t setup_frame_number
; /**< frame number of setup message */
55 /* Start and stop packets needed for .num and .abs_ts */
58 nstime_t start_rel_time
; /**< relative start time from pinfo */
59 nstime_t stop_rel_time
; /**< relative stop time from pinfo */
60 nstime_t start_abs_time
; /**< abs start time from pinfo */
63 bool tag_diffserv_error
;
65 tap_rtp_stat_t rtp_stats
; /**< here goes the RTP statistics info */
66 bool problem
; /**< if the streams had wrong sequence numbers or wrong timestamps */
67 const char *ed137_info
; /** pointer to static text, no freeing is required */
78 typedef struct _rtpstream_tapinfo rtpstream_tapinfo_t
;
80 typedef void (*rtpstream_tap_reset_cb
)(rtpstream_tapinfo_t
*tapinfo
);
81 typedef void (*rtpstream_tap_draw_cb
)(rtpstream_tapinfo_t
*tapinfo
);
82 typedef void (*tap_mark_packet_cb
)(rtpstream_tapinfo_t
*tapinfo
, frame_data
*fd
);
83 typedef void (*rtpstream_tap_error_cb
)(GString
*error_string
);
85 /* structure that holds the information about all detected streams */
86 /** struct holding all information of the tap */
87 struct _rtpstream_tapinfo
{
88 rtpstream_tap_reset_cb tap_reset
; /**< tap reset callback */
89 rtpstream_tap_draw_cb tap_draw
; /**< tap draw callback */
90 tap_mark_packet_cb tap_mark_packet
; /**< packet marking callback */
91 void *tap_data
; /**< data for tap callbacks */
92 int nstreams
; /**< number of streams in the list */
93 GList
*strinfo_list
; /**< list of rtpstream_info_t* */
94 GHashTable
*strinfo_hash
; /**< multihash of rtpstream_info_t **/
95 /* multihash means that there can be */
96 /* more values related to one hash key */
97 int npackets
; /**< total number of rtp packets of all streams */
98 /* used while tapping. user shouldn't modify these */
100 rtpstream_info_t
*filter_stream_fwd
; /**< used as filter in some tap modes */
101 rtpstream_info_t
*filter_stream_rev
; /**< used as filter in some tap modes */
103 bool is_registered
; /**< if the tap listener is currently registered or not */
104 bool apply_display_filter
; /**< if apply display filter during analyse */
108 #define RTP_STREAM_DEBUG(...) { \
109 char *RTP_STREAM_DEBUG_MSG = ws_strdup_printf(__VA_ARGS__); \
110 ws_warning("rtp_stream: %s:%d %s", G_STRFUNC, __LINE__, RTP_STREAM_DEBUG_MSG); \
111 g_free(RTP_STREAM_DEBUG_MSG); \
114 #define RTP_STREAM_DEBUG(...)
117 /****************************************************************************/
120 void show_tap_registration_error(GString
*error_string
);
123 * Scans all packets for RTP streams and updates the RTP streams list.
124 * (redissects all packets)
126 void rtpstream_scan(rtpstream_tapinfo_t
*tapinfo
, capture_file
*cap_file
, const char *fstring
);
129 * Saves an RTP stream as raw data stream with timestamp information for later RTP playback.
130 * (redissects all packets)
132 bool rtpstream_save(rtpstream_tapinfo_t
*tapinfo
, capture_file
*cap_file
, rtpstream_info_t
* stream
, const char *filename
);
135 * Marks all packets belonging to either of stream_fwd or stream_rev.
137 * (redissects all packets)
139 void rtpstream_mark(rtpstream_tapinfo_t
*tapinfo
, capture_file
*cap_file
, rtpstream_info_t
* stream_fwd
, rtpstream_info_t
* stream_rev
);
141 /* Constant based on fix for bug 4119/5902: don't insert too many silence
144 #define MAX_SILENCE_FRAMES 14400000
148 #endif /* __cplusplus */
150 #endif /* __RTP_STREAM_H__ */