git.samba.org
/
obnox
/
wireshark
/
wip.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set subheader root length to 1, so if contentsinvalid will already be correctl length.
[obnox/wireshark/wip.git]
/
tap-mgcpstat.c
diff --git
a/tap-mgcpstat.c
b/tap-mgcpstat.c
index 8ffe2c4fc6e37e3e3ee36fac00b56e4989b0e05f..f5b0b1ee7995aefe9e01c1a9a3e8a023403783bf 100644
(file)
--- a/
tap-mgcpstat.c
+++ b/
tap-mgcpstat.c
@@
-3,8
+3,8
@@
*
* $Id$
*
*
* $Id$
*
- *
Ethereal
- Network traffic analyzer
- * By Gerald Combs <gerald@
ethereal.com
>
+ *
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
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
@@
-37,8
+37,7
@@
#include <epan/tap.h>
#include <epan/stat_cmd_args.h>
#include "epan/value_string.h"
#include <epan/tap.h>
#include <epan/stat_cmd_args.h>
#include "epan/value_string.h"
-#include "register.h"
-#include "plugins/mgcp/packet-mgcp.h"
+#include "epan/dissectors/packet-mgcp.h"
#include "timestats.h"
#define NUM_TIMESTATS 11
#include "timestats.h"
#define NUM_TIMESTATS 11
@@
-64,6
+63,7
@@
static const value_string mgcp_mesage_type[] = {
{ 7, "AUEP "},
{ 8, "AUCX "},
{ 9, "RSIP "},
{ 7, "AUEP "},
{ 8, "AUCX "},
{ 9, "RSIP "},
+ { 0, NULL}
};
static int
};
static int
@@
-72,6
+72,7
@@
mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
mgcpstat_t *ms=(mgcpstat_t *)pms;
const mgcp_info_t *mi=pmi;
nstime_t delta;
mgcpstat_t *ms=(mgcpstat_t *)pms;
const mgcp_info_t *mi=pmi;
nstime_t delta;
+ int ret = 0;
switch (mi->mgcp_type) {
switch (mi->mgcp_type) {
@@
-79,24
+80,20
@@
mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
if(mi->is_duplicate){
/* Duplicate is ignored */
ms->req_dup_num++;
if(mi->is_duplicate){
/* Duplicate is ignored */
ms->req_dup_num++;
- return 0;
}
else {
ms->open_req_num++;
}
else {
ms->open_req_num++;
- return 0;
}
}
- break;
+
break;
case MGCP_RESPONSE:
if(mi->is_duplicate){
/* Duplicate is ignored */
ms->rsp_dup_num++;
case MGCP_RESPONSE:
if(mi->is_duplicate){
/* Duplicate is ignored */
ms->rsp_dup_num++;
- return 0;
}
else if (!mi->request_available) {
/* no request was seen */
ms->disc_rsp_num++;
}
else if (!mi->request_available) {
/* no request was seen */
ms->disc_rsp_num++;
- return 0;
}
else {
ms->open_req_num--;
}
else {
ms->open_req_num--;
@@
-105,45
+102,46
@@
mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
time_stat_update(&(ms->rtd[0]),&delta, pinfo);
time_stat_update(&(ms->rtd[0]),&delta, pinfo);
- if (strncasecmp(mi->code, "EPCF", 4) == 0 ) {
+ if (
g_ascii_
strncasecmp(mi->code, "EPCF", 4) == 0 ) {
time_stat_update(&(ms->rtd[1]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[1]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "CRCX", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "CRCX", 4) == 0 ) {
time_stat_update(&(ms->rtd[2]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[2]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "MDCX", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "MDCX", 4) == 0 ) {
time_stat_update(&(ms->rtd[3]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[3]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "DLCX", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "DLCX", 4) == 0 ) {
time_stat_update(&(ms->rtd[4]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[4]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "RQNT", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "RQNT", 4) == 0 ) {
time_stat_update(&(ms->rtd[5]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[5]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "NTFY", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "NTFY", 4) == 0 ) {
time_stat_update(&(ms->rtd[6]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[6]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "AUEP", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "AUEP", 4) == 0 ) {
time_stat_update(&(ms->rtd[7]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[7]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "AUCX", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "AUCX", 4) == 0 ) {
time_stat_update(&(ms->rtd[8]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[8]),&delta, pinfo);
}
- else if (strncasecmp(mi->code, "RSIP", 4) == 0 ) {
+ else if (
g_ascii_
strncasecmp(mi->code, "RSIP", 4) == 0 ) {
time_stat_update(&(ms->rtd[9]),&delta, pinfo);
}
else {
time_stat_update(&(ms->rtd[10]),&delta, pinfo);
}
time_stat_update(&(ms->rtd[9]),&delta, pinfo);
}
else {
time_stat_update(&(ms->rtd[10]),&delta, pinfo);
}
- ret
urn
1;
+ ret
=
1;
}
}
- break;
+
break;
default:
default:
- return 0;
- break;
+ break;
}
}
+
+ return ret;
}
static void
}
static void
@@
-181,19
+179,15
@@
mgcpstat_init(const char *optarg, void* userdata _U_)
{
mgcpstat_t *ms;
int i;
{
mgcpstat_t *ms;
int i;
- const char *filter=NULL;
GString *error_string;
GString *error_string;
+ ms=g_malloc(sizeof(mgcpstat_t));
if(!strncmp(optarg,"mgcp,rtd,",9)){
if(!strncmp(optarg,"mgcp,rtd,",9)){
-
filter=optarg+9
;
+
ms->filter=g_strdup(optarg+9)
;
} else {
} else {
-
filter=""
;
+
ms->filter=NULL
;
}
}
- ms=g_malloc(sizeof(mgcpstat_t));
- ms->filter=g_malloc(strlen(filter)+1);
- strcpy(ms->filter, filter);
-
for(i=0;i<NUM_TIMESTATS;i++) {
ms->rtd[i].num=0;
ms->rtd[i].min_num=0;
for(i=0;i<NUM_TIMESTATS;i++) {
ms->rtd[i].num=0;
ms->rtd[i].min_num=0;
@@
-211,13
+205,13
@@
mgcpstat_init(const char *optarg, void* userdata _U_)
ms->req_dup_num=0;
ms->rsp_dup_num=0;
ms->req_dup_num=0;
ms->rsp_dup_num=0;
- error_string=register_tap_listener("mgcp", ms,
filter
, NULL, mgcpstat_packet, mgcpstat_draw);
+ error_string=register_tap_listener("mgcp", ms,
ms->filter, 0
, NULL, mgcpstat_packet, mgcpstat_draw);
if(error_string){
/* error, we failed to attach to the tap. clean up */
g_free(ms->filter);
g_free(ms);
if(error_string){
/* error, we failed to attach to the tap. clean up */
g_free(ms->filter);
g_free(ms);
- fprintf(stderr, "t
ethereal
: Couldn't register mgcp,rtd tap: %s\n",
+ fprintf(stderr, "t
shark
: Couldn't register mgcp,rtd tap: %s\n",
error_string->str);
g_string_free(error_string, TRUE);
exit(1);
error_string->str);
g_string_free(error_string, TRUE);
exit(1);