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.
34 #include <epan/packet_info.h>
35 #include <epan/epan.h>
36 #include <epan/value_string.h>
40 #include "../timestats.h"
42 #include "../globals.h"
43 #include "../stat_menu.h"
45 #include "tap-megaco-common.h"
48 megacostat_is_duplicate_reply(const gcp_cmd_t* cmd)
54 gcp_cmd_msg_t *cmd_msg;
55 /* cycle through commands to find same command in the transaction */
56 for (cmd_msg = cmd->trx->cmds;
57 (cmd_msg != NULL) && (cmd_msg->cmd->msg->framenum != cmd->msg->framenum);
58 cmd_msg = cmd_msg->next) {
59 if (cmd_msg->cmd->type == cmd->type)
75 megacostat_had_request(const gcp_cmd_t* cmd)
81 gcp_cmd_msg_t *cmd_msg;
82 /* cycle through commands to find a request in the transaction */
83 for (cmd_msg = cmd->trx->cmds;
84 (cmd_msg != NULL) && (cmd_msg->cmd->msg->framenum != cmd->msg->framenum);
85 cmd_msg = cmd_msg->next) {
87 switch (cmd_msg->cmd->type) {
108 megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi)
110 megacostat_t *ms=(megacostat_t *)pms;
111 const gcp_cmd_t *mi=(const gcp_cmd_t*)pmi;
118 if(!mi->trx->initial) {
119 /* Track Context is probably disabled, we cannot
120 * measure service response time */
124 else if(mi->trx->initial->framenum != mi->msg->framenum){
125 /* Duplicate is ignored */
134 if(megacostat_is_duplicate_reply(mi)){
135 /* Duplicate is ignored */
138 else if (!megacostat_had_request(mi)) {
139 /* no request was seen */
144 /* calculate time delta between request and response */
145 nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->trx->initial->time);
149 case GCP_CMD_ADD_REPLY:
150 time_stat_update(&(ms->rtd[0]),&delta, pinfo);
152 case GCP_CMD_MOVE_REPLY:
153 time_stat_update(&(ms->rtd[1]),&delta, pinfo);
155 case GCP_CMD_MOD_REPLY:
156 time_stat_update(&(ms->rtd[2]),&delta, pinfo);
158 case GCP_CMD_SUB_REPLY:
159 time_stat_update(&(ms->rtd[3]),&delta, pinfo);
161 case GCP_CMD_AUDITCAP_REPLY:
162 time_stat_update(&(ms->rtd[4]),&delta, pinfo);
164 case GCP_CMD_AUDITVAL_REPLY:
165 time_stat_update(&(ms->rtd[5]),&delta, pinfo);
167 case GCP_CMD_NOTIFY_REPLY:
168 time_stat_update(&(ms->rtd[6]),&delta, pinfo);
170 case GCP_CMD_SVCCHG_REPLY:
171 time_stat_update(&(ms->rtd[7]),&delta, pinfo);
173 case GCP_CMD_TOPOLOGY_REPLY:
174 time_stat_update(&(ms->rtd[8]),&delta, pinfo);
177 time_stat_update(&(ms->rtd[9]),&delta, pinfo);
180 time_stat_update(&(ms->rtd[11]),&delta, pinfo);
182 time_stat_update(&(ms->rtd[10]),&delta, pinfo);