2 * megaco-statistics for Wireshark
3 * Copyright 2003 Lars Roland
4 * Copyright 2008 Ericsson AB
5 * By Balint Reczey <balint.reczey@ericsson.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet_info.h>
31 #include <epan/epan.h>
32 #include <epan/value_string.h>
36 #include "epan/timestats.h"
39 #include <epan/stat_groups.h>
41 #include "tap-megaco-common.h"
44 megacostat_is_duplicate_reply(const gcp_cmd_t* cmd)
50 gcp_cmd_msg_t *cmd_msg;
51 /* cycle through commands to find same command in the transaction */
52 for (cmd_msg = cmd->trx->cmds;
53 (cmd_msg != NULL) && (cmd_msg->cmd->msg->framenum != cmd->msg->framenum);
54 cmd_msg = cmd_msg->next) {
55 if (cmd_msg->cmd->type == cmd->type)
71 megacostat_had_request(const gcp_cmd_t* cmd)
77 gcp_cmd_msg_t *cmd_msg;
78 /* cycle through commands to find a request in the transaction */
79 for (cmd_msg = cmd->trx->cmds;
80 (cmd_msg != NULL) && (cmd_msg->cmd->msg->framenum != cmd->msg->framenum);
81 cmd_msg = cmd_msg->next) {
83 switch (cmd_msg->cmd->type) {
104 megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi)
106 megacostat_t *ms=(megacostat_t *)pms;
107 const gcp_cmd_t *mi=(const gcp_cmd_t*)pmi;
114 if(!mi->trx->initial) {
115 /* Track Context is probably disabled, we cannot
116 * measure service response time */
120 else if(mi->trx->initial->framenum != mi->msg->framenum){
121 /* Duplicate is ignored */
130 if(megacostat_is_duplicate_reply(mi)){
131 /* Duplicate is ignored */
134 else if (!megacostat_had_request(mi)) {
135 /* no request was seen */
140 /* calculate time delta between request and response */
141 nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->trx->initial->time);
145 case GCP_CMD_ADD_REPLY:
146 time_stat_update(&(ms->rtd[0]),&delta, pinfo);
148 case GCP_CMD_MOVE_REPLY:
149 time_stat_update(&(ms->rtd[1]),&delta, pinfo);
151 case GCP_CMD_MOD_REPLY:
152 time_stat_update(&(ms->rtd[2]),&delta, pinfo);
154 case GCP_CMD_SUB_REPLY:
155 time_stat_update(&(ms->rtd[3]),&delta, pinfo);
157 case GCP_CMD_AUDITCAP_REPLY:
158 time_stat_update(&(ms->rtd[4]),&delta, pinfo);
160 case GCP_CMD_AUDITVAL_REPLY:
161 time_stat_update(&(ms->rtd[5]),&delta, pinfo);
163 case GCP_CMD_NOTIFY_REPLY:
164 time_stat_update(&(ms->rtd[6]),&delta, pinfo);
166 case GCP_CMD_SVCCHG_REPLY:
167 time_stat_update(&(ms->rtd[7]),&delta, pinfo);
169 case GCP_CMD_TOPOLOGY_REPLY:
170 time_stat_update(&(ms->rtd[8]),&delta, pinfo);
173 time_stat_update(&(ms->rtd[9]),&delta, pinfo);
176 time_stat_update(&(ms->rtd[11]),&delta, pinfo);
178 time_stat_update(&(ms->rtd[10]),&delta, pinfo);
192 * Editor modelines - http://www.wireshark.org/tools/modelines.html
197 * indent-tabs-mode: t
200 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
201 * :indentSize=8:tabSize=8:noTabs=false: