1 /* tap-rtp-analysis.h
2  * RTP analysis addition for Wireshark
3  *
4  * Copyright 2003, Alcatel Business Systems
5  * By Lars Ruoff <lars.ruoff@gmx.net>
6  *
7  * based on tap_rtp.c
8  * Copyright 2003, Iskratel, Ltd, Kranj
9  * By Miha Jemec <m.jemec@iskratel.si>
10  *
11  * Wireshark - Network traffic analyzer
12  * By Gerald Combs <gerald@wireshark.org>
13  * Copyright 1998 Gerald Combs
14  *
15  * SPDX-License-Identifier: GPL-2.0-or-later
16  */
17 
18 #ifndef __TAP_RTP_ANALYSIS_H__
19 #define __TAP_RTP_ANALYSIS_H__
20 
21 #include <epan/address.h>
22 #include <epan/packet_info.h>
23 
24 /** @file
25  *  ???
26  *  @todo what's this?
27  */
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32 
33 /****************************************************************************/
34 /* structure that holds the information about the forward and reversed direction */
35 typedef struct _bw_history_item {
36     double time;
37     guint32 bytes;
38 } bw_history_item;
39 
40 #define BUFF_BW 300
41 
42 typedef struct _tap_rtp_stat_t {
43     gboolean        first_packet; /**< do not use in code that is called after rtppacket_analyse */
44                                /* use (flags & STAT_FLAG_FIRST) instead */
45     /* all of the following fields will be initialized after
46      * rtppacket_analyse has been called
47      */
48     guint32         flags;      /* see STAT_FLAG-defines below */
49     guint16         seq_num;
50     guint32         timestamp;
51     guint32         first_timestamp;
52     double          bandwidth;
53     bw_history_item bw_history[BUFF_BW];
54     guint16         bw_start_index;
55     guint16         bw_index;
56     guint32         total_bytes;
57     guint32         clock_rate;
58     double          delta;
59     double          jitter;
60     double          diff;
61     double          skew;
62     double          sumt;
63     double          sumTS;
64     double          sumt2;
65     double          sumtTS;
66     double          time;       /**< Unit is ms */
67     double          start_time; /**< Unit is ms */
68     double          lastnominaltime;
69     double          min_delta;
70     double          max_delta;
71     double          mean_delta;
72     double          min_jitter;
73     double          max_jitter;
74     double          max_skew;
75     double          mean_jitter;
76     guint32         max_nr;
77     guint16         start_seq_nr;
78     guint16         stop_seq_nr;
79     guint32         total_nr;
80     guint32         sequence;
81     gboolean        under;
82     gint            seq_cycles;
83     guint16         pt;
84     int             reg_pt;
85     guint32         first_packet_num;
86     guint           last_payload_len;
87 } tap_rtp_stat_t;
88 
89 typedef struct _tap_rtp_save_data_t {
90     guint32 timestamp;
91     unsigned int payload_type;
92     size_t payload_len;
93 } tap_rtp_save_data_t;
94 
95 #define PT_UNDEFINED -1
96 
97 /* status flags for the flags parameter in tap_rtp_stat_t */
98 #define STAT_FLAG_FIRST             0x001
99 #define STAT_FLAG_MARKER            0x002
100 #define STAT_FLAG_WRONG_SEQ         0x004
101 #define STAT_FLAG_PT_CHANGE         0x008
102 #define STAT_FLAG_PT_CN             0x010
103 #define STAT_FLAG_FOLLOW_PT_CN      0x020
104 #define STAT_FLAG_REG_PT_CHANGE     0x040
105 #define STAT_FLAG_WRONG_TIMESTAMP   0x080
106 #define STAT_FLAG_PT_T_EVENT        0x100
107 #define STAT_FLAG_DUP_PKT           0x200
108 
109 /* forward */
110 struct _rtp_info;
111 
112 /* function for analysing an RTP packet. Called from rtp_analysis and rtp_streams */
113 extern void rtppacket_analyse(tap_rtp_stat_t *statinfo,
114                               const packet_info *pinfo,
115                               const struct _rtp_info *rtpinfo);
116 
117 #ifdef __cplusplus
118 }
119 #endif /* __cplusplus */
120 
121 #endif /* __TAP_RTP_ANALYSIS_H__ */
122