summaryrefslogtreecommitdiff
path: root/ui/tap-rtp-common.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-07-13 11:56:20 -0700
committerGerald Combs <gerald@wireshark.org>2015-07-13 20:12:33 +0000
commitef3cc4a2c15cc351a38193e44adf938624634666 (patch)
treedc1bab362deb15ad35a1cecf2a8007286b8dc60a /ui/tap-rtp-common.c
parentbed31637255464d890cb74d4c7edc57c20c9a2f4 (diff)
downloadwireshark-ef3cc4a2c15cc351a38193e44adf938624634666.tar.gz
RTP updates.
Merge rtp_sample_header_t into rtp_sample_t. That's the only place it was used. Note that rtp_sample_t is used for writing rtpdump files. Move the rtp_sample_t definition to tap-rtp-common.c. Rename it to rtpdump_info_t. Make rtp_write_sample static. Change-Id: I04e7428f634efa87a98e5d6c82a354f94ab1765d Reviewed-on: https://code.wireshark.org/review/9629 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/tap-rtp-common.c')
-rw-r--r--ui/tap-rtp-common.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/ui/tap-rtp-common.c b/ui/tap-rtp-common.c
index 60f6fa90d7..d260a0f1a4 100644
--- a/ui/tap-rtp-common.c
+++ b/ui/tap-rtp-common.c
@@ -45,6 +45,14 @@
*/
/****************************************************************************/
+/* Type for storing and writing rtpdump information */
+typedef struct st_rtpdump_info {
+ double rec_time; /**< milliseconds since start of recording */
+ guint16 num_samples; /**< number of bytes in *frame */
+ const guint8 *samples; /**< data bytes */
+} rtpdump_info_t;
+
+/****************************************************************************/
/* GCompareFunc style comparison function for _rtp_stream_info */
static gint rtp_stream_info_cmp(gconstpointer aa, gconstpointer bb)
{
@@ -158,16 +166,16 @@ 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)*/
-void rtp_write_sample(rtp_sample_t* sample, FILE* file)
+static void rtp_write_sample(rtpdump_info_t* rtpdump_info, FILE* file)
{
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 */
- length = g_htons(sample->header.frame_length + 8);
- plen = g_htons(sample->header.frame_length);
- offset = g_htonl(sample->header.rec_time);
+ length = g_htons(rtpdump_info->num_samples + 8);
+ plen = g_htons(rtpdump_info->num_samples);
+ offset = g_htonl(rtpdump_info->rec_time);
if (fwrite(&length, 2, 1, file) == 0)
return;
@@ -175,7 +183,7 @@ void rtp_write_sample(rtp_sample_t* sample, FILE* file)
return;
if (fwrite(&offset, 4, 1, file) == 0)
return;
- if (fwrite(sample->frame, sample->header.frame_length, 1, file) == 0)
+ if (fwrite(rtpdump_info->samples, rtpdump_info->num_samples, 1, file) == 0)
return;
}
@@ -189,7 +197,7 @@ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
rtp_stream_info_t new_stream_info;
rtp_stream_info_t *stream_info = NULL;
GList* list;
- rtp_sample_t sample;
+ rtpdump_info_t rtpdump_info;
struct _rtp_conversation_info *p_conv_data = NULL;
@@ -257,11 +265,11 @@ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
if (rtp_stream_info_cmp(&new_stream_info, tapinfo->filter_stream_fwd)==0) {
/* XXX - what if rtpinfo->info_all_data_present is
FALSE, so that we don't *have* all the data? */
- sample.header.rec_time = nstime_to_msec(&pinfo->fd->abs_ts) -
+ rtpdump_info.rec_time = nstime_to_msec(&pinfo->fd->abs_ts) -
nstime_to_msec(&tapinfo->filter_stream_fwd->start_fd->abs_ts);
- sample.header.frame_length = rtpinfo->info_data_len;
- sample.frame = rtpinfo->info_data;
- rtp_write_sample(&sample, tapinfo->save_file);
+ rtpdump_info.num_samples = rtpinfo->info_data_len;
+ rtpdump_info.samples = rtpinfo->info_data;
+ rtp_write_sample(&rtpdump_info, tapinfo->save_file);
}
}
else if (tapinfo->mode == TAP_MARK && tapinfo->tap_mark_packet) {