diff options
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/Makefile.common | 1 | ||||
-rw-r--r-- | ui/gtk/iax2_analysis.c | 97 | ||||
-rw-r--r-- | ui/gtk/iax2_analysis.h | 117 | ||||
-rw-r--r-- | ui/gtk/rtp_analysis.c | 2 | ||||
-rw-r--r-- | ui/gtk/voip_calls_dlg.c | 2 |
5 files changed, 4 insertions, 215 deletions
diff --git a/ui/gtk/Makefile.common b/ui/gtk/Makefile.common index cce7d8eae8..a46e656caa 100644 --- a/ui/gtk/Makefile.common +++ b/ui/gtk/Makefile.common @@ -228,7 +228,6 @@ noinst_HEADERS = \ gui_utils.h \ help_dlg.h \ hostlist_table.h \ - iax2_analysis.h \ keys.h \ layouts.h \ lbm_stream_dlg.h \ 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}; diff --git a/ui/gtk/iax2_analysis.h b/ui/gtk/iax2_analysis.h deleted file mode 100644 index c7bc10ce70..0000000000 --- a/ui/gtk/iax2_analysis.h +++ /dev/null @@ -1,117 +0,0 @@ -/* iax2_analysis.h - * IAX2 analysis addition for Wireshark - * - * based on rtp_analysis.c - * Copyright 2003, Alcatel Business Systems - * By Lars Ruoff <lars.ruoff@gmx.net> - * - * based on tap_rtp.c - * Copyright 2003, Iskratel, Ltd, Kranj - * By Miha Jemec <m.jemec@iskratel.si> - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __IAX2_ANALYSIS_H__ -#define __IAX2_ANALYSIS_H__ - -#include <glib.h> -#include <epan/address.h> -#include <epan/packet_info.h> - -/** @file - * ??? - * @todo what's this? - */ - -void iax2_analysis( - address *ip_src_fwd, - guint16 port_src_fwd, - address *ip_dst_fwd, - guint16 port_dst_fwd, - address *ip_src_rev, - guint16 port_src_rev, - address *ip_dst_rev, - guint16 port_dst_rev - ); - -/****************************************************************************/ -/* structure that holds the information about the forward and reversed direction */ -typedef struct _iax2_bw_history_item { - double time; - guint32 bytes; -} iax2_bw_history_item; - -#define BUFF_BW 300 - -typedef struct _tap_iax2_stat_t { - gboolean first_packet; /* do not use in code that is called after rtp_packet_analyse */ - /* use (flags & STAT_FLAG_FIRST) instead */ - /* all of the following fields will be initialized after - rtp_packet_analyse has been called */ - guint32 flags; /* see STAT_FLAG-defines below */ - guint16 seq_num; - guint32 timestamp; - guint32 delta_timestamp; - double bandwidth; - iax2_bw_history_item bw_history[BUFF_BW]; - guint16 bw_start_index; - guint16 bw_index; - guint32 total_bytes; - double delta; - double jitter; - double diff; - double time; - double start_time; - double max_delta; - double max_jitter; - double mean_jitter; - guint32 max_nr; - guint16 start_seq_nr; - guint16 stop_seq_nr; - guint32 total_nr; - guint32 sequence; - gboolean under; - gint cycles; - guint16 pt; - int reg_pt; -} tap_iax2_stat_t; - -#define PT_UNDEFINED -1 - -/* status flags for the flags parameter in tap_iax2_stat_t */ -#define STAT_FLAG_FIRST 0x001 -#define STAT_FLAG_MARKER 0x002 -#define STAT_FLAG_WRONG_SEQ 0x004 -#define STAT_FLAG_PT_CHANGE 0x008 -#define STAT_FLAG_PT_CN 0x010 -#define STAT_FLAG_FOLLOW_PT_CN 0x020 -#define STAT_FLAG_REG_PT_CHANGE 0x040 -#define STAT_FLAG_WRONG_TIMESTAMP 0x080 - -/* forward */ -struct _rtp_info; - -/* function for analysing an RTP packet. Called from rtp_analysis and rtp_streams */ -extern int iax2_packet_analyse(tap_iax2_stat_t *statinfo, - packet_info *pinfo, - const struct _iax2_info_t *iax2info); - - -#endif /* __IAX2_ANALYSIS_H__ */ diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c index e33e25932f..beb62afe6f 100644 --- a/ui/gtk/rtp_analysis.c +++ b/ui/gtk/rtp_analysis.c @@ -78,8 +78,8 @@ #include "ui/gtk/gui_stat_menu.h" #include "ui/gtk/pixmap_save.h" #include "ui/gtk/main.h" -#include "ui/rtp_analysis.h" #include "ui/rtp_stream.h" +#include "ui/tap-rtp-analysis.h" #include "ui/gtk/rtp_stream_dlg.h" #include "ui/gtk/stock_icons.h" diff --git a/ui/gtk/voip_calls_dlg.c b/ui/gtk/voip_calls_dlg.c index 1e45233e7a..0fdcea5af5 100644 --- a/ui/gtk/voip_calls_dlg.c +++ b/ui/gtk/voip_calls_dlg.c @@ -55,7 +55,7 @@ #include "ui/gtk/stock_icons.h" #ifdef HAVE_LIBPORTAUDIO -#include "ui/rtp_analysis.h" +#include "ui/tap-rtp-analysis.h" #include "ui/gtk/rtp_player.h" #endif /* HAVE_LIBPORTAUDIO */ |