aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/Makefile.am5
-rw-r--r--gtk/Makefile.nmake4
-rw-r--r--gtk/rtp_stream.c17
-rw-r--r--gtk/rtp_stream.h9
-rw-r--r--gtk/rtp_stream_dlg.c21
-rw-r--r--packet-rtp.c17
-rw-r--r--packet-rtp.h31
7 files changed, 69 insertions, 35 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 65ff9eea71..32a394c9ec 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for the GTK interface routines for Ethereal
#
-# $Id: Makefile.am,v 1.76 2003/11/19 00:02:42 ulfl Exp $
+# $Id: Makefile.am,v 1.77 2003/11/20 23:34:30 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@@ -49,7 +49,6 @@ ETHEREAL_TAP_SRC = \
rpc_progs.c \
smb_stat.c \
rtp_analysis.c \
- rtp_stream.c \
rtp_stream_dlg.c \
wsp_stat.c
@@ -129,6 +128,7 @@ libui_a_SOURCES = \
proto_hier_stats_dlg.h \
proto_hier_stats_dlg.c \
rtp_analysis.h \
+ rtp_stream.c \
rtp_stream.h \
rtp_stream_dlg.h \
service_response_time_table.c \
@@ -220,6 +220,7 @@ libui_a_SOURCES = \
proto_hier_stats_dlg.h \
proto_hier_stats_dlg.c \
rtp_analysis.h \
+ rtp_stream.c \
rtp_stream.h \
rtp_stream_dlg.h \
service_response_time_table.c \
diff --git a/gtk/Makefile.nmake b/gtk/Makefile.nmake
index dd4755cc10..11f0c53b26 100644
--- a/gtk/Makefile.nmake
+++ b/gtk/Makefile.nmake
@@ -1,7 +1,7 @@
## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
-# $Id: Makefile.nmake,v 1.61 2003/11/19 00:01:38 ulfl Exp $
+# $Id: Makefile.nmake,v 1.62 2003/11/20 23:34:31 guy Exp $
include ..\config.nmake
@@ -40,7 +40,6 @@ ETHEREAL_TAP_SRC = \
rpc_progs.c \
smb_stat.c \
rtp_analysis.c \
- rtp_stream.c \
rtp_stream_dlg.c \
wsp_stat.c
@@ -92,6 +91,7 @@ OBJECTS = \
proto_dlg.obj \
proto_draw.obj \
proto_hier_stats_dlg.obj \
+ rtp_stream.obj \
service_response_time_table.obj \
simple_dialog.obj \
stream_prefs.obj \
diff --git a/gtk/rtp_stream.c b/gtk/rtp_stream.c
index a1b9c3e69e..edd07d1cc8 100644
--- a/gtk/rtp_stream.c
+++ b/gtk/rtp_stream.c
@@ -1,7 +1,7 @@
/* rtp_stream.c
* RTP streams summary addition for ethereal
*
- * $Id: rtp_stream.c,v 1.2 2003/09/25 19:35:14 guy Exp $
+ * $Id: rtp_stream.c,v 1.3 2003/11/20 23:34:31 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@@ -167,7 +167,7 @@ static void rtp_write_header(rtp_stream_info_t *strinfo, FILE *file)
/* utility function for writing a sample to file in rtpdump -F dump format (.rtp)*/
static void rtp_write_sample(rtp_sample_t* sample, FILE* file)
{
- guint16 length; /* length of packet, including this header (may
+ guint16 length; /* length of packet, including this header (may
be smaller than plen if not whole packet recorded) */
guint16 plen; /* actual header+payload length for RTP, 0 for RTCP */
guint32 offset; /* milliseconds since the start of recording */
@@ -193,12 +193,6 @@ int rtpstream_packet(rtpstream_tapinfo_t *tapinfo _U_, packet_info *pinfo, epan_
rtp_sample_t sample;
- /* we ignore packets that are not displayed */
-/*
- if (pinfo->fd->flags.passed_dfilter == 0)
- return 0;
-*/
-
/* gather infos on the stream this packet is part of */
g_memmove(&(tmp_strinfo.src_addr), pinfo->src.data, 4);
tmp_strinfo.src_port = pinfo->srcport;
@@ -239,6 +233,8 @@ int rtpstream_packet(rtpstream_tapinfo_t *tapinfo _U_, packet_info *pinfo, epan_
/* increment the packets counter of all streams */
++(tapinfo->npackets);
+
+ return 1; /* refresh output */
}
else if (tapinfo->mode == TAP_SAVE) {
if (rtp_stream_info_cmp(&tmp_strinfo, tapinfo->filter_stream_fwd)==0) {
@@ -366,16 +362,13 @@ remove_tap_listener_rtp_stream(void)
void
register_tap_listener_rtp_stream(void)
{
- gchar filter_text[256];
GString *error_string;
if (!the_tapinfo_struct.is_registered) {
register_ethereal_tap("rtp", rtpstream_init_tap);
- sprintf(filter_text, "rtp && ip && !icmp");
-
error_string = register_tap_listener("rtp", &the_tapinfo_struct,
- filter_text,
+ NULL,
(void*)rtpstream_reset, (void*)rtpstream_packet, (void*)rtpstream_draw);
if (error_string != NULL) {
diff --git a/gtk/rtp_stream.h b/gtk/rtp_stream.h
index 3817268543..a0f656f9d2 100644
--- a/gtk/rtp_stream.h
+++ b/gtk/rtp_stream.h
@@ -1,7 +1,7 @@
/* rtp_stream.h
* RTP streams summary addition for ethereal
*
- * $Id: rtp_stream.h,v 1.1 2003/09/24 07:48:11 guy Exp $
+ * $Id: rtp_stream.h,v 1.2 2003/11/20 23:34:31 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@@ -41,7 +41,7 @@ typedef struct st_rtp_sample_header {
/* type for storing rtp frame information */
typedef struct st_rtp_sample {
rtp_sample_header_t header; /* date and size */
- char *frame; /* data bytes */
+ const guint8 *frame; /* data bytes */
} rtp_sample_t;
typedef rtp_sample_t* rtp_sample_p;
@@ -118,6 +118,11 @@ void remove_tap_listener_rtp_stream(void);
const rtpstream_tapinfo_t* rtpstream_get_info();
/*
+* Cleans up memory of rtp streams tap.
+*/
+void rtpstream_reset(rtpstream_tapinfo_t *tapinfo _U_);
+
+/*
* Scans all packets for RTP streams and updates the RTP streams list.
* (redissects all packets)
*/
diff --git a/gtk/rtp_stream_dlg.c b/gtk/rtp_stream_dlg.c
index 13e1b376bf..384a999653 100644
--- a/gtk/rtp_stream_dlg.c
+++ b/gtk/rtp_stream_dlg.c
@@ -1,7 +1,7 @@
/* rtp_stream_dlg.c
* RTP streams summary addition for ethereal
*
- * $Id: rtp_stream_dlg.c,v 1.4 2003/10/06 08:58:00 guy Exp $
+ * $Id: rtp_stream_dlg.c,v 1.5 2003/11/20 23:34:31 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@@ -175,11 +175,17 @@ static void
rtpstream_on_destroy (GtkObject *object _U_,
gpointer user_data _U_)
{
+ /* Remove the stream tap listener */
+ remove_tap_listener_rtp_stream();
+
/* Is there a save voice window open? */
if (rtpstream_save_dlg != NULL)
gtk_widget_destroy(rtpstream_save_dlg);
- /* Note that we no longer have a "RTP Analyse" dialog box. */
+ /* Clean up memory used by stream tap */
+ rtpstream_reset((rtpstream_tapinfo_t*) rtpstream_get_info());
+
+ /* Note that we no longer have a "RTP Streams" dialog box. */
rtp_stream_dlg = NULL;
}
@@ -375,6 +381,7 @@ rtpstream_on_analyse (GtkButton *button _U_,
port_dst_rev,
ssrc_rev
);
+
}
@@ -759,8 +766,16 @@ void rtpstream_dlg_show(GList *list)
/* entry point when called via the GTK menu */
void rtpstream_launch(GtkWidget *w _U_, gpointer data _U_)
{
- /* Show the dialog box */
+ /* Register the tap listener */
+ register_tap_listener_rtp_stream();
+
+ /* Scan for RTP streams (redissect all packets) */
+ rtpstream_scan();
+
+ /* Show the dialog box with the list of streams */
rtpstream_dlg_show(rtpstream_get_info()->strinfo_list);
+
+ /* Tap listener will be removed and cleaned up in rtpstream_on_destroy */
}
/****************************************************************************/
diff --git a/packet-rtp.c b/packet-rtp.c
index ac2eb7df69..813676da81 100644
--- a/packet-rtp.c
+++ b/packet-rtp.c
@@ -6,7 +6,7 @@
* Copyright 2000, Philips Electronics N.V.
* Written by Andreas Sikkema <andreas.sikkema@philips.com>
*
- * $Id: packet-rtp.c,v 1.42 2003/11/09 22:55:34 guy Exp $
+ * $Id: packet-rtp.c,v 1.43 2003/11/20 23:34:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -349,7 +349,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
timestamp = tvb_get_ntohl( tvb, offset + 4 );
sync_src = tvb_get_ntohl( tvb, offset + 8 );
- /* fill in the rtp_info structure */
+ /* fill in the rtp_info structure */
rtp_info.info_padding_set = padding_set;
rtp_info.info_padding_count = 0;
rtp_info.info_marker_set = marker_set;
@@ -359,6 +359,16 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
rtp_info.info_sync_src = sync_src;
rtp_info.info_data_len = tvb_reported_length_remaining( tvb, offset );
+ /*
+ * Save the pointer to raw rtp data (header + payload incl. padding)
+ * That should be safe because the "epan_dissect_t" constructed for the packet
+ * has not yet been freed when the taps are called.
+ * (destroying the "epan_dissect_t" will end up freeing all the tvbuffs
+ * and hence invalidating pointers to their data).
+ * See "add_packet_to_packet_list()" for details.
+ */
+ rtp_info.info_data = tvb_get_ptr(tvb, 0, -1);
+
if ( check_col( pinfo->cinfo, COL_PROTOCOL ) ) {
col_set_str( pinfo->cinfo, COL_PROTOCOL, "RTP" );
}
@@ -534,7 +544,8 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
rtp_info.info_payload_offset = offset;
rtp_info.info_payload_len = tvb_length_remaining(tvb, offset);
}
- tap_queue_packet(rtp_tap, pinfo, &rtp_info);
+ if (!pinfo->in_error_pkt)
+ tap_queue_packet(rtp_tap, pinfo, &rtp_info);
}
void
diff --git a/packet-rtp.h b/packet-rtp.h
index bd59720fcd..2eaa495842 100644
--- a/packet-rtp.h
+++ b/packet-rtp.h
@@ -3,7 +3,7 @@
* Routines for RTP dissection
* RTP = Real time Transport Protocol
*
- * $Id: packet-rtp.h,v 1.9 2003/05/20 21:22:58 guy Exp $
+ * $Id: packet-rtp.h,v 1.10 2003/11/20 23:34:30 guy Exp $
*
* Copyright 2000, Philips Electronics N.V.
* Written by Andreas Sikkema <andreas.sikkema@philips.com>
@@ -28,16 +28,25 @@
*/
struct _rtp_info {
- gboolean info_padding_set;
- gboolean info_marker_set;
- unsigned int info_payload_type;
- unsigned int info_padding_count;
- guint16 info_seq_num;
- guint32 info_timestamp;
- guint32 info_sync_src;
- guint info_data_len;
- guint info_payload_offset;
- guint info_payload_len;
+ gboolean info_padding_set;
+ gboolean info_marker_set;
+ unsigned int info_payload_type;
+ unsigned int info_padding_count;
+ guint16 info_seq_num;
+ guint32 info_timestamp;
+ guint32 info_sync_src;
+ guint info_data_len; /* length of raw rtp data as reported */
+ guint info_payload_offset; /* start of payload relative to info_data */
+ guint info_payload_len; /* length of payload (incl padding) */
+ const guint8* info_data; /* pointer to raw rtp data */
+ /*
+ * info_data: pointer to raw rtp data = header + payload incl. padding.
+ * That should be safe because the "epan_dissect_t" constructed for the packet
+ * has not yet been freed when the taps are called.
+ * (destroying the "epan_dissect_t" will end up freeing all the tvbuffs
+ * and hence invalidating pointers to their data).
+ * See "add_packet_to_packet_list()" for details.
+ */
};
void rtp_add_address ( packet_info *pinfo, const unsigned char* ip_addr, int prt );