2 * megaco-statistics for Wireshark
3 * Copyright 2003 Lars Roland
4 * Copyright 2008 Ericsson AB
5 * By Balint Reczey <balint.reczey@ericsson.com>
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
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.
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.
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.
32 #ifdef HAVE_SYS_TYPES_H
33 # include <sys/types.h>
38 #include <epan/packet_info.h>
39 #include <epan/epan.h>
40 #include <epan/value_string.h>
44 #include "../register.h"
45 #include "../timestats.h"
46 #include "../simple_dialog.h"
48 #include "../globals.h"
49 #include "../stat_menu.h"
51 #include "tap-megaco-common.h"
54 megacostat_is_duplicate_reply(const gcp_cmd_t* cmd)
60 gcp_cmd_msg_t *cmd_msg;
61 /* cycle through commands to find same command in the transaction */
62 for (cmd_msg = cmd->trx->cmds; cmd_msg->cmd->msg->framenum != cmd->msg->framenum &&
63 cmd_msg != NULL; cmd_msg = cmd_msg->next) {
64 if (cmd_msg->cmd->type == cmd->type)
80 megacostat_had_request(const gcp_cmd_t* cmd)
86 gcp_cmd_msg_t *cmd_msg;
87 /* cycle through commands to find a request in the transaction */
88 for (cmd_msg = cmd->trx->cmds; cmd_msg->cmd->msg->framenum != cmd->msg->framenum &&
89 cmd_msg != NULL; cmd_msg = cmd_msg->next) {
91 switch (cmd_msg->cmd->type) {
112 megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi)
114 megacostat_t *ms=(megacostat_t *)pms;
115 const gcp_cmd_t *mi=(const gcp_cmd_t*)pmi;
122 if(!mi->trx->initial) {
123 /* Track Context is probably disabled, we cannot
124 * measure service response time */
128 else if(mi->trx->initial->framenum != mi->msg->framenum){
129 /* Duplicate is ignored */
138 if(megacostat_is_duplicate_reply(mi)){
139 /* Duplicate is ignored */
142 else if (!megacostat_had_request(mi)) {
143 /* no request was seen */
148 /* calculate time delta between request and response */
149 nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->trx->initial->time);
153 case GCP_CMD_ADD_REPLY:
154 time_stat_update(&(ms->rtd[0]),&delta, pinfo);
156 case GCP_CMD_MOVE_REPLY:
157 time_stat_update(&(ms->rtd[1]),&delta, pinfo);
159 case GCP_CMD_MOD_REPLY:
160 time_stat_update(&(ms->rtd[2]),&delta, pinfo);
162 case GCP_CMD_SUB_REPLY:
163 time_stat_update(&(ms->rtd[3]),&delta, pinfo);
165 case GCP_CMD_AUDITCAP_REPLY:
166 time_stat_update(&(ms->rtd[4]),&delta, pinfo);
168 case GCP_CMD_AUDITVAL_REPLY:
169 time_stat_update(&(ms->rtd[5]),&delta, pinfo);
171 case GCP_CMD_NOTIFY_REPLY:
172 time_stat_update(&(ms->rtd[6]),&delta, pinfo);
174 case GCP_CMD_SVCCHG_REPLY:
175 time_stat_update(&(ms->rtd[7]),&delta, pinfo);
177 case GCP_CMD_TOPOLOGY_REPLY:
178 time_stat_update(&(ms->rtd[8]),&delta, pinfo);
181 time_stat_update(&(ms->rtd[9]),&delta, pinfo);
184 time_stat_update(&(ms->rtd[11]),&delta, pinfo);
186 time_stat_update(&(ms->rtd[10]),&delta, pinfo);