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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet_info.h>
33 #include <epan/epan.h>
34 #include <epan/value_string.h>
38 #include "../timestats.h"
40 #include "../globals.h"
41 #include "../stat_menu.h"
43 #include "tap-megaco-common.h"
46 megacostat_is_duplicate_reply(const gcp_cmd_t* cmd)
52 gcp_cmd_msg_t *cmd_msg;
53 /* cycle through commands to find same command in the transaction */
54 for (cmd_msg = cmd->trx->cmds;
55 (cmd_msg != NULL) && (cmd_msg->cmd->msg->framenum != cmd->msg->framenum);
56 cmd_msg = cmd_msg->next) {
57 if (cmd_msg->cmd->type == cmd->type)
73 megacostat_had_request(const gcp_cmd_t* cmd)
79 gcp_cmd_msg_t *cmd_msg;
80 /* cycle through commands to find a request in the transaction */
81 for (cmd_msg = cmd->trx->cmds;
82 (cmd_msg != NULL) && (cmd_msg->cmd->msg->framenum != cmd->msg->framenum);
83 cmd_msg = cmd_msg->next) {
85 switch (cmd_msg->cmd->type) {
106 megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi)
108 megacostat_t *ms=(megacostat_t *)pms;
109 const gcp_cmd_t *mi=(const gcp_cmd_t*)pmi;
116 if(!mi->trx->initial) {
117 /* Track Context is probably disabled, we cannot
118 * measure service response time */
122 else if(mi->trx->initial->framenum != mi->msg->framenum){
123 /* Duplicate is ignored */
132 if(megacostat_is_duplicate_reply(mi)){
133 /* Duplicate is ignored */
136 else if (!megacostat_had_request(mi)) {
137 /* no request was seen */
142 /* calculate time delta between request and response */
143 nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->trx->initial->time);
147 case GCP_CMD_ADD_REPLY:
148 time_stat_update(&(ms->rtd[0]),&delta, pinfo);
150 case GCP_CMD_MOVE_REPLY:
151 time_stat_update(&(ms->rtd[1]),&delta, pinfo);
153 case GCP_CMD_MOD_REPLY:
154 time_stat_update(&(ms->rtd[2]),&delta, pinfo);
156 case GCP_CMD_SUB_REPLY:
157 time_stat_update(&(ms->rtd[3]),&delta, pinfo);
159 case GCP_CMD_AUDITCAP_REPLY:
160 time_stat_update(&(ms->rtd[4]),&delta, pinfo);
162 case GCP_CMD_AUDITVAL_REPLY:
163 time_stat_update(&(ms->rtd[5]),&delta, pinfo);
165 case GCP_CMD_NOTIFY_REPLY:
166 time_stat_update(&(ms->rtd[6]),&delta, pinfo);
168 case GCP_CMD_SVCCHG_REPLY:
169 time_stat_update(&(ms->rtd[7]),&delta, pinfo);
171 case GCP_CMD_TOPOLOGY_REPLY:
172 time_stat_update(&(ms->rtd[8]),&delta, pinfo);
175 time_stat_update(&(ms->rtd[9]),&delta, pinfo);
178 time_stat_update(&(ms->rtd[11]),&delta, pinfo);
180 time_stat_update(&(ms->rtd[10]),&delta, pinfo);