Set the svn:eol-style property on all text files to "native", so that
[obnox/wireshark/wip.git] / gtk / rtp_stream.h
1 /* rtp_stream.h
2  * RTP streams summary addition for ethereal
3  *
4  * $Id$
5  *
6  * Copyright 2003, Alcatel Business Systems
7  * By Lars Ruoff <lars.ruoff@gmx.net>
8  *
9  * Ethereal - Network traffic analyzer
10  * By Gerald Combs <gerald@ethereal.com>
11  * Copyright 1998 Gerald Combs
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation,  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  */
27
28 #ifndef RTP_STREAM_H_INCLUDED
29 #define RTP_STREAM_H_INCLUDED
30
31 #include <glib.h>
32 #include <stdio.h>
33
34 /** @file
35  *  ??? 
36  *  @ingroup dialog_group
37  *  @todo what's this?
38  */
39
40 /****************************************************************************/
41 /* type for storing rtp frame information */
42 typedef struct st_rtp_sample_header {
43         guint32 rec_time;       /* miliseconds since start of recording */
44         guint16 frame_length;   /* number of bytes in *frame */
45 } rtp_sample_header_t;
46
47 /* type for storing rtp frame information */
48 typedef struct st_rtp_sample {
49         rtp_sample_header_t header;  /* date and size */
50         const guint8 *frame;                 /* data bytes */
51 } rtp_sample_t;
52
53 typedef rtp_sample_t* rtp_sample_p;
54
55
56 /* defines an rtp stream */
57 typedef struct _rtp_stream_info {
58         guint32 src_addr;
59         guint16 src_port;
60         guint32 dest_addr;
61         guint16 dest_port;
62         guint32 ssrc;
63         guint8  pt;
64         guint32 npackets;
65
66         guint32 first_frame_num; /* frame number of first frame */
67         /* start of recording (GMT) of this stream */
68     guint32 start_sec;         /* seconds */
69     guint32 start_usec;        /* microseconds */
70         gboolean tag_vlan_error;
71         gboolean tag_diffserv_error;
72         guint16 vlan_id;
73
74 } rtp_stream_info_t;
75
76
77 /* tapping modes */
78 typedef enum
79 {
80   TAP_ANALYSE,
81   TAP_SAVE,
82   TAP_MARK
83 } tap_mode_t;
84
85
86 /* structure that holds the information about all detected streams */
87 /* struct holding all information of the tap */
88 typedef struct _rtpstream_tapinfo {
89         int     nstreams;       /* number of streams in the list */
90         GList*  strinfo_list;   /* list with all streams */
91         int     npackets;       /* total number of rtp packets of all streams */
92         /* used while tapping. user shouldnt modify these */
93         tap_mode_t mode;
94         rtp_stream_info_t* filter_stream_fwd;  /* used as filter in some tap modes */
95         rtp_stream_info_t* filter_stream_rev;  /* used as filter in some tap modes */
96         FILE*   save_file;
97         guint32 launch_count;   /* number of times the tap has been run */
98         gboolean is_registered; /* if the tap listener is currently registered or not */
99 } rtpstream_tapinfo_t;
100
101
102 /****************************************************************************/
103 /* INTERFACE */
104
105 /*
106 * Registers the rtp_streams tap listener (if not already done).
107 * From that point on, the RTP streams list will be updated with every redissection.
108 * This function is also the entry point for the initialization routine of the tap system.
109 * So whenever rtp_stream.c is added to the list of ETHEREAL_TAP_SRCs, the tap will be registered on startup.
110 * If not, it will be registered on demand by the rtp_streams and rtp_analysis functions that need it.
111 */
112 void register_tap_listener_rtp_stream(void);
113
114 /*
115 * Removes the rtp_streams tap listener (if not already done)
116 * From that point on, the RTP streams list won't be updated any more.
117 */
118 void remove_tap_listener_rtp_stream(void);
119
120 /*
121 * Retrieves a constant reference to the unique info structure of the rtp_streams tap listener.
122 * The user should not modify the data pointed to.
123 */
124 const rtpstream_tapinfo_t* rtpstream_get_info(void);
125
126 /*
127 * Cleans up memory of rtp streams tap.
128 */
129 void rtpstream_reset(rtpstream_tapinfo_t *tapinfo);
130
131 /*
132 * Scans all packets for RTP streams and updates the RTP streams list.
133 * (redissects all packets)
134 */
135 void rtpstream_scan(void);
136
137 /*
138 * Saves an RTP stream as raw data stream with timestamp information for later RTP playback.
139 * (redissects all packets)
140 */
141 gboolean rtpstream_save(rtp_stream_info_t* stream, const gchar *filename);
142
143 /*
144 * Marks all packets belonging to either of stream_fwd or stream_rev.
145 * (both can be NULL)
146 * (redissects all packets)
147 */
148 void rtpstream_mark(rtp_stream_info_t* stream_fwd, rtp_stream_info_t* stream_rev);
149
150
151 #endif /*RTP_STREAM_H_INCLUDED*/