diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-09-03 11:46:20 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-09-03 21:48:48 +0000 |
commit | e4d9ce18d8008e29c824d6de89b04eb486532755 (patch) | |
tree | ef20e949a410782d6d319d9b0e692dea38bcd665 /ui/gtk/iax2_analysis.c | |
parent | 04913778d899939cefbcfa47de50e9c9a1aa0447 (diff) |
Move IAX2 analysis to the ui directory.
Rename ui/gtk/iax2_analysis.h to ui/tap-iax2-analysis.h. Move
iax2_packet_analyse to ui/tap-iax2-analysis.c.
Rename rtp_analysis.h to tap-rtp-analysis.h to match IAX2.
Change-Id: Ice7e9ad0d7bf62d631850089c880ec09a3e101dd
Reviewed-on: https://code.wireshark.org/review/10375
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/gtk/iax2_analysis.c')
-rw-r--r-- | ui/gtk/iax2_analysis.c | 97 |
1 files changed, 2 insertions, 95 deletions
diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c index f0bc3eaad1..054ffb3e5b 100644 --- a/ui/gtk/iax2_analysis.c +++ b/ui/gtk/iax2_analysis.c @@ -78,8 +78,8 @@ #include "ui/gtk/gui_utils.h" #include "ui/gtk/gui_stat_menu.h" #include "ui/gtk/main.h" -#include "ui/rtp_analysis.h" -#include "ui/gtk/iax2_analysis.h" +#include "ui/tap-rtp-analysis.h" +#include "ui/tap-iax2-analysis.h" #include "ui/rtp_stream.h" #include "ui/gtk/rtp_stream_dlg.h" #include "ui/gtk/old-gtk-compat.h" @@ -499,99 +499,6 @@ iax2_packet(void *user_data_arg, packet_info *pinfo, epan_dissect_t *edt _U_, co return FALSE; } -/****************************************************************************/ -/* This comes from tap-rtp-common.c */ -/****************************************************************************/ - -int iax2_packet_analyse(tap_iax2_stat_t *statinfo, - packet_info *pinfo, - const struct _iax2_info_t *iax2info) -{ - double current_time; - double current_jitter; - double current_diff; - - statinfo->flags = 0; - /* check payload type */ - if (iax2info->ftype == AST_FRAME_VOICE) { - if (iax2info->csub != statinfo->pt) - statinfo->flags |= STAT_FLAG_PT_CHANGE; - statinfo->pt = iax2info->csub; - } - - /* store the current time and calculate the current jitter */ - current_time = nstime_to_sec(&pinfo->rel_ts); - current_diff = fabs (current_time - statinfo->time - (((double)iax2info->timestamp - (double)statinfo->timestamp)/1000)); - current_jitter = statinfo->jitter + ( current_diff - statinfo->jitter)/16; - statinfo->delta = current_time - (statinfo->time); - statinfo->jitter = current_jitter; - statinfo->diff = current_diff; - - /* calculate the BW in Kbps adding the IP+IAX2 header to the RTP -> 20bytes(IP)+ 4bytes(Mini) = 24bytes */ - statinfo->bw_history[statinfo->bw_index].bytes = iax2info->payload_len + 24; - statinfo->bw_history[statinfo->bw_index].time = current_time; - /* check if there are more than 1sec in the history buffer to calculate BW in bps. If so, remove those for the calculation */ - while ((statinfo->bw_history[statinfo->bw_start_index].time+1) < current_time) { - statinfo->total_bytes -= statinfo->bw_history[statinfo->bw_start_index].bytes; - statinfo->bw_start_index++; - if (statinfo->bw_start_index == BUFF_BW) statinfo->bw_start_index = 0; - }; - statinfo->total_bytes += iax2info->payload_len + 24; - statinfo->bandwidth = (double)(statinfo->total_bytes*8)/1000; - statinfo->bw_index++; - if (statinfo->bw_index == BUFF_BW) statinfo->bw_index = 0; - - - /* is this the first packet we got in this direction? */ - if (statinfo->first_packet) { - statinfo->start_seq_nr = 0; - statinfo->start_time = current_time; - statinfo->delta = 0; - statinfo->jitter = 0; - statinfo->diff = 0; - statinfo->flags |= STAT_FLAG_FIRST; - statinfo->first_packet = FALSE; - } - /* is it a regular packet? */ - if (!(statinfo->flags & STAT_FLAG_FIRST) - && !(statinfo->flags & STAT_FLAG_MARKER) - && !(statinfo->flags & STAT_FLAG_PT_CN) - && !(statinfo->flags & STAT_FLAG_WRONG_TIMESTAMP) - && !(statinfo->flags & STAT_FLAG_FOLLOW_PT_CN)) { - /* include it in maximum delta calculation */ - if (statinfo->delta > statinfo->max_delta) { - statinfo->max_delta = statinfo->delta; - statinfo->max_nr = pinfo->fd->num; - } - /* maximum and mean jitter calculation */ - if (statinfo->jitter > statinfo->max_jitter) { - statinfo->max_jitter = statinfo->jitter; - } - statinfo->mean_jitter = (statinfo->mean_jitter*statinfo->total_nr + current_diff) / (statinfo->total_nr+1); - } - /* regular payload change? (CN ignored) */ - if (!(statinfo->flags & STAT_FLAG_FIRST) - && !(statinfo->flags & STAT_FLAG_PT_CN)) { - if ((statinfo->pt != statinfo->reg_pt) - && (statinfo->reg_pt != PT_UNDEFINED)) { - statinfo->flags |= STAT_FLAG_REG_PT_CHANGE; - } - } - - /* set regular payload*/ - if (!(statinfo->flags & STAT_FLAG_PT_CN)) { - statinfo->reg_pt = statinfo->pt; - } - - /* TODO: lost packets / duplicated: we should infer this from timestamp... */ - statinfo->time = current_time; - statinfo->timestamp = iax2info->timestamp; /* millisecs */ - statinfo->stop_seq_nr = 0; - statinfo->total_nr++; - - return 0; -} - #if 0 static const GdkColor COLOR_DEFAULT = {0, 0xffff, 0xffff, 0xffff}; |