Remove trailing whitespace
[metze/wireshark/wip.git] / ui / rtp_analysis.h
1 /* rtp_analysis.h
2  * RTP analysis addition for Wireshark
3  *
4  * $Id$
5  *
6  * Copyright 2003, Alcatel Business Systems
7  * By Lars Ruoff <lars.ruoff@gmx.net>
8  *
9  * based on tap_rtp.c
10  * Copyright 2003, Iskratel, Ltd, Kranj
11  * By Miha Jemec <m.jemec@iskratel.si>
12  *
13  * Wireshark - Network traffic analyzer
14  * By Gerald Combs <gerald@wireshark.org>
15  * Copyright 1998 Gerald Combs
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License
19  * as published by the Free Software Foundation; either version 2
20  * of the License, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation,  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30  */
31
32 #ifndef __RTP_ANALYSIS_H__
33 #define __RTP_ANALYSIS_H__
34
35 #include <glib.h>
36 #include <epan/address.h>
37 #include <epan/packet_info.h>
38
39 /** @file
40  *  ???
41  *  @todo what's this?
42  */
43
44 void rtp_analysis(
45                 address *ip_src_fwd,
46                 guint32 port_src_fwd,
47                 address *ip_dst_fwd,
48                 guint32 port_dst_fwd,
49                 guint32 ssrc_fwd,
50                 address *ip_src_rev,
51                 guint32 port_src_rev,
52                 address *ip_dst_rev,
53                 guint32 port_dst_rev,
54                 guint32 ssrc_rev
55                 );
56
57 /****************************************************************************/
58 /* structure that holds the information about the forward and reversed direction */
59 typedef struct _bw_history_item {
60         double time;
61         guint32 bytes;
62 } bw_history_item;
63
64 #define BUFF_BW 300
65
66 typedef struct _tap_rtp_stat_t {
67         gboolean first_packet;     /**< do not use in code that is called after rtp_packet_analyse */
68                                    /* use (flags & STAT_FLAG_FIRST) instead */
69         /* all of the following fields will be initialized after
70          * rtp_packet_analyse has been called
71          */
72         address first_packet_mac_addr;  /**< MAC address of first packet, used to determine duplicates due to mirroring */
73         guint32 flags;                                  /* see STAT_FLAG-defines below */
74         guint16 seq_num;
75         guint32 timestamp;
76         guint32 first_timestamp;
77         guint32 delta_timestamp;
78         double bandwidth;
79         bw_history_item bw_history[BUFF_BW];
80         guint16 bw_start_index;
81         guint16 bw_index;
82         guint32 total_bytes;
83         guint32 clock_rate;
84         double delta;
85         double jitter;
86         double diff;
87         double skew;
88         double sumt;
89         double sumTS;
90         double sumt2;
91         double sumtTS;
92         double time;           /**< Unit is ms */
93         double start_time;
94         double lastnominaltime;
95         double max_delta;
96         double max_jitter;
97         double max_skew;
98         double mean_jitter;
99         guint32 max_nr;
100         guint16 start_seq_nr;
101         guint16 stop_seq_nr;
102         guint32 total_nr;
103         guint32 sequence;
104         gboolean under;
105         gint cycles;
106         guint16 pt;
107         int reg_pt;
108 } tap_rtp_stat_t;
109
110 #define PT_UNDEFINED -1
111
112 /* status flags for the flags parameter in tap_rtp_stat_t */
113 #define STAT_FLAG_FIRST                         0x001
114 #define STAT_FLAG_MARKER                        0x002
115 #define STAT_FLAG_WRONG_SEQ                     0x004
116 #define STAT_FLAG_PT_CHANGE                     0x008
117 #define STAT_FLAG_PT_CN                         0x010
118 #define STAT_FLAG_FOLLOW_PT_CN          0x020
119 #define STAT_FLAG_REG_PT_CHANGE         0x040
120 #define STAT_FLAG_WRONG_TIMESTAMP       0x080
121 #define STAT_FLAG_PT_T_EVENT            0x100
122 #define STAT_FLAG_DUP_PKT                       0x200
123
124 /* forward */
125 struct _rtp_info;
126
127 /* function for analysing an RTP packet. Called from rtp_analysis and rtp_streams */
128 extern int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
129         packet_info *pinfo,
130         const struct _rtp_info *rtpinfo);
131
132
133 #endif /* __RTP_ANALYSIS_H__ */