2 * RTP streams handler functions used by tshark and wireshark
4 * Copyright 2008, Ericsson AB
5 * By Balint Reczey <balint.reczey@ericsson.com>
7 * most functions are copied from ui/gtk/rtp_stream.c and ui/gtk/rtp_analisys.c
8 * Copyright 2003, Alcatel Business Systems
9 * By Lars Ruoff <lars.ruoff@gmx.net>
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * SPDX-License-Identifier: GPL-2.0-or-later
18 #ifndef __TAP_RTP_COMMON_H__
19 #define __TAP_RTP_COMMON_H__
23 #endif /* __cplusplus */
25 #include "ui/rtp_stream.h"
27 /* type of error when saving voice in a file didn't succeed */
32 TAP_RTP_PADDING_ERROR,
34 TAP_RTP_FILE_OPEN_ERROR,
35 TAP_RTP_FILE_WRITE_ERROR,
37 } tap_rtp_error_type_t;
39 typedef struct _tap_rtp_save_info_t {
42 tap_rtp_error_type_t error_type;
44 } tap_rtp_save_info_t;
46 typedef struct _rtpstream_info_calc {
52 gchar *all_payload_type_names; /* Name of codec derived from fixed or dynamic codec names */
55 guint32 packet_expected; /* Count of expected packets, derived from lenght of RTP stream */
62 gboolean problem; /* Indication that RTP stream contains something unusual -GUI should indicate it somehow */
63 double clock_drift_ms;
65 double freq_drift_perc;
68 double start_time_ms; /**< Unit is ms */
69 guint32 first_packet_num;
70 guint32 last_packet_num;
71 } rtpstream_info_calc_t;
74 * Funcions for init and destroy of rtpstream_info_t and attached structures
76 void rtpstream_info_init(rtpstream_info_t* info);
77 rtpstream_info_t *rtpstream_info_malloc_and_init(void);
78 void rtpstream_info_copy_deep(rtpstream_info_t *dest, const rtpstream_info_t *src);
79 rtpstream_info_t *rtpstream_info_malloc_and_copy_deep(const rtpstream_info_t *src);
80 void rtpstream_info_free_data(rtpstream_info_t* info);
81 void rtpstream_info_free_all(rtpstream_info_t* info);
84 * Compares two RTP stream infos (GCompareFunc style comparison function)
88 gint rtpstream_info_cmp(gconstpointer aa, gconstpointer bb);
91 * Compares the endpoints of two RTP streams.
95 gboolean rtpstream_info_is_reverse(const rtpstream_info_t *stream_a, rtpstream_info_t *stream_b);
97 /****************************************************************************/
101 * Registers the rtp_streams tap listener (if not already done).
102 * From that point on, the RTP streams list will be updated with every redissection.
103 * This function is also the entry point for the initialization routine of the tap system.
104 * So whenever rtp_stream.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
105 * If not, it will be registered on demand by the rtp_streams and rtp_analysis functions that need it.
107 void register_tap_listener_rtpstream(rtpstream_tapinfo_t *tapinfo, const char *fstring, rtpstream_tap_error_cb tap_error);
110 * Removes the rtp_streams tap listener (if not already done)
111 * From that point on, the RTP streams list won't be updated any more.
113 void remove_tap_listener_rtpstream(rtpstream_tapinfo_t *tapinfo);
116 * Cleans up memory of rtp streams tap.
118 void rtpstream_reset(rtpstream_tapinfo_t *tapinfo);
120 void rtpstream_reset_cb(void*);
121 void rtp_write_header(rtpstream_info_t*, FILE*);
122 int rtpstream_packet_cb(void*, packet_info*, epan_dissect_t *, const void *);
125 * Evaluate rtpstream_info_t calculations
127 void rtpstream_info_calculate(const rtpstream_info_t *strinfo, rtpstream_info_calc_t *calc);
130 * Free rtpstream_info_calc_t structure (internal items)
132 void rtpstream_info_calc_free(rtpstream_info_calc_t *calc);
136 #endif /* __cplusplus */
138 #endif /* __TAP_RTP_COMMON_H__ */
141 * Editor modelines - https://www.wireshark.org/tools/modelines.html
146 * indent-tabs-mode: nil
149 * ex: set shiftwidth=4 tabstop=8 expandtab:
150 * :indentSize=4:tabSize=8:noTabs=true: