more
[metze/wireshark/wip.git] / ui / tap-rtp-analysis.h
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     address         first_packet_mac_addr; /**< MAC address of first packet, used to determine duplicates due to mirroring */
49     guint32         flags;      /* see STAT_FLAG-defines below */
50     guint16         seq_num;
51     guint32         timestamp;
52     guint32         first_timestamp;
53     guint32         delta_timestamp;
54     double          bandwidth;
55     bw_history_item bw_history[BUFF_BW];
56     guint16         bw_start_index;
57     guint16         bw_index;
58     guint32         total_bytes;
59     guint32         clock_rate;
60     double          delta;
61     double          jitter;
62     double          diff;
63     double          skew;
64     double          sumt;
65     double          sumTS;
66     double          sumt2;
67     double          sumtTS;
68     double          time;       /**< Unit is ms */
69     double          start_time; /**< Unit is ms */
70     double          lastnominaltime;
71     double          max_delta;
72     double          max_jitter;
73     double          max_skew;
74     double          mean_jitter;
75     guint32         max_nr;
76     guint16         start_seq_nr;
77     guint16         stop_seq_nr;
78     guint32         total_nr;
79     guint32         sequence;
80     gboolean        under;
81     gint            cycles;
82     guint16         pt;
83     int             reg_pt;
84     guint32         first_packet_num;
85     guint           last_payload_len;
86 } tap_rtp_stat_t;
87
88 typedef struct _tap_rtp_save_data_t {
89     guint32 timestamp;
90     unsigned int payload_type;
91     size_t payload_len;
92 } tap_rtp_save_data_t;
93
94 #define PT_UNDEFINED -1
95
96 /* status flags for the flags parameter in tap_rtp_stat_t */
97 #define STAT_FLAG_FIRST             0x001
98 #define STAT_FLAG_MARKER            0x002
99 #define STAT_FLAG_WRONG_SEQ         0x004
100 #define STAT_FLAG_PT_CHANGE         0x008
101 #define STAT_FLAG_PT_CN             0x010
102 #define STAT_FLAG_FOLLOW_PT_CN      0x020
103 #define STAT_FLAG_REG_PT_CHANGE     0x040
104 #define STAT_FLAG_WRONG_TIMESTAMP   0x080
105 #define STAT_FLAG_PT_T_EVENT        0x100
106 #define STAT_FLAG_DUP_PKT           0x200
107
108 /* forward */
109 struct _rtp_info;
110
111 /* function for analysing an RTP packet. Called from rtp_analysis and rtp_streams */
112 extern void rtppacket_analyse(tap_rtp_stat_t *statinfo,
113                               packet_info *pinfo,
114                               const struct _rtp_info *rtpinfo);
115
116 #ifdef __cplusplus
117 }
118 #endif /* __cplusplus */
119
120 #endif /* __TAP_RTP_ANALYSIS_H__ */
121
122 /*
123  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
124  *
125  * Local variables:
126  * c-basic-offset: 4
127  * tab-width: 8
128  * indent-tabs-mode: nil
129  * End:
130  *
131  * vi: set shiftwidth=4 tabstop=8 expandtab:
132  * :indentSize=4:tabSize=8:noTabs=true:
133  */