nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* rtp_stream.h |
2 | * RTP streams summary addition for Wireshark |
||
3 | * |
||
4 | * Copyright 2003, Alcatel Business Systems |
||
5 | * By Lars Ruoff <lars.ruoff@gmx.net> |
||
6 | * |
||
7 | * Wireshark - Network traffic analyzer |
||
8 | * By Gerald Combs <gerald@wireshark.org> |
||
9 | * Copyright 1998 Gerald Combs |
||
10 | * |
||
11 | * This program is free software; you can redistribute it and/or |
||
12 | * modify it under the terms of the GNU General Public License |
||
13 | * as published by the Free Software Foundation; either version 2 |
||
14 | * of the License, or (at your option) any later version. |
||
15 | * |
||
16 | * This program is distributed in the hope that it will be useful, |
||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
19 | * GNU General Public License for more details. |
||
20 | * |
||
21 | * You should have received a copy of the GNU General Public License |
||
22 | * along with this program; if not, write to the Free Software |
||
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
24 | */ |
||
25 | |||
26 | #ifndef __RTP_STREAM_H__ |
||
27 | #define __RTP_STREAM_H__ |
||
28 | |||
29 | /** @file |
||
30 | * "RTP Streams" dialog box common routines. |
||
31 | * @ingroup main_ui_group |
||
32 | */ |
||
33 | |||
34 | #ifdef __cplusplus |
||
35 | extern "C" { |
||
36 | #endif /* __cplusplus */ |
||
37 | |||
38 | #include "tap-rtp-analysis.h" |
||
39 | #include <glib.h> |
||
40 | #include <stdio.h> |
||
41 | |||
42 | #include "cfile.h" |
||
43 | |||
44 | #include <epan/address.h> |
||
45 | #include <epan/tap.h> |
||
46 | |||
47 | /** Defines an rtp stream */ |
||
48 | typedef struct _rtp_stream_info { |
||
49 | address src_addr; |
||
50 | guint32 src_port; |
||
51 | address dest_addr; |
||
52 | guint32 dest_port; |
||
53 | guint32 ssrc; |
||
54 | |||
55 | guint8 payload_type; /**< Numeric payload type */ |
||
56 | gchar *payload_type_name; /**< Payload type name */ |
||
57 | gboolean is_srtp; |
||
58 | |||
59 | guint32 packet_count; |
||
60 | gboolean end_stream; /**< Used to track streams across payload types */ |
||
61 | int rtp_event; |
||
62 | |||
63 | int call_num; /**< Used to match call_num in voip_calls_info_t */ |
||
64 | guint32 setup_frame_number; /**< frame number of setup message */ |
||
65 | /* Start and stop packets needed for .num and .abs_ts */ |
||
66 | frame_data *start_fd; |
||
67 | frame_data *stop_fd; |
||
68 | nstime_t start_rel_time; /**< relative start time from pinfo */ |
||
69 | nstime_t stop_rel_time; /**< relative stop time from pinfo */ |
||
70 | guint16 vlan_id; |
||
71 | gboolean tag_vlan_error; |
||
72 | gboolean tag_diffserv_error; |
||
73 | |||
74 | gboolean decode; /**< Decode this stream. GTK+ only? */ |
||
75 | GList *rtp_packet_list; /**< List of RTP rtp_packet_t. GTK+ only */ |
||
76 | |||
77 | tap_rtp_stat_t rtp_stats; /**< here goes the RTP statistics info */ |
||
78 | gboolean problem; /**< if the streams had wrong sequence numbers or wrong timestamps */ |
||
79 | } rtp_stream_info_t; |
||
80 | |||
81 | /** tapping modes */ |
||
82 | typedef enum |
||
83 | { |
||
84 | TAP_ANALYSE, |
||
85 | TAP_SAVE, |
||
86 | TAP_MARK |
||
87 | } tap_mode_t; |
||
88 | |||
89 | typedef struct _rtpstream_tapinfo rtpstream_tapinfo_t; |
||
90 | |||
91 | typedef void (*rtpstream_tap_reset_cb)(rtpstream_tapinfo_t *tapinfo); |
||
92 | typedef void (*rtpstream_tap_draw_cb)(rtpstream_tapinfo_t *tapinfo); |
||
93 | typedef void (*tap_mark_packet_cb)(rtpstream_tapinfo_t *tapinfo, frame_data *fd); |
||
94 | |||
95 | /* structure that holds the information about all detected streams */ |
||
96 | /** struct holding all information of the tap */ |
||
97 | struct _rtpstream_tapinfo { |
||
98 | rtpstream_tap_reset_cb tap_reset; /**< tap reset callback */ |
||
99 | rtpstream_tap_draw_cb tap_draw; /**< tap draw callback */ |
||
100 | tap_mark_packet_cb tap_mark_packet; /**< packet marking callback */ |
||
101 | void *tap_data; /**< data for tap callbacks */ |
||
102 | int nstreams; /**< number of streams in the list */ |
||
103 | GList *strinfo_list; /**< list of rtp_stream_info_t* */ |
||
104 | int npackets; /**< total number of rtp packets of all streams */ |
||
105 | /* used while tapping. user shouldn't modify these */ |
||
106 | tap_mode_t mode; |
||
107 | rtp_stream_info_t *filter_stream_fwd; /**< used as filter in some tap modes */ |
||
108 | rtp_stream_info_t *filter_stream_rev; /**< used as filter in some tap modes */ |
||
109 | FILE *save_file; |
||
110 | gboolean is_registered; /**< if the tap listener is currently registered or not */ |
||
111 | }; |
||
112 | |||
113 | #if 0 |
||
114 | #define RTP_STREAM_DEBUG(...) { \ |
||
115 | char *RTP_STREAM_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \ |
||
116 | g_warning("rtp_stream: %s:%d %s", G_STRFUNC, __LINE__, RTP_STREAM_DEBUG_MSG); \ |
||
117 | g_free(RTP_STREAM_DEBUG_MSG); \ |
||
118 | } |
||
119 | #else |
||
120 | #define RTP_STREAM_DEBUG(...) |
||
121 | #endif |
||
122 | |||
123 | /****************************************************************************/ |
||
124 | /* INTERFACE */ |
||
125 | |||
126 | /** |
||
127 | * Registers the rtp_streams tap listener (if not already done). |
||
128 | * From that point on, the RTP streams list will be updated with every redissection. |
||
129 | * This function is also the entry point for the initialization routine of the tap system. |
||
130 | * So whenever rtp_stream.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup. |
||
131 | * If not, it will be registered on demand by the rtp_streams and rtp_analysis functions that need it. |
||
132 | */ |
||
133 | void register_tap_listener_rtp_stream(rtpstream_tapinfo_t *tapinfo, const char *fstring); |
||
134 | |||
135 | /** |
||
136 | * Removes the rtp_streams tap listener (if not already done) |
||
137 | * From that point on, the RTP streams list won't be updated any more. |
||
138 | */ |
||
139 | void remove_tap_listener_rtp_stream(rtpstream_tapinfo_t *tapinfo); |
||
140 | |||
141 | /** |
||
142 | * Cleans up memory of rtp streams tap. |
||
143 | */ |
||
144 | void rtpstream_reset(rtpstream_tapinfo_t *tapinfo); |
||
145 | |||
146 | /** |
||
147 | * Scans all packets for RTP streams and updates the RTP streams list. |
||
148 | * (redissects all packets) |
||
149 | */ |
||
150 | void rtpstream_scan(rtpstream_tapinfo_t *tapinfo, capture_file *cap_file, const char *fstring); |
||
151 | |||
152 | /** |
||
153 | * Saves an RTP stream as raw data stream with timestamp information for later RTP playback. |
||
154 | * (redissects all packets) |
||
155 | */ |
||
156 | gboolean rtpstream_save(rtpstream_tapinfo_t *tapinfo, capture_file *cap_file, rtp_stream_info_t* stream, const gchar *filename); |
||
157 | |||
158 | /** |
||
159 | * Compares the endpoints of two RTP streams. |
||
160 | * |
||
161 | * @return TRUE if the |
||
162 | */ |
||
163 | gboolean rtp_stream_info_is_reverse(const rtp_stream_info_t *stream_a, rtp_stream_info_t *stream_b); |
||
164 | |||
165 | /** |
||
166 | * Marks all packets belonging to either of stream_fwd or stream_rev. |
||
167 | * (both can be NULL) |
||
168 | * (redissects all packets) |
||
169 | */ |
||
170 | void rtpstream_mark(rtpstream_tapinfo_t *tapinfo, capture_file *cap_file, rtp_stream_info_t* stream_fwd, rtp_stream_info_t* stream_rev); |
||
171 | |||
172 | #define MAX_SILENCE_FRAMES 14400000 |
||
173 | |||
174 | #ifdef __cplusplus |
||
175 | } |
||
176 | #endif /* __cplusplus */ |
||
177 | |||
178 | #endif /* __RTP_STREAM_H__ */ |
||
179 | |||
180 | /* |
||
181 | * Editor modelines - http://www.wireshark.org/tools/modelines.html |
||
182 | * |
||
183 | * Local variables: |
||
184 | * c-basic-offset: 4 |
||
185 | * tab-width: 8 |
||
186 | * indent-tabs-mode: nil |
||
187 | * End: |
||
188 | * |
||
189 | * vi: set shiftwidth=4 tabstop=8 expandtab: |
||
190 | * :indentSize=4:tabSize=8:noTabs=true: |
||
191 | */ |