aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2014-10-13 15:04:21 -0400
committerBill Meier <wmeier@newsguy.com>2014-10-13 19:09:07 +0000
commit6a9479ecf90ef64f944526354fb26ee876d3ad25 (patch)
treeff0542670c21c9323020d89002d3a2c64e93a46c
parent63faad686b49e02b86cd1961dd3bc8283f120da8 (diff)
Add editor modelines and/or adjust whilespace.
Change-Id: I626b7bd8ac6e4b91c57cc9152e7ce038754e7278 Reviewed-on: https://code.wireshark.org/review/4658 Reviewed-by: Bill Meier <wmeier@newsguy.com>
-rw-r--r--ui/cli/tap-afpstat.c101
-rw-r--r--ui/cli/tap-ansi_astat.c109
-rw-r--r--ui/cli/tap-bootpstat.c52
-rw-r--r--ui/cli/tap-camelcounter.c57
-rw-r--r--ui/cli/tap-camelsrt.c191
-rw-r--r--ui/cli/tap-comparestat.c378
-rw-r--r--ui/cli/tap-dcerpcstat.c213
-rw-r--r--ui/cli/tap-diameter-avp.c200
-rw-r--r--ui/cli/tap-expert.c52
-rw-r--r--ui/cli/tap-follow.c153
-rw-r--r--ui/cli/tap-funnel.c77
-rw-r--r--ui/cli/tap-gsm_astat.c333
-rw-r--r--ui/cli/tap-h225counter.c193
-rw-r--r--ui/cli/tap-h225rassrt.c115
-rw-r--r--ui/cli/tap-hosts.c43
-rw-r--r--ui/cli/tap-httpstat.c185
-rw-r--r--ui/cli/tap-icmpstat.c16
-rw-r--r--ui/cli/tap-icmpv6stat.c16
-rw-r--r--ui/cli/tap-iostat.c366
-rw-r--r--ui/cli/tap-iousers.c30
-rw-r--r--ui/cli/tap-macltestat.c30
-rw-r--r--ui/cli/tap-megacostat.c92
-rw-r--r--ui/cli/tap-mgcpstat.c140
-rw-r--r--ui/cli/tap-protocolinfo.c66
-rw-r--r--ui/cli/tap-protohierstat.c134
-rw-r--r--ui/cli/tap-radiusstat.c104
-rw-r--r--ui/cli/tap-rlcltestat.c28
-rw-r--r--ui/cli/tap-rpcprogs.c199
-rw-r--r--ui/cli/tap-rpcstat.c198
-rw-r--r--ui/cli/tap-rtp.c14
-rw-r--r--ui/cli/tap-rtspstat.c97
-rw-r--r--ui/cli/tap-scsistat.c72
-rw-r--r--ui/cli/tap-sctpchunkstat.c97
-rw-r--r--ui/cli/tap-sipstat.c495
-rw-r--r--ui/cli/tap-smbsids.c36
-rw-r--r--ui/cli/tap-smbstat.c182
-rw-r--r--ui/cli/tap-stats_tree.c33
-rw-r--r--ui/cli/tap-sv.c33
-rw-r--r--ui/cli/tap-wspstat.c116
39 files changed, 2743 insertions, 2303 deletions
diff --git a/ui/cli/tap-afpstat.c b/ui/cli/tap-afpstat.c
index e0127f23c6..0682c0c8af 100644
--- a/ui/cli/tap-afpstat.c
+++ b/ui/cli/tap-afpstat.c
@@ -45,24 +45,24 @@ typedef struct _afpstat_t {
static int
afpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv)
{
- afpstat_t *ss=(afpstat_t *)pss;
- const afp_request_val *request_val=(const afp_request_val *)prv;
+ afpstat_t *ss = (afpstat_t *)pss;
+ const afp_request_val *request_val = (const afp_request_val *)prv;
nstime_t t, deltat;
- timestat_t *sp=NULL;
+ timestat_t *sp = NULL;
/* if we havnt seen the request, just ignore it */
- if(!request_val){
+ if (!request_val) {
return 0;
}
- sp=&(ss->proc[request_val->command]);
+ sp = &(ss->proc[request_val->command]);
/* calculate time delta between request and reply */
- t=pinfo->fd->abs_ts;
+ t = pinfo->fd->abs_ts;
nstime_delta(&deltat, &t, &request_val->req_time);
- if(sp){
- time_stat_update(sp,&deltat, pinfo);
+ if (sp) {
+ time_stat_update(sp, &deltat, pinfo);
}
return 1;
@@ -71,35 +71,35 @@ afpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
static void
afpstat_draw(void *pss)
{
- afpstat_t *ss=(afpstat_t *)pss;
+ afpstat_t *ss = (afpstat_t *)pss;
guint32 i;
guint64 td;
printf("\n");
printf("===================================================================\n");
printf("AFP SRT Statistics:\n");
- printf("Filter: %s\n",ss->filter?ss->filter:"");
+ printf("Filter: %s\n", ss->filter ? ss->filter : "");
printf("Commands Calls Min SRT Max SRT Avg SRT\n");
- for(i=0;i<256;i++){
+ for (i=0; i<256; i++) {
/* nothing seen, nothing to do */
- if(ss->proc[i].num==0){
+ if (ss->proc[i].num == 0) {
continue;
}
/* scale it to units of 10us.*/
- td=ss->proc[i].tot.secs;
- td=td*100000+(int)ss->proc[i].tot.nsecs/10000;
- if(ss->proc[i].num){
- td/=ss->proc[i].num;
+ td = ss->proc[i].tot.secs;
+ td = td*100000+(int)ss->proc[i].tot.nsecs/10000;
+ if (ss->proc[i].num) {
+ td /= ss->proc[i].num;
} else {
- td=0;
+ td = 0;
}
printf("%-25s %6d %3d.%05d %3d.%05d %3" G_GINT64_MODIFIER "u.%05" G_GINT64_MODIFIER "u\n",
- val_to_str_ext(i, &CommandCode_vals_ext, "Unknown (%u)"),
- ss->proc[i].num,
- (int)ss->proc[i].min.secs,ss->proc[i].min.nsecs/10000,
- (int)ss->proc[i].max.secs,ss->proc[i].max.nsecs/10000,
- td/100000, td%100000
+ val_to_str_ext(i, &CommandCode_vals_ext, "Unknown (%u)"),
+ ss->proc[i].num,
+ (int)ss->proc[i].min.secs, ss->proc[i].min.nsecs/10000,
+ (int)ss->proc[i].max.secs, ss->proc[i].max.nsecs/10000,
+ td/100000, td%100000
);
}
printf("===================================================================\n");
@@ -107,40 +107,40 @@ afpstat_draw(void *pss)
static void
-afpstat_init(const char *opt_arg, void* userdata _U_)
+afpstat_init(const char *opt_arg, void *userdata _U_)
{
afpstat_t *ss;
guint32 i;
- const char *filter=NULL;
+ const char *filter = NULL;
GString *error_string;
- if(!strncmp(opt_arg,"afp,srt,",8)){
- filter=opt_arg+8;
+ if (!strncmp(opt_arg, "afp,srt,", 8)) {
+ filter = opt_arg+8;
} else {
- filter=NULL;
+ filter = NULL;
}
- ss=g_new(afpstat_t,1);
- if(filter){
- ss->filter=g_strdup(filter);
+ ss = g_new(afpstat_t, 1);
+ if (filter) {
+ ss->filter = g_strdup(filter);
} else {
- ss->filter=NULL;
+ ss->filter = NULL;
}
- for(i=0;i<256;i++){
- ss->proc[i].num=0;
- ss->proc[i].min_num=0;
- ss->proc[i].max_num=0;
- ss->proc[i].min.secs=0;
- ss->proc[i].min.nsecs=0;
- ss->proc[i].max.secs=0;
- ss->proc[i].max.nsecs=0;
- ss->proc[i].tot.secs=0;
- ss->proc[i].tot.nsecs=0;
+ for (i=0; i<256; i++) {
+ ss->proc[i].num = 0;
+ ss->proc[i].min_num = 0;
+ ss->proc[i].max_num = 0;
+ ss->proc[i].min.secs = 0;
+ ss->proc[i].min.nsecs = 0;
+ ss->proc[i].max.secs = 0;
+ ss->proc[i].max.nsecs = 0;
+ ss->proc[i].tot.secs = 0;
+ ss->proc[i].tot.nsecs = 0;
}
- error_string=register_tap_listener("afp", ss, filter, 0, NULL, afpstat_packet, afpstat_draw);
- if(error_string){
+ error_string = register_tap_listener("afp", ss, filter, 0, NULL, afpstat_packet, afpstat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(ss->filter);
g_free(ss);
@@ -155,5 +155,18 @@ afpstat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_afpstat(void)
{
- register_stat_cmd_arg("afp,srt", afpstat_init,NULL);
+ register_stat_cmd_arg("afp,srt", afpstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-ansi_astat.c b/ui/cli/tap-ansi_astat.c
index 9af5ec3ea8..89e80a0e8e 100644
--- a/ui/cli/tap-ansi_astat.c
+++ b/ui/cli/tap-ansi_astat.c
@@ -42,37 +42,37 @@
void register_tap_listener_ansi_astat(void);
typedef struct _ansi_a_stat_t {
- int bsmap_message_type[0xff];
- int dtap_message_type[0xff];
+ int bsmap_message_type[0xff];
+ int dtap_message_type[0xff];
} ansi_a_stat_t;
static int
ansi_a_stat_packet(
- void *tapdata,
- packet_info *pinfo _U_,
- epan_dissect_t *edt _U_,
- const void *data)
+ void *tapdata,
+ packet_info *pinfo _U_,
+ epan_dissect_t *edt _U_,
+ const void *data)
{
- ansi_a_stat_t *stat_p = (ansi_a_stat_t *)tapdata;
- const ansi_a_tap_rec_t *tap_p = (const ansi_a_tap_rec_t *)data;
+ ansi_a_stat_t *stat_p = (ansi_a_stat_t *)tapdata;
+ const ansi_a_tap_rec_t *tap_p = (const ansi_a_tap_rec_t *)data;
switch (tap_p->pdu_type)
{
case BSSAP_PDU_TYPE_BSMAP:
- stat_p->bsmap_message_type[tap_p->message_type]++;
- break;
+ stat_p->bsmap_message_type[tap_p->message_type]++;
+ break;
case BSSAP_PDU_TYPE_DTAP:
- stat_p->dtap_message_type[tap_p->message_type]++;
- break;
+ stat_p->dtap_message_type[tap_p->message_type]++;
+ break;
default:
- /*
- * unknown PDU type !!!
- */
- return(0);
+ /*
+ * unknown PDU type !!!
+ */
+ return(0);
}
return(1);
@@ -81,10 +81,10 @@ ansi_a_stat_packet(
static void
ansi_a_stat_draw(
- void *tapdata)
+ void *tapdata)
{
- ansi_a_stat_t *stat_p = (ansi_a_stat_t *)tapdata;
- guint8 i;
+ ansi_a_stat_t *stat_p = (ansi_a_stat_t *)tapdata;
+ guint8 i;
printf("\n");
@@ -95,15 +95,15 @@ ansi_a_stat_draw(
i = 0;
while (ansi_a_ios401_bsmap_strings[i].strptr)
{
- if (stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- ansi_a_ios401_bsmap_strings[i].value,
- ansi_a_ios401_bsmap_strings[i].strptr,
- stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value]);
- }
-
- i++;
+ if (stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ ansi_a_ios401_bsmap_strings[i].value,
+ ansi_a_ios401_bsmap_strings[i].strptr,
+ stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP\n");
@@ -112,15 +112,15 @@ ansi_a_stat_draw(
i = 0;
while (ansi_a_ios401_dtap_strings[i].strptr)
{
- if (stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- ansi_a_ios401_dtap_strings[i].value,
- ansi_a_ios401_dtap_strings[i].strptr,
- stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ ansi_a_ios401_dtap_strings[i].value,
+ ansi_a_ios401_dtap_strings[i].strptr,
+ stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value]);
+ }
+
+ i++;
}
printf("==============================================================\n");
@@ -128,27 +128,27 @@ ansi_a_stat_draw(
static void
-ansi_a_stat_init(const char *opt_arg _U_, void* userdata _U_)
+ansi_a_stat_init(const char *opt_arg _U_, void *userdata _U_)
{
- ansi_a_stat_t *stat_p;
- GString *err_p;
+ ansi_a_stat_t *stat_p;
+ GString *err_p;
stat_p = (ansi_a_stat_t *)g_malloc(sizeof(ansi_a_stat_t));
memset(stat_p, 0, sizeof(ansi_a_stat_t));
err_p =
- register_tap_listener("ansi_a", stat_p, NULL, 0,
- NULL,
- ansi_a_stat_packet,
- ansi_a_stat_draw);
+ register_tap_listener("ansi_a", stat_p, NULL, 0,
+ NULL,
+ ansi_a_stat_packet,
+ ansi_a_stat_draw);
if (err_p != NULL)
{
- g_free(stat_p);
- g_string_free(err_p, TRUE);
+ g_free(stat_p);
+ g_string_free(err_p, TRUE);
- exit(1);
+ exit(1);
}
}
@@ -156,5 +156,18 @@ ansi_a_stat_init(const char *opt_arg _U_, void* userdata _U_)
void
register_tap_listener_ansi_astat(void)
{
- register_stat_cmd_arg("ansi_a,", ansi_a_stat_init,NULL);
+ register_stat_cmd_arg("ansi_a,", ansi_a_stat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-bootpstat.c b/ui/cli/tap-bootpstat.c
index cf79f2c3ec..6ec66b399d 100644
--- a/ui/cli/tap-bootpstat.c
+++ b/ui/cli/tap-bootpstat.c
@@ -32,7 +32,7 @@
void register_tap_listener_gtkdhcpstat(void);
-typedef const char* bootp_info_value_t;
+typedef const char *bootp_info_value_t;
/* used to keep track of the statictics for an entire program interface */
typedef struct _dhcp_stats_t {
@@ -69,30 +69,30 @@ dhcp_reset_hash(gchar *key _U_ , dhcp_message_type_t *data, gpointer ptr _U_ )
static void
dhcp_draw_message_type(gchar *key _U_, dhcp_message_type_t *data, gchar * format )
{
- if ((data==NULL) || (data->packets==0))
+ if ((data == NULL) || (data->packets == 0))
return;
printf( format, data->name, data->packets);
}
static void
dhcpstat_reset(void *psp)
{
- dhcpstat_t *sp=(dhcpstat_t *)psp;
+ dhcpstat_t *sp = (dhcpstat_t *)psp;
g_hash_table_foreach( sp->hash, (GHFunc)dhcp_reset_hash, NULL);
}
static int
dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
{
- dhcpstat_t *sp=(dhcpstat_t *)psp;
- const bootp_info_value_t value=(const bootp_info_value_t)pri;
+ dhcpstat_t *sp = (dhcpstat_t *)psp;
+ const bootp_info_value_t value = (const bootp_info_value_t)pri;
dhcp_message_type_t *sc;
- if (sp==NULL)
+ if (sp == NULL)
return 0;
sc = (dhcp_message_type_t *)g_hash_table_lookup(
sp->hash,
value);
if (!sc) {
- sc = g_new(dhcp_message_type_t,1);
+ sc = g_new(dhcp_message_type_t, 1);
sc -> packets = 1;
sc -> name = value;
sc -> sp = sp;
@@ -111,12 +111,12 @@ dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
static void
dhcpstat_draw(void *psp)
{
- dhcpstat_t *sp=(dhcpstat_t *)psp;
+ dhcpstat_t *sp = (dhcpstat_t *)psp;
printf("\n");
printf("===================================================================\n");
- if (sp->filter==NULL)
+ if (sp->filter == NULL)
printf("BOOTP Statistics\n");
else
printf("BOOTP Statistics with filter %s\n", sp->filter);
@@ -134,24 +134,24 @@ dhcpstat_draw(void *psp)
/* When called, this function will create a new instance of tap-boopstat.
*/
static void
-dhcpstat_init(const char *opt_arg, void* userdata _U_)
+dhcpstat_init(const char *opt_arg, void *userdata _U_)
{
dhcpstat_t *sp;
- const char *filter=NULL;
+ const char *filter = NULL;
GString *error_string;
- if (!strncmp (opt_arg, "bootp,stat,", 11)){
- filter=opt_arg+11;
+ if (!strncmp (opt_arg, "bootp,stat,", 11)) {
+ filter = opt_arg+11;
} else {
- filter=NULL;
+ filter = NULL;
}
- sp = g_new(dhcpstat_t,1);
+ sp = g_new(dhcpstat_t, 1);
sp->hash = g_hash_table_new( g_str_hash, g_str_equal);
- if(filter){
- sp->filter=g_strdup(filter);
+ if (filter) {
+ sp->filter = g_strdup(filter);
} else {
- sp->filter=NULL;
+ sp->filter = NULL;
}
sp->index = 0; /* Nothing to display yet */
@@ -163,7 +163,7 @@ dhcpstat_init(const char *opt_arg, void* userdata _U_)
dhcpstat_reset,
dhcpstat_packet,
dhcpstat_draw);
- if (error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(sp->filter);
g_free(sp);
@@ -179,6 +179,18 @@ dhcpstat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_gtkdhcpstat(void)
{
- register_stat_cmd_arg("bootp,stat,", dhcpstat_init,NULL);
+ register_stat_cmd_arg("bootp,stat,", dhcpstat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-camelcounter.c b/ui/cli/tap-camelcounter.c
index 992a0e9856..440b24ee4f 100644
--- a/ui/cli/tap-camelcounter.c
+++ b/ui/cli/tap-camelcounter.c
@@ -49,16 +49,16 @@ struct camelcounter_t {
static void camelcounter_reset(void *phs)
{
struct camelcounter_t * p_counter= ( struct camelcounter_t *) phs;
- memset(p_counter,0,sizeof(struct camelcounter_t));
+ memset(p_counter, 0, sizeof(struct camelcounter_t));
}
static int camelcounter_packet(void *phs,
- packet_info *pinfo _U_,
- epan_dissect_t *edt _U_,
- const void *phi)
+ packet_info *pinfo _U_,
+ epan_dissect_t *edt _U_,
+ const void *phi)
{
struct camelcounter_t * p_counter =(struct camelcounter_t *)phs;
- const struct camelsrt_info_t * pi=(const struct camelsrt_info_t *)phi;
+ const struct camelsrt_info_t * pi = (const struct camelsrt_info_t *)phi;
if (pi->opcode != 255)
p_counter->camel_msg[pi->opcode]++;
@@ -74,45 +74,45 @@ static void camelcounter_draw(void *phs)
printf("CAMEL Message and Response Status Counter:\n");
printf("------------------------------------------\n");
- for(i=0;i<camel_MAX_NUM_OPR_CODES;i++) {
+ for (i=0; i<camel_MAX_NUM_OPR_CODES; i++) {
/* Message counter */
- if(p_counter->camel_msg[i]!=0) {
- printf("%30s ", val_to_str(i,camel_opr_code_strings,"Unknown message "));
+ if (p_counter->camel_msg[i] != 0) {
+ printf("%30s ", val_to_str(i, camel_opr_code_strings, "Unknown message "));
printf("%6d\n", p_counter->camel_msg[i]);
}
} /* Message Type */
printf("------------------------------------------\n");
}
-static void camelcounter_init(const char *opt_arg, void* userdata _U_)
+static void camelcounter_init(const char *opt_arg, void *userdata _U_)
{
struct camelcounter_t *p_camelcounter;
GString *error_string;
- p_camelcounter = g_new(struct camelcounter_t,1);
- if(!strncmp(opt_arg,"camel,counter,",13)){
- p_camelcounter->filter=g_strdup(opt_arg+13);
+ p_camelcounter = g_new(struct camelcounter_t, 1);
+ if (!strncmp(opt_arg, "camel,counter,", 13)) {
+ p_camelcounter->filter = g_strdup(opt_arg+13);
} else {
- p_camelcounter->filter=NULL;
+ p_camelcounter->filter = NULL;
}
camelcounter_reset(p_camelcounter);
- error_string=register_tap_listener("CAMEL",
- p_camelcounter,
- p_camelcounter->filter,
- 0,
- NULL,
- camelcounter_packet,
- camelcounter_draw);
+ error_string = register_tap_listener("CAMEL",
+ p_camelcounter,
+ p_camelcounter->filter,
+ 0,
+ NULL,
+ camelcounter_packet,
+ camelcounter_draw);
- if(error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(p_camelcounter->filter);
g_free(p_camelcounter);
fprintf(stderr, "tshark: Couldn't register camel,counter tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -124,3 +124,16 @@ register_tap_listener_camelcounter(void)
{
register_stat_cmd_arg("camel,counter", camelcounter_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-camelsrt.c b/ui/cli/tap-camelsrt.c
index 6e31d73350..83e6d2b963 100644
--- a/ui/cli/tap-camelsrt.c
+++ b/ui/cli/tap-camelsrt.c
@@ -57,33 +57,33 @@ struct camelsrt_t {
/* Reset the counter */
static void camelsrt_reset(void *phs)
{
- struct camelsrt_t *hs=(struct camelsrt_t *)phs;
- memset(hs,0,sizeof(struct camelsrt_t));
+ struct camelsrt_t *hs = (struct camelsrt_t *)phs;
+ memset(hs, 0, sizeof(struct camelsrt_t));
}
static int camelsrt_packet(void *phs,
- packet_info *pinfo _U_,
- epan_dissect_t *edt _U_,
- const void *phi)
+ packet_info *pinfo _U_,
+ epan_dissect_t *edt _U_,
+ const void *phi)
{
- struct camelsrt_t *hs=(struct camelsrt_t *)phs;
- const struct camelsrt_info_t * pi=(const struct camelsrt_info_t *)phi;
+ struct camelsrt_t *hs = (struct camelsrt_t *)phs;
+ const struct camelsrt_info_t * pi = (const struct camelsrt_info_t *)phi;
int i;
for (i=0; i<NB_CAMELSRT_CATEGORY; i++) {
if (pi->bool_msginfo[i] &&
- pi->msginfo[i].is_delta_time
- && pi->msginfo[i].request_available
- && !pi->msginfo[i].is_duplicate ) {
+ pi->msginfo[i].is_delta_time
+ && pi->msginfo[i].request_available
+ && !pi->msginfo[i].is_duplicate ) {
time_stat_update(&(hs->stats[i]),
- &(pi->msginfo[i].delta_time),
- pinfo);
+ &(pi->msginfo[i].delta_time),
+ pinfo);
if (hs->count[i] < NUM_RAS_STATS) {
- hs->delta_time[i][hs->count[i]++]
- = pi->msginfo[i].delta_time;
+ hs->delta_time[i][hs->count[i]++]
+ = pi->msginfo[i].delta_time;
}
}
}
@@ -93,13 +93,13 @@ static int camelsrt_packet(void *phs,
static void camelsrt_draw(void *phs)
{
- struct camelsrt_t *hs=(struct camelsrt_t *)phs;
- guint j,z;
+ struct camelsrt_t *hs = (struct camelsrt_t *)phs;
+ guint j, z;
guint32 li;
- int somme,iteration=0;
+ int somme, iteration = 0;
timestat_t *rtd_temp;
- double x,delay,delay_max,delay_min,delta;
- double criteria[NB_CRITERIA]={ 5.0, 10.0, 75.0, 90.0, 95.0,99.0,99.90 };
+ double x, delay, delay_max, delay_min, delta;
+ double criteria[NB_CRITERIA] = { 5.0, 10.0, 75.0, 90.0, 95.0, 99.0, 99.90 };
double delay_criteria[NB_CRITERIA];
printf("\n");
@@ -108,33 +108,33 @@ static void camelsrt_draw(void *phs)
printf("| Category | Measure | Min SRT | Max SRT | Avg SRT | Min frame | Max frame |\n");
printf("|-------------------------|---------|-----------|-----------|-----------|-----------|-----------|\n");
- j=1;
+ j = 1;
printf("|%24s |%8u |%8.2f s |%8.2f s |%8.2f s |%10u |%10u |\n",
- val_to_str(j,camelSRTtype_naming,"Unknown Message 0x%02x"),
- hs->stats[j].num,
- nstime_to_sec(&(hs->stats[j].min)),
- nstime_to_sec(&(hs->stats[j].max)),
- get_average(&(hs->stats[j].tot),hs->stats[j].num)/1000.0,
- hs->stats[j].min_num,
- hs->stats[j].max_num
- );
- for(j=2; j<NB_CAMELSRT_CATEGORY; j++) {
- if(hs->stats[j].num==0){
+ val_to_str(j, camelSRTtype_naming, "Unknown Message 0x%02x"),
+ hs->stats[j].num,
+ nstime_to_sec(&(hs->stats[j].min)),
+ nstime_to_sec(&(hs->stats[j].max)),
+ get_average(&(hs->stats[j].tot), hs->stats[j].num)/1000.0,
+ hs->stats[j].min_num,
+ hs->stats[j].max_num
+ );
+ for (j=2; j<NB_CAMELSRT_CATEGORY; j++) {
+ if (hs->stats[j].num == 0) {
printf("|%24s |%8u |%8.2f ms|%8.2f ms|%8.2f ms|%10u |%10u |\n",
- val_to_str(j,camelSRTtype_naming,"Unknown Message 0x%02x"),
- 0, 0.0, 0.0, 0.0, 0, 0);
+ val_to_str(j, camelSRTtype_naming, "Unknown Message 0x%02x"),
+ 0, 0.0, 0.0, 0.0, 0, 0);
continue;
}
printf("|%24s |%8u |%8.2f ms|%8.2f ms|%8.2f ms|%10u |%10u |\n",
- val_to_str(j,camelSRTtype_naming,"Unknown Message 0x%02x"),
- hs->stats[j].num,
- MIN(9999,nstime_to_msec(&(hs->stats[j].min))),
- MIN(9999,nstime_to_msec(&(hs->stats[j].max))),
- MIN(9999,get_average(&(hs->stats[j].tot),hs->stats[j].num)),
- hs->stats[j].min_num,
- hs->stats[j].max_num
- );
+ val_to_str(j, camelSRTtype_naming, "Unknown Message 0x%02x"),
+ hs->stats[j].num,
+ MIN(9999, nstime_to_msec(&(hs->stats[j].min))),
+ MIN(9999, nstime_to_msec(&(hs->stats[j].max))),
+ MIN(9999, get_average(&(hs->stats[j].tot), hs->stats[j].num)),
+ hs->stats[j].min_num,
+ hs->stats[j].max_num
+ );
} /* j category */
printf("=================================================================================================\n");
@@ -143,89 +143,89 @@ static void camelsrt_draw(void *phs)
*/
printf("| Category/Criteria |");
- for(z=0; z<NB_CRITERIA; z++) printf("%7.2f%% |", criteria[z]);
+ for (z=0; z<NB_CRITERIA; z++) printf("%7.2f%% |", criteria[z]);
printf("\n");
printf("|-------------------------|");
- for(z=0; z<NB_CRITERIA; z++) printf("---------|");
+ for (z=0; z<NB_CRITERIA; z++) printf("---------|");
printf("\n");
/* calculate the delay max to have a given number of messages (in percentage) */
- for(j=2;j<NB_CAMELSRT_CATEGORY;j++) {
+ for (j=2; j<NB_CAMELSRT_CATEGORY;j++) {
rtd_temp = &(hs->stats[j]);
- if (hs->count[j]>0) {
+ if (hs->count[j] > 0) {
/* Calculate the delay to answer to p% of the MS */
- for(z=0; z<NB_CRITERIA; z++) {
- iteration=0;
- delay_max=(double)rtd_temp->max.secs*1000 +(double)rtd_temp->max.nsecs/1000000;
- delay_min=(double)rtd_temp->min.secs*1000 +(double)rtd_temp->min.nsecs/1000000;
- delay=delay_min;
- delta=delay_max-delay_min;
- while( (delta > 0.001) && (iteration < 10000) ) {
- somme=0;
- iteration++;
-
- for(li=0;li<hs->count[j];li++) {
- x=hs->delta_time[j][li].secs*1000
- + (double)hs->delta_time[j][li].nsecs/1000000;
- if (x <= delay) somme++;
- }
- if ( somme*100 > hs->count[j]*criteria[z] ) { /* trop grand */
- delay_max=delay;
- delay=(delay_max+delay_min)/2;
- delta=delay_max-delay_min;
- } else { /* trop petit */
- delay_min=delay;
- delay=(delay_max+delay_min)/2;
- delta=delay_max-delay_min;
- }
- } /* while */
- delay_criteria[z]=delay;
+ for (z=0; z<NB_CRITERIA; z++) {
+ iteration = 0;
+ delay_max = (double)rtd_temp->max.secs*1000 +(double)rtd_temp->max.nsecs/1000000;
+ delay_min = (double)rtd_temp->min.secs*1000 +(double)rtd_temp->min.nsecs/1000000;
+ delay = delay_min;
+ delta = delay_max-delay_min;
+ while ( (delta > 0.001) && (iteration < 10000) ) {
+ somme = 0;
+ iteration++;
+
+ for (li=0; li<hs->count[j]; li++) {
+ x = hs->delta_time[j][li].secs*1000
+ + (double)hs->delta_time[j][li].nsecs/1000000;
+ if (x <= delay) somme++;
+ }
+ if ( somme*100 > hs->count[j]*criteria[z] ) { /* trop grand */
+ delay_max = delay;
+ delay = (delay_max+delay_min)/2;
+ delta = delay_max-delay_min;
+ } else { /* trop petit */
+ delay_min = delay;
+ delay = (delay_max+delay_min)/2;
+ delta = delay_max-delay_min;
+ }
+ } /* while */
+ delay_criteria[z] = delay;
} /* z criteria */
/* Append the result to the table */
printf("X%24s |", val_to_str(j, camelSRTtype_naming, "Unknown") );
- for(z=0; z<NB_CRITERIA; z++) printf("%8.2f |", MIN(9999,delay_criteria[z]));
+ for (z=0; z<NB_CRITERIA; z++) printf("%8.2f |", MIN(9999, delay_criteria[z]));
printf("\n");
} else { /* count */
printf("X%24s |", val_to_str(j, camelSRTtype_naming, "Unknown") );
- for(z=0; z<NB_CRITERIA; z++) printf("%8.2f |", 0.0);
+ for (z=0; z<NB_CRITERIA; z++) printf("%8.2f |", 0.0);
printf("\n");
} /* count */
}/* j category */
printf("===========================");
- for(z=0; z<NB_CRITERIA; z++) printf("==========");
+ for (z=0; z<NB_CRITERIA; z++) printf("==========");
printf("\n");
}
-static void camelsrt_init(const char *opt_arg, void* userdata _U_)
+static void camelsrt_init(const char *opt_arg, void *userdata _U_)
{
struct camelsrt_t *p_camelsrt;
GString *error_string;
- p_camelsrt = g_new(struct camelsrt_t,1);
- if(!strncmp(opt_arg,"camel,srt,",9)){
- p_camelsrt->filter=g_strdup(opt_arg+9);
+ p_camelsrt = g_new(struct camelsrt_t, 1);
+ if (!strncmp(opt_arg, "camel,srt,", 9)) {
+ p_camelsrt->filter = g_strdup(opt_arg+9);
} else {
- p_camelsrt->filter=NULL;
+ p_camelsrt->filter = NULL;
}
camelsrt_reset(p_camelsrt);
- error_string=register_tap_listener("CAMEL",
- p_camelsrt,
- p_camelsrt->filter,
- 0,
- NULL,
- camelsrt_packet,
- camelsrt_draw);
+ error_string = register_tap_listener("CAMEL",
+ p_camelsrt,
+ p_camelsrt->filter,
+ 0,
+ NULL,
+ camelsrt_packet,
+ camelsrt_draw);
- if(error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(p_camelsrt->filter);
g_free(p_camelsrt);
fprintf(stderr, "tshark: Couldn't register camel,srt tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -236,8 +236,8 @@ static void camelsrt_init(const char *opt_arg, void* userdata _U_)
* Whereas, with wireshark, it is not possible to have the correct display, if the stats are
* not saved along the analyze
*/
- gtcap_StatSRT=TRUE;
- gcamel_StatSRT=TRUE;
+ gtcap_StatSRT = TRUE;
+ gcamel_StatSRT = TRUE;
}
@@ -246,3 +246,16 @@ register_tap_listener_camelsrt(void)
{
register_stat_cmd_arg("camel,srt", camelsrt_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-comparestat.c b/ui/cli/tap-comparestat.c
index cf208e73f0..00e5104d4c 100644
--- a/ui/cli/tap-comparestat.c
+++ b/ui/cli/tap-comparestat.c
@@ -90,9 +90,9 @@ typedef struct _comparestat_t {
/* to call directly _init */
-static gdouble compare_variance=0.0;
+static gdouble compare_variance = 0.0;
static guint8 compare_start, compare_stop;
-static gboolean TTL_method=TRUE, ON_method=TRUE;
+static gboolean TTL_method = TRUE, ON_method = TRUE;
/* This callback is never used by tshark but it is here for completeness. */
static void
@@ -110,42 +110,42 @@ comparestat_reset(void *dummy _U_)
static int
comparestat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2)
{
- comparestat_t *cs=(comparestat_t *)arg;
- const ws_ip *ci=(const ws_ip *)arg2;
+ comparestat_t *cs = (comparestat_t *)arg;
+ const ws_ip *ci = (const ws_ip *)arg2;
frame_info *fInfo;
vec_t cksum_vec[3];
- guint16 computed_cksum=0;
+ guint16 computed_cksum = 0;
/* so this get filled, usually with the first frame */
- if(cs->eth_dst.len==0) {
- cs->eth_dst=pinfo->dl_dst;
- cs->eth_src=pinfo->dl_src;
+ if (cs->eth_dst.len == 0) {
+ cs->eth_dst = pinfo->dl_dst;
+ cs->eth_src = pinfo->dl_src;
}
/* Set up the fields of the pseudo-header and create checksum */
- cksum_vec[0].ptr=&ci->ip_v_hl;
- cksum_vec[0].len=BYTES;
+ cksum_vec[0].ptr = &ci->ip_v_hl;
+ cksum_vec[0].len = BYTES;
/* skip TTL */
- cksum_vec[1].ptr=&ci->ip_p;
- cksum_vec[1].len=1;
+ cksum_vec[1].ptr = &ci->ip_p;
+ cksum_vec[1].len = 1;
/* skip header checksum and ip's (because of NAT)*/
- cksum_vec[2].ptr=(const guint8 *)ci->ip_dst.data;
- cksum_vec[2].ptr=cksum_vec[2].ptr+ci->ip_dst.len;
+ cksum_vec[2].ptr = (const guint8 *)ci->ip_dst.data;
+ cksum_vec[2].ptr = cksum_vec[2].ptr+ci->ip_dst.len;
/* dynamic computation */
- cksum_vec[2].len=ci->ip_len-20;
- computed_cksum=in_cksum(&cksum_vec[0], 3);
+ cksum_vec[2].len = ci->ip_len-20;
+ computed_cksum = in_cksum(&cksum_vec[0], 3);
/* collect all packet infos */
- fInfo=(frame_info*)se_alloc(sizeof(frame_info));
- fInfo->fp=(for_print*)se_alloc(sizeof(for_print));
- fInfo->fp->partner=NULL;
- fInfo->fp->count=1;
- fInfo->fp->cksum=computed_cksum;
- fInfo->num=pinfo->fd->num;
- fInfo->id=ci->ip_id;
- fInfo->ip_ttl=ci->ip_ttl;
- fInfo->dl_dst=pinfo->dl_dst;
- fInfo->abs_ts=pinfo->fd->abs_ts;
+ fInfo = (frame_info*)se_alloc(sizeof(frame_info));
+ fInfo->fp = (for_print*)se_alloc(sizeof(for_print));
+ fInfo->fp->partner = NULL;
+ fInfo->fp->count = 1;
+ fInfo->fp->cksum = computed_cksum;
+ fInfo->num = pinfo->fd->num;
+ fInfo->id = ci->ip_id;
+ fInfo->ip_ttl = ci->ip_ttl;
+ fInfo->dl_dst = pinfo->dl_dst;
+ fInfo->abs_ts = pinfo->fd->abs_ts;
/* clean memory */
nstime_set_zero(&fInfo->zebra_time);
nstime_set_zero(&fInfo->fp->predecessor_time);
@@ -158,56 +158,56 @@ comparestat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
static void
call_foreach_count_ip_id(gpointer key _U_, gpointer value, gpointer arg)
{
- comparestat_t *cs=(comparestat_t*)arg;
- frame_info *fInfo=(frame_info*)value, *fInfoTemp;
+ comparestat_t *cs = (comparestat_t*)arg;
+ frame_info *fInfo = (frame_info*)value, *fInfoTemp;
nstime_t delta;
guint i;
/* we only need one value out of pinfo we use a temp one */
- packet_info *pinfo=(packet_info*)ep_alloc(sizeof(packet_info));
- pinfo->fd=(frame_data*)ep_alloc(sizeof(frame_data));
+ packet_info *pinfo = (packet_info*)ep_alloc(sizeof(packet_info));
+ pinfo->fd = (frame_data*)ep_alloc(sizeof(frame_data));
pinfo->fd->num = fInfo->num;
- fInfoTemp=(frame_info *)g_hash_table_lookup(cs->ip_id_set, GINT_TO_POINTER((gint)fInfo->id));
- if(fInfoTemp==NULL){
+ fInfoTemp = (frame_info *)g_hash_table_lookup(cs->ip_id_set, GINT_TO_POINTER((gint)fInfo->id));
+ if (fInfoTemp == NULL) {
/* Detect ongoing package loss */
- if((cs->last_hit==FALSE)&&(cs->start_ongoing_hits>compare_start)&&(cs->stop_ongoing_hits<compare_stop)){
+ if ((cs->last_hit == FALSE) && (cs->start_ongoing_hits > compare_start) && (cs->stop_ongoing_hits < compare_stop)) {
cs->stop_ongoing_hits++;
- cs->stop_packet_nr_first=fInfo->num;
- } else if(cs->stop_ongoing_hits<compare_stop){
- cs->stop_ongoing_hits=0;
- cs->stop_packet_nr_first=G_MAXINT32;
+ cs->stop_packet_nr_first = fInfo->num;
+ } else if (cs->stop_ongoing_hits < compare_stop) {
+ cs->stop_ongoing_hits = 0;
+ cs->stop_packet_nr_first = G_MAXINT32;
}
- cs->last_hit=FALSE;
+ cs->last_hit = FALSE;
- fInfo->fp->count=1;
+ fInfo->fp->count = 1;
g_hash_table_insert(cs->ip_id_set, GINT_TO_POINTER((gint)fInfo->id), fInfo);
} else {
/* Detect ongoing package hits, special behavior if start is set to 0 */
- if((cs->last_hit||(compare_start==0))&&(cs->start_ongoing_hits<compare_start||(compare_start==0))){
- if((compare_start==0)&&(cs->start_ongoing_hits!=0)){
+ if ((cs->last_hit || (compare_start == 0)) && (cs->start_ongoing_hits < compare_start || (compare_start == 0))) {
+ if ((compare_start == 0) && (cs->start_ongoing_hits != 0)) {
/* start from the first packet so already set */
} else {
cs->start_ongoing_hits++;
/* Take the lower number */
- cs->start_packet_nr_first=fInfoTemp->num;
- cs->start_packet_nr_second=fInfo->num;
+ cs->start_packet_nr_first = fInfoTemp->num;
+ cs->start_packet_nr_second = fInfo->num;
}
- } else if(cs->start_ongoing_hits<compare_start){
- cs->start_ongoing_hits=0;
- cs->start_packet_nr_first=G_MAXINT32;
+ } else if (cs->start_ongoing_hits < compare_start) {
+ cs->start_ongoing_hits = 0;
+ cs->start_packet_nr_first = G_MAXINT32;
}
- cs->last_hit=TRUE;
+ cs->last_hit = TRUE;
- fInfo->fp->count=fInfoTemp->fp->count + 1;
- if(fInfoTemp->fp->cksum!=fInfo->fp->cksum){
- fInfo->fp->cksum=WRONG_CHKSUM;
- fInfoTemp->fp->cksum=WRONG_CHKSUM;
+ fInfo->fp->count = fInfoTemp->fp->count + 1;
+ if (fInfoTemp->fp->cksum != fInfo->fp->cksum) {
+ fInfo->fp->cksum = WRONG_CHKSUM;
+ fInfoTemp->fp->cksum = WRONG_CHKSUM;
}
/* Add partner */
- fInfo->fp->partner=fInfoTemp;
+ fInfo->fp->partner = fInfoTemp;
/* Create time statistic */
- if(fInfo->fp->count==MERGED_FILES){
+ if (fInfo->fp->count == MERGED_FILES) {
nstime_delta(&delta, &fInfo->abs_ts, &fInfoTemp->abs_ts);
/* Set delta in both packets */
nstime_set_zero(&fInfoTemp->delta);
@@ -220,9 +220,9 @@ call_foreach_count_ip_id(gpointer key _U_, gpointer value, gpointer arg)
}
/* collect TTL's */
- if(TTL_method && (fInfo->num<TTL_SEARCH)){
- for(i=0; i < cs->ip_ttl_list->len; i++){
- if(g_array_index(cs->ip_ttl_list, guint8, i) == fInfo->ip_ttl){
+ if (TTL_method && (fInfo->num < TTL_SEARCH)) {
+ for (i=0; i < cs->ip_ttl_list->len; i++) {
+ if (g_array_index(cs->ip_ttl_list, guint8, i) == fInfo->ip_ttl) {
return;
}
}
@@ -234,125 +234,125 @@ call_foreach_count_ip_id(gpointer key _U_, gpointer value, gpointer arg)
static void
call_foreach_new_order(gpointer key _U_, gpointer value, gpointer arg)
{
- comparestat_t *cs=(comparestat_t*)arg;
- frame_info *fInfo=(frame_info*)value, *fInfoTemp;
+ comparestat_t *cs = (comparestat_t*)arg;
+ frame_info *fInfo = (frame_info*)value, *fInfoTemp;
/* overwrite Info column for new ordering */
- fInfoTemp=(frame_info *)g_hash_table_lookup(cs->nr_set, GINT_TO_POINTER((gint)fInfo->id));
- if(fInfoTemp==NULL){
- if(TTL_method==FALSE){
- if((ADDRESSES_EQUAL(&cs->eth_dst, &fInfo->dl_dst)) || (ADDRESSES_EQUAL(&cs->eth_src, &fInfo->dl_dst))){
+ fInfoTemp = (frame_info *)g_hash_table_lookup(cs->nr_set, GINT_TO_POINTER((gint)fInfo->id));
+ if (fInfoTemp == NULL) {
+ if (TTL_method == FALSE) {
+ if ((ADDRESSES_EQUAL(&cs->eth_dst, &fInfo->dl_dst)) || (ADDRESSES_EQUAL(&cs->eth_src, &fInfo->dl_dst))) {
g_hash_table_insert(cs->nr_set, GINT_TO_POINTER((gint)fInfo->id), fInfo);
- fInfo->zebra_time=cs->zebra_time;
- cs->zebra_time.nsecs=cs->zebra_time.nsecs + MERGED_FILES;
+ fInfo->zebra_time = cs->zebra_time;
+ cs->zebra_time.nsecs = cs->zebra_time.nsecs + MERGED_FILES;
} else {
cs->zebra_time.nsecs++;
g_hash_table_insert(cs->nr_set, GINT_TO_POINTER((gint)fInfo->id), fInfo);
- fInfo->zebra_time=cs->zebra_time;
+ fInfo->zebra_time = cs->zebra_time;
cs->zebra_time.nsecs++;
}
} else {
- if((g_array_index(cs->ip_ttl_list, guint8, 0)==fInfo->ip_ttl) || (g_array_index(cs->ip_ttl_list, guint8, 1)==fInfo->ip_ttl)){
+ if ((g_array_index(cs->ip_ttl_list, guint8, 0) == fInfo->ip_ttl) || (g_array_index(cs->ip_ttl_list, guint8, 1) == fInfo->ip_ttl)) {
g_hash_table_insert(cs->nr_set, GINT_TO_POINTER((gint)fInfo->id), fInfo);
- fInfo->zebra_time=cs->zebra_time;
- cs->zebra_time.nsecs=cs->zebra_time.nsecs + MERGED_FILES;
+ fInfo->zebra_time = cs->zebra_time;
+ cs->zebra_time.nsecs = cs->zebra_time.nsecs + MERGED_FILES;
} else {
cs->zebra_time.nsecs++;
g_hash_table_insert(cs->nr_set, GINT_TO_POINTER((gint)fInfo->id), fInfo);
- fInfo->zebra_time=cs->zebra_time;
+ fInfo->zebra_time = cs->zebra_time;
cs->zebra_time.nsecs++;
}
}
} else {
- if(TTL_method==FALSE){
- if(((ADDRESSES_EQUAL(&cs->eth_dst, &fInfo->dl_dst)) || (ADDRESSES_EQUAL(&cs->eth_src, &fInfo->dl_dst)))&&(!fmod(fInfoTemp->zebra_time.nsecs,MERGED_FILES))){
- fInfo->zebra_time.nsecs=fInfoTemp->zebra_time.nsecs;
+ if (TTL_method == FALSE) {
+ if (((ADDRESSES_EQUAL(&cs->eth_dst, &fInfo->dl_dst)) || (ADDRESSES_EQUAL(&cs->eth_src, &fInfo->dl_dst))) && (!fmod(fInfoTemp->zebra_time.nsecs, MERGED_FILES))) {
+ fInfo->zebra_time.nsecs = fInfoTemp->zebra_time.nsecs;
} else {
- fInfo->zebra_time.nsecs=fInfoTemp->zebra_time.nsecs+1;
+ fInfo->zebra_time.nsecs = fInfoTemp->zebra_time.nsecs+1;
}
} else {
- if(((g_array_index(cs->ip_ttl_list, guint8, 0)==fInfo->ip_ttl) || (g_array_index(cs->ip_ttl_list, guint8, 1)==fInfo->ip_ttl))&&(!fmod(fInfoTemp->zebra_time.nsecs,MERGED_FILES))){
- fInfo->zebra_time.nsecs=fInfoTemp->zebra_time.nsecs;
+ if (((g_array_index(cs->ip_ttl_list, guint8, 0) == fInfo->ip_ttl) || (g_array_index(cs->ip_ttl_list, guint8, 1) == fInfo->ip_ttl)) && (!fmod(fInfoTemp->zebra_time.nsecs, MERGED_FILES))) {
+ fInfo->zebra_time.nsecs = fInfoTemp->zebra_time.nsecs;
} else {
- fInfo->zebra_time.nsecs=fInfoTemp->zebra_time.nsecs+1;
+ fInfo->zebra_time.nsecs = fInfoTemp->zebra_time.nsecs+1;
}
}
}
/* count packets of file */
- if(fmod(fInfo->zebra_time.nsecs, MERGED_FILES)){
+ if (fmod(fInfo->zebra_time.nsecs, MERGED_FILES)) {
cs->first_file_amount++;
} else {
cs->second_file_amount++;
}
/* ordering */
- if(!nstime_is_unset(&cs->current_time)){
- fInfo->fp->predecessor_time.nsecs=cs->current_time.nsecs;
+ if (!nstime_is_unset(&cs->current_time)) {
+ fInfo->fp->predecessor_time.nsecs = cs->current_time.nsecs;
}
- cs->current_time.nsecs=fInfo->zebra_time.nsecs;
+ cs->current_time.nsecs = fInfo->zebra_time.nsecs;
}
/* calculate scopes if not set yet */
static void
call_foreach_merge_settings(gpointer key _U_, gpointer value, gpointer arg)
{
- comparestat_t *cs=(comparestat_t*)arg;
- frame_info *fInfo=(frame_info*)value, *fInfoTemp=NULL;
- guint32 tot_packet_amount=cs->first_file_amount+cs->second_file_amount, swap;
+ comparestat_t *cs = (comparestat_t*)arg;
+ frame_info *fInfo = (frame_info*)value, *fInfoTemp = NULL;
+ guint32 tot_packet_amount = cs->first_file_amount+cs->second_file_amount, swap;
- if((fInfo->num==tot_packet_amount)&&(cs->stop_packet_nr_first!=G_MAXINT32)){
+ if ((fInfo->num == tot_packet_amount) && (cs->stop_packet_nr_first != G_MAXINT32)) {
/* calculate missing stop number */
- swap=cs->stop_packet_nr_first;
- cs->stop_packet_nr_first=tot_packet_amount-cs->second_file_amount;
- cs->stop_packet_nr_second=swap;
+ swap = cs->stop_packet_nr_first;
+ cs->stop_packet_nr_first = tot_packet_amount-cs->second_file_amount;
+ cs->stop_packet_nr_second = swap;
}
- if((fInfo->num==tot_packet_amount)&&(cs->stop_packet_nr_first==G_MAXINT32)&&(cs->start_packet_nr_first!=G_MAXINT32)){
- fInfoTemp=(frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->start_packet_nr_first));
- if(fInfoTemp==NULL){
+ if ((fInfo->num == tot_packet_amount) && (cs->stop_packet_nr_first == G_MAXINT32) && (cs->start_packet_nr_first != G_MAXINT32)) {
+ fInfoTemp = (frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->start_packet_nr_first));
+ if (fInfoTemp == NULL) {
printf("ERROR: start number not set correctly\n");
return;
}
- if(fmod(fInfoTemp->zebra_time.nsecs, 2)){
+ if (fmod(fInfoTemp->zebra_time.nsecs, 2)) {
/*first file*/
- cs->stop_packet_nr_first=cs->start_packet_nr_first+(cs->second_file_amount-(cs->start_packet_nr_second-cs->first_file_amount));
- if(cs->stop_packet_nr_first>(tot_packet_amount-cs->second_file_amount)){
- cs->stop_packet_nr_first=tot_packet_amount-cs->second_file_amount;
+ cs->stop_packet_nr_first = cs->start_packet_nr_first+(cs->second_file_amount-(cs->start_packet_nr_second-cs->first_file_amount));
+ if (cs->stop_packet_nr_first > (tot_packet_amount-cs->second_file_amount)) {
+ cs->stop_packet_nr_first = tot_packet_amount-cs->second_file_amount;
}
/*this only happens if we have too many MAC's or TTL*/
- if(cs->stop_packet_nr_first>cs->start_packet_nr_second){
- cs->stop_packet_nr_first=cs->start_packet_nr_second-1;
+ if (cs->stop_packet_nr_first > cs->start_packet_nr_second) {
+ cs->stop_packet_nr_first = cs->start_packet_nr_second-1;
}
- fInfoTemp=(frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
- while((fInfoTemp!=NULL)?fmod(!fInfoTemp->zebra_time.nsecs, 2):TRUE){
+ fInfoTemp = (frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
+ while ((fInfoTemp != NULL) ? fmod(!fInfoTemp->zebra_time.nsecs, 2) : TRUE) {
cs->stop_packet_nr_first--;
- fInfoTemp=(frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
+ fInfoTemp = (frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
}
} else {
/*this only happens if we have too many MAC's or TTL*/
- cs->stop_packet_nr_first=cs->first_file_amount+cs->start_packet_nr_first;
- if(cs->stop_packet_nr_first>tot_packet_amount-cs->first_file_amount){
- cs->stop_packet_nr_first=tot_packet_amount-cs->first_file_amount;
+ cs->stop_packet_nr_first = cs->first_file_amount+cs->start_packet_nr_first;
+ if (cs->stop_packet_nr_first > tot_packet_amount-cs->first_file_amount) {
+ cs->stop_packet_nr_first = tot_packet_amount-cs->first_file_amount;
}
- fInfoTemp=(frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
- while((fInfoTemp!=NULL)?fmod(fInfoTemp->zebra_time.nsecs, 2):TRUE){
+ fInfoTemp = (frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
+ while ((fInfoTemp != NULL) ? fmod(fInfoTemp->zebra_time.nsecs, 2) : TRUE) {
cs->stop_packet_nr_first--;
- fInfoTemp=(frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
+ fInfoTemp = (frame_info *)g_hash_table_lookup(cs->packet_set, GINT_TO_POINTER(cs->stop_packet_nr_first));
}
}
/* set second stop location */
- cs->stop_packet_nr_second=cs->start_packet_nr_second+(cs->stop_packet_nr_first-cs->start_packet_nr_first);
- if(cs->stop_packet_nr_second>tot_packet_amount){
- cs->stop_packet_nr_second=tot_packet_amount;
+ cs->stop_packet_nr_second = cs->start_packet_nr_second+(cs->stop_packet_nr_first-cs->start_packet_nr_first);
+ if (cs->stop_packet_nr_second > tot_packet_amount) {
+ cs->stop_packet_nr_second = tot_packet_amount;
}
}
/* no start found */
- if(fInfo->num==tot_packet_amount&&compare_start!=0&&compare_stop!=0){
- if(cs->start_packet_nr_first==G_MAXINT32){
+ if (fInfo->num == tot_packet_amount && compare_start != 0 && compare_stop != 0) {
+ if (cs->start_packet_nr_first == G_MAXINT32) {
printf("Start point couldn't be set, choose a lower compare start");
}
}
@@ -361,58 +361,58 @@ call_foreach_merge_settings(gpointer key _U_, gpointer value, gpointer arg)
static void
call_foreach_print_ip_tree(gpointer key _U_, gpointer value, gpointer user_data)
{
- frame_info *fInfo=(frame_info*)value;
- comparestat_t *cs=(comparestat_t*)user_data;
+ frame_info *fInfo = (frame_info*)value;
+ comparestat_t *cs = (comparestat_t*)user_data;
gdouble delta, average;
- gboolean show_it=FALSE;
+ gboolean show_it = FALSE;
- delta=fabs(get_average(&fInfo->delta,1));
- average=fabs(get_average(&cs->stats.tot, cs->stats.num));
+ delta = fabs(get_average(&fInfo->delta, 1));
+ average = fabs(get_average(&cs->stats.tot, cs->stats.num));
/* special case if both are set to zero ignore start and stop numbering */
- if(compare_start!=0&&compare_stop!=0){
+ if (compare_start != 0 && compare_stop != 0) {
/* check out if packet is in searched scope */
- if((cs->start_packet_nr_first<fInfo->num)&&(cs->stop_packet_nr_first>fInfo->num)){
- show_it=TRUE;
+ if ((cs->start_packet_nr_first < fInfo->num)&&(cs->stop_packet_nr_first > fInfo->num)) {
+ show_it = TRUE;
} else {
/* so we won't miss the other file */
- if((fInfo->num>cs->start_packet_nr_second)&&(fInfo->num<cs->stop_packet_nr_second)){
- show_it=TRUE;
+ if ((fInfo->num > cs->start_packet_nr_second)&&(fInfo->num < cs->stop_packet_nr_second)) {
+ show_it = TRUE;
}
}
} else {
- show_it=TRUE;
+ show_it = TRUE;
}
- if(show_it){
- if(fInfo->fp->count < MERGED_FILES){
+ if (show_it) {
+ if (fInfo->fp->count < MERGED_FILES) {
printf("Packet id :%i, count:%i Problem:", fInfo->id, fInfo->fp->count);
printf("Packet lost\n");
}
- if(fInfo->fp->count > MERGED_FILES){
+ if (fInfo->fp->count > MERGED_FILES) {
printf("Packet id :%i, count:%i Problem:", fInfo->id, fInfo->fp->count);
printf("More than two packets\n");
- if(fInfo->fp->cksum == WRONG_CHKSUM){
+ if (fInfo->fp->cksum == WRONG_CHKSUM) {
printf("Checksum error over IP header\n");
}
}
- if(fInfo->fp->count == MERGED_FILES){
- if(fInfo->fp->cksum == WRONG_CHKSUM){
+ if (fInfo->fp->count == MERGED_FILES) {
+ if (fInfo->fp->cksum == WRONG_CHKSUM) {
printf("Packet id :%i, count:%i Problem:", fInfo->id, fInfo->fp->count);
printf("Checksum error over IP header\n");
- if(((delta < (average-cs->stats.variance)) || (delta > (average+cs->stats.variance))) && (delta > 0.0) && (cs->stats.variance!=0)){
+ if (((delta < (average-cs->stats.variance)) || (delta > (average+cs->stats.variance))) && (delta > 0.0) && (cs->stats.variance != 0)) {
printf("Not arrived in time\n");
}
- if((nstime_cmp(&fInfo->fp->predecessor_time, &fInfo->zebra_time)>0||nstime_cmp(&fInfo->fp->partner->fp->predecessor_time, &fInfo->fp->partner->zebra_time)>0) && (fInfo->zebra_time.nsecs!=MERGED_FILES) && ON_method){
+ if ((nstime_cmp(&fInfo->fp->predecessor_time, &fInfo->zebra_time) > 0||nstime_cmp(&fInfo->fp->partner->fp->predecessor_time, &fInfo->fp->partner->zebra_time) > 0) && (fInfo->zebra_time.nsecs != MERGED_FILES) && ON_method) {
printf("Not correct order\n");
}
- } else if(((delta < (average-cs->stats.variance)) || (delta > (average+cs->stats.variance))) && (delta > 0.0) && (cs->stats.variance!=0)) {
+ } else if (((delta < (average-cs->stats.variance)) || (delta > (average+cs->stats.variance))) && (delta > 0.0) && (cs->stats.variance != 0)) {
printf("Packet id :%i, count:%i Problem:", fInfo->id, fInfo->fp->count);
printf("Package not arrived in time\n");
- if((nstime_cmp(&fInfo->fp->predecessor_time, &fInfo->zebra_time)>0||nstime_cmp(&fInfo->fp->partner->fp->predecessor_time, &fInfo->fp->partner->zebra_time)>0) && fInfo->zebra_time.nsecs != MERGED_FILES && ON_method){
+ if ((nstime_cmp(&fInfo->fp->predecessor_time, &fInfo->zebra_time) > 0 || nstime_cmp(&fInfo->fp->partner->fp->predecessor_time, &fInfo->fp->partner->zebra_time) > 0) && fInfo->zebra_time.nsecs != MERGED_FILES && ON_method) {
printf("Not correct order\n");
}
- } else if((nstime_cmp(&fInfo->fp->predecessor_time, &fInfo->zebra_time)>0||nstime_cmp(&fInfo->fp->partner->fp->predecessor_time, &fInfo->fp->partner->zebra_time)>0) && fInfo->zebra_time.nsecs != MERGED_FILES && ON_method){
+ } else if ((nstime_cmp(&fInfo->fp->predecessor_time, &fInfo->zebra_time) > 0 || nstime_cmp(&fInfo->fp->partner->fp->predecessor_time, &fInfo->fp->partner->zebra_time) > 0) && fInfo->zebra_time.nsecs != MERGED_FILES && ON_method) {
printf("Packet id :%i, count:%i Problem:", fInfo->id, fInfo->fp->count);
printf("Not correct order\n");
}
@@ -435,49 +435,49 @@ call_foreach_print_ip_tree(gpointer key _U_, gpointer value, gpointer user_data)
static void
comparestat_draw(void *prs)
{
- comparestat_t *cs=(comparestat_t *)prs;
+ comparestat_t *cs = (comparestat_t *)prs;
GString *filter_str = g_string_new("");
const gchar *statis_string;
guint32 first_file_amount, second_file_amount;
/* initial steps, clear all data before start*/
- cs->zebra_time.secs=0;
- cs->zebra_time.nsecs=1;
+ cs->zebra_time.secs = 0;
+ cs->zebra_time.nsecs = 1;
nstime_set_unset(&cs->current_time);
- cs->ip_ttl_list=g_array_new(FALSE, FALSE, sizeof(guint8));
- cs->last_hit=FALSE;
- cs->start_ongoing_hits=0;
- cs->stop_ongoing_hits=0;
- cs->start_packet_nr_first=G_MAXINT32;
- cs->start_packet_nr_second=G_MAXINT32;
- cs->stop_packet_nr_first=G_MAXINT32;
- cs->stop_packet_nr_second=G_MAXINT32;
- cs->first_file_amount=0;
- cs->second_file_amount=0;
+ cs->ip_ttl_list = g_array_new(FALSE, FALSE, sizeof(guint8));
+ cs->last_hit = FALSE;
+ cs->start_ongoing_hits = 0;
+ cs->stop_ongoing_hits = 0;
+ cs->start_packet_nr_first = G_MAXINT32;
+ cs->start_packet_nr_second = G_MAXINT32;
+ cs->stop_packet_nr_first = G_MAXINT32;
+ cs->stop_packet_nr_second = G_MAXINT32;
+ cs->first_file_amount = 0;
+ cs->second_file_amount = 0;
time_stat_init(&cs->stats);
- cs->ip_id_set=g_hash_table_new(NULL, NULL);
+ cs->ip_id_set = g_hash_table_new(NULL, NULL);
g_hash_table_foreach(cs->packet_set, call_foreach_count_ip_id, cs);
/* set up TTL choice if only one number found */
- if(TTL_method&&cs->ip_ttl_list->len==1){
+ if (TTL_method&&cs->ip_ttl_list->len == 1) {
g_array_append_val(cs->ip_ttl_list, g_array_index(cs->ip_ttl_list, guint8, 1));
}
- g_hash_table_foreach(cs->packet_set, call_foreach_new_order,cs);
+ g_hash_table_foreach(cs->packet_set, call_foreach_new_order, cs);
g_hash_table_foreach(cs->packet_set, call_foreach_merge_settings, cs);
/* remembering file amounts */
- first_file_amount=cs->first_file_amount;
- second_file_amount=cs->second_file_amount;
+ first_file_amount = cs->first_file_amount;
+ second_file_amount = cs->second_file_amount;
/* reset after numbering */
g_hash_table_remove_all(cs->nr_set);
/* Variance */
- cs->stats.variance=compare_variance;
+ cs->stats.variance = compare_variance;
/* add statistic string */
- statis_string=g_strdup_printf("Compare Statistics: \nFilter: %s\nNumber of packets total:%i 1st file:%i, 2nd file:%i\nScopes:\t start:%i stop:%i\nand:\t start:%i stop:%i\nEqual packets: %i \nAllowed variation: %f \nAverage time difference: %f\n", cs->filter ? cs->filter : "", (first_file_amount+second_file_amount), first_file_amount, second_file_amount, cs->start_packet_nr_first, cs->stop_packet_nr_first, cs->start_packet_nr_second, cs->stop_packet_nr_second, cs->stats.num, cs->stats.variance, fabs(get_average(&cs->stats.tot, cs->stats.num)));
+ statis_string = g_strdup_printf("Compare Statistics: \nFilter: %s\nNumber of packets total:%i 1st file:%i, 2nd file:%i\nScopes:\t start:%i stop:%i\nand:\t start:%i stop:%i\nEqual packets: %i \nAllowed variation: %f \nAverage time difference: %f\n", cs->filter ? cs->filter : "", (first_file_amount+second_file_amount), first_file_amount, second_file_amount, cs->start_packet_nr_first, cs->stop_packet_nr_first, cs->start_packet_nr_second, cs->stop_packet_nr_second, cs->stats.num, cs->stats.variance, fabs(get_average(&cs->stats.tot, cs->stats.num)));
printf("\n");
printf("===================================================================\n");
@@ -495,62 +495,62 @@ comparestat_draw(void *prs)
* new instance for the compare tap.
*/
static void
-comparestat_init(const char *opt_arg, void* userdata _U_)
+comparestat_init(const char *opt_arg, void *userdata _U_)
{
comparestat_t *cs;
- const char *filter=NULL;
+ const char *filter = NULL;
GString *error_string;
- gint start, stop,ttl, order, pos=0;
+ gint start, stop, ttl, order, pos = 0;
gdouble variance;
- if(sscanf(opt_arg,"compare,%d,%d,%d,%d,%lf%n",&start, &stop, &ttl, &order, &variance, &pos)==5){
- if(pos){
- if(*(opt_arg+pos)==',')
- filter=opt_arg+pos+1;
+ if (sscanf(opt_arg, "compare,%d,%d,%d,%d,%lf%n", &start, &stop, &ttl, &order, &variance, &pos) == 5) {
+ if (pos) {
+ if (*(opt_arg+pos) == ',')
+ filter = opt_arg+pos+1;
else
- filter=opt_arg+pos;
+ filter = opt_arg+pos;
} else {
- filter=NULL;
+ filter = NULL;
}
} else {
fprintf(stderr, "tshark: invalid \"-z compare,<start>,<stop>,<ttl[0|1]>,<order[0|1]>,<variance>[,<filter>]\" argument\n");
exit(1);
}
- compare_variance=variance;
- compare_start=start;
- compare_stop=stop;
- TTL_method=ttl;
- ON_method=order;
+ compare_variance = variance;
+ compare_start = start;
+ compare_stop = stop;
+ TTL_method = ttl;
+ ON_method = order;
- cs=g_new(comparestat_t,1);
+ cs = g_new(comparestat_t, 1);
nstime_set_unset(&cs->current_time);
- cs->ip_ttl_list=g_array_new(FALSE, FALSE, sizeof(guint8));
- cs->last_hit=FALSE;
- cs->start_ongoing_hits=0;
- cs->stop_ongoing_hits=0;
- cs->start_packet_nr_first=G_MAXINT32;
- cs->start_packet_nr_second=G_MAXINT32;
- cs->stop_packet_nr_first=G_MAXINT32;
- cs->stop_packet_nr_second=G_MAXINT32;
- cs->first_file_amount=0;
- cs->second_file_amount=0;
-
- cs->zebra_time.secs=0;
- cs->zebra_time.nsecs=1;
- cs->nr_set=g_hash_table_new(NULL, NULL);
-
- if(filter){
- cs->filter=g_strdup(filter);
+ cs->ip_ttl_list = g_array_new(FALSE, FALSE, sizeof(guint8));
+ cs->last_hit = FALSE;
+ cs->start_ongoing_hits = 0;
+ cs->stop_ongoing_hits = 0;
+ cs->start_packet_nr_first = G_MAXINT32;
+ cs->start_packet_nr_second = G_MAXINT32;
+ cs->stop_packet_nr_first = G_MAXINT32;
+ cs->stop_packet_nr_second = G_MAXINT32;
+ cs->first_file_amount = 0;
+ cs->second_file_amount = 0;
+
+ cs->zebra_time.secs = 0;
+ cs->zebra_time.nsecs = 1;
+ cs->nr_set = g_hash_table_new(NULL, NULL);
+
+ if (filter) {
+ cs->filter = g_strdup(filter);
} else {
- cs->filter=NULL;
+ cs->filter = NULL;
}
/* create a Hash to count the packets with the same ip.id */
- cs->packet_set=g_hash_table_new(NULL, NULL);
+ cs->packet_set = g_hash_table_new(NULL, NULL);
- error_string=register_tap_listener("ip", cs, filter, 0, comparestat_reset, comparestat_packet, comparestat_draw);
- if(error_string){
+ error_string = register_tap_listener("ip", cs, filter, 0, comparestat_reset, comparestat_packet, comparestat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(cs->filter);
g_hash_table_destroy(cs->packet_set);
@@ -566,7 +566,7 @@ comparestat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_comparestat(void)
{
- register_stat_cmd_arg("compare,", comparestat_init,NULL);
+ register_stat_cmd_arg("compare,", comparestat_init, NULL);
}
/*
diff --git a/ui/cli/tap-dcerpcstat.c b/ui/cli/tap-dcerpcstat.c
index 19535949e0..80c973fa27 100644
--- a/ui/cli/tap-dcerpcstat.c
+++ b/ui/cli/tap-dcerpcstat.c
@@ -60,76 +60,76 @@ typedef struct _rpcstat_t {
static int
dcerpcstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri)
{
- const dcerpc_info *ri=(const dcerpc_info *)pri;
- rpcstat_t *rs=(rpcstat_t *)prs;
+ const dcerpc_info *ri = (const dcerpc_info *)pri;
+ rpcstat_t *rs = (rpcstat_t *)prs;
nstime_t delta;
rpc_procedure_t *rp;
- if(!ri->call_data){
+ if (!ri->call_data) {
return 0;
}
- if(!ri->call_data->req_frame){
+ if (!ri->call_data->req_frame) {
/* we have not seen the request so we don't know the delta*/
return 0;
}
- if(ri->call_data->opnum>=rs->num_procedures){
+ if (ri->call_data->opnum >= rs->num_procedures) {
/* don't handle this since its outside of known table */
return 0;
}
/* we are only interested in reply packets */
- if(ri->ptype != PDU_RESP){
+ if (ri->ptype != PDU_RESP) {
return 0;
}
/* we are only interested in certain program/versions */
- if( (ri->call_data->uuid.Data1!=rs->uuid.Data1)
- ||(ri->call_data->uuid.Data2!=rs->uuid.Data2)
- ||(ri->call_data->uuid.Data3!=rs->uuid.Data3)
- ||(ri->call_data->uuid.Data4[0]!=rs->uuid.Data4[0])
- ||(ri->call_data->uuid.Data4[1]!=rs->uuid.Data4[1])
- ||(ri->call_data->uuid.Data4[2]!=rs->uuid.Data4[2])
- ||(ri->call_data->uuid.Data4[3]!=rs->uuid.Data4[3])
- ||(ri->call_data->uuid.Data4[4]!=rs->uuid.Data4[4])
- ||(ri->call_data->uuid.Data4[5]!=rs->uuid.Data4[5])
- ||(ri->call_data->uuid.Data4[6]!=rs->uuid.Data4[6])
- ||(ri->call_data->uuid.Data4[7]!=rs->uuid.Data4[7])
- ||(ri->call_data->ver!=rs->ver)){
+ if ( (ri->call_data->uuid.Data1 != rs->uuid.Data1)
+ || (ri->call_data->uuid.Data2 != rs->uuid.Data2)
+ || (ri->call_data->uuid.Data3 != rs->uuid.Data3)
+ || (ri->call_data->uuid.Data4[0] != rs->uuid.Data4[0])
+ || (ri->call_data->uuid.Data4[1] != rs->uuid.Data4[1])
+ || (ri->call_data->uuid.Data4[2] != rs->uuid.Data4[2])
+ || (ri->call_data->uuid.Data4[3] != rs->uuid.Data4[3])
+ || (ri->call_data->uuid.Data4[4] != rs->uuid.Data4[4])
+ || (ri->call_data->uuid.Data4[5] != rs->uuid.Data4[5])
+ || (ri->call_data->uuid.Data4[6] != rs->uuid.Data4[6])
+ || (ri->call_data->uuid.Data4[7] != rs->uuid.Data4[7])
+ || (ri->call_data->ver != rs->ver)) {
return 0;
}
- rp=&(rs->procedures[ri->call_data->opnum]);
+ rp = &(rs->procedures[ri->call_data->opnum]);
/* calculate time delta between request and reply */
nstime_delta(&delta, &pinfo->fd->abs_ts, &ri->call_data->req_time);
- if(rp->num==0){
- rp->max.secs=delta.secs;
- rp->max.nsecs=delta.nsecs;
+ if (rp->num == 0) {
+ rp->max.secs = delta.secs;
+ rp->max.nsecs = delta.nsecs;
}
- if(rp->num==0){
- rp->min.secs=delta.secs;
- rp->min.nsecs=delta.nsecs;
+ if (rp->num == 0) {
+ rp->min.secs = delta.secs;
+ rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs<rp->min.secs)
- ||( (delta.secs==rp->min.secs)
- &&(delta.nsecs<rp->min.nsecs) ) ){
- rp->min.secs=delta.secs;
- rp->min.nsecs=delta.nsecs;
+ if ( (delta.secs < rp->min.secs)
+ || ( (delta.secs == rp->min.secs)
+ && (delta.nsecs < rp->min.nsecs) ) ) {
+ rp->min.secs = delta.secs;
+ rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs>rp->max.secs)
- ||( (delta.secs==rp->max.secs)
- &&(delta.nsecs>rp->max.nsecs) ) ){
- rp->max.secs=delta.secs;
- rp->max.nsecs=delta.nsecs;
+ if ( (delta.secs > rp->max.secs)
+ || ( (delta.secs == rp->max.secs)
+ && (delta.nsecs > rp->max.nsecs) ) ) {
+ rp->max.secs = delta.secs;
+ rp->max.nsecs = delta.nsecs;
}
- rp->tot.secs += delta.secs;
+ rp->tot.secs += delta.secs;
rp->tot.nsecs += delta.nsecs;
- if(rp->tot.nsecs > NANOSECS_PER_SEC){
+ if (rp->tot.nsecs > NANOSECS_PER_SEC) {
rp->tot.nsecs -= NANOSECS_PER_SEC;
rp->tot.secs++;
}
@@ -142,18 +142,18 @@ dcerpcstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const
static void
dcerpcstat_draw(void *prs)
{
- rpcstat_t *rs=(rpcstat_t *)prs;
+ rpcstat_t *rs = (rpcstat_t *)prs;
guint32 i;
guint64 td;
printf("\n");
printf("=======================================================================\n");
printf("%s Major Version %u SRT Statistics:\n", rs->prog, rs->ver);
- printf("Filter: %s\n",rs->filter?rs->filter:"");
+ printf("Filter: %s\n",rs->filter ? rs->filter : "");
printf("Procedure Calls Min SRT Max SRT Avg SRT\n");
- for(i=0;i<rs->num_procedures;i++){
+ for (i=0; i<rs->num_procedures; i++) {
/* Only display procs with non-zero calls */
- if(rs->procedures[i].num==0){
+ if (rs->procedures[i].num == 0) {
continue;
}
/* Scale the average SRT in units of 1us and round to the nearest us. */
@@ -161,11 +161,11 @@ dcerpcstat_draw(void *prs)
td = ((td / rs->procedures[i].num) + 500) / 1000;
printf("%-31s %6d %3d.%06d %3d.%06d %3" G_GINT64_MODIFIER "u.%06" G_GINT64_MODIFIER "u\n",
- rs->procedures[i].proc,
- rs->procedures[i].num,
- (int)(rs->procedures[i].min.secs),(rs->procedures[i].min.nsecs+500)/1000,
- (int)(rs->procedures[i].max.secs),(rs->procedures[i].max.nsecs+500)/1000,
- td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
+ rs->procedures[i].proc,
+ rs->procedures[i].num,
+ (int)(rs->procedures[i].min.secs), (rs->procedures[i].min.nsecs+500)/1000,
+ (int)(rs->procedures[i].max.secs), (rs->procedures[i].max.nsecs+500)/1000,
+ td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
);
}
printf("=======================================================================\n");
@@ -174,18 +174,18 @@ dcerpcstat_draw(void *prs)
static void
-dcerpcstat_init(const char *opt_arg, void* userdata _U_)
+dcerpcstat_init(const char *opt_arg, void *userdata _U_)
{
rpcstat_t *rs;
guint32 i, max_procs;
dcerpc_sub_dissector *procs;
e_uuid_t uuid;
- guint d1,d2,d3,d40,d41,d42,d43,d44,d45,d46,d47;
+ guint d1, d2, d3, d40, d41, d42, d43, d44, d45, d46, d47;
int major, minor;
guint16 ver;
- int pos=0;
- const char *filter=NULL;
- GString *error_string;
+ int pos = 0;
+ const char *filter = NULL;
+ GString *error_string;
/*
* XXX - DCE RPC statistics are maintained only by major version,
@@ -199,83 +199,83 @@ dcerpcstat_init(const char *opt_arg, void* userdata _U_)
* report aggregate statistics for all minor version numbers
* if it's omitted?
*/
- if(sscanf(opt_arg,
+ if (sscanf(opt_arg,
"dcerpc,srt,%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x,%d.%d%n",
- &d1,&d2,&d3,&d40,&d41,&d42,&d43,&d44,&d45,&d46,&d47,
- &major,&minor,&pos)==13){
- uuid.Data1=d1;
- uuid.Data2=d2;
- uuid.Data3=d3;
- uuid.Data4[0]=d40;
- uuid.Data4[1]=d41;
- uuid.Data4[2]=d42;
- uuid.Data4[3]=d43;
- uuid.Data4[4]=d44;
- uuid.Data4[5]=d45;
- uuid.Data4[6]=d46;
- uuid.Data4[7]=d47;
- if(pos){
- filter=opt_arg+pos;
+ &d1, &d2, &d3, &d40, &d41, &d42, &d43, &d44, &d45, &d46, &d47,
+ &major, &minor, &pos) == 13) {
+ uuid.Data1 = d1;
+ uuid.Data2 = d2;
+ uuid.Data3 = d3;
+ uuid.Data4[0] = d40;
+ uuid.Data4[1] = d41;
+ uuid.Data4[2] = d42;
+ uuid.Data4[3] = d43;
+ uuid.Data4[4] = d44;
+ uuid.Data4[5] = d45;
+ uuid.Data4[6] = d46;
+ uuid.Data4[7] = d47;
+ if (pos) {
+ filter = opt_arg+pos;
} else {
- filter=NULL;
+ filter = NULL;
}
} else {
fprintf(stderr, "tshark: invalid \"-z dcerpc,srt,<uuid>,<major version>.<minor version>[,<filter>]\" argument\n");
exit(1);
}
if (major < 0 || major > 65535) {
- fprintf(stderr,"tshark: dcerpcstat_init() Major version number %d is invalid - must be positive and <= 65535\n", major);
+ fprintf(stderr, "tshark: dcerpcstat_init() Major version number %d is invalid - must be positive and <= 65535\n", major);
exit(1);
}
if (minor < 0 || minor > 65535) {
- fprintf(stderr,"tshark: dcerpcstat_init() Minor version number %d is invalid - must be positive and <= 65535\n", minor);
+ fprintf(stderr, "tshark: dcerpcstat_init() Minor version number %d is invalid - must be positive and <= 65535\n", minor);
exit(1);
}
ver = major;
- rs=g_new(rpcstat_t,1);
- rs->prog=dcerpc_get_proto_name(&uuid, ver);
- if(!rs->prog){
+ rs = g_new(rpcstat_t, 1);
+ rs->prog = dcerpc_get_proto_name(&uuid, ver);
+ if (!rs->prog) {
g_free(rs);
- fprintf(stderr,"tshark: dcerpcstat_init() Protocol with uuid:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x v%u not supported\n",uuid.Data1,uuid.Data2,uuid.Data3,uuid.Data4[0],uuid.Data4[1],uuid.Data4[2],uuid.Data4[3],uuid.Data4[4],uuid.Data4[5],uuid.Data4[6],uuid.Data4[7],ver);
+ fprintf(stderr, "tshark: dcerpcstat_init() Protocol with uuid:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x v%u not supported\n", uuid.Data1, uuid.Data2, uuid.Data3, uuid.Data4[0], uuid.Data4[1], uuid.Data4[2], uuid.Data4[3], uuid.Data4[4], uuid.Data4[5], uuid.Data4[6], uuid.Data4[7], ver);
exit(1);
}
- procs=dcerpc_get_proto_sub_dissector(&uuid, ver);
- rs->uuid=uuid;
- rs->ver=ver;
+ procs = dcerpc_get_proto_sub_dissector(&uuid, ver);
+ rs->uuid = uuid;
+ rs->ver = ver;
- if(filter){
- rs->filter=g_strdup(filter);
+ if (filter) {
+ rs->filter = g_strdup(filter);
} else {
- rs->filter=NULL;
+ rs->filter = NULL;
}
- for(i=0,max_procs=0;procs[i].name;i++){
- if(procs[i].num>max_procs){
- max_procs=procs[i].num;
+ for (i=0,max_procs=0; procs[i].name; i++) {
+ if (procs[i].num > max_procs) {
+ max_procs = procs[i].num;
}
}
- rs->num_procedures=max_procs+1;
- rs->procedures=(rpc_procedure_t *)g_malloc(sizeof(rpc_procedure_t)*(rs->num_procedures+1));
- for(i=0;i<rs->num_procedures;i++){
+ rs->num_procedures = max_procs+1;
+ rs->procedures = (rpc_procedure_t *)g_malloc(sizeof(rpc_procedure_t)*(rs->num_procedures+1));
+ for (i=0; i<rs->num_procedures; i++) {
int j;
- rs->procedures[i].proc="unknown";
- for(j=0;procs[j].name;j++){
- if(procs[j].num==i){
- rs->procedures[i].proc=procs[j].name;
+ rs->procedures[i].proc = "unknown";
+ for (j=0; procs[j].name; j++) {
+ if (procs[j].num == i) {
+ rs->procedures[i].proc = procs[j].name;
}
}
- rs->procedures[i].num=0;
- rs->procedures[i].min.secs=0;
- rs->procedures[i].min.nsecs=0;
- rs->procedures[i].max.secs=0;
- rs->procedures[i].max.nsecs=0;
- rs->procedures[i].tot.secs=0;
- rs->procedures[i].tot.nsecs=0;
+ rs->procedures[i].num = 0;
+ rs->procedures[i].min.secs = 0;
+ rs->procedures[i].min.nsecs = 0;
+ rs->procedures[i].max.secs = 0;
+ rs->procedures[i].max.nsecs = 0;
+ rs->procedures[i].tot.secs = 0;
+ rs->procedures[i].tot.nsecs = 0;
}
- error_string=register_tap_listener("dcerpc", rs, filter, 0, NULL, dcerpcstat_packet, dcerpcstat_draw);
- if(error_string){
+ error_string = register_tap_listener("dcerpc", rs, filter, 0, NULL, dcerpcstat_packet, dcerpcstat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(rs->procedures);
g_free(rs->filter);
@@ -291,5 +291,18 @@ dcerpcstat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_dcerpcstat(void)
{
- register_stat_cmd_arg("dcerpc,srt,", dcerpcstat_init,NULL);
+ register_stat_cmd_arg("dcerpc,srt,", dcerpcstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-diameter-avp.c b/ui/cli/tap-diameter-avp.c
index a4789737c0..7acc40922b 100644
--- a/ui/cli/tap-diameter-avp.c
+++ b/ui/cli/tap-diameter-avp.c
@@ -53,13 +53,13 @@ void register_tap_listener_diameteravp(void);
/* used to keep track of the statistics for an entire program interface */
typedef struct _diameteravp_t {
- guint32 frame;
- guint32 diammsg_toprocess;
- guint32 cmd_code;
- guint32 req_count;
- guint32 ans_count;
- guint32 paired_ans_count;
- gchar* filter;
+ guint32 frame;
+ guint32 diammsg_toprocess;
+ guint32 cmd_code;
+ guint32 req_count;
+ guint32 ans_count;
+ guint32 paired_ans_count;
+ gchar *filter;
} diameteravp_t;
/* Copied from proto.c */
@@ -84,36 +84,37 @@ tree_traverse_pre_order(proto_tree *tree, proto_tree_traverse_func func, gpointe
}
static gboolean
-diam_tree_to_csv(proto_node* node, gpointer data)
+diam_tree_to_csv(proto_node *node, gpointer data)
{
- char* val_str=NULL;
- char* val_tmp=NULL;
- ftenum_t ftype;
- field_info* fi;
- header_field_info *hfi;
- if(!node) {
- fprintf(stderr,"traverse end: empty node. node='%p' data='%p'\n",(void *)node,(void *)data);
+ char *val_str = NULL;
+ char *val_tmp = NULL;
+ ftenum_t ftype;
+ field_info *fi;
+ header_field_info *hfi;
+
+ if (!node) {
+ fprintf(stderr, "traverse end: empty node. node='%p' data='%p'\n", (void *)node, (void *)data);
return FALSE;
}
- fi=node->finfo;
- hfi=fi ? fi->hfinfo : NULL;
- if(!hfi) {
- fprintf(stderr,"traverse end: hfi not found. node='%p'\n",(void *)node);
+ fi = node->finfo;
+ hfi = fi ? fi->hfinfo : NULL;
+ if (!hfi) {
+ fprintf(stderr, "traverse end: hfi not found. node='%p'\n", (void *)node);
return FALSE;
}
- ftype=fvalue_type_ftenum(&fi->value);
- if (ftype!=FT_NONE&&ftype!=FT_PROTOCOL) {
+ ftype = fvalue_type_ftenum(&fi->value);
+ if (ftype != FT_NONE && ftype != FT_PROTOCOL) {
/* convert value to string */
- val_tmp=fvalue_to_string_repr(&fi->value,FTREPR_DISPLAY,NULL);
- if(val_tmp)
+ val_tmp = fvalue_to_string_repr(&fi->value, FTREPR_DISPLAY, NULL);
+ if (val_tmp)
{
- val_str=ep_strdup(val_tmp);
+ val_str = ep_strdup(val_tmp);
g_free(val_tmp);
} else
- val_str=ep_strdup_printf("unsupported type: %s",ftype_name(ftype));
+ val_str = ep_strdup_printf("unsupported type: %s", ftype_name(ftype));
- /*printf("traverse: name='%s', abbrev='%s',desc='%s', val='%s'\n",hfi->name,hfi->abbrev,ftype_name(hfi->type),val_str);*/
- printf("%s='%s' ",hfi->name,val_str);
+ /*printf("traverse: name='%s', abbrev='%s',desc='%s', val='%s'\n", hfi->name, hfi->abbrev, ftype_name(hfi->type), val_str);*/
+ printf("%s='%s' ", hfi->name, val_str);
}
return FALSE;
}
@@ -122,47 +123,47 @@ static int
diameteravp_packet(void *pds, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pdi)
{
int ret = 0;
- double resp_time=0.;
- gboolean is_request=TRUE;
- guint32 cmd_code=0;
- guint32 req_frame=0;
- guint32 ans_frame=0;
- guint32 diam_child_node=0;
- proto_node* current=NULL;
- proto_node* node = NULL;
- header_field_info* hfi=NULL;
- field_info* finfo=NULL;
- const diameter_req_ans_pair_t* dp=(const diameter_req_ans_pair_t*)pdi;
- diameteravp_t *ds=NULL;
+ double resp_time = 0.;
+ gboolean is_request = TRUE;
+ guint32 cmd_code = 0;
+ guint32 req_frame = 0;
+ guint32 ans_frame = 0;
+ guint32 diam_child_node = 0;
+ proto_node *current = NULL;
+ proto_node *node = NULL;
+ header_field_info *hfi = NULL;
+ field_info *finfo = NULL;
+ const diameter_req_ans_pair_t *dp = (const diameter_req_ans_pair_t *)pdi;
+ diameteravp_t *ds = NULL;
/* Validate paramerers. */
- if(!dp || !edt || !edt->tree)
+ if (!dp || !edt || !edt->tree)
return ret;
/* Several diameter messages within one frame are possible. *
* Check if we processing the message in same frame like befor or in new frame.*/
- ds=(diameteravp_t *)pds;
- if(pinfo->fd->num > ds->frame) {
- ds->frame=pinfo->fd->num;
- ds->diammsg_toprocess=0;
+ ds = (diameteravp_t *)pds;
+ if (pinfo->fd->num > ds->frame) {
+ ds->frame = pinfo->fd->num;
+ ds->diammsg_toprocess = 0;
} else {
- ds->diammsg_toprocess+=1;
+ ds->diammsg_toprocess += 1;
}
/* Extract data from request/answer pair provided by diameter dissector.*/
- is_request=dp->processing_request;
- cmd_code=dp->cmd_code;
- req_frame=dp->req_frame;
- ans_frame=dp->ans_frame;
- if(!is_request) {
+ is_request = dp->processing_request;
+ cmd_code = dp->cmd_code;
+ req_frame = dp->req_frame;
+ ans_frame = dp->ans_frame;
+ if (!is_request) {
nstime_t ns;
nstime_delta(&ns, &pinfo->fd->abs_ts, &dp->req_time);
- resp_time=nstime_to_sec(&ns);
- resp_time=resp_time<0?0.:resp_time;
+ resp_time = nstime_to_sec(&ns);
+ resp_time = resp_time < 0. ? 0. : resp_time;
}
/* Check command code provided by command line option.*/
- if (ds->cmd_code && ds->cmd_code!=cmd_code)
+ if (ds->cmd_code && ds->cmd_code != cmd_code)
return ret;
/* Loop over top level nodes */
@@ -170,28 +171,28 @@ diameteravp_packet(void *pds, packet_info *pinfo, epan_dissect_t *edt _U_, const
while (node != NULL) {
current = node;
node = current->next;
- finfo=current->finfo;
- hfi=finfo ? finfo->hfinfo : NULL;
- /*fprintf(stderr,"DEBUG: diameteravp_packet %d %p %p node=%p abbrev=%s\n",cmd_code,edt,edt->tree,current,hfi->abbrev);*/
+ finfo = current->finfo;
+ hfi = finfo ? finfo->hfinfo : NULL;
+ /*fprintf(stderr, "DEBUG: diameteravp_packet %d %p %p node=%p abbrev=%s\n", cmd_code, edt, edt->tree, current, hfi->abbrev);*/
/* process current diameter subtree in the current frame. */
- if(hfi && hfi->abbrev && strcmp(hfi->abbrev,"diameter")==0) {
+ if (hfi && hfi->abbrev && strcmp(hfi->abbrev, "diameter") == 0) {
/* Process current diameter message in the frame */
- if (ds->diammsg_toprocess==diam_child_node) {
- if(is_request) {
+ if (ds->diammsg_toprocess == diam_child_node) {
+ if (is_request) {
ds->req_count++;
} else {
ds->ans_count++;
- if (req_frame>0)
+ if (req_frame > 0)
ds->paired_ans_count++;
}
/* Output frame data.*/
printf("frame='%d' time='%f' src='%s' srcport='%d' dst='%s' dstport='%d' proto='diameter' msgnr='%d' is_request='%d' cmd='%d' req_frame='%d' ans_frame='%d' resp_time='%f' ",
- pinfo->fd->num,nstime_to_sec(&pinfo->fd->abs_ts),ep_address_to_str(&pinfo->src),pinfo->srcport,ep_address_to_str(&pinfo->dst), pinfo->destport,ds->diammsg_toprocess,is_request,cmd_code,req_frame,ans_frame,resp_time);
+ pinfo->fd->num, nstime_to_sec(&pinfo->fd->abs_ts), ep_address_to_str(&pinfo->src), pinfo->srcport, ep_address_to_str(&pinfo->dst), pinfo->destport, ds->diammsg_toprocess, is_request, cmd_code, req_frame, ans_frame, resp_time);
/* Visit selected nodes of one diameter message.*/
tree_traverse_pre_order(current, diam_tree_to_csv, &ds);
/* End of message.*/
printf("\n");
- /*printf("hfi: name='%s', msg_curr='%d' abbrev='%s',type='%s'\n",hfi->name,diam_child_node,hfi->abbrev,ftype_name(hfi->type));*/
+ /*printf("hfi: name='%s', msg_curr='%d' abbrev='%s',type='%s'\n", hfi->name, diam_child_node, hfi->abbrev, ftype_name(hfi->type));*/
}
diam_child_node++;
}
@@ -200,62 +201,62 @@ diameteravp_packet(void *pds, packet_info *pinfo, epan_dissect_t *edt _U_, const
}
static void
-diameteravp_draw(void* pds)
+diameteravp_draw(void *pds)
{
- diameteravp_t *ds=(diameteravp_t *)pds;
+ diameteravp_t *ds = (diameteravp_t *)pds;
/* printing results */
- printf("=== Diameter Summary ===\nrequset count:\t%d\nanswer count:\t%d\nreq/ans pairs:\t%d\n",ds->req_count,ds->ans_count,ds->paired_ans_count);
+ printf("=== Diameter Summary ===\nrequset count:\t%d\nanswer count:\t%d\nreq/ans pairs:\t%d\n", ds->req_count, ds->ans_count, ds->paired_ans_count);
}
static void
-diameteravp_init(const char *opt_arg, void* userdata _U_)
+diameteravp_init(const char *opt_arg, void *userdata _U_)
{
- diameteravp_t *ds;
- gchar* field=NULL;
- gchar** tokens;
- guint opt_count=0;
- guint opt_idx=0;
- GString* filter=NULL;
- GString* error_string=NULL;
+ diameteravp_t *ds;
+ gchar *field = NULL;
+ gchar **tokens;
+ guint opt_count = 0;
+ guint opt_idx = 0;
+ GString *filter = NULL;
+ GString *error_string = NULL;
- ds=g_new(diameteravp_t,1);
- ds->frame=0;
- ds->diammsg_toprocess=0;
- ds->cmd_code=0;
- ds->req_count=0;
- ds->ans_count=0;
- ds->paired_ans_count=0;
- ds->filter=NULL;
+ ds = g_new(diameteravp_t, 1);
+ ds->frame = 0;
+ ds->diammsg_toprocess = 0;
+ ds->cmd_code = 0;
+ ds->req_count = 0;
+ ds->ans_count = 0;
+ ds->paired_ans_count = 0;
+ ds->filter = NULL;
- filter=g_string_new("diameter");
+ filter = g_string_new("diameter");
/* Split command line options. */
- tokens = g_strsplit(opt_arg,",", 1024);
- opt_count=0;
+ tokens = g_strsplit(opt_arg, ",", 1024);
+ opt_count = 0;
while (tokens[opt_count])
opt_count++;
- if (opt_count>2)
- ds->cmd_code=(guint32)atoi(tokens[2]);
+ if (opt_count > 2)
+ ds->cmd_code = (guint32)atoi(tokens[2]);
/* Loop over diameter field names. */
- for(opt_idx=3;opt_idx<opt_count;opt_idx++)
+ for (opt_idx=3; opt_idx<opt_count; opt_idx++)
{
/* Current field from command line arguments. */
- field=tokens[opt_idx];
+ field = tokens[opt_idx];
/* Connect all requested fields with logical OR. */
- g_string_append(filter,"||");
+ g_string_append(filter, "||");
/* Prefix field name with "diameter." by default. */
- if(!strchr(field,'.'))
+ if (!strchr(field, '.'))
g_string_append(filter, "diameter.");
/* Append field name to the filter. */
g_string_append(filter, field);
}
g_strfreev(tokens);
- ds->filter=g_string_free(filter,FALSE);
+ ds->filter = g_string_free(filter, FALSE);
- error_string=register_tap_listener("diameter", ds, ds->filter, 0, NULL, diameteravp_packet, diameteravp_draw);
- if(error_string){
+ error_string = register_tap_listener("diameter", ds, ds->filter, 0, NULL, diameteravp_packet, diameteravp_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(ds);
@@ -273,3 +274,16 @@ register_tap_listener_diameteravp(void)
register_stat_cmd_arg("diameter,avp", diameteravp_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-expert.c b/ui/cli/tap-expert.c
index 892decd930..ff3006f7eb 100644
--- a/ui/cli/tap-expert.c
+++ b/ui/cli/tap-expert.c
@@ -37,7 +37,7 @@ void register_tap_listener_expert_info(void);
/* Tap data */
typedef enum severity_level_t {
- chat_level=0,
+ chat_level = 0,
note_level,
warn_level,
error_level,
@@ -52,15 +52,15 @@ typedef struct expert_entry
{
guint32 group;
int frequency;
- const gchar *protocol;
- gchar *summary;
+ const gchar *protocol;
+ gchar *summary;
} expert_entry;
/* Overall struct for storing all data seen */
typedef struct expert_tapdata_t {
- GArray *ei_array[max_level]; /* expert info items */
- GStringChunk* text; /* for efficient storage of summary strings */
+ GArray *ei_array[max_level]; /* expert info items */
+ GStringChunk *text; /* for efficient storage of summary strings */
} expert_tapdata_t;
@@ -68,7 +68,7 @@ typedef struct expert_tapdata_t {
static void
expert_stat_reset(void *tapdata)
{
- gint n;
+ gint n;
expert_tapdata_t *etd = (expert_tapdata_t *)tapdata;
/* Free & reallocate chunk of strings */
@@ -86,12 +86,12 @@ static int
expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_,
const void *pointer)
{
- const expert_info_t *ei = (const expert_info_t *)pointer;
- expert_tapdata_t *data = (expert_tapdata_t *)tapdata;
- severity_level_t severity_level;
- expert_entry tmp_entry;
- expert_entry *entry;
- guint n;
+ const expert_info_t *ei = (const expert_info_t *)pointer;
+ expert_tapdata_t *data = (expert_tapdata_t *)tapdata;
+ severity_level_t severity_level;
+ expert_entry tmp_entry;
+ expert_entry *entry;
+ guint n;
switch (ei->severity) {
case PI_CHAT:
@@ -143,9 +143,9 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U
/* Output for all of the items of one severity */
static void draw_items_for_severity(GArray *items, const gchar *label)
{
- guint n;
+ guint n;
expert_entry *ei;
- int total = 0;
+ int total = 0;
/* Don't print title if no items */
if (items->len == 0) {
@@ -191,11 +191,11 @@ expert_stat_draw(void *phs _U_)
/* Create a new expert stats struct */
static void expert_stat_init(const char *opt_arg, void *userdata _U_)
{
- const char *args = NULL;
- const char *filter = NULL;
- GString *error_string;
- expert_tapdata_t *hs;
- int n;
+ const char *args = NULL;
+ const char *filter = NULL;
+ GString *error_string;
+ expert_tapdata_t *hs;
+ int n;
/* Check for args. */
if (strncmp(opt_arg, "expert", 6) == 0) {
@@ -234,7 +234,7 @@ static void expert_stat_init(const char *opt_arg, void *userdata _U_)
/* Create top-level struct */
- hs = g_new(expert_tapdata_t,1);
+ hs = g_new(expert_tapdata_t, 1);
memset(hs, 0, sizeof(expert_tapdata_t));
/* Allocate chunk of strings */
@@ -270,3 +270,15 @@ register_tap_listener_expert_info(void)
register_stat_cmd_arg("expert", expert_stat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-follow.c b/ui/cli/tap-follow.c
index 90a4cf360e..fa729bf0d9 100644
--- a/ui/cli/tap-follow.c
+++ b/ui/cli/tap-follow.c
@@ -87,8 +87,8 @@ typedef struct
guint32 chunkMax;
/* stream chunk file */
- FILE * filep;
- gchar * filenamep;
+ FILE *filep;
+ gchar *filenamep;
} follow_t;
#define STR_FOLLOW "follow,"
@@ -102,7 +102,7 @@ typedef struct
static void
followExit(
- const char * strp
+ const char *strp
)
{
fprintf(stderr, "tshark: follow - %s\n", strp);
@@ -111,7 +111,7 @@ followExit(
static const char *
followStrType(
- const follow_t * fp
+ const follow_t *fp
)
{
switch (fp->type)
@@ -128,7 +128,7 @@ followStrType(
static const char *
followStrMode(
- const follow_t * fp
+ const follow_t *fp
)
{
switch (fp->mode)
@@ -145,12 +145,12 @@ followStrMode(
static const char *
followStrFilter(
- const follow_t * fp
+ const follow_t *fp
)
{
static char filter[512];
int len = 0;
- const gchar * verp;
+ const gchar *verp;
gchar ip0[MAX_IP6_STR_LEN];
gchar ip1[MAX_IP6_STR_LEN];
@@ -219,7 +219,7 @@ followStrFilter(
static void
followFileClose(
- follow_t * fp
+ follow_t *fp
)
{
if (fp->filep != NULL)
@@ -242,11 +242,11 @@ followFileClose(
static void
followFileOpen(
- follow_t * fp
+ follow_t *fp
)
{
- int fd;
- char * tempfilep;
+ int fd;
+ char *tempfilep;
if (fp->type == type_TCP && data_out_file != NULL)
{
@@ -290,7 +290,7 @@ followAlloc(
type_e type
)
{
- follow_t * fp;
+ follow_t *fp;
fp = (follow_t *)g_malloc0(sizeof *fp);
@@ -303,7 +303,7 @@ followAlloc(
static void
followFree(
- follow_t * fp
+ follow_t *fp
)
{
followFileClose(fp);
@@ -312,16 +312,16 @@ followFree(
static int
followUdpPacket(
- void * contextp,
- packet_info * pip,
- epan_dissect_t * edp _U_,
- const void * datap
+ void *contextp,
+ packet_info *pip,
+ epan_dissect_t *edp _U_,
+ const void *datap
)
{
- follow_t * fp = (follow_t *)contextp;
- const tvbuff_t * tvbp = (const tvbuff_t *)datap;
- tcp_stream_chunk sc;
- size_t size;
+ follow_t *fp = (follow_t *)contextp;
+ const tvbuff_t *tvbp = (const tvbuff_t *)datap;
+ tcp_stream_chunk sc;
+ size_t size;
if (tvbp->length > 0)
{
@@ -348,18 +348,18 @@ followUdpPacket(
static int
followSslPacket(
- void * contextp,
- packet_info * pip,
- epan_dissect_t * edp _U_,
- const void * datap
+ void *contextp,
+ packet_info *pip,
+ epan_dissect_t *edp _U_,
+ const void *datap
)
{
- follow_t * fp = (follow_t *)contextp;
- SslPacketInfo * spip = (SslPacketInfo *)p_get_proto_data(wmem_file_scope(), pip, GPOINTER_TO_INT(datap), 0);
- SslDataInfo * sdip;
- gint length;
- tcp_stream_chunk sc;
- size_t size;
+ follow_t *fp = (follow_t *)contextp;
+ SslPacketInfo *spip = (SslPacketInfo *)p_get_proto_data(wmem_file_scope(), pip, GPOINTER_TO_INT(datap), 0);
+ SslDataInfo *sdip;
+ gint length;
+ tcp_stream_chunk sc;
+ size_t size;
if (spip == NULL)
{
@@ -432,10 +432,10 @@ static const char bin2hex[] = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
static void
followPrintHex(
- const char * prefixp,
- guint32 offset,
- void * datap,
- int len
+ const char *prefixp,
+ guint32 offset,
+ void *datap,
+ int len
)
{
int ii;
@@ -491,25 +491,25 @@ followPrintHex(
static void
followDraw(
- void * contextp
+ void *contextp
)
{
static const char separator[] =
"===================================================================\n";
- follow_t * fp = (follow_t *)contextp;
- tcp_stream_chunk sc;
- int node;
- const address * addr[2];
- int port[2];
- gchar buf[MAX_IP6_STR_LEN];
- guint32 ii;
- guint32 jj;
- guint32 len;
- guint32 chunk;
- guint32 offset[2];
- guint8 bin[4096];
- char data[(sizeof bin * 2) + 2];
+ follow_t *fp = (follow_t *)contextp;
+ tcp_stream_chunk sc;
+ int node;
+ const address *addr[2];
+ int port[2];
+ gchar buf[MAX_IP6_STR_LEN];
+ guint32 ii;
+ guint32 jj;
+ guint32 len;
+ guint32 chunk;
+ guint32 offset[2];
+ guint8 bin[4096];
+ char data[(sizeof bin * 2) + 2];
g_assert(sizeof bin % BYTES_PER_LINE == 0);
@@ -721,8 +721,8 @@ done:
static gboolean
followArgStrncmp(
- const char ** opt_argp,
- const char * strp
+ const char **opt_argp,
+ const char *strp
)
{
int len = (guint32)strlen(strp);
@@ -737,8 +737,8 @@ followArgStrncmp(
static void
followArgMode(
- const char ** opt_argp,
- follow_t * fp
+ const char **opt_argp,
+ follow_t *fp
)
{
if (followArgStrncmp(opt_argp, STR_HEX))
@@ -761,8 +761,8 @@ followArgMode(
static void
followArgFilter(
- const char ** opt_argp,
- follow_t * fp
+ const char **opt_argp,
+ follow_t *fp
)
{
#define _STRING(s) # s
@@ -823,8 +823,8 @@ followArgFilter(
static void
followArgRange(
- const char ** opt_argp,
- follow_t * fp
+ const char **opt_argp,
+ follow_t *fp
)
{
int len;
@@ -859,7 +859,7 @@ followArgRange(
static void
followArgDone(
- const char * opt_argp
+ const char *opt_argp
)
{
if (*opt_argp != 0)
@@ -870,12 +870,12 @@ followArgDone(
static void
followTcp(
- const char * opt_argp,
- void * userdata _U_
+ const char *opt_argp,
+ void *userdata _U_
)
{
- follow_t * fp;
- GString * errp;
+ follow_t *fp;
+ GString *errp;
opt_argp += strlen(STR_FOLLOW_TCP);
@@ -917,12 +917,12 @@ followTcp(
static void
followUdp(
- const char * opt_argp,
- void * userdata _U_
+ const char *opt_argp,
+ void *userdata _U_
)
{
- follow_t * fp;
- GString * errp;
+ follow_t *fp;
+ GString *errp;
opt_argp += strlen(STR_FOLLOW_UDP);
@@ -952,12 +952,12 @@ followUdp(
static void
followSsl(
- const char * opt_argp,
- void * userdata _U_
+ const char *opt_argp,
+ void *userdata _U_
)
{
- follow_t * fp;
- GString * errp;
+ follow_t *fp;
+ GString *errp;
opt_argp += strlen(STR_FOLLOW_SSL);
@@ -992,3 +992,16 @@ register_tap_listener_follow(void)
register_stat_cmd_arg(STR_FOLLOW_UDP, followUdp, NULL);
register_stat_cmd_arg(STR_FOLLOW_SSL, followSsl, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-funnel.c b/ui/cli/tap-funnel.c
index 16e0cac09f..bf13223d5b 100644
--- a/ui/cli/tap-funnel.c
+++ b/ui/cli/tap-funnel.c
@@ -37,44 +37,44 @@
void register_tap_listener_gtkfunnel(void);
struct _funnel_text_window_t {
- gchar* title;
- GString* text;
+ gchar *title;
+ GString *text;
};
-static GPtrArray* text_windows = NULL;
+static GPtrArray *text_windows = NULL;
-static funnel_text_window_t* new_text_window(const gchar* title) {
- funnel_text_window_t* tw = g_new(funnel_text_window_t,1);
+static funnel_text_window_t *new_text_window(const gchar *title) {
+ funnel_text_window_t *tw = g_new(funnel_text_window_t, 1);
tw->title = g_strdup(title);
tw->text = g_string_new("");
if (!text_windows)
text_windows = g_ptr_array_new();
- g_ptr_array_add(text_windows,tw);
+ g_ptr_array_add(text_windows, tw);
return tw;
}
-static void text_window_clear(funnel_text_window_t* tw) {
- g_string_free(tw->text,TRUE);
+static void text_window_clear(funnel_text_window_t *tw) {
+ g_string_free(tw->text, TRUE);
tw->text = g_string_new("");
}
-static void text_window_append(funnel_text_window_t* tw, const char *text ) {
- g_string_append(tw->text,text);
+static void text_window_append(funnel_text_window_t *tw, const char *text ) {
+ g_string_append(tw->text, text);
}
-static void text_window_set_text(funnel_text_window_t* tw, const char* text) {
- g_string_free(tw->text,TRUE);
+static void text_window_set_text(funnel_text_window_t *tw, const char *text) {
+ g_string_free(tw->text, TRUE);
tw->text = g_string_new(text);
}
-static void text_window_prepend(funnel_text_window_t* tw, const char *text) {
- g_string_prepend(tw->text,text);
+static void text_window_prepend(funnel_text_window_t *tw, const char *text) {
+ g_string_prepend(tw->text, text);
}
-static const gchar* text_window_get_text(funnel_text_window_t* tw) {
+static const gchar *text_window_get_text(funnel_text_window_t *tw) {
return tw->text->str;
}
@@ -83,7 +83,7 @@ static void funnel_logger(const gchar *log_domain _U_,
GLogLevelFlags log_level _U_,
const gchar *message,
gpointer user_data _U_) {
- fputs(message,stderr);
+ fputs(message, stderr);
}
@@ -129,32 +129,32 @@ void funnel_dump_all_text_windows(void) {
if (!text_windows) return;
for ( i = 0 ; i < text_windows->len; i++) {
- funnel_text_window_t* tw = (funnel_text_window_t*)g_ptr_array_index(text_windows,i);
+ funnel_text_window_t *tw = (funnel_text_window_t *)g_ptr_array_index(text_windows, i);
printf("\n========================== %s "
- "==========================\n%s\n",tw->title,tw->text->str);
+ "==========================\n%s\n", tw->title, tw->text->str);
- g_ptr_array_remove_index(text_windows,i);
+ g_ptr_array_remove_index(text_windows, i);
g_free(tw->title);
- g_string_free(tw->text,TRUE);
+ g_string_free(tw->text, TRUE);
g_free(tw);
}
}
#if 0
-GHashTable* menus = NULL;
+GHashTable *menus = NULL;
typedef struct _menu_cb_t {
void (*callback)(gpointer);
- void* callback_data;
+ void *callback_data;
} menu_cb_t;
-static void init_funnel_cmd(const char *opt_arg, void* data ) {
- gchar** args = g_strsplit(opt_arg,",",0);
- gchar** arg;
- menu_cb_t* mcb = data;
+static void init_funnel_cmd(const char *opt_arg, void *data ) {
+ gchar **args = g_strsplit(opt_arg, ",", 0);
+ gchar **arg;
+ menu_cb_t *mcb = data;
- for(arg = args; *arg ; arg++) {
+ for (arg = args; *arg ; arg++) {
g_strstrip(*arg);
}
@@ -169,17 +169,17 @@ static void register_menu_cb(const char *name,
void (*callback)(gpointer),
gpointer callback_data,
gboolean retap _U_) {
- menu_cb_t* mcb = g_malloc(sizeof(menu_cb_t));
+ menu_cb_t *mcb = g_malloc(sizeof(menu_cb_t));
mcb->callback = callback;
mcb->callback_data = callback_data;
if (!menus)
- menus = g_hash_table_new(g_str_hash,g_str_equal);
+ menus = g_hash_table_new(g_str_hash, g_str_equal);
- g_hash_table_insert(menus,g_strdup(name),mcb);
+ g_hash_table_insert(menus, g_strdup(name), mcb);
- register_stat_cmd_arg(name,init_funnel_cmd,mcb);
+ register_stat_cmd_arg(name, init_funnel_cmd, mcb);
}
void initialize_funnel_ops(void) {
@@ -191,7 +191,20 @@ void
register_tap_listener_gtkfunnel(void)
{
#if 0
- /* #if 0 at least since Revision Rev 17396 */
+ /* #if 0 at least since Revision Rev 17396 */
funnel_register_all_menus(register_menu_cb);
#endif
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-gsm_astat.c b/ui/cli/tap-gsm_astat.c
index ed3b9d83d4..94cfae5c64 100644
--- a/ui/cli/tap-gsm_astat.c
+++ b/ui/cli/tap-gsm_astat.c
@@ -42,69 +42,69 @@
void register_tap_listener_gsm_astat(void);
typedef struct _gsm_a_stat_t {
- int bssmap_message_type[0xff];
- int dtap_mm_message_type[0xff];
- int dtap_rr_message_type[0xff];
- int dtap_cc_message_type[0xff];
- int dtap_gmm_message_type[0xff];
- int dtap_sms_message_type[0xff];
- int dtap_sm_message_type[0xff];
- int dtap_ss_message_type[0xff];
- int dtap_tp_message_type[0xff];
- int sacch_rr_message_type[0xff];
+ int bssmap_message_type[0xff];
+ int dtap_mm_message_type[0xff];
+ int dtap_rr_message_type[0xff];
+ int dtap_cc_message_type[0xff];
+ int dtap_gmm_message_type[0xff];
+ int dtap_sms_message_type[0xff];
+ int dtap_sm_message_type[0xff];
+ int dtap_ss_message_type[0xff];
+ int dtap_tp_message_type[0xff];
+ int sacch_rr_message_type[0xff];
} gsm_a_stat_t;
static int
gsm_a_stat_packet(
- void *tapdata,
- packet_info *pinfo _U_,
- epan_dissect_t *edt _U_,
- const void *data)
+ void *tapdata,
+ packet_info *pinfo _U_,
+ epan_dissect_t *edt _U_,
+ const void *data)
{
- gsm_a_stat_t *stat_p = (gsm_a_stat_t *)tapdata;
- const gsm_a_tap_rec_t *tap_p = (const gsm_a_tap_rec_t *)data;
+ gsm_a_stat_t *stat_p = (gsm_a_stat_t *)tapdata;
+ const gsm_a_tap_rec_t *tap_p = (const gsm_a_tap_rec_t *)data;
switch (tap_p->pdu_type)
{
case BSSAP_PDU_TYPE_BSSMAP:
- stat_p->bssmap_message_type[tap_p->message_type]++;
- break;
+ stat_p->bssmap_message_type[tap_p->message_type]++;
+ break;
case BSSAP_PDU_TYPE_DTAP:
- switch (tap_p->protocol_disc)
- {
- case PD_CC:
- stat_p->dtap_cc_message_type[tap_p->message_type]++;
- break;
- case PD_MM:
- stat_p->dtap_mm_message_type[tap_p->message_type]++;
- break;
- case PD_RR:
- stat_p->dtap_rr_message_type[tap_p->message_type]++;
- break;
- case PD_GMM:
- stat_p->dtap_gmm_message_type[tap_p->message_type]++;
- break;
- case PD_SMS:
- stat_p->dtap_sms_message_type[tap_p->message_type]++;
- break;
- case PD_SM:
- stat_p->dtap_sm_message_type[tap_p->message_type]++;
- break;
- case PD_SS:
- stat_p->dtap_ss_message_type[tap_p->message_type]++;
- break;
- case PD_TP:
- stat_p->dtap_tp_message_type[tap_p->message_type]++;
- break;
- default:
- /*
- * unsupported PD
- */
- return(0);
- }
- break;
+ switch (tap_p->protocol_disc)
+ {
+ case PD_CC:
+ stat_p->dtap_cc_message_type[tap_p->message_type]++;
+ break;
+ case PD_MM:
+ stat_p->dtap_mm_message_type[tap_p->message_type]++;
+ break;
+ case PD_RR:
+ stat_p->dtap_rr_message_type[tap_p->message_type]++;
+ break;
+ case PD_GMM:
+ stat_p->dtap_gmm_message_type[tap_p->message_type]++;
+ break;
+ case PD_SMS:
+ stat_p->dtap_sms_message_type[tap_p->message_type]++;
+ break;
+ case PD_SM:
+ stat_p->dtap_sm_message_type[tap_p->message_type]++;
+ break;
+ case PD_SS:
+ stat_p->dtap_ss_message_type[tap_p->message_type]++;
+ break;
+ case PD_TP:
+ stat_p->dtap_tp_message_type[tap_p->message_type]++;
+ break;
+ default:
+ /*
+ * unsupported PD
+ */
+ return(0);
+ }
+ break;
case GSM_A_PDU_TYPE_SACCH:
switch (tap_p->protocol_disc)
@@ -120,10 +120,10 @@ gsm_a_stat_packet(
default:
- /*
- * unknown PDU type !!!
- */
- return(0);
+ /*
+ * unknown PDU type !!!
+ */
+ return(0);
}
return(1);
@@ -132,10 +132,10 @@ gsm_a_stat_packet(
static void
gsm_a_stat_draw(
- void *tapdata)
+ void *tapdata)
{
- gsm_a_stat_t *stat_p = (gsm_a_stat_t *)tapdata;
- guint8 i;
+ gsm_a_stat_t *stat_p = (gsm_a_stat_t *)tapdata;
+ guint8 i;
printf("\n");
@@ -146,15 +146,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_bssmap_msg_strings[i].strptr)
{
- if (stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_bssmap_msg_strings[i].value,
- gsm_a_bssmap_msg_strings[i].strptr,
- stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value]);
- }
-
- i++;
+ if (stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_bssmap_msg_strings[i].value,
+ gsm_a_bssmap_msg_strings[i].strptr,
+ stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_MM]);
@@ -163,15 +163,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_mm_strings[i].strptr)
{
- if (stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_mm_strings[i].value,
- gsm_a_dtap_msg_mm_strings[i].strptr,
- stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_mm_strings[i].value,
+ gsm_a_dtap_msg_mm_strings[i].strptr,
+ stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_RR]);
@@ -180,15 +180,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_rr_strings[i].strptr)
{
- if (stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_rr_strings[i].value,
- gsm_a_dtap_msg_rr_strings[i].strptr,
- stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_rr_strings[i].value,
+ gsm_a_dtap_msg_rr_strings[i].strptr,
+ stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_CC]);
@@ -197,15 +197,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_cc_strings[i].strptr)
{
- if (stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_cc_strings[i].value,
- gsm_a_dtap_msg_cc_strings[i].strptr,
- stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_cc_strings[i].value,
+ gsm_a_dtap_msg_cc_strings[i].strptr,
+ stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_GMM]);
@@ -214,15 +214,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_gmm_strings[i].strptr)
{
- if (stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_gmm_strings[i].value,
- gsm_a_dtap_msg_gmm_strings[i].strptr,
- stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_gmm_strings[i].value,
+ gsm_a_dtap_msg_gmm_strings[i].strptr,
+ stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_SMS]);
@@ -231,15 +231,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_sms_strings[i].strptr)
{
- if (stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_sms_strings[i].value,
- gsm_a_dtap_msg_sms_strings[i].strptr,
- stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_sms_strings[i].value,
+ gsm_a_dtap_msg_sms_strings[i].strptr,
+ stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_SM]);
@@ -248,15 +248,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_sm_strings[i].strptr)
{
- if (stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_sm_strings[i].value,
- gsm_a_dtap_msg_sm_strings[i].strptr,
- stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_sm_strings[i].value,
+ gsm_a_dtap_msg_sm_strings[i].strptr,
+ stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_SS]);
@@ -265,15 +265,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_ss_strings[i].strptr)
{
- if (stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_ss_strings[i].value,
- gsm_a_dtap_msg_ss_strings[i].strptr,
- stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_ss_strings[i].value,
+ gsm_a_dtap_msg_ss_strings[i].strptr,
+ stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value]);
+ }
+
+ i++;
}
printf("\nDTAP %s\n", gsm_a_pd_str[PD_TP]);
@@ -282,15 +282,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_dtap_msg_tp_strings[i].strptr)
{
- if (stat_p->dtap_tp_message_type[gsm_a_dtap_msg_tp_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_dtap_msg_tp_strings[i].value,
- gsm_a_dtap_msg_tp_strings[i].strptr,
- stat_p->dtap_tp_message_type[gsm_a_dtap_msg_tp_strings[i].value]);
- }
-
- i++;
+ if (stat_p->dtap_tp_message_type[gsm_a_dtap_msg_tp_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_dtap_msg_tp_strings[i].value,
+ gsm_a_dtap_msg_tp_strings[i].strptr,
+ stat_p->dtap_tp_message_type[gsm_a_dtap_msg_tp_strings[i].value]);
+ }
+
+ i++;
}
printf("\nSACCH Radio Resources Management messages\n");
@@ -299,15 +299,15 @@ gsm_a_stat_draw(
i = 0;
while (gsm_a_rr_short_pd_msg_strings[i].strptr)
{
- if (stat_p->sacch_rr_message_type[gsm_a_rr_short_pd_msg_strings[i].value] > 0)
- {
- printf("0x%02x %-50s%d\n",
- gsm_a_rr_short_pd_msg_strings[i].value,
- gsm_a_rr_short_pd_msg_strings[i].strptr,
- stat_p->sacch_rr_message_type[gsm_a_rr_short_pd_msg_strings[i].value]);
- }
-
- i++;
+ if (stat_p->sacch_rr_message_type[gsm_a_rr_short_pd_msg_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ gsm_a_rr_short_pd_msg_strings[i].value,
+ gsm_a_rr_short_pd_msg_strings[i].strptr,
+ stat_p->sacch_rr_message_type[gsm_a_rr_short_pd_msg_strings[i].value]);
+ }
+
+ i++;
}
printf("==============================================================\n");
@@ -315,27 +315,27 @@ gsm_a_stat_draw(
static void
-gsm_a_stat_init(const char *opt_arg _U_,void* userdata _U_)
+gsm_a_stat_init(const char *opt_arg _U_, void *userdata _U_)
{
- gsm_a_stat_t *stat_p;
- GString *err_p;
+ gsm_a_stat_t *stat_p;
+ GString *err_p;
- stat_p = g_new(gsm_a_stat_t,1);
+ stat_p = g_new(gsm_a_stat_t, 1);
memset(stat_p, 0, sizeof(gsm_a_stat_t));
err_p =
- register_tap_listener("gsm_a", stat_p, NULL, 0,
- NULL,
- gsm_a_stat_packet,
- gsm_a_stat_draw);
+ register_tap_listener("gsm_a", stat_p, NULL, 0,
+ NULL,
+ gsm_a_stat_packet,
+ gsm_a_stat_draw);
if (err_p != NULL)
{
- g_free(stat_p);
- g_string_free(err_p, TRUE);
+ g_free(stat_p);
+ g_string_free(err_p, TRUE);
- exit(1);
+ exit(1);
}
}
@@ -343,5 +343,18 @@ gsm_a_stat_init(const char *opt_arg _U_,void* userdata _U_)
void
register_tap_listener_gsm_astat(void)
{
- register_stat_cmd_arg("gsm_a,", gsm_a_stat_init,NULL);
+ register_stat_cmd_arg("gsm_a,", gsm_a_stat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-h225counter.c b/ui/cli/tap-h225counter.c
index 489a6b07d1..447a865e73 100644
--- a/ui/cli/tap-h225counter.c
+++ b/ui/cli/tap-h225counter.c
@@ -58,26 +58,26 @@ void register_tap_listener_h225counter(void);
typedef struct _h225counter_t {
char *filter;
guint32 ras_msg[RAS_MSG_TYPES + 1];
- guint32 cs_msg[CS_MSG_TYPES + 1];
- guint32 grj_reason[GRJ_REASONS + 1];
- guint32 rrj_reason[RRJ_REASONS + 1];
- guint32 urq_reason[URQ_REASONS + 1];
- guint32 urj_reason[URJ_REASONS + 1];
- guint32 arj_reason[ARJ_REASONS + 1];
- guint32 brj_reason[BRJ_REASONS + 1];
- guint32 drq_reason[DRQ_REASONS + 1];
- guint32 drj_reason[DRJ_REASONS + 1];
- guint32 lrj_reason[LRJ_REASONS + 1];
- guint32 irqnak_reason[IRQNAK_REASONS + 1];
- guint32 rel_cmp_reason[REL_CMP_REASONS + 1];
- guint32 facility_reason[FACILITY_REASONS + 1];
+ guint32 cs_msg[CS_MSG_TYPES + 1];
+ guint32 grj_reason[GRJ_REASONS + 1];
+ guint32 rrj_reason[RRJ_REASONS + 1];
+ guint32 urq_reason[URQ_REASONS + 1];
+ guint32 urj_reason[URJ_REASONS + 1];
+ guint32 arj_reason[ARJ_REASONS + 1];
+ guint32 brj_reason[BRJ_REASONS + 1];
+ guint32 drq_reason[DRQ_REASONS + 1];
+ guint32 drj_reason[DRJ_REASONS + 1];
+ guint32 lrj_reason[LRJ_REASONS + 1];
+ guint32 irqnak_reason[IRQNAK_REASONS + 1];
+ guint32 rel_cmp_reason[REL_CMP_REASONS + 1];
+ guint32 facility_reason[FACILITY_REASONS + 1];
} h225counter_t;
static void
h225counter_reset(void *phs)
{
- h225counter_t *hs=(h225counter_t *)phs;
+ h225counter_t *hs = (h225counter_t *)phs;
char *save_filter = hs->filter;
memset(hs, 0, sizeof(h225counter_t));
@@ -88,13 +88,13 @@ h225counter_reset(void *phs)
static int
h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
{
- h225counter_t *hs=(h225counter_t *)phs;
- const h225_packet_info *pi=(const h225_packet_info *)phi;
+ h225counter_t *hs = (h225counter_t *)phs;
+ const h225_packet_info *pi = (const h225_packet_info *)phi;
switch (pi->msg_type) {
case H225_RAS:
- if(pi->msg_tag==-1) { /* uninitialized */
+ if (pi->msg_tag == -1) { /* uninitialized */
return 0;
}
else if (pi->msg_tag >= RAS_MSG_TYPES) { /* unknown */
@@ -105,68 +105,68 @@ h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, c
}
/* Look for reason tag */
- if(pi->reason==-1) { /* uninitialized */
+ if (pi->reason == -1) { /* uninitialized */
break;
}
- switch(pi->msg_tag) {
+ switch (pi->msg_tag) {
case 2: /* GRJ */
- if(pi->reason < GRJ_REASONS)
+ if (pi->reason < GRJ_REASONS)
hs->grj_reason[pi->reason]++;
else
hs->grj_reason[GRJ_REASONS]++;
break;
case 5: /* RRJ */
- if(pi->reason < RRJ_REASONS)
+ if (pi->reason < RRJ_REASONS)
hs->rrj_reason[pi->reason]++;
else
hs->rrj_reason[RRJ_REASONS]++;
break;
case 6: /* URQ */
- if(pi->reason < URQ_REASONS)
+ if (pi->reason < URQ_REASONS)
hs->urq_reason[pi->reason]++;
else
hs->urq_reason[URQ_REASONS]++;
break;
case 8: /* URJ */
- if(pi->reason < URJ_REASONS)
+ if (pi->reason < URJ_REASONS)
hs->urj_reason[pi->reason]++;
else
hs->urj_reason[URJ_REASONS]++;
break;
case 11: /* ARJ */
- if(pi->reason < ARJ_REASONS)
+ if (pi->reason < ARJ_REASONS)
hs->arj_reason[pi->reason]++;
else
hs->arj_reason[ARJ_REASONS]++;
break;
case 14: /* BRJ */
- if(pi->reason < BRJ_REASONS)
+ if (pi->reason < BRJ_REASONS)
hs->brj_reason[pi->reason]++;
else
hs->brj_reason[BRJ_REASONS]++;
break;
case 15: /* DRQ */
- if(pi->reason < DRQ_REASONS)
+ if (pi->reason < DRQ_REASONS)
hs->drq_reason[pi->reason]++;
else
hs->drq_reason[DRQ_REASONS]++;
break;
case 17: /* DRJ */
- if(pi->reason < DRJ_REASONS)
+ if (pi->reason < DRJ_REASONS)
hs->drj_reason[pi->reason]++;
else
hs->drj_reason[DRJ_REASONS]++;
break;
case 20: /* LRJ */
- if(pi->reason < LRJ_REASONS)
+ if (pi->reason < LRJ_REASONS)
hs->lrj_reason[pi->reason]++;
else
hs->lrj_reason[LRJ_REASONS]++;
break;
case 29: /* IRQ Nak */
- if(pi->reason < IRQNAK_REASONS)
+ if (pi->reason < IRQNAK_REASONS)
hs->irqnak_reason[pi->reason]++;
else
hs->irqnak_reason[IRQNAK_REASONS]++;
@@ -180,7 +180,7 @@ h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, c
break;
case H225_CS:
- if(pi->msg_tag==-1) { /* uninitialized */
+ if (pi->msg_tag == -1) { /* uninitialized */
return 0;
}
else if (pi->msg_tag >= CS_MSG_TYPES) { /* unknown */
@@ -191,20 +191,20 @@ h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, c
}
/* Look for reason tag */
- if(pi->reason==-1) { /* uninitialized */
+ if (pi->reason == -1) { /* uninitialized */
break;
}
- switch(pi->msg_tag) {
+ switch (pi->msg_tag) {
case 5: /* ReleaseComplete */
- if(pi->reason < REL_CMP_REASONS)
+ if (pi->reason < REL_CMP_REASONS)
hs->rel_cmp_reason[pi->reason]++;
else
hs->rel_cmp_reason[REL_CMP_REASONS]++;
break;
case 6: /* Facility */
- if(pi->reason < FACILITY_REASONS)
+ if (pi->reason < FACILITY_REASONS)
hs->facility_reason[pi->reason]++;
else
hs->facility_reason[FACILITY_REASONS]++;
@@ -227,83 +227,83 @@ h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, c
static void
h225counter_draw(void *phs)
{
- h225counter_t *hs=(h225counter_t *)phs;
- int i,j;
+ h225counter_t *hs = (h225counter_t *)phs;
+ int i, j;
printf("================== H225 Message and Reason Counter ==================\n");
printf("RAS-Messages:\n");
- for(i=0;i<=RAS_MSG_TYPES;i++) {
- if(hs->ras_msg[i]!=0) {
- printf(" %s : %u\n", val_to_str(i,h225_RasMessage_vals,"unknown ras-messages "), hs->ras_msg[i]);
+ for (i=0; i<=RAS_MSG_TYPES; i++) {
+ if (hs->ras_msg[i] != 0) {
+ printf(" %s : %u\n", val_to_str(i, h225_RasMessage_vals, "unknown ras-messages "), hs->ras_msg[i]);
/* reason counter */
- switch(i) {
+ switch (i) {
case 2: /* GRJ */
- for(j=0;j<=GRJ_REASONS;j++) {
- if(hs->grj_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,GatekeeperRejectReason_vals,"unknown reason "), hs->grj_reason[j]);
+ for (j=0; j<=GRJ_REASONS; j++) {
+ if (hs->grj_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, GatekeeperRejectReason_vals, "unknown reason "), hs->grj_reason[j]);
}
}
break;
case 5: /* RRJ */
- for(j=0;j<=RRJ_REASONS;j++) {
- if(hs->rrj_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,RegistrationRejectReason_vals,"unknown reason "), hs->rrj_reason[j]);
+ for (j=0; j<=RRJ_REASONS; j++) {
+ if (hs->rrj_reason[j] != 0 ) {
+ printf(" %s : %u\n", val_to_str(j, RegistrationRejectReason_vals, "unknown reason "), hs->rrj_reason[j]);
}
}
break;
case 6: /* URQ */
- for(j=0;j<=URQ_REASONS;j++) {
- if(hs->urq_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,UnregRequestReason_vals,"unknown reason "), hs->urq_reason[j]);
+ for (j=0; j<=URQ_REASONS; j++) {
+ if (hs->urq_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, UnregRequestReason_vals, "unknown reason "), hs->urq_reason[j]);
}
}
break;
case 8: /* URJ */
- for(j=0;j<=URJ_REASONS;j++) {
- if(hs->urj_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,UnregRejectReason_vals,"unknown reason "), hs->urj_reason[j]);
+ for (j=0; j<=URJ_REASONS; j++) {
+ if (hs->urj_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, UnregRejectReason_vals, "unknown reason "), hs->urj_reason[j]);
}
}
break;
case 11: /* ARJ */
- for(j=0;j<=ARJ_REASONS;j++) {
- if(hs->arj_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,AdmissionRejectReason_vals,"unknown reason "), hs->arj_reason[j]);
+ for (j=0; j<=ARJ_REASONS; j++) {
+ if (hs->arj_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, AdmissionRejectReason_vals, "unknown reason "), hs->arj_reason[j]);
}
}
break;
case 14: /* BRJ */
- for(j=0;j<=BRJ_REASONS;j++) {
- if(hs->brj_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,BandRejectReason_vals,"unknown reason "), hs->brj_reason[j]);
+ for (j=0; j<=BRJ_REASONS; j++) {
+ if (hs->brj_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, BandRejectReason_vals, "unknown reason "), hs->brj_reason[j]);
}
}
break;
case 15: /* DRQ */
- for(j=0;j<=DRQ_REASONS;j++) {
- if(hs->drq_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,DisengageReason_vals,"unknown reason "), hs->drq_reason[j]);
+ for (j=0; j<=DRQ_REASONS; j++) {
+ if (hs->drq_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, DisengageReason_vals, "unknown reason "), hs->drq_reason[j]);
}
}
break;
case 17: /* DRJ */
- for(j=0;j<=DRJ_REASONS;j++) {
- if(hs->drj_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,DisengageRejectReason_vals,"unknown reason "), hs->drj_reason[j]);
+ for (j=0; j<=DRJ_REASONS; j++) {
+ if (hs->drj_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, DisengageRejectReason_vals, "unknown reason "), hs->drj_reason[j]);
}
}
break;
case 20: /* LRJ */
- for(j=0;j<=LRJ_REASONS;j++) {
- if(hs->lrj_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,LocationRejectReason_vals,"unknown reason "), hs->lrj_reason[j]);
+ for (j=0; j<=LRJ_REASONS; j++) {
+ if (hs->lrj_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, LocationRejectReason_vals, "unknown reason "), hs->lrj_reason[j]);
}
}
break;
case 29: /* IRQNak */
- for(j=0;j<=IRQNAK_REASONS;j++) {
- if(hs->irqnak_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,InfoRequestNakReason_vals,"unknown reason "), hs->irqnak_reason[j]);
+ for (j=0; j<= IRQNAK_REASONS; j++) {
+ if (hs->irqnak_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, InfoRequestNakReason_vals, "unknown reason "), hs->irqnak_reason[j]);
}
}
break;
@@ -314,22 +314,22 @@ h225counter_draw(void *phs)
}
}
printf("Call Signalling:\n");
- for(i=0;i<=CS_MSG_TYPES;i++) {
- if(hs->cs_msg[i]!=0) {
- printf(" %s : %u\n", val_to_str(i,T_h323_message_body_vals,"unknown cs-messages "), hs->cs_msg[i]);
+ for (i=0; i<=CS_MSG_TYPES; i++) {
+ if (hs->cs_msg[i] != 0) {
+ printf(" %s : %u\n", val_to_str(i, T_h323_message_body_vals, "unknown cs-messages "), hs->cs_msg[i]);
/* reason counter */
- switch(i) {
+ switch (i) {
case 5: /* ReleaseComplete */
- for(j=0;j<=REL_CMP_REASONS;j++) {
- if(hs->rel_cmp_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,h225_ReleaseCompleteReason_vals,"unknown reason "), hs->rel_cmp_reason[j]);
+ for (j=0; j<=REL_CMP_REASONS; j++) {
+ if (hs->rel_cmp_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, h225_ReleaseCompleteReason_vals, "unknown reason "), hs->rel_cmp_reason[j]);
}
}
break;
case 6: /* Facility */
- for(j=0;j<=FACILITY_REASONS;j++) {
- if(hs->facility_reason[j]!=0) {
- printf(" %s : %u\n", val_to_str(j,FacilityReason_vals,"unknown reason "), hs->facility_reason[j]);
+ for (j=0; j<=FACILITY_REASONS; j++) {
+ if (hs->facility_reason[j] != 0) {
+ printf(" %s : %u\n", val_to_str(j, FacilityReason_vals, "unknown reason "), hs->facility_reason[j]);
}
}
break;
@@ -338,33 +338,33 @@ h225counter_draw(void *phs)
}
}
}
- printf("=====================================================================\n");
+ printf("=====================================================================\n");
}
static void
-h225counter_init(const char *opt_arg, void* userdata _U_)
+h225counter_init(const char *opt_arg, void *userdata _U_)
{
h225counter_t *hs;
GString *error_string;
- hs = g_new(h225counter_t,1);
- if(!strncmp(opt_arg,"h225,counter,",13)){
- hs->filter=g_strdup(opt_arg+13);
+ hs = g_new(h225counter_t, 1);
+ if (!strncmp(opt_arg, "h225,counter,", 13)) {
+ hs->filter = g_strdup(opt_arg+13);
} else {
- hs->filter=NULL;
+ hs->filter = NULL;
}
h225counter_reset(hs);
- error_string=register_tap_listener("h225", hs, hs->filter, 0, NULL, h225counter_packet, h225counter_draw);
- if(error_string){
+ error_string = register_tap_listener("h225", hs, hs->filter, 0, NULL, h225counter_packet, h225counter_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(hs->filter);
g_free(hs);
fprintf(stderr, "tshark: Couldn't register h225,counter tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -374,5 +374,18 @@ h225counter_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_h225counter(void)
{
- register_stat_cmd_arg("h225,counter", h225counter_init,NULL);
+ register_stat_cmd_arg("h225,counter", h225counter_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-h225rassrt.c b/ui/cli/tap-h225rassrt.c
index 8c4eb29798..360e9e7aad 100644
--- a/ui/cli/tap-h225rassrt.c
+++ b/ui/cli/tap-h225rassrt.c
@@ -41,14 +41,14 @@
void register_tap_listener_h225rassrt(void);
static const value_string ras_message_category[] = {
- { 0, "Gatekeeper "},
- { 1, "Registration "},
- { 2, "UnRegistration"},
- { 3, "Admission "},
- { 4, "Bandwidth "},
- { 5, "Disengage "},
- { 6, "Location "},
- { 0, NULL }
+ { 0, "Gatekeeper "},
+ { 1, "Registration "},
+ { 2, "UnRegistration"},
+ { 3, "Admission "},
+ { 4, "Bandwidth "},
+ { 5, "Disengage "},
+ { 6, "Location "},
+ { 0, NULL }
};
typedef enum _ras_type {
@@ -88,23 +88,23 @@ typedef struct _h225rassrt_t {
static void
h225rassrt_reset(void *phs)
{
- h225rassrt_t *hs=(h225rassrt_t *)phs;
+ h225rassrt_t *hs = (h225rassrt_t *)phs;
int i;
- for(i=0;i<NUM_RAS_STATS;i++) {
- hs->ras_rtd[i].stats.num = 0;
- hs->ras_rtd[i].stats.min_num = 0;
- hs->ras_rtd[i].stats.max_num = 0;
- hs->ras_rtd[i].stats.min.secs = 0;
- hs->ras_rtd[i].stats.min.nsecs = 0;
- hs->ras_rtd[i].stats.max.secs = 0;
- hs->ras_rtd[i].stats.max.nsecs = 0;
- hs->ras_rtd[i].stats.tot.secs = 0;
- hs->ras_rtd[i].stats.tot.nsecs = 0;
- hs->ras_rtd[i].open_req_num = 0;
- hs->ras_rtd[i].disc_rsp_num = 0;
- hs->ras_rtd[i].req_dup_num = 0;
- hs->ras_rtd[i].rsp_dup_num = 0;
+ for (i=0; i<NUM_RAS_STATS; i++) {
+ hs->ras_rtd[i].stats.num = 0;
+ hs->ras_rtd[i].stats.min_num = 0;
+ hs->ras_rtd[i].stats.max_num = 0;
+ hs->ras_rtd[i].stats.min.secs = 0;
+ hs->ras_rtd[i].stats.min.nsecs = 0;
+ hs->ras_rtd[i].stats.max.secs = 0;
+ hs->ras_rtd[i].stats.max.nsecs = 0;
+ hs->ras_rtd[i].stats.tot.secs = 0;
+ hs->ras_rtd[i].stats.tot.nsecs = 0;
+ hs->ras_rtd[i].open_req_num = 0;
+ hs->ras_rtd[i].disc_rsp_num = 0;
+ hs->ras_rtd[i].req_dup_num = 0;
+ hs->ras_rtd[i].rsp_dup_num = 0;
}
}
@@ -112,8 +112,8 @@ h225rassrt_reset(void *phs)
static int
h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
{
- h225rassrt_t *hs=(h225rassrt_t *)phs;
- const h225_packet_info *pi=(const h225_packet_info *)phi;
+ h225rassrt_t *hs = (h225rassrt_t *)phs;
+ const h225_packet_info *pi = (const h225_packet_info *)phi;
ras_type rasmsg_type = RAS_OTHER;
ras_category rascategory = RAS_OTHERS;
@@ -133,10 +133,10 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
return 0;
}
- switch(rasmsg_type) {
+ switch (rasmsg_type) {
case RAS_REQUEST:
- if(pi->is_duplicate){
+ if (pi->is_duplicate) {
hs->ras_rtd[rascategory].req_dup_num++;
}
else {
@@ -147,7 +147,7 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
case RAS_CONFIRM:
/* no break - delay calculation is identical for Confirm and Reject */
case RAS_REJECT:
- if(pi->is_duplicate){
+ if (pi->is_duplicate) {
/* Duplicate is ignored */
hs->ras_rtd[rascategory].rsp_dup_num++;
}
@@ -157,7 +157,7 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
}
else {
hs->ras_rtd[rascategory].open_req_num--;
- time_stat_update(&(hs->ras_rtd[rascategory].stats),&(pi->delta_time), pinfo);
+ time_stat_update(&(hs->ras_rtd[rascategory].stats), &(pi->delta_time), pinfo);
}
break;
@@ -170,33 +170,33 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
static void
h225rassrt_draw(void *phs)
{
- h225rassrt_t *hs=(h225rassrt_t *)phs;
+ h225rassrt_t *hs = (h225rassrt_t *)phs;
int i;
timestat_t *rtd_temp;
printf("======================================== H225 RAS Service Response Time ========================================\n");
printf("H225 RAS Service Response Time (SRT) Statistics:\n");
printf("RAS-Messages | Measurements | Min SRT | Max SRT | Avg SRT | Min in Frame | Max in Frame |\n");
- for(i=0;i<NUM_RAS_STATS;i++) {
+ for (i=0; i<NUM_RAS_STATS; i++) {
rtd_temp = &(hs->ras_rtd[i].stats);
- if(rtd_temp->num){
+ if (rtd_temp->num) {
printf("%s | %10u | %9.2f msec | %9.2f msec | %9.2f msec | %10u | %10u |\n",
- val_to_str(i,ras_message_category,"Unknown "),rtd_temp->num,
- nstime_to_msec(&(rtd_temp->min)), nstime_to_msec(&(rtd_temp->max)),
- get_average(&(rtd_temp->tot), rtd_temp->num),
- rtd_temp->min_num, rtd_temp->max_num
+ val_to_str(i, ras_message_category, "Unknown "), rtd_temp->num,
+ nstime_to_msec(&(rtd_temp->min)), nstime_to_msec(&(rtd_temp->max)),
+ get_average(&(rtd_temp->tot), rtd_temp->num),
+ rtd_temp->min_num, rtd_temp->max_num
);
}
}
- printf("================================================================================================================\n");
+ printf("================================================================================================================\n");
printf("RAS-Messages | Open REQ | Discarded RSP | Repeated REQ | Repeated RSP |\n");
- for(i=0;i<NUM_RAS_STATS;i++) {
+ for (i=0; i<NUM_RAS_STATS; i++) {
rtd_temp = &(hs->ras_rtd[i].stats);
- if(rtd_temp->num){
+ if (rtd_temp->num) {
printf("%s | %10u | %10u | %10u | %10u |\n",
- val_to_str(i,ras_message_category,"Unknown "),
- hs->ras_rtd[i].open_req_num, hs->ras_rtd[i].disc_rsp_num,
- hs->ras_rtd[i].req_dup_num, hs->ras_rtd[i].rsp_dup_num
+ val_to_str(i, ras_message_category, "Unknown "),
+ hs->ras_rtd[i].open_req_num, hs->ras_rtd[i].disc_rsp_num,
+ hs->ras_rtd[i].req_dup_num, hs->ras_rtd[i].rsp_dup_num
);
}
}
@@ -206,28 +206,28 @@ h225rassrt_draw(void *phs)
static void
-h225rassrt_init(const char *opt_arg, void* userdata _U_)
+h225rassrt_init(const char *opt_arg, void *userdata _U_)
{
h225rassrt_t *hs;
GString *error_string;
- hs = g_new(h225rassrt_t,1);
- if(!strncmp(opt_arg,"h225,srt,",9)){
- hs->filter=g_strdup(opt_arg+9);
+ hs = g_new(h225rassrt_t, 1);
+ if (!strncmp(opt_arg, "h225,srt,", 9)) {
+ hs->filter = g_strdup(opt_arg+9);
} else {
- hs->filter=NULL;
+ hs->filter = NULL;
}
h225rassrt_reset(hs);
- error_string=register_tap_listener("h225", hs, hs->filter, 0, NULL, h225rassrt_packet, h225rassrt_draw);
- if(error_string){
+ error_string = register_tap_listener("h225", hs, hs->filter, 0, NULL, h225rassrt_packet, h225rassrt_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(hs->filter);
g_free(hs);
fprintf(stderr, "tshark: Couldn't register h225,srt tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -237,5 +237,18 @@ h225rassrt_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_h225rassrt(void)
{
- register_stat_cmd_arg("h225,srt", h225rassrt_init,NULL);
+ register_stat_cmd_arg("h225,srt", h225rassrt_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-hosts.c b/ui/cli/tap-hosts.c
index e9c5eb3773..da2b323da6 100644
--- a/ui/cli/tap-hosts.c
+++ b/ui/cli/tap-hosts.c
@@ -51,10 +51,10 @@ ipv4_hash_table_print_resolved(gpointer key _U_, gpointer value, gpointer user_d
{
hashipv4_t *ipv4_hash_table_entry = (hashipv4_t *)value;
- if((ipv4_hash_table_entry->flags & DUMMY_ADDRESS_ENTRY)== DUMMY_ADDRESS_ENTRY){
+ if ((ipv4_hash_table_entry->flags & DUMMY_ADDRESS_ENTRY) == DUMMY_ADDRESS_ENTRY) {
printf("%s\t%s",
- ipv4_hash_table_entry->ip,
- ipv4_hash_table_entry->name);
+ ipv4_hash_table_entry->ip,
+ ipv4_hash_table_entry->name);
}
}
@@ -63,10 +63,10 @@ ipv6_hash_table_print_resolved(gpointer key _U_, gpointer value, gpointer user_d
{
hashipv6_t *ipv6_hash_table_entry = (hashipv6_t *)value;
- if((ipv6_hash_table_entry->flags & DUMMY_ADDRESS_ENTRY)== DUMMY_ADDRESS_ENTRY){
+ if ((ipv6_hash_table_entry->flags & DUMMY_ADDRESS_ENTRY) == DUMMY_ADDRESS_ENTRY) {
printf("%s\t%s",
- ipv6_hash_table_entry->ip6,
- ipv6_hash_table_entry->name);
+ ipv6_hash_table_entry->ip6,
+ ipv6_hash_table_entry->name);
}
}
@@ -83,12 +83,12 @@ hosts_draw(void *dummy _U_)
printf("\n");
ipv4_hash_table = get_ipv4_hash_table();
- if(ipv4_hash_table){
+ if (ipv4_hash_table) {
g_hash_table_foreach( ipv4_hash_table, ipv4_hash_table_print_resolved, NULL);
}
ipv6_hash_table = get_ipv6_hash_table();
- if(ipv6_hash_table){
+ if (ipv6_hash_table) {
g_hash_table_foreach( ipv6_hash_table, ipv6_hash_table_print_resolved, NULL);
}
@@ -96,7 +96,7 @@ hosts_draw(void *dummy _U_)
static void
-hosts_init(const char *opt_arg, void* userdata _U_)
+hosts_init(const char *opt_arg, void *userdata _U_)
{
GString *error_string;
gchar **tokens;
@@ -105,13 +105,13 @@ hosts_init(const char *opt_arg, void* userdata _U_)
dump_v4 = FALSE;
dump_v6 = FALSE;
- if(strcmp(TAP_NAME, opt_arg)==0) {
+ if (strcmp(TAP_NAME, opt_arg) == 0) {
/* No arguments; dump everything */
dump_v4 = TRUE;
dump_v6 = TRUE;
} else {
- tokens = g_strsplit(opt_arg,",", 0);
- opt_count=0;
+ tokens = g_strsplit(opt_arg, ",", 0);
+ opt_count = 0;
while (tokens[opt_count]) {
if (strcmp("ipv4", tokens[opt_count]) == 0) {
dump_v4 = TRUE;
@@ -126,12 +126,12 @@ hosts_init(const char *opt_arg, void* userdata _U_)
g_strfreev(tokens);
}
- error_string=register_tap_listener("frame", NULL, NULL, TL_REQUIRES_PROTO_TREE,
+ error_string = register_tap_listener("frame", NULL, NULL, TL_REQUIRES_PROTO_TREE,
NULL, NULL, hosts_draw);
- if(error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
fprintf(stderr, "tshark: Couldn't register " TAP_NAME " tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -143,3 +143,16 @@ register_tap_listener_hosts(void)
register_stat_cmd_arg(TAP_NAME, hosts_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-httpstat.c b/ui/cli/tap-httpstat.c
index fdc89d6b3e..073d04178a 100644
--- a/ui/cli/tap-httpstat.c
+++ b/ui/cli/tap-httpstat.c
@@ -77,34 +77,34 @@ static const value_string vals_status_code[] = {
{ 301, "Moved Permanently"},
{ 302, "Moved Temporarily"},
{ 303, "See Other"},
- { 304, "Not Modified"},
- { 305, "Use Proxy"},
+ { 304, "Not Modified"},
+ { 305, "Use Proxy"},
{ 399, "Redirection - Others"},
- { 400, "Bad Request"},
- { 401, "Unauthorized"},
- { 402, "Payment Required"},
- { 403, "Forbidden"},
- { 404, "Not Found"},
- { 405, "Method Not Allowed"},
- { 406, "Not Acceptable"},
- { 407, "Proxy Authentication Required"},
- { 408, "Request Time-out"},
- { 409, "Conflict"},
- { 410, "Gone"},
- { 411, "Length Required"},
- { 412, "Precondition Failed"},
- { 413, "Request Entity Too Large"},
- { 414, "Request-URI Too Large"},
- { 415, "Unsupported Media Type"},
+ { 400, "Bad Request"},
+ { 401, "Unauthorized"},
+ { 402, "Payment Required"},
+ { 403, "Forbidden"},
+ { 404, "Not Found"},
+ { 405, "Method Not Allowed"},
+ { 406, "Not Acceptable"},
+ { 407, "Proxy Authentication Required"},
+ { 408, "Request Time-out"},
+ { 409, "Conflict"},
+ { 410, "Gone"},
+ { 411, "Length Required"},
+ { 412, "Precondition Failed"},
+ { 413, "Request Entity Too Large"},
+ { 414, "Request-URI Too Large"},
+ { 415, "Unsupported Media Type"},
{ 499, "Client Error - Others"},
- { 500, "Internal Server Error"},
- { 501, "Not Implemented"},
- { 502, "Bad Gateway"},
- { 503, "Service Unavailable"},
- { 504, "Gateway Time-out"},
- { 505, "HTTP Version not supported"},
+ { 500, "Internal Server Error"},
+ { 501, "Not Implemented"},
+ { 502, "Bad Gateway"},
+ { 503, "Service Unavailable"},
+ { 504, "Gateway Time-out"},
+ { 505, "HTTP Version not supported"},
{ 599, "Server Error - Others"},
{ 0, NULL}
@@ -112,41 +112,41 @@ static const value_string vals_status_code[] = {
/* insert some entries */
static void
-http_init_hash( httpstat_t *sp)
+http_init_hash(httpstat_t *sp)
{
int i;
- sp->hash_responses = g_hash_table_new( g_int_hash, g_int_equal);
+ sp->hash_responses = g_hash_table_new(g_int_hash, g_int_equal);
- for (i=0 ; vals_status_code[i].strptr ; i++ )
+ for (i=0; vals_status_code[i].strptr; i++ )
{
- gint *key = g_new (gint,1);
- http_response_code_t *sc = g_new (http_response_code_t,1);
+ gint *key = g_new (gint, 1);
+ http_response_code_t *sc = g_new (http_response_code_t, 1);
*key = vals_status_code[i].value;
- sc->packets=0;
+ sc->packets = 0;
sc->response_code = *key;
- sc->name=vals_status_code[i].strptr;
+ sc->name = vals_status_code[i].strptr;
sc->sp = sp;
- g_hash_table_insert( sc->sp->hash_responses, key, sc);
+ g_hash_table_insert(sc->sp->hash_responses, key, sc);
}
- sp->hash_requests = g_hash_table_new( g_str_hash, g_str_equal);
+ sp->hash_requests = g_hash_table_new(g_str_hash, g_str_equal);
}
static void
-http_draw_hash_requests( gchar *key _U_ , http_request_methode_t *data, gchar * format)
+http_draw_hash_requests(gchar *key _U_ , http_request_methode_t *data, gchar *format)
{
- if (data->packets==0)
+ if (data->packets == 0)
return;
- printf( format, data->response, data->packets);
+ printf(format, data->response, data->packets);
}
static void
-http_draw_hash_responses( gint * key _U_ , http_response_code_t *data, char * format)
+http_draw_hash_responses(gint * key _U_ , http_response_code_t *data, char *format)
{
- if (data==NULL) {
+ if (data == NULL) {
g_warning("No data available, key=%d\n", *key);
exit(EXIT_FAILURE);
}
- if (data->packets==0)
+ if (data->packets == 0)
return;
/* " HTTP %3d %-35s %9d packets", */
printf(format, data->response_code, data->name, data->packets );
@@ -157,7 +157,7 @@ http_draw_hash_responses( gint * key _U_ , http_response_code_t *data, char * fo
/* NOT USED at this moment */
/*
static void
-http_free_hash( gpointer key, gpointer value, gpointer user_data _U_ )
+http_free_hash(gpointer key, gpointer value, gpointer user_data _U_ )
{
g_free(key);
g_free(value);
@@ -177,72 +177,72 @@ http_reset_hash_requests(gchar *key _U_ , http_request_methode_t *data, gpointer
static void
httpstat_reset(void *psp )
{
- httpstat_t *sp=(httpstat_t *)psp;
+ httpstat_t *sp = (httpstat_t *)psp;
- g_hash_table_foreach( sp->hash_responses, (GHFunc)http_reset_hash_responses, NULL);
- g_hash_table_foreach( sp->hash_requests, (GHFunc)http_reset_hash_requests, NULL);
+ g_hash_table_foreach(sp->hash_responses, (GHFunc)http_reset_hash_responses, NULL);
+ g_hash_table_foreach(sp->hash_requests, (GHFunc)http_reset_hash_requests, NULL);
}
static int
httpstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
{
- const http_info_value_t *value=(const http_info_value_t *)pri;
- httpstat_t *sp=(httpstat_t *) psp;
+ const http_info_value_t *value = (const http_info_value_t *)pri;
+ httpstat_t *sp = (httpstat_t *) psp;
/* We are only interested in reply packets with a status code */
/* Request or reply packets ? */
- if (value->response_code!=0) {
- guint *key=g_new(guint,1);
+ if (value->response_code != 0) {
+ guint *key = g_new(guint, 1);
http_response_code_t *sc;
- *key=value->response_code;
+ *key = value->response_code;
sc = (http_response_code_t *)g_hash_table_lookup(
sp->hash_responses,
key);
- if (sc==NULL){
+ if (sc == NULL) {
/* non standard status code ; we classify it as others
* in the relevant category (Informational,Success,Redirection,Client Error,Server Error)
*/
int i = value->response_code;
- if ((i<100) || (i>=600)) {
+ if ((i < 100) || (i >= 600)) {
return 0;
}
- else if (i<200){
- *key=199; /* Hopefully, this status code will never be used */
+ else if (i < 200) {
+ *key = 199; /* Hopefully, this status code will never be used */
}
- else if (i<300){
- *key=299;
+ else if (i < 300) {
+ *key = 299;
}
- else if (i<400){
- *key=399;
+ else if (i < 400) {
+ *key = 399;
}
- else if (i<500){
- *key=499;
+ else if (i < 500) {
+ *key = 499;
}
else{
- *key=599;
+ *key = 599;
}
sc = (http_response_code_t *)g_hash_table_lookup(
sp->hash_responses,
key);
- if (sc==NULL)
+ if (sc == NULL)
return 0;
}
sc->packets++;
}
- else if (value->request_method){
+ else if (value->request_method) {
http_request_methode_t *sc;
sc = (http_request_methode_t *)g_hash_table_lookup(
sp->hash_requests,
value->request_method);
- if (sc==NULL){
- sc=g_new(http_request_methode_t,1);
- sc->response=g_strdup( value->request_method );
- sc->packets=1;
+ if (sc == NULL) {
+ sc = g_new(http_request_methode_t, 1);
+ sc->response = g_strdup(value->request_method );
+ sc->packets = 1;
sc->sp = sp;
- g_hash_table_insert( sp->hash_requests, sc->response, sc);
+ g_hash_table_insert(sp->hash_requests, sc->response, sc);
} else {
sc->packets++;
}
@@ -256,7 +256,7 @@ httpstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, con
static void
httpstat_draw(void *psp )
{
- httpstat_t *sp=(httpstat_t *)psp;
+ httpstat_t *sp = (httpstat_t *)psp;
printf("\n");
printf("===================================================================\n");
if (! sp->filter[0])
@@ -264,12 +264,12 @@ httpstat_draw(void *psp )
else
printf("HTTP Statistics with filter %s\n", sp->filter);
- printf( "* HTTP Status Codes in reply packets\n");
- g_hash_table_foreach( sp->hash_responses, (GHFunc)http_draw_hash_responses,
- (gpointer)" HTTP %3d %s\n");
+ printf("* HTTP Status Codes in reply packets\n");
+ g_hash_table_foreach(sp->hash_responses, (GHFunc)http_draw_hash_responses,
+ (gpointer)" HTTP %3d %s\n");
printf("* List of HTTP Request methods\n");
- g_hash_table_foreach( sp->hash_requests, (GHFunc)http_draw_hash_requests,
- (gpointer)" %9s %d \n");
+ g_hash_table_foreach(sp->hash_requests, (GHFunc)http_draw_hash_requests,
+ (gpointer)" %9s %d \n");
printf("===================================================================\n");
}
@@ -278,25 +278,25 @@ httpstat_draw(void *psp )
/* When called, this function will create a new instance of gtk_httpstat.
*/
static void
-gtk_httpstat_init(const char *opt_arg,void* userdata _U_)
+gtk_httpstat_init(const char *opt_arg, void *userdata _U_)
{
httpstat_t *sp;
- const char *filter=NULL;
- GString *error_string;
+ const char *filter = NULL;
+ GString *error_string;
- if (!strncmp (opt_arg, "http,stat,", 10)){
- filter=opt_arg+10;
+ if (!strncmp (opt_arg, "http,stat,", 10)) {
+ filter = opt_arg+10;
} else {
- filter=NULL;
+ filter = NULL;
}
- sp = g_new(httpstat_t,1);
- if(filter){
- sp->filter=g_strdup(filter);
+ sp = g_new(httpstat_t, 1);
+ if (filter) {
+ sp->filter = g_strdup(filter);
} else {
- sp->filter=NULL;
+ sp->filter = NULL;
}
- /*g_hash_table_foreach( http_status, (GHFunc)http_reset_hash_responses, NULL);*/
+ /*g_hash_table_foreach(http_status, (GHFunc)http_reset_hash_responses, NULL);*/
error_string = register_tap_listener(
@@ -307,12 +307,12 @@ gtk_httpstat_init(const char *opt_arg,void* userdata _U_)
httpstat_reset,
httpstat_packet,
httpstat_draw);
- if (error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(sp->filter);
g_free(sp);
fprintf (stderr, "tshark: Couldn't register http,stat tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -323,5 +323,18 @@ gtk_httpstat_init(const char *opt_arg,void* userdata _U_)
void
register_tap_listener_gtkhttpstat(void)
{
- register_stat_cmd_arg("http,stat,", gtk_httpstat_init,NULL);
+ register_stat_cmd_arg("http,stat,", gtk_httpstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-icmpstat.c b/ui/cli/tap-icmpstat.c
index e02a236df7..bbfb87407b 100644
--- a/ui/cli/tap-icmpstat.c
+++ b/ui/cli/tap-icmpstat.c
@@ -125,7 +125,7 @@ icmpstat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_,
if (trans->resp_frame) {
resp_time = nstime_to_msec(&trans->resp_time);
- rt = g_new(double,1);
+ rt = g_new(double, 1);
if (rt == NULL)
return 0;
*rt = resp_time;
@@ -264,7 +264,7 @@ icmpstat_draw(void *tapdata)
* instance for the icmp tap.
*/
static void
-icmpstat_init(const char *opt_arg, void* userdata _U_)
+icmpstat_init(const char *opt_arg, void *userdata _U_)
{
icmpstat_t *icmpstat;
const char *filter = NULL;
@@ -316,3 +316,15 @@ register_tap_listener_icmpstat(void)
register_stat_cmd_arg("icmp,srt", icmpstat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-icmpv6stat.c b/ui/cli/tap-icmpv6stat.c
index 294b285402..c0d1a88dde 100644
--- a/ui/cli/tap-icmpv6stat.c
+++ b/ui/cli/tap-icmpv6stat.c
@@ -126,7 +126,7 @@ icmpv6stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_
if (trans->resp_frame) {
resp_time = nstime_to_msec(&trans->resp_time);
- rt = g_new(double,1);
+ rt = g_new(double, 1);
if (rt == NULL)
return 0;
*rt = resp_time;
@@ -265,7 +265,7 @@ icmpv6stat_draw(void *tapdata)
* instance for the icmpv6 tap.
*/
static void
-icmpv6stat_init(const char *opt_arg, void* userdata _U_)
+icmpv6stat_init(const char *opt_arg, void *userdata _U_)
{
icmpv6stat_t *icmpv6stat;
const char *filter = NULL;
@@ -317,3 +317,15 @@ register_tap_listener_icmpv6stat(void)
register_stat_cmd_arg("icmpv6,srt", icmpv6stat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c
index 5bb000b770..e9560d69a5 100644
--- a/ui/cli/tap-iostat.c
+++ b/ui/cli/tap-iostat.c
@@ -52,15 +52,15 @@ typedef struct {
} calc_type_ent_t;
static calc_type_ent_t calc_type_table[] = {
- { "FRAMES", CALC_TYPE_FRAMES },
- { "BYTES", CALC_TYPE_BYTES },
+ { "FRAMES", CALC_TYPE_FRAMES },
+ { "BYTES", CALC_TYPE_BYTES },
{ "FRAMES BYTES", CALC_TYPE_FRAMES_AND_BYTES },
- { "COUNT", CALC_TYPE_COUNT },
- { "SUM", CALC_TYPE_SUM },
- { "MIN", CALC_TYPE_MIN },
- { "MAX", CALC_TYPE_MAX },
- { "AVG", CALC_TYPE_AVG },
- { "LOAD", CALC_TYPE_LOAD },
+ { "COUNT", CALC_TYPE_COUNT },
+ { "SUM", CALC_TYPE_SUM },
+ { "MIN", CALC_TYPE_MIN },
+ { "MAX", CALC_TYPE_MAX },
+ { "AVG", CALC_TYPE_AVG },
+ { "LOAD", CALC_TYPE_LOAD },
{ NULL, 0 }
};
@@ -151,25 +151,25 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
/* Store info in the current structure */
it->frames++;
- switch(it->calc_type) {
+ switch (it->calc_type) {
case CALC_TYPE_FRAMES:
case CALC_TYPE_BYTES:
case CALC_TYPE_FRAMES_AND_BYTES:
it->counter += pinfo->fd->pkt_len;
break;
case CALC_TYPE_COUNT:
- gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
- if(gp){
+ gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if (gp) {
it->counter += gp->len;
}
break;
case CALC_TYPE_SUM:
- gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
- if(gp){
+ gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if (gp) {
guint64 val;
- for(i=0;i<gp->len;i++){
- switch(proto_registrar_get_ftype(it->hf_index)){
+ for (i=0; i<gp->len; i++) {
+ switch (proto_registrar_get_ftype(it->hf_index)) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
@@ -212,28 +212,28 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_MIN:
- gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
- if(gp){
+ gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if (gp) {
guint64 val;
gfloat float_val;
gdouble double_val;
- ftype=proto_registrar_get_ftype(it->hf_index);
- for(i=0;i<gp->len;i++){
- switch(ftype){
+ ftype = proto_registrar_get_ftype(it->hf_index);
+ for (i=0; i<gp->len; i++) {
+ switch (ftype) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
val = fvalue_get_uinteger(&((field_info *)gp->pdata[i])->value);
- if ((it->frames==1 && i==0) || (val < it->counter)) {
- it->counter=val;
+ if ((it->frames == 1 && i == 0) || (val < it->counter)) {
+ it->counter = val;
}
break;
case FT_UINT64:
val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
- if((it->frames==1 && i==0) || (val < it->counter)){
- it->counter=val;
+ if ((it->frames == 1 && i == 0) || (val < it->counter)) {
+ it->counter = val;
}
break;
case FT_INT8:
@@ -241,33 +241,33 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_INT24:
case FT_INT32:
val = fvalue_get_sinteger(&((field_info *)gp->pdata[i])->value);
- if((it->frames==1 && i==0) || ((gint32)val < (gint32)it->counter)) {
- it->counter=val;
+ if ((it->frames == 1 && i == 0) || ((gint32)val < (gint32)it->counter)) {
+ it->counter = val;
}
break;
case FT_INT64:
val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
- if((it->frames==1 && i==0) || ((gint64)val < (gint64)it->counter)) {
- it->counter=val;
+ if ((it->frames == 1 && i == 0) || ((gint64)val < (gint64)it->counter)) {
+ it->counter = val;
}
break;
case FT_FLOAT:
- float_val=(gfloat)fvalue_get_floating(&((field_info *)gp->pdata[i])->value);
- if((it->frames==1 && i==0) || (float_val < it->float_counter)) {
- it->float_counter=float_val;
+ float_val = (gfloat)fvalue_get_floating(&((field_info *)gp->pdata[i])->value);
+ if ((it->frames == 1 && i == 0) || (float_val < it->float_counter)) {
+ it->float_counter = float_val;
}
break;
case FT_DOUBLE:
- double_val=fvalue_get_floating(&((field_info *)gp->pdata[i])->value);
- if((it->frames==1 && i==0) || (double_val < it->double_counter)) {
- it->double_counter=double_val;
+ double_val = fvalue_get_floating(&((field_info *)gp->pdata[i])->value);
+ if ((it->frames == 1 && i == 0) || (double_val < it->double_counter)) {
+ it->double_counter = double_val;
}
break;
case FT_RELATIVE_TIME:
new_time = (nstime_t *)fvalue_get(&((field_info *)gp->pdata[i])->value);
val = ((guint64)new_time->secs * NANOSECS_PER_SEC) + (guint64)new_time->nsecs;
- if((it->frames==1 && i==0) || (val < it->counter)) {
- it->counter=val;
+ if ((it->frames == 1 && i == 0) || (val < it->counter)) {
+ it->counter = val;
}
break;
default:
@@ -282,56 +282,56 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_MAX:
- gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
- if(gp){
+ gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if (gp) {
guint64 val;
gfloat float_val;
gdouble double_val;
- ftype=proto_registrar_get_ftype(it->hf_index);
- for(i=0;i<gp->len;i++){
- switch(ftype){
+ ftype = proto_registrar_get_ftype(it->hf_index);
+ for (i=0; i<gp->len; i++) {
+ switch (ftype) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
val = fvalue_get_uinteger(&((field_info *)gp->pdata[i])->value);
- if(val > it->counter)
- it->counter=val;
+ if (val > it->counter)
+ it->counter = val;
break;
case FT_UINT64:
val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
- if(val > it->counter)
- it->counter=val;
+ if (val > it->counter)
+ it->counter = val;
break;
case FT_INT8:
case FT_INT16:
case FT_INT24:
case FT_INT32:
val = fvalue_get_sinteger(&((field_info *)gp->pdata[i])->value);
- if((gint32)val > (gint32)it->counter)
- it->counter=val;
+ if ((gint32)val > (gint32)it->counter)
+ it->counter = val;
break;
case FT_INT64:
val = fvalue_get_integer64(&((field_info *)gp->pdata[i])->value);
if ((gint64)val > (gint64)it->counter)
- it->counter=val;
+ it->counter = val;
break;
case FT_FLOAT:
float_val = (gfloat)fvalue_get_floating(&((field_info *)gp->pdata[i])->value);
- if(float_val > it->float_counter)
- it->float_counter=float_val;
+ if (float_val > it->float_counter)
+ it->float_counter = float_val;
break;
case FT_DOUBLE:
double_val = fvalue_get_floating(&((field_info *)gp->pdata[i])->value);
- if(double_val > it->double_counter)
- it->double_counter=double_val;
+ if (double_val > it->double_counter)
+ it->double_counter = double_val;
break;
case FT_RELATIVE_TIME:
new_time = (nstime_t *)fvalue_get(&((field_info *)gp->pdata[i])->value);
val = ((guint64)new_time->secs * NANOSECS_PER_SEC) + (guint64)new_time->nsecs;
- if (val>it->counter)
- it->counter=val;
+ if (val > it->counter)
+ it->counter = val;
break;
default:
/*
@@ -345,14 +345,14 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_AVG:
- gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
- if(gp){
+ gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if (gp) {
guint64 val;
- ftype=proto_registrar_get_ftype(it->hf_index);
- for(i=0;i<gp->len;i++){
+ ftype = proto_registrar_get_ftype(it->hf_index);
+ for (i=0; i<gp->len; i++) {
it->num++;
- switch(ftype) {
+ switch (ftype) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
@@ -403,7 +403,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
"\ntshark: LOAD() is only supported for relative-time fields such as smb.time\n");
exit(10);
}
- for(i=0;i<gp->len;i++){
+ for (i=0; i<gp->len; i++) {
guint64 val;
int tival;
io_stat_item_t *pit;
@@ -433,12 +433,12 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
* calc the average, round it to the next second and store the seconds. For all other calc types
* of RELATIVE_TIME fields, store the counters without modification.
* fields. */
- switch(it->calc_type) {
+ switch (it->calc_type) {
case CALC_TYPE_FRAMES:
case CALC_TYPE_FRAMES_AND_BYTES:
parent->max_frame[it->colnum] =
MAX(parent->max_frame[it->colnum], it->frames);
- if (it->calc_type==CALC_TYPE_FRAMES_AND_BYTES)
+ if (it->calc_type == CALC_TYPE_FRAMES_AND_BYTES)
parent->max_vals[it->colnum] =
MAX(parent->max_vals[it->colnum], it->counter);
@@ -450,15 +450,15 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case CALC_TYPE_SUM:
case CALC_TYPE_MIN:
case CALC_TYPE_MAX:
- ftype=proto_registrar_get_ftype(it->hf_index);
- switch(ftype) {
+ ftype = proto_registrar_get_ftype(it->hf_index);
+ switch (ftype) {
case FT_FLOAT:
parent->max_vals[it->colnum] =
MAX(parent->max_vals[it->colnum], (guint64)(it->float_counter+0.5));
break;
case FT_DOUBLE:
parent->max_vals[it->colnum] =
- MAX(parent->max_vals[it->colnum],(guint64)(it->double_counter+0.5));
+ MAX(parent->max_vals[it->colnum], (guint64)(it->double_counter+0.5));
break;
case FT_RELATIVE_TIME:
parent->max_vals[it->colnum] =
@@ -472,17 +472,17 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_AVG:
- if (it->num==0) /* avoid division by zero */
+ if (it->num == 0) /* avoid division by zero */
break;
- ftype=proto_registrar_get_ftype(it->hf_index);
- switch(ftype) {
+ ftype = proto_registrar_get_ftype(it->hf_index);
+ switch (ftype) {
case FT_FLOAT:
parent->max_vals[it->colnum] =
MAX(parent->max_vals[it->colnum], (guint64)it->float_counter/it->num);
break;
case FT_DOUBLE:
parent->max_vals[it->colnum] =
- MAX(parent->max_vals[it->colnum],(guint64)it->double_counter/it->num);
+ MAX(parent->max_vals[it->colnum], (guint64)it->double_counter/it->num);
break;
case FT_RELATIVE_TIME:
parent->max_vals[it->colnum] =
@@ -501,11 +501,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
static int
magnitude (guint64 val, int max_w)
{
- int i, mag=0;
+ int i, mag = 0;
for (i=0; i<max_w; i++) {
mag++;
- if ((val /= 10)==0)
+ if ((val /= 10) == 0)
break;
}
return(mag);
@@ -518,12 +518,12 @@ static void
printcenter (const char *label, int lenval, int numpad)
{
int lenlab = (int) strlen(label), len;
- const char spaces[]=" ", *spaces_ptr;
+ const char spaces[] = " ", *spaces_ptr;
len = (int) (strlen(spaces)) - (((lenval-lenlab) / 2) + numpad);
if (len > 0 && len < 6) {
spaces_ptr = &spaces[len];
- if ((lenval-lenlab)%2==0) {
+ if ((lenval-lenlab)%2 == 0) {
printf("%s%s%s|", spaces_ptr, label, spaces_ptr);
} else {
printf("%s%s%s|", spaces_ptr-1, label, spaces_ptr);
@@ -544,15 +544,15 @@ iostat_draw(void *arg)
guint32 num;
guint64 interval, duration, t, invl_end, dv;
int i, j, k, num_cols, num_rows, dur_secs_orig, dur_nsecs_orig, dur_secs, dur_nsecs, dur_mag,
- invl_mag, invl_prec, tabrow_w, borderlen, invl_col_w, numpad=1, namelen, len_filt, type,
+ invl_mag, invl_prec, tabrow_w, borderlen, invl_col_w, numpad = 1, namelen, len_filt, type,
maxfltr_w, ftype;
int fr_mag; /* The magnitude of the max frame number in this column */
int val_mag; /* The magnitude of the max value in this column */
- char *spaces, *spaces_s, *filler_s=NULL, **fmts, *fmt=NULL;
+ char *spaces, *spaces_s, *filler_s = NULL, **fmts, *fmt = NULL;
const char *filter;
static gchar dur_mag_s[3], invl_prec_s[3], fr_mag_s[3], val_mag_s[3], *invl_fmt, *full_fmt;
io_stat_item_t *mit, **stat_cols, *item, **item_in_column;
- gboolean last_row=FALSE;
+ gboolean last_row = FALSE;
io_stat_t *iot;
column_width *col_w;
struct tm *tm_time;
@@ -567,13 +567,13 @@ iostat_draw(void *arg)
(guint64)((cfile.elapsed_time.nsecs + 500) / 1000);
/* Store the pointer to each stat column */
- stat_cols = (io_stat_item_t **) g_malloc(sizeof(io_stat_item_t *) * num_cols);
+ stat_cols = (io_stat_item_t **)g_malloc(sizeof(io_stat_item_t *) * num_cols);
for (j=0; j<num_cols; j++)
stat_cols[j] = &iot->items[j];
/* The following prevents gross inaccuracies when the user specifies an interval that is greater
* than the capture duration. */
- if (iot->interval > duration || iot->interval==G_MAXINT32) {
+ if (iot->interval > duration || iot->interval == G_MAXINT32) {
interval = duration;
iot->interval = G_MAXINT32;
} else {
@@ -592,25 +592,25 @@ iostat_draw(void *arg)
invl_mag = magnitude(interval/G_GUINT64_CONSTANT(1000000), 5);
/* Set or get the interval precision */
- if (interval==duration) {
+ if (interval == duration) {
/*
* An interval arg of 0 or an interval size exceeding the capture duration was specified.
* Set the decimal precision of duration based on its magnitude. */
if (dur_mag >= 2)
invl_prec = 1;
- else if (dur_mag==1)
+ else if (dur_mag == 1)
invl_prec = 3;
else
invl_prec = 6;
- borderlen = 30 + dur_mag + (invl_prec==0 ? 0 : invl_prec+1);
+ borderlen = 30 + dur_mag + (invl_prec == 0 ? 0 : invl_prec+1);
} else {
invl_prec = iot->invl_prec;
- borderlen = 24 + invl_mag + (invl_prec==0 ? 0 : invl_prec+1);
+ borderlen = 24 + invl_mag + (invl_prec == 0 ? 0 : invl_prec+1);
}
/* Round the duration according to invl_prec */
- dv=1000000;
+ dv = 1000000;
for (i=0; i<invl_prec; i++)
dv /= 10;
if ((duration%dv) > 5*(dv/10)) {
@@ -622,11 +622,11 @@ iostat_draw(void *arg)
* Recalc dur_mag in case rounding has increased its magnitude */
dur_mag = magnitude((guint64)dur_secs, 5);
}
- if (iot->interval==G_MAXINT32)
+ if (iot->interval == G_MAXINT32)
interval = duration;
/* Calc the width of the time interval column (incl borders and padding). */
- if (invl_prec==0)
+ if (invl_prec == 0)
invl_col_w = (2*dur_mag) + 8;
else
invl_col_w = (2*dur_mag) + (2*invl_prec) + 10;
@@ -654,13 +654,13 @@ iostat_draw(void *arg)
tabrow_w = invl_col_w;
for (j=0; j<num_cols; j++) {
type = iot->items[j].calc_type;
- if (type==CALC_TYPE_FRAMES_AND_BYTES) {
+ if (type == CALC_TYPE_FRAMES_AND_BYTES) {
namelen = 5;
} else {
namelen = (int) strlen(calc_type_table[type].func_name);
}
- if(type==CALC_TYPE_FRAMES
- || type==CALC_TYPE_FRAMES_AND_BYTES) {
+ if (type == CALC_TYPE_FRAMES
+ || type == CALC_TYPE_FRAMES_AND_BYTES) {
fr_mag = magnitude(iot->max_frame[j], 15);
fr_mag = MAX(6, fr_mag);
@@ -668,7 +668,7 @@ iostat_draw(void *arg)
tabrow_w += col_w[j].fr + 3;
g_snprintf(fr_mag_s, 3, "%u", fr_mag);
- if (type==CALC_TYPE_FRAMES) {
+ if (type == CALC_TYPE_FRAMES) {
fmt = g_strconcat(" %", fr_mag_s, "u |", NULL);
} else {
/* CALC_TYPE_FRAMES_AND_BYTES
@@ -684,7 +684,7 @@ iostat_draw(void *arg)
fmts[j] = fmt;
continue;
}
- switch(type) {
+ switch (type) {
case CALC_TYPE_BYTES:
case CALC_TYPE_COUNT:
@@ -708,7 +708,7 @@ iostat_draw(void *arg)
case FT_RELATIVE_TIME:
/* Convert FT_RELATIVE_TIME field to seconds
* CALC_TYPE_LOAD was already converted in iostat_packet() ) */
- if (type==CALC_TYPE_LOAD) {
+ if (type == CALC_TYPE_LOAD) {
iot->max_vals[j] /= interval;
} else if (type != CALC_TYPE_AVG) {
iot->max_vals[j] = (iot->max_vals[j] + G_GUINT64_CONSTANT(500000000)) / NANOSECS_PER_SEC;
@@ -752,7 +752,7 @@ iostat_draw(void *arg)
/* Calc the max width of the list of filters. */
maxfltr_w = 0;
- for(j=0; j<num_cols; j++) {
+ for (j=0; j<num_cols; j++) {
if (iot->filters[j]) {
k = (int) (strlen(iot->filters[j]) + 11);
maxfltr_w = MAX(maxfltr_w, k);
@@ -770,7 +770,7 @@ iostat_draw(void *arg)
borderlen = MIN(maxfltr_w, 102);
/* Prevent double right border by adding a space */
- if (borderlen-tabrow_w==1)
+ if (borderlen-tabrow_w == 1)
borderlen++;
/* Display the top border */
@@ -778,7 +778,7 @@ iostat_draw(void *arg)
for (i=0; i<borderlen; i++)
printf("=");
- spaces = (char*) g_malloc(borderlen+1);
+ spaces = (char *)g_malloc(borderlen+1);
for (i=0; i<borderlen; i++)
spaces[i] = ' ';
spaces[borderlen] = '\0';
@@ -788,7 +788,7 @@ iostat_draw(void *arg)
spaces_s = &spaces[2];
printf("|%s|\n", spaces_s);
- if (invl_prec==0) {
+ if (invl_prec == 0) {
invl_fmt = g_strconcat("%", dur_mag_s, "u", NULL);
full_fmt = g_strconcat("| Duration: ", invl_fmt, ".%6u secs%s|\n", NULL);
spaces_s = &spaces[25 + dur_mag];
@@ -817,9 +817,9 @@ iostat_draw(void *arg)
/* Display the list of filters and their column numbers vertically */
printf("| Col");
- for(j=0; j<num_cols; j++){
- printf((j==0 ? "%2u: " : "| %2u: "), j+1);
- if (!iot->filters[j] || (iot->filters[j]==0)) {
+ for (j=0; j<num_cols; j++) {
+ printf((j == 0 ? "%2u: " : "| %2u: "), j+1);
+ if (!iot->filters[j] || (iot->filters[j] == 0)) {
/*
* An empty (no filter) comma field was specified */
spaces_s = &spaces[16 + 10];
@@ -841,7 +841,7 @@ iostat_draw(void *arg)
gchar *sfilter1, *sfilter2;
const gchar *pos;
gsize len;
- int next_start, max_w=borderlen-11;
+ int next_start, max_w = borderlen-11;
do {
if (len_filt > max_w) {
@@ -876,7 +876,7 @@ iostat_draw(void *arg)
}
printf("|-");
- for(i=0;i<borderlen-3;i++){
+ for (i=0; i<borderlen-3; i++) {
printf("-");
}
printf("|\n");
@@ -886,11 +886,11 @@ iostat_draw(void *arg)
printf("|%s|", spaces_s);
/* Display column number headers */
- for(j=0; j<num_cols; j++) {
+ for (j=0; j<num_cols; j++) {
item = stat_cols[j];
- if(item->calc_type==CALC_TYPE_FRAMES_AND_BYTES)
+ if (item->calc_type == CALC_TYPE_FRAMES_AND_BYTES)
spaces_s = &spaces[borderlen - (col_w[j].fr + col_w[j].val)] - 3;
- else if (item->calc_type==CALC_TYPE_FRAMES)
+ else if (item->calc_type == CALC_TYPE_FRAMES)
spaces_s = &spaces[borderlen - col_w[j].fr];
else
spaces_s = &spaces[borderlen - col_w[j].val];
@@ -926,11 +926,11 @@ iostat_draw(void *arg)
printf("%s|", spaces_s);
/* Display the stat label in each column */
- for(j=0; j<num_cols; j++) {
+ for (j=0; j<num_cols; j++) {
type = stat_cols[j]->calc_type;
- if(type==CALC_TYPE_FRAMES) {
+ if (type == CALC_TYPE_FRAMES) {
printcenter (calc_type_table[type].func_name, col_w[j].fr, numpad);
- } else if (type==CALC_TYPE_FRAMES_AND_BYTES) {
+ } else if (type == CALC_TYPE_FRAMES_AND_BYTES) {
printcenter ("Frames", col_w[j].fr, numpad);
printcenter ("Bytes", col_w[j].val, numpad);
} else {
@@ -941,7 +941,7 @@ iostat_draw(void *arg)
printf("%s|", filler_s);
printf("\n|-");
- for(i=0; i<tabrow_w-3; i++)
+ for (i=0; i<tabrow_w-3; i++)
printf("-");
printf("|");
@@ -949,8 +949,8 @@ iostat_draw(void *arg)
printf("%s|", &spaces[tabrow_w+1]);
printf("\n");
- t=0;
- if (invl_prec==0 && dur_mag==1)
+ t = 0;
+ if (invl_prec == 0 && dur_mag == 1)
full_fmt = g_strconcat("| ", invl_fmt, " <> ", invl_fmt, " |", NULL);
else
full_fmt = g_strconcat("| ", invl_fmt, " <> ", invl_fmt, " |", NULL);
@@ -962,7 +962,7 @@ iostat_draw(void *arg)
}
/* Load item_in_column with the first item in each column */
- item_in_column = (io_stat_item_t **) g_malloc(sizeof(io_stat_item_t *) * num_cols);
+ item_in_column = (io_stat_item_t **)g_malloc(sizeof(io_stat_item_t *) * num_cols);
for (j=0; j<num_cols; j++) {
item_in_column[j] = stat_cols[j];
}
@@ -972,7 +972,7 @@ iostat_draw(void *arg)
* The outer loop is for time interval rows and the inner loop is for stat column items.*/
for (i=0; i<num_rows; i++) {
- if (i==num_rows-1)
+ if (i == num_rows-1)
last_row = TRUE;
/* Compute the interval for this row */
@@ -1048,13 +1048,13 @@ iostat_draw(void *arg)
case TS_RELATIVE:
case TS_NOT_SET:
- if (invl_prec==0) {
- if(last_row) {
+ if (invl_prec == 0) {
+ if (last_row) {
int maxw;
maxw = dur_mag >= 3 ? dur_mag+1 : 3;
g_free(full_fmt);
g_snprintf(dur_mag_s, 3, "%u", maxw);
- full_fmt = g_strconcat( dur_mag==1 ? "| " : "| ",
+ full_fmt = g_strconcat( dur_mag == 1 ? "| " : "| ",
invl_fmt, " <> ", "%-",
dur_mag_s, "s|", NULL);
printf(full_fmt, (guint32)(t/G_GUINT64_CONSTANT(1000000)), "Dur");
@@ -1083,7 +1083,7 @@ iostat_draw(void *arg)
item = item_in_column[j];
if (item) {
- switch(item->calc_type) {
+ switch (item->calc_type) {
case CALC_TYPE_FRAMES:
printf(fmt, item->frames);
break;
@@ -1099,7 +1099,7 @@ iostat_draw(void *arg)
case CALC_TYPE_MIN:
case CALC_TYPE_MAX:
ftype = proto_registrar_get_ftype(stat_cols[j]->hf_index);
- switch(ftype){
+ switch (ftype) {
case FT_FLOAT:
printf(fmt, item->float_counter);
break;
@@ -1120,10 +1120,10 @@ iostat_draw(void *arg)
case CALC_TYPE_AVG:
num = item->num;
- if(num==0)
- num=1;
+ if (num == 0)
+ num = 1;
ftype = proto_registrar_get_ftype(stat_cols[j]->hf_index);
- switch(ftype){
+ switch (ftype) {
case FT_FLOAT:
printf(fmt, item->float_counter/num);
break;
@@ -1144,7 +1144,7 @@ iostat_draw(void *arg)
case CALC_TYPE_LOAD:
ftype = proto_registrar_get_ftype(stat_cols[j]->hf_index);
- switch(ftype){
+ switch (ftype) {
case FT_RELATIVE_TIME:
if (!last_row) {
printf(fmt,
@@ -1176,7 +1176,7 @@ iostat_draw(void *arg)
t += interval;
}
- for(i=0;i<borderlen;i++){
+ for (i=0; i<borderlen; i++) {
printf("=");
}
printf("\n");
@@ -1205,43 +1205,43 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
char *field;
header_field_info *hfi;
- io->items[i].prev=&io->items[i];
- io->items[i].next=NULL;
- io->items[i].parent=io;
- io->items[i].time=0;
- io->items[i].calc_type=CALC_TYPE_FRAMES_AND_BYTES;
- io->items[i].frames=0;
- io->items[i].counter=0;
- io->items[i].num=0;
-
- io->filters[i]=filter;
- flt=filter;
-
- field=NULL;
- hfi=NULL;
- for(j=0; calc_type_table[j].func_name; j++){
- namelen=strlen(calc_type_table[j].func_name);
- if(filter && strncmp(filter, calc_type_table[j].func_name, namelen) == 0) {
- io->items[i].calc_type=calc_type_table[j].calc_type;
+ io->items[i].prev = &io->items[i];
+ io->items[i].next = NULL;
+ io->items[i].parent = io;
+ io->items[i].time = 0;
+ io->items[i].calc_type = CALC_TYPE_FRAMES_AND_BYTES;
+ io->items[i].frames = 0;
+ io->items[i].counter = 0;
+ io->items[i].num = 0;
+
+ io->filters[i] = filter;
+ flt = filter;
+
+ field = NULL;
+ hfi = NULL;
+ for (j=0; calc_type_table[j].func_name; j++) {
+ namelen = strlen(calc_type_table[j].func_name);
+ if (filter && strncmp(filter, calc_type_table[j].func_name, namelen) == 0) {
+ io->items[i].calc_type = calc_type_table[j].calc_type;
io->items[i].colnum = i;
- if(*(filter+namelen)=='(') {
- p=filter+namelen+1;
- parenp=strchr(p, ')');
- if(!parenp){
+ if (*(filter+namelen) == '(') {
+ p = filter+namelen+1;
+ parenp = strchr(p, ')');
+ if (!parenp) {
fprintf(stderr,
"\ntshark: Closing parenthesis missing from calculated expression.\n");
exit(10);
}
- if(io->items[i].calc_type==CALC_TYPE_FRAMES || io->items[i].calc_type==CALC_TYPE_BYTES){
- if(parenp!=p) {
+ if (io->items[i].calc_type == CALC_TYPE_FRAMES || io->items[i].calc_type == CALC_TYPE_BYTES) {
+ if (parenp != p) {
fprintf(stderr,
"\ntshark: %s does not require or allow a field name within the parens.\n",
calc_type_table[j].func_name);
exit(10);
}
} else {
- if(parenp==p) {
+ if (parenp == p) {
/* bail out if a field name was not specified */
fprintf(stderr, "\ntshark: You didn't specify a field name for %s(*).\n",
calc_type_table[j].func_name);
@@ -1249,34 +1249,34 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
}
}
- field = (char *) g_malloc(parenp-p+1);
+ field = (char *)g_malloc(parenp-p+1);
memcpy(field, p, parenp-p);
field[parenp-p] = '\0';
- flt=parenp + 1;
- if (io->items[i].calc_type==CALC_TYPE_FRAMES || io->items[i].calc_type==CALC_TYPE_BYTES)
+ flt = parenp + 1;
+ if (io->items[i].calc_type == CALC_TYPE_FRAMES || io->items[i].calc_type == CALC_TYPE_BYTES)
break;
- hfi=proto_registrar_get_byname(field);
- if(!hfi){
+ hfi = proto_registrar_get_byname(field);
+ if (!hfi) {
fprintf(stderr, "\ntshark: There is no field named '%s'.\n",
field);
g_free(field);
exit(10);
}
- io->items[i].hf_index=hfi->id;
+ io->items[i].hf_index = hfi->id;
break;
}
} else {
- if (io->items[i].calc_type==CALC_TYPE_FRAMES || io->items[i].calc_type==CALC_TYPE_BYTES)
- flt="";
+ if (io->items[i].calc_type == CALC_TYPE_FRAMES || io->items[i].calc_type == CALC_TYPE_BYTES)
+ flt = "";
io->items[i].colnum = i;
}
}
- if(hfi && !(io->items[i].calc_type==CALC_TYPE_BYTES ||
- io->items[i].calc_type==CALC_TYPE_FRAMES ||
- io->items[i].calc_type==CALC_TYPE_FRAMES_AND_BYTES)){
+ if (hfi && !(io->items[i].calc_type == CALC_TYPE_BYTES ||
+ io->items[i].calc_type == CALC_TYPE_FRAMES ||
+ io->items[i].calc_type == CALC_TYPE_FRAMES_AND_BYTES)) {
/* check that the type is compatible */
- switch(hfi->type){
+ switch (hfi->type) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
@@ -1292,7 +1292,7 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
case FT_FLOAT:
case FT_DOUBLE:
/* these types only support SUM, COUNT, MAX, MIN, AVG */
- switch(io->items[i].calc_type){
+ switch (io->items[i].calc_type) {
case CALC_TYPE_SUM:
case CALC_TYPE_COUNT:
case CALC_TYPE_MAX:
@@ -1309,7 +1309,7 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
break;
case FT_RELATIVE_TIME:
/* this type only supports SUM, COUNT, MAX, MIN, AVG, LOAD */
- switch(io->items[i].calc_type){
+ switch (io->items[i].calc_type) {
case CALC_TYPE_SUM:
case CALC_TYPE_COUNT:
case CALC_TYPE_MAX:
@@ -1330,7 +1330,7 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
* XXX - support all operations on floating-point
* numbers?
*/
- if(io->items[i].calc_type!=CALC_TYPE_COUNT){
+ if (io->items[i].calc_type != CALC_TYPE_COUNT) {
fprintf(stderr,
"\ntshark: %s doesn't have integral values, so %s(*) "
"calculations are not supported on it.\n",
@@ -1343,9 +1343,9 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
g_free(field);
}
- error_string=register_tap_listener("frame", &io->items[i], flt, TL_REQUIRES_PROTO_TREE, NULL,
- iostat_packet, i?NULL:iostat_draw);
- if(error_string){
+ error_string = register_tap_listener("frame", &io->items[i], flt, TL_REQUIRES_PROTO_TREE, NULL,
+ iostat_packet, i ? NULL : iostat_draw);
+ if (error_string) {
g_free(io->items);
g_free(io);
fprintf(stderr, "\ntshark: Couldn't register io,stat tap: %s\n",
@@ -1356,10 +1356,10 @@ register_io_tap(io_stat_t *io, int i, const char *filter)
}
static void
-iostat_init(const char *opt_arg, void* userdata _U_)
+iostat_init(const char *opt_arg, void *userdata _U_)
{
gdouble interval_float;
- guint32 idx=0;
+ guint32 idx = 0;
int i;
io_stat_t *io;
const gchar *filters, *str, *pos;
@@ -1371,7 +1371,7 @@ iostat_init(const char *opt_arg, void* userdata _U_)
exit(1);
}
- filters=opt_arg+idx;
+ filters = opt_arg+idx;
if (*filters) {
if (*filters != ',') {
/* For locale's that use ',' instead of '.', the comma might
@@ -1383,7 +1383,7 @@ iostat_init(const char *opt_arg, void* userdata _U_)
}
}
} else
- filters=NULL;
+ filters = NULL;
switch (timestamp_get_type()) {
case TS_DELTA:
@@ -1395,11 +1395,11 @@ iostat_init(const char *opt_arg, void* userdata _U_)
break;
}
- io = (io_stat_t *) g_malloc(sizeof(io_stat_t));
+ io = (io_stat_t *)g_malloc(sizeof(io_stat_t));
/* If interval is 0, calculate statistics over the whole file by setting the interval to
* G_MAXINT32 */
- if (interval_float==0) {
+ if (interval_float == 0) {
io->interval = G_MAXINT32;
io->invl_prec = 0;
} else {
@@ -1413,7 +1413,7 @@ iostat_init(const char *opt_arg, void* userdata _U_)
break;
io->invl_prec--;
}
- if (io->invl_prec==0) {
+ if (io->invl_prec == 0) {
/* The precision is zero but if the user specified one of more zeros after the decimal point,
they want that many decimal places shown in the table for all time intervals except
response time values such as smb.time which always have 6 decimal places of precision.
@@ -1436,7 +1436,7 @@ iostat_init(const char *opt_arg, void* userdata _U_)
}
}
}
- if (io->interval < 1){
+ if (io->interval < 1) {
fprintf(stderr,
"\ntshark: \"-z\" interval must be >=0.000001 seconds or \"0\" for the entire capture duration.\n");
exit(10);
@@ -1444,30 +1444,30 @@ iostat_init(const char *opt_arg, void* userdata _U_)
/* Find how many ',' separated filters we have */
io->num_cols = 1;
- io->start_time=0;
+ io->start_time = 0;
if (filters && (*filters != '\0')) {
/* Eliminate the first comma. */
filters++;
str = filters;
- while((str = strchr(str, ','))) {
+ while ((str = strchr(str, ','))) {
io->num_cols++;
str++;
}
}
- io->items = (io_stat_item_t *) g_malloc(sizeof(io_stat_item_t) * io->num_cols);
- io->filters = (const char **)g_malloc(sizeof(char *) * io->num_cols);
- io->max_vals = (guint64 *) g_malloc(sizeof(guint64) * io->num_cols);
- io->max_frame = (guint32 *) g_malloc(sizeof(guint32) * io->num_cols);
+ io->items = (io_stat_item_t *)g_malloc(sizeof(io_stat_item_t) * io->num_cols);
+ io->filters = (const char **)g_malloc(sizeof(char *) * io->num_cols);
+ io->max_vals = (guint64 *)g_malloc(sizeof(guint64) * io->num_cols);
+ io->max_frame = (guint32 *)g_malloc(sizeof(guint32) * io->num_cols);
for (i=0; i<io->num_cols; i++) {
- io->max_vals[i] = 0;
+ io->max_vals[i] = 0;
io->max_frame[i] = 0;
}
/* Register a tap listener for each filter */
- if((!filters) || (filters[0]==0)) {
+ if ((!filters) || (filters[0] == 0)) {
register_io_tap(io, 0, NULL);
} else {
gchar *filter;
@@ -1475,9 +1475,9 @@ iostat_init(const char *opt_arg, void* userdata _U_)
str = filters;
do {
pos = (gchar*) strchr(str, ',');
- if(pos==str){
+ if (pos == str) {
register_io_tap(io, i, NULL);
- } else if (pos==NULL) {
+ } else if (pos == NULL) {
str = (const char*) g_strstrip((gchar*)str);
filter = g_strdup(str);
if (*filter)
@@ -1492,7 +1492,7 @@ iostat_init(const char *opt_arg, void* userdata _U_)
}
str = pos+1;
i++;
- } while(pos);
+ } while (pos);
}
}
diff --git a/ui/cli/tap-iousers.c b/ui/cli/tap-iousers.c
index 36669e47a6..7119c192c4 100644
--- a/ui/cli/tap-iousers.c
+++ b/ui/cli/tap-iousers.c
@@ -52,8 +52,8 @@ iousers_draw(void *arg)
guint i;
printf("================================================================================\n");
- printf("%s Conversations\n",iu->type);
- printf("Filter:%s\n",iu->filter?iu->filter:"<No Filter>");
+ printf("%s Conversations\n", iu->type);
+ printf("Filter:%s\n", iu->filter ? iu->filter : "<No Filter>");
switch (timestamp_get_type()) {
case TS_ABSOLUTE:
@@ -76,27 +76,27 @@ iousers_draw(void *arg)
break;
}
- max_frames=UINT_MAX;
+ max_frames = UINT_MAX;
do {
- last_frames=0;
- for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++){
+ last_frames = 0;
+ for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++) {
guint64 tot_frames;
iui = &g_array_index(iu->hash.conv_array, conv_item_t, i);
tot_frames = iui->rx_frames + iui->tx_frames;
- if ((tot_frames>last_frames) && (tot_frames<max_frames)){
- last_frames=tot_frames;
+ if ((tot_frames > last_frames) && (tot_frames < max_frames)) {
+ last_frames = tot_frames;
}
}
- for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++){
+ for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++) {
guint64 tot_frames;
iui = &g_array_index(iu->hash.conv_array, conv_item_t, i);
tot_frames = iui->rx_frames + iui->tx_frames;
- if (tot_frames == last_frames){
+ if (tot_frames == last_frames) {
printf("%-20s <-> %-20s %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER
"u %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u %6"
G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u ",
@@ -178,23 +178,23 @@ iousers_draw(void *arg)
}
}
}
- max_frames=last_frames;
- } while(last_frames);
+ max_frames = last_frames;
+ } while (last_frames);
printf("================================================================================\n");
}
-void init_iousers(struct register_ct* ct, const char *filter)
+void init_iousers(struct register_ct *ct, const char *filter)
{
io_users_t *iu;
GString *error_string;
- iu = g_new0(io_users_t,1);
+ iu = g_new0(io_users_t, 1);
iu->type = proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(ct)));
iu->filter = g_strdup(filter);
iu->hash.user_data = iu;
- error_string=register_tap_listener(proto_get_protocol_filter_name(get_conversation_proto_id(ct)), &iu->hash, filter, 0, NULL, get_conversation_packet_func(ct), iousers_draw);
- if(error_string){
+ error_string = register_tap_listener(proto_get_protocol_filter_name(get_conversation_proto_id(ct)), &iu->hash, filter, 0, NULL, get_conversation_packet_func(ct), iousers_draw);
+ if (error_string) {
g_free(iu);
fprintf(stderr, "tshark: Couldn't register conversations tap: %s\n",
error_string->str);
diff --git a/ui/cli/tap-macltestat.c b/ui/cli/tap-macltestat.c
index 4413f17ab5..253fd4f2c8 100644
--- a/ui/cli/tap-macltestat.c
+++ b/ui/cli/tap-macltestat.c
@@ -101,7 +101,7 @@ typedef struct mac_lte_row_data {
/* One row/UE in the UE table */
typedef struct mac_lte_ep {
- struct mac_lte_ep* next;
+ struct mac_lte_ep *next;
struct mac_lte_row_data stats;
} mac_lte_ep_t;
@@ -142,8 +142,8 @@ typedef struct mac_lte_stat_t {
static void
mac_lte_stat_reset(void *phs)
{
- mac_lte_stat_t* mac_lte_stat = (mac_lte_stat_t *)phs;
- mac_lte_ep_t* list = mac_lte_stat->ep_list;
+ mac_lte_stat_t *mac_lte_stat = (mac_lte_stat_t *)phs;
+ mac_lte_ep_t *list = mac_lte_stat->ep_list;
/* Reset counts of unique ueids & rntis */
memset(mac_lte_stat->used_ueids, 0, 65535);
@@ -163,15 +163,15 @@ mac_lte_stat_reset(void *phs)
/* Allocate a mac_lte_ep_t struct to store info for new UE */
-static mac_lte_ep_t* alloc_mac_lte_ep(const struct mac_lte_tap_info *si, packet_info *pinfo _U_)
+static mac_lte_ep_t *alloc_mac_lte_ep(const struct mac_lte_tap_info *si, packet_info *pinfo _U_)
{
- mac_lte_ep_t* ep;
+ mac_lte_ep_t *ep;
if (!si) {
return NULL;
}
- if (!(ep = g_new(mac_lte_ep_t,1))) {
+ if (!(ep = g_new(mac_lte_ep_t, 1))) {
return NULL;
}
@@ -291,7 +291,7 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
for (tmp = hs->ep_list;(tmp != NULL); tmp = tmp->next) {
/* Match only by RNTI and UEId together */
if ((tmp->stats.rnti == si->rnti) &&
- (tmp->stats.ueid == si->ueid)){
+ (tmp->stats.ueid == si->ueid)) {
te = tmp;
break;
}
@@ -438,7 +438,7 @@ mac_lte_stat_draw(void *phs)
/* Deref the struct */
mac_lte_stat_t *hs = (mac_lte_stat_t *)phs;
- mac_lte_ep_t* list = hs->ep_list, *tmp = 0;
+ mac_lte_ep_t *list = hs->ep_list, *tmp = 0;
/* System data */
printf("System data:\n");
@@ -526,7 +526,7 @@ static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_)
}
/* Create struct */
- hs = g_new0(mac_lte_stat_t,1);
+ hs = g_new0(mac_lte_stat_t, 1);
hs->ep_list = NULL;
error_string = register_tap_listener("mac-lte", hs,
@@ -549,3 +549,15 @@ register_tap_listener_mac_lte_stat(void)
register_stat_cmd_arg("mac-lte,stat", mac_lte_stat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-megacostat.c b/ui/cli/tap-megacostat.c
index 2492d8fa38..0a232d972a 100644
--- a/ui/cli/tap-megacostat.c
+++ b/ui/cli/tap-megacostat.c
@@ -43,43 +43,43 @@ void register_tap_listener_megacostat(void);
static void
megacostat_draw(void *pms)
{
- megacostat_t *ms=(megacostat_t *)pms;
+ megacostat_t *ms = (megacostat_t *)pms;
int i;
/* printing results */
printf("\n");
printf("=====================================================================================================\n");
printf("MEGACO Response Time Delay (RTD) Statistics:\n");
- printf("Filter for statistics: %s\n",ms->filter?ms->filter:"");
- printf("Duplicate requests: %u\n",ms->req_dup_num);
- printf("Duplicate responses: %u\n",ms->rsp_dup_num);
- printf("Open requests: %u\n",ms->open_req_num);
- printf("Discarded responses: %u\n",ms->disc_rsp_num);
- printf(" Type | Messages | Min RTD | Max RTD | Avg RTD | Min in Frame | Max in Frame |\n");
- for(i=0;i<NUM_TIMESTATS;i++) {
- if(ms->rtd[i].num) {
- printf("%5s | %7u | %8.2f msec | %8.2f msec | %8.2f msec | %10u | %10u |\n",
- val_to_str(i,megaco_message_type,"Other"),ms->rtd[i].num,
- nstime_to_msec(&(ms->rtd[i].min)), nstime_to_msec(&(ms->rtd[i].max)),
- get_average(&(ms->rtd[i].tot), ms->rtd[i].num),
- ms->rtd[i].min_num, ms->rtd[i].max_num
+ printf("Filter for statistics: %s\n", ms->filter ? ms->filter : "");
+ printf("Duplicate requests: %u\n", ms->req_dup_num);
+ printf("Duplicate responses: %u\n", ms->rsp_dup_num);
+ printf("Open requests: %u\n", ms->open_req_num);
+ printf("Discarded responses: %u\n", ms->disc_rsp_num);
+ printf(" Type | Messages | Min RTD | Max RTD | Avg RTD | Min in Frame | Max in Frame |\n");
+ for (i=0; i<NUM_TIMESTATS; i++) {
+ if (ms->rtd[i].num) {
+ printf("%5s | %7u | %8.2f msec | %8.2f msec | %8.2f msec | %10u | %10u |\n",
+ val_to_str(i, megaco_message_type, "Other"), ms->rtd[i].num,
+ nstime_to_msec(&(ms->rtd[i].min)), nstime_to_msec(&(ms->rtd[i].max)),
+ get_average(&(ms->rtd[i].tot), ms->rtd[i].num),
+ ms->rtd[i].min_num, ms->rtd[i].max_num
);
}
}
- printf("=====================================================================================================\n");
+ printf("=====================================================================================================\n");
}
static void
-megacostat_init(const char *opt_arg, void* userdata _U_)
+megacostat_init(const char *opt_arg, void *userdata _U_)
{
megacostat_t *ms;
int i;
GString *error_string;
- pref_t *megaco_ctx_track,*h248_ctx_track;
+ pref_t *megaco_ctx_track, *h248_ctx_track;
- megaco_ctx_track = prefs_find_preference(prefs_find_module("megaco"),"ctx_info");
- h248_ctx_track = prefs_find_preference(prefs_find_module("h248"),"ctx_info");
+ megaco_ctx_track = prefs_find_preference(prefs_find_module("megaco"), "ctx_info");
+ h248_ctx_track = prefs_find_preference(prefs_find_module("h248"), "ctx_info");
if (!megaco_ctx_track || !h248_ctx_track) {
/* No such preferences */
@@ -92,38 +92,38 @@ megacostat_init(const char *opt_arg, void* userdata _U_)
exit(1);
}
- ms=g_new(megacostat_t,1);
- if(!strncmp(opt_arg,"megaco,rtd,",11)){
- ms->filter=g_strdup(opt_arg+11);
+ ms = g_new(megacostat_t, 1);
+ if (!strncmp(opt_arg, "megaco,rtd,", 11)) {
+ ms->filter = g_strdup(opt_arg+11);
} else {
- ms->filter=NULL;
+ ms->filter = NULL;
}
- for(i=0;i<NUM_TIMESTATS;i++) {
- ms->rtd[i].num=0;
- ms->rtd[i].min_num=0;
- ms->rtd[i].max_num=0;
- ms->rtd[i].min.secs=0;
- ms->rtd[i].min.nsecs=0;
- ms->rtd[i].max.secs=0;
- ms->rtd[i].max.nsecs=0;
- ms->rtd[i].tot.secs=0;
- ms->rtd[i].tot.nsecs=0;
+ for (i=0; i<NUM_TIMESTATS; i++) {
+ ms->rtd[i].num = 0;
+ ms->rtd[i].min_num = 0;
+ ms->rtd[i].max_num = 0;
+ ms->rtd[i].min.secs = 0;
+ ms->rtd[i].min.nsecs = 0;
+ ms->rtd[i].max.secs = 0;
+ ms->rtd[i].max.nsecs = 0;
+ ms->rtd[i].tot.secs = 0;
+ ms->rtd[i].tot.nsecs = 0;
}
- ms->open_req_num=0;
- ms->disc_rsp_num=0;
- ms->req_dup_num=0;
- ms->rsp_dup_num=0;
+ ms->open_req_num = 0;
+ ms->disc_rsp_num = 0;
+ ms->req_dup_num = 0;
+ ms->rsp_dup_num = 0;
- error_string=register_tap_listener("megaco", ms, ms->filter, 0, NULL, megacostat_packet, megacostat_draw);
- if(error_string){
+ error_string = register_tap_listener("megaco", ms, ms->filter, 0, NULL, megacostat_packet, megacostat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(ms->filter);
g_free(ms);
fprintf(stderr, "tshark: Couldn't register megaco,rtd tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -139,3 +139,15 @@ register_tap_listener_megacostat(void)
}
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-mgcpstat.c b/ui/cli/tap-mgcpstat.c
index 04ace9d1ac..939a037ec5 100644
--- a/ui/cli/tap-mgcpstat.c
+++ b/ui/cli/tap-mgcpstat.c
@@ -40,7 +40,7 @@ void register_tap_listener_mgcpstat(void);
/* used to keep track of the statistics for an entire program interface */
typedef struct _mgcpstat_t {
char *filter;
- timestat_t rtd[NUM_TIMESTATS];
+ timestat_t rtd[NUM_TIMESTATS];
guint32 open_req_num;
guint32 disc_rsp_num;
guint32 req_dup_num;
@@ -48,31 +48,31 @@ typedef struct _mgcpstat_t {
} mgcpstat_t;
static const value_string mgcp_mesage_type[] = {
- { 0, "Overall"},
- { 1, "EPCF "},
- { 2, "CRCX "},
- { 3, "MDCX "},
- { 4, "DLCX "},
- { 5, "RQNT "},
- { 6, "NTFY "},
- { 7, "AUEP "},
- { 8, "AUCX "},
- { 9, "RSIP "},
- { 0, NULL}
+ { 0, "Overall"},
+ { 1, "EPCF "},
+ { 2, "CRCX "},
+ { 3, "MDCX "},
+ { 4, "DLCX "},
+ { 5, "RQNT "},
+ { 6, "NTFY "},
+ { 7, "AUEP "},
+ { 8, "AUCX "},
+ { 9, "RSIP "},
+ { 0, NULL}
};
static int
mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi)
{
- mgcpstat_t *ms=(mgcpstat_t *)pms;
- const mgcp_info_t *mi=(const mgcp_info_t *)pmi;
+ mgcpstat_t *ms = (mgcpstat_t *)pms;
+ const mgcp_info_t *mi = (const mgcp_info_t *)pmi;
nstime_t delta;
int ret = 0;
switch (mi->mgcp_type) {
case MGCP_REQUEST:
- if(mi->is_duplicate){
+ if (mi->is_duplicate) {
/* Duplicate is ignored */
ms->req_dup_num++;
}
@@ -82,7 +82,7 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
break;
case MGCP_RESPONSE:
- if(mi->is_duplicate){
+ if (mi->is_duplicate) {
/* Duplicate is ignored */
ms->rsp_dup_num++;
}
@@ -95,37 +95,37 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
/* calculate time delta between request and response */
nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->req_time);
- time_stat_update(&(ms->rtd[0]),&delta, pinfo);
+ time_stat_update(&(ms->rtd[0]), &delta, pinfo);
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 (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 (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 (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 (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 (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 (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 (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 (g_ascii_strncasecmp(mi->code, "RSIP", 4) == 0 ) {
- time_stat_update(&(ms->rtd[9]),&delta, pinfo);
+ time_stat_update(&(ms->rtd[9]), &delta, pinfo);
}
else {
- time_stat_update(&(ms->rtd[10]),&delta, pinfo);
+ time_stat_update(&(ms->rtd[10]), &delta, pinfo);
}
ret = 1;
@@ -142,72 +142,72 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
static void
mgcpstat_draw(void *pms)
{
- mgcpstat_t *ms=(mgcpstat_t *)pms;
+ mgcpstat_t *ms = (mgcpstat_t *)pms;
int i;
/* printing results */
printf("\n");
printf("=====================================================================================================\n");
printf("MGCP Response Time Delay (RTD) Statistics:\n");
- printf("Filter for statistics: %s\n",ms->filter?ms->filter:"");
- printf("Duplicate requests: %u\n",ms->req_dup_num);
- printf("Duplicate responses: %u\n",ms->rsp_dup_num);
- printf("Open requests: %u\n",ms->open_req_num);
- printf("Discarded responses: %u\n",ms->disc_rsp_num);
- printf("Type | Messages | Min RTD | Max RTD | Avg RTD | Min in Frame | Max in Frame |\n");
- for(i=0;i<NUM_TIMESTATS;i++) {
- if(ms->rtd[i].num) {
- printf("%s | %7u | %8.2f msec | %8.2f msec | %8.2f msec | %10u | %10u |\n",
- val_to_str(i,mgcp_mesage_type,"Other "),ms->rtd[i].num,
- nstime_to_msec(&(ms->rtd[i].min)), nstime_to_msec(&(ms->rtd[i].max)),
- get_average(&(ms->rtd[i].tot), ms->rtd[i].num),
- ms->rtd[i].min_num, ms->rtd[i].max_num
+ printf("Filter for statistics: %s\n", ms->filter ? ms->filter : "");
+ printf("Duplicate requests: %u\n", ms->req_dup_num);
+ printf("Duplicate responses: %u\n", ms->rsp_dup_num);
+ printf("Open requests: %u\n", ms->open_req_num);
+ printf("Discarded responses: %u\n", ms->disc_rsp_num);
+ printf("Type | Messages | Min RTD | Max RTD | Avg RTD | Min in Frame | Max in Frame |\n");
+ for (i=0; i<NUM_TIMESTATS; i++) {
+ if (ms->rtd[i].num) {
+ printf("%s | %7u | %8.2f msec | %8.2f msec | %8.2f msec | %10u | %10u |\n",
+ val_to_str(i, mgcp_mesage_type, "Other "), ms->rtd[i].num,
+ nstime_to_msec(&(ms->rtd[i].min)), nstime_to_msec(&(ms->rtd[i].max)),
+ get_average(&(ms->rtd[i].tot), ms->rtd[i].num),
+ ms->rtd[i].min_num, ms->rtd[i].max_num
);
}
}
- printf("=====================================================================================================\n");
+ printf("=====================================================================================================\n");
}
static void
-mgcpstat_init(const char *opt_arg, void* userdata _U_)
+mgcpstat_init(const char *opt_arg, void *userdata _U_)
{
mgcpstat_t *ms;
int i;
GString *error_string;
- ms=g_new(mgcpstat_t,1);
- if(!strncmp(opt_arg,"mgcp,rtd,",9)){
- ms->filter=g_strdup(opt_arg+9);
+ ms = g_new(mgcpstat_t, 1);
+ if (!strncmp(opt_arg, "mgcp,rtd,", 9)) {
+ ms->filter = g_strdup(opt_arg+9);
} else {
- ms->filter=NULL;
+ ms->filter = NULL;
}
- for(i=0;i<NUM_TIMESTATS;i++) {
- ms->rtd[i].num=0;
- ms->rtd[i].min_num=0;
- ms->rtd[i].max_num=0;
- ms->rtd[i].min.secs=0;
- ms->rtd[i].min.nsecs=0;
- ms->rtd[i].max.secs=0;
- ms->rtd[i].max.nsecs=0;
- ms->rtd[i].tot.secs=0;
- ms->rtd[i].tot.nsecs=0;
+ for (i=0; i<NUM_TIMESTATS; i++) {
+ ms->rtd[i].num = 0;
+ ms->rtd[i].min_num = 0;
+ ms->rtd[i].max_num = 0;
+ ms->rtd[i].min.secs = 0;
+ ms->rtd[i].min.nsecs = 0;
+ ms->rtd[i].max.secs = 0;
+ ms->rtd[i].max.nsecs = 0;
+ ms->rtd[i].tot.secs = 0;
+ ms->rtd[i].tot.nsecs = 0;
}
- ms->open_req_num=0;
- ms->disc_rsp_num=0;
- ms->req_dup_num=0;
- ms->rsp_dup_num=0;
+ ms->open_req_num = 0;
+ ms->disc_rsp_num = 0;
+ ms->req_dup_num = 0;
+ ms->rsp_dup_num = 0;
- error_string=register_tap_listener("mgcp", ms, ms->filter, 0, NULL, mgcpstat_packet, mgcpstat_draw);
- if(error_string){
+ 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);
fprintf(stderr, "tshark: Couldn't register mgcp,rtd tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -223,3 +223,15 @@ register_tap_listener_mgcpstat(void)
}
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-protocolinfo.c b/ui/cli/tap-protocolinfo.c
index c3a5b6501a..a2b640a162 100644
--- a/ui/cli/tap-protocolinfo.c
+++ b/ui/cli/tap-protocolinfo.c
@@ -46,7 +46,7 @@ typedef struct _pci_t {
static int
protocolinfo_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const void *dummy _U_)
{
- pci_t *rs=(pci_t *)prs;
+ pci_t *rs = (pci_t *)prs;
GPtrArray *gp;
guint i;
char *str;
@@ -65,15 +65,15 @@ protocolinfo_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const vo
fprintf(stderr, "tshark: the proto,colinfo tap doesn't work if the INFO column isn't being printed.\n");
exit(1);
}
- gp=proto_get_finfo_ptr_array(edt->tree, rs->hf_index);
- if(!gp){
+ gp = proto_get_finfo_ptr_array(edt->tree, rs->hf_index);
+ if (!gp) {
return 0;
}
- for(i=0;i<gp->len;i++){
- str=(char *)proto_construct_match_selected_string((field_info *)gp->pdata[i], NULL);
- if(str){
- col_append_fstr(pinfo->cinfo, COL_INFO, " %s",str);
+ for (i=0; i<gp->len; i++) {
+ str = (char *)proto_construct_match_selected_string((field_info *)gp->pdata[i], NULL);
+ if (str) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " %s", str);
}
}
return 0;
@@ -82,43 +82,43 @@ protocolinfo_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const vo
static void
-protocolinfo_init(const char *opt_arg, void* userdata _U_)
+protocolinfo_init(const char *opt_arg, void *userdata _U_)
{
pci_t *rs;
- const char *field=NULL;
- const char *filter=NULL;
+ const char *field = NULL;
+ const char *filter = NULL;
header_field_info *hfi;
GString *error_string;
- if(!strncmp("proto,colinfo,",opt_arg,14)){
- filter=opt_arg+14;
- field=strchr(filter,',');
- if(field){
- field+=1; /* skip the ',' */
+ if (!strncmp("proto,colinfo,", opt_arg, 14)) {
+ filter = opt_arg+14;
+ field = strchr(filter, ',');
+ if (field) {
+ field += 1; /* skip the ',' */
}
}
- if(!field){
+ if (!field) {
fprintf(stderr, "tshark: invalid \"-z proto,colinfo,<filter>,<field>\" argument\n");
exit(1);
}
- hfi=proto_registrar_get_byname(field);
- if(!hfi){
+ hfi = proto_registrar_get_byname(field);
+ if (!hfi) {
fprintf(stderr, "tshark: Field \"%s\" doesn't exist.\n", field);
exit(1);
}
- rs=g_new(pci_t,1);
- rs->hf_index=hfi->id;
- if((field-filter)>1){
- rs->filter=(char *)g_malloc(field-filter);
- g_strlcpy(rs->filter,filter,(field-filter));
+ rs = g_new(pci_t, 1);
+ rs->hf_index = hfi->id;
+ if ((field-filter) > 1) {
+ rs->filter = (char *)g_malloc(field-filter);
+ g_strlcpy(rs->filter, filter, (field-filter));
} else {
- rs->filter=NULL;
+ rs->filter = NULL;
}
- error_string=register_tap_listener("frame", rs, rs->filter, TL_REQUIRES_PROTO_TREE, NULL, protocolinfo_packet, NULL);
- if(error_string){
+ error_string = register_tap_listener("frame", rs, rs->filter, TL_REQUIRES_PROTO_TREE, NULL, protocolinfo_packet, NULL);
+ if (error_string) {
/* error, we failed to attach to the tap. complain and clean up */
fprintf(stderr, "tshark: Couldn't register proto,colinfo tap: %s\n",
error_string->str);
@@ -134,6 +134,18 @@ protocolinfo_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_protocolinfo(void)
{
- register_stat_cmd_arg("proto,colinfo,", protocolinfo_init,NULL);
+ register_stat_cmd_arg("proto,colinfo,", protocolinfo_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-protohierstat.c b/ui/cli/tap-protohierstat.c
index e9f10fb3f8..8014eebd0d 100644
--- a/ui/cli/tap-protohierstat.c
+++ b/ui/cli/tap-protohierstat.c
@@ -52,15 +52,15 @@ static phs_t *
new_phs_t(phs_t *parent)
{
phs_t *rs;
- rs=g_new(phs_t,1);
- rs->sibling=NULL;
- rs->child=NULL;
- rs->parent=parent;
- rs->filter=NULL;
- rs->protocol=-1;
- rs->proto_name=NULL;
- rs->frames=0;
- rs->bytes=0;
+ rs = g_new(phs_t, 1);
+ rs->sibling = NULL;
+ rs->child = NULL;
+ rs->parent = parent;
+ rs->filter = NULL;
+ rs->protocol = -1;
+ rs->proto_name = NULL;
+ rs->frames = 0;
+ rs->bytes = 0;
return rs;
}
@@ -68,61 +68,61 @@ new_phs_t(phs_t *parent)
static int
protohierstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const void *dummy _U_)
{
- phs_t *rs=(phs_t *)prs;
+ phs_t *rs = (phs_t *)prs;
phs_t *tmprs;
proto_node *node;
field_info *fi;
- if(!edt){
+ if (!edt) {
return 0;
}
- if(!edt->tree){
+ if (!edt->tree) {
return 0;
}
- if(!edt->tree->first_child){
+ if (!edt->tree->first_child) {
return 0;
}
- for(node=edt->tree->first_child;node;node=node->next){
- fi=PNODE_FINFO(node);
+ for (node=edt->tree->first_child; node; node=node->next) {
+ fi = PNODE_FINFO(node);
/* first time we saw a protocol at this leaf */
- if(rs->protocol==-1){
- rs->protocol=fi->hfinfo->id;
- rs->proto_name=fi->hfinfo->abbrev;
- rs->frames=1;
- rs->bytes=pinfo->fd->pkt_len;
- rs->child=new_phs_t(rs);
- rs=rs->child;
+ if (rs->protocol == -1) {
+ rs->protocol = fi->hfinfo->id;
+ rs->proto_name = fi->hfinfo->abbrev;
+ rs->frames = 1;
+ rs->bytes = pinfo->fd->pkt_len;
+ rs->child = new_phs_t(rs);
+ rs = rs->child;
continue;
}
/* find this protocol in the list of siblings */
- for(tmprs=rs;tmprs;tmprs=tmprs->sibling){
- if(tmprs->protocol==fi->hfinfo->id){
+ for (tmprs=rs; tmprs; tmprs=tmprs->sibling) {
+ if (tmprs->protocol == fi->hfinfo->id) {
break;
}
}
/* not found, then we must add it to the end of the list */
- if(!tmprs){
- for(tmprs=rs;tmprs->sibling;tmprs=tmprs->sibling)
+ if (!tmprs) {
+ for (tmprs=rs; tmprs->sibling; tmprs=tmprs->sibling)
;
- tmprs->sibling=new_phs_t(rs->parent);
- rs=tmprs->sibling;
- rs->protocol=fi->hfinfo->id;
- rs->proto_name=fi->hfinfo->abbrev;
+ tmprs->sibling = new_phs_t(rs->parent);
+ rs = tmprs->sibling;
+ rs->protocol = fi->hfinfo->id;
+ rs->proto_name = fi->hfinfo->abbrev;
} else {
- rs=tmprs;
+ rs = tmprs;
}
rs->frames++;
- rs->bytes+=pinfo->fd->pkt_len;
+ rs->bytes += pinfo->fd->pkt_len;
- if(!rs->child){
- rs->child=new_phs_t(rs);
+ if (!rs->child) {
+ rs->child = new_phs_t(rs);
}
- rs=rs->child;
+ rs = rs->child;
}
return 1;
}
@@ -133,21 +133,21 @@ phs_draw(phs_t *rs, int indentation)
int i, stroff;
#define MAXPHSLINE 80
char str[MAXPHSLINE];
- for(;rs;rs=rs->sibling){
- if(rs->protocol==-1){
+ for (;rs;rs = rs->sibling) {
+ if (rs->protocol == -1) {
return;
}
- str[0]=0;
- stroff=0;
- for(i=0;i<indentation;i++){
- if(i>15){
- stroff+=g_snprintf(str+stroff, MAXPHSLINE-stroff, "...");
+ str[0] = 0;
+ stroff = 0;
+ for (i=0; i<indentation; i++) {
+ if (i > 15) {
+ stroff += g_snprintf(str+stroff, MAXPHSLINE-stroff, "...");
break;
}
- stroff+=g_snprintf(str+stroff, MAXPHSLINE-stroff, " ");
+ stroff += g_snprintf(str+stroff, MAXPHSLINE-stroff, " ");
}
g_snprintf(str+stroff, MAXPHSLINE-stroff, "%s", rs->proto_name);
- printf("%-40s frames:%d bytes:%" G_GINT64_MODIFIER "d\n",str, rs->frames, rs->bytes);
+ printf("%-40s frames:%d bytes:%" G_GINT64_MODIFIER "d\n", str, rs->frames, rs->bytes);
phs_draw(rs->child, indentation+1);
}
}
@@ -155,52 +155,52 @@ phs_draw(phs_t *rs, int indentation)
static void
protohierstat_draw(void *prs)
{
- phs_t *rs=(phs_t *)prs;
+ phs_t *rs = (phs_t *)prs;
printf("\n");
printf("===================================================================\n");
printf("Protocol Hierarchy Statistics\n");
- printf("Filter: %s\n\n",rs->filter?rs->filter:"");
- phs_draw(rs,0);
+ printf("Filter: %s\n\n", rs->filter ? rs->filter : "");
+ phs_draw(rs, 0);
printf("===================================================================\n");
}
static void
-protohierstat_init(const char *opt_arg, void* userdata _U_)
+protohierstat_init(const char *opt_arg, void *userdata _U_)
{
phs_t *rs;
- int pos=0;
- const char *filter=NULL;
+ int pos = 0;
+ const char *filter = NULL;
GString *error_string;
- if(strcmp("io,phs",opt_arg)==0){
+ if (strcmp("io,phs", opt_arg) == 0) {
/* No arguments */
- } else if(sscanf(opt_arg,"io,phs,%n",&pos)==0){
- if(pos){
- filter=opt_arg+pos;
+ } else if (sscanf(opt_arg, "io,phs,%n", &pos) == 0) {
+ if (pos) {
+ filter = opt_arg+pos;
}
} else {
fprintf(stderr, "tshark: invalid \"-z io,phs[,<filter>]\" argument\n");
exit(1);
}
- rs=new_phs_t(NULL);
+ rs = new_phs_t(NULL);
- if(filter){
- rs->filter=g_strdup(filter);
+ if (filter) {
+ rs->filter = g_strdup(filter);
} else {
- rs->filter=NULL;
+ rs->filter = NULL;
}
- error_string=register_tap_listener("frame", rs, filter, TL_REQUIRES_PROTO_TREE, NULL, protohierstat_packet, protohierstat_draw);
- if(error_string){
+ error_string = register_tap_listener("frame", rs, filter, TL_REQUIRES_PROTO_TREE, NULL, protohierstat_packet, protohierstat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(rs->filter);
g_free(rs);
fprintf(stderr, "tshark: Couldn't register io,phs tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -213,3 +213,15 @@ register_tap_listener_protohierstat(void)
register_stat_cmd_arg("io,phs", protohierstat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-radiusstat.c b/ui/cli/tap-radiusstat.c
index bc4a3fe355..6360fb6dbc 100644
--- a/ui/cli/tap-radiusstat.c
+++ b/ui/cli/tap-radiusstat.c
@@ -47,7 +47,7 @@ typedef enum _radius_category {
RADIUS_CAT_DISCONNECT,
RADIUS_CAT_COA,
RADIUS_CAT_OTHERS,
- RADIUS_CAT_NUM_TIMESTATS
+ RADIUS_CAT_NUM_TIMESTATS
} radius_category;
/* used to keep track of the statistics for an entire program interface */
@@ -81,8 +81,8 @@ static const value_string radius_message_code[] = {
static int
radiusstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri)
{
- radiusstat_t *rs=(radiusstat_t *)prs;
- const radius_info_t *ri=(const radius_info_t *)pri;
+ radiusstat_t *rs = (radiusstat_t *)prs;
+ const radius_info_t *ri = (const radius_info_t *)pri;
nstime_t delta;
int ret = 0;
@@ -97,7 +97,7 @@ radiusstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const
case RADIUS_PKT_TYPE_EVENT_REQUEST:
case RADIUS_PKT_TYPE_DISCONNECT_REQUEST:
case RADIUS_PKT_TYPE_COA_REQUEST:
- if(ri->is_duplicate){
+ if (ri->is_duplicate) {
/* Duplicate is ignored */
rs->req_dup_num++;
}
@@ -119,7 +119,7 @@ radiusstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const
case RADIUS_PKT_TYPE_DISCONNECT_NAK:
case RADIUS_PKT_TYPE_COA_ACK:
case RADIUS_PKT_TYPE_COA_NAK:
- if(ri->is_duplicate){
+ if (ri->is_duplicate) {
/* Duplicate is ignored */
rs->rsp_dup_num++;
}
@@ -132,16 +132,16 @@ radiusstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const
/* calculate time delta between request and response */
nstime_delta(&delta, &pinfo->fd->abs_ts, &ri->req_time);
- time_stat_update(&(rs->rtd[RADIUS_CAT_OVERALL]),&delta, pinfo);
+ time_stat_update(&(rs->rtd[RADIUS_CAT_OVERALL]), &delta, pinfo);
if (ri->code == RADIUS_PKT_TYPE_ACCESS_ACCEPT || ri->code == RADIUS_PKT_TYPE_ACCESS_REJECT) {
- time_stat_update(&(rs->rtd[RADIUS_CAT_ACCESS]),&delta, pinfo);
+ time_stat_update(&(rs->rtd[RADIUS_CAT_ACCESS]), &delta, pinfo);
}
else if (ri->code == RADIUS_PKT_TYPE_ACCOUNTING_RESPONSE) {
- time_stat_update(&(rs->rtd[RADIUS_CAT_ACCOUNTING]),&delta, pinfo);
+ time_stat_update(&(rs->rtd[RADIUS_CAT_ACCOUNTING]), &delta, pinfo);
}
else {
- time_stat_update(&(rs->rtd[RADIUS_CAT_OTHERS]),&delta, pinfo);
+ time_stat_update(&(rs->rtd[RADIUS_CAT_OTHERS]), &delta, pinfo);
}
ret = 1;
@@ -158,72 +158,72 @@ radiusstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const
static void
radiusstat_draw(void *prs)
{
- radiusstat_t *rs=(radiusstat_t *)prs;
+ radiusstat_t *rs = (radiusstat_t *)prs;
int i;
/* printing results */
printf("\n");
printf("===========================================================================================================\n");
printf("RADIUS Response Time Delay (RTD) Statistics:\n");
- printf("Filter for statistics: %s\n",rs->filter?rs->filter:"");
- printf("Duplicate requests: %u\n",rs->req_dup_num);
- printf("Duplicate responses: %u\n",rs->rsp_dup_num);
- printf("Open requests: %u\n",rs->open_req_num);
- printf("Discarded responses: %u\n",rs->disc_rsp_num);
- printf("Type | Messages | Min RTD | Max RTD | Avg RTD | Min in Frame | Max in Frame |\n");
- for(i=0;i<RADIUS_CAT_NUM_TIMESTATS;i++) {
- if(rs->rtd[i].num) {
- printf("%s | %7u | %8.2f msec | %8.2f msec | %8.2f msec | %10u | %10u |\n",
- val_to_str(i,radius_message_code,"Other "),rs->rtd[i].num,
- nstime_to_msec(&(rs->rtd[i].min)), nstime_to_msec(&(rs->rtd[i].max)),
- get_average(&(rs->rtd[i].tot), rs->rtd[i].num),
- rs->rtd[i].min_num, rs->rtd[i].max_num
+ printf("Filter for statistics: %s\n", rs->filter ? rs->filter : "");
+ printf("Duplicate requests: %u\n", rs->req_dup_num);
+ printf("Duplicate responses: %u\n", rs->rsp_dup_num);
+ printf("Open requests: %u\n", rs->open_req_num);
+ printf("Discarded responses: %u\n", rs->disc_rsp_num);
+ printf("Type | Messages | Min RTD | Max RTD | Avg RTD | Min in Frame | Max in Frame |\n");
+ for (i=0; i<RADIUS_CAT_NUM_TIMESTATS; i++) {
+ if (rs->rtd[i].num) {
+ printf("%s | %7u | %8.2f msec | %8.2f msec | %8.2f msec | %10u | %10u |\n",
+ val_to_str(i, radius_message_code, "Other "), rs->rtd[i].num,
+ nstime_to_msec(&(rs->rtd[i].min)), nstime_to_msec(&(rs->rtd[i].max)),
+ get_average(&(rs->rtd[i].tot), rs->rtd[i].num),
+ rs->rtd[i].min_num, rs->rtd[i].max_num
);
}
}
- printf("===========================================================================================================\n");
+ printf("===========================================================================================================\n");
}
static void
-radiusstat_init(const char *opt_arg, void* userdata _U_)
+radiusstat_init(const char *opt_arg, void *userdata _U_)
{
radiusstat_t *rs;
int i;
GString *error_string;
- rs=g_new(radiusstat_t,1);
- if(!strncmp(opt_arg,"radius,rtd,",11)){
- rs->filter=g_strdup(opt_arg+11);
+ rs = g_new(radiusstat_t, 1);
+ if (!strncmp(opt_arg, "radius,rtd,", 11)) {
+ rs->filter = g_strdup(opt_arg+11);
} else {
- rs->filter=NULL;
+ rs->filter = NULL;
}
- for(i=0;i<RADIUS_CAT_NUM_TIMESTATS;i++) {
- rs->rtd[i].num=0;
- rs->rtd[i].min_num=0;
- rs->rtd[i].max_num=0;
- rs->rtd[i].min.secs=0;
- rs->rtd[i].min.nsecs=0;
- rs->rtd[i].max.secs=0;
- rs->rtd[i].max.nsecs=0;
- rs->rtd[i].tot.secs=0;
- rs->rtd[i].tot.nsecs=0;
+ for (i=0; i<RADIUS_CAT_NUM_TIMESTATS; i++) {
+ rs->rtd[i].num = 0;
+ rs->rtd[i].min_num = 0;
+ rs->rtd[i].max_num = 0;
+ rs->rtd[i].min.secs = 0;
+ rs->rtd[i].min.nsecs = 0;
+ rs->rtd[i].max.secs = 0;
+ rs->rtd[i].max.nsecs = 0;
+ rs->rtd[i].tot.secs = 0;
+ rs->rtd[i].tot.nsecs = 0;
}
- rs->open_req_num=0;
- rs->disc_rsp_num=0;
- rs->req_dup_num=0;
- rs->rsp_dup_num=0;
+ rs->open_req_num = 0;
+ rs->disc_rsp_num = 0;
+ rs->req_dup_num = 0;
+ rs->rsp_dup_num = 0;
- error_string=register_tap_listener("radius", rs, rs->filter, 0, NULL, radiusstat_packet, radiusstat_draw);
- if(error_string){
+ error_string = register_tap_listener("radius", rs, rs->filter, 0, NULL, radiusstat_packet, radiusstat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(rs->filter);
g_free(rs);
fprintf(stderr, "tshark: Couldn't register radius,rtd tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -236,3 +236,15 @@ register_tap_listener_radiusstat(void)
register_stat_cmd_arg("radius,rtd", radiusstat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-rlcltestat.c b/ui/cli/tap-rlcltestat.c
index b9522608f7..40996bb4cd 100644
--- a/ui/cli/tap-rlcltestat.c
+++ b/ui/cli/tap-rlcltestat.c
@@ -93,7 +93,7 @@ typedef struct rlc_lte_common_stats {
/* One row/UE in the UE table */
typedef struct rlc_lte_ep {
- struct rlc_lte_ep* next;
+ struct rlc_lte_ep *next;
struct rlc_lte_row_data stats;
} rlc_lte_ep_t;
@@ -113,8 +113,8 @@ typedef struct rlc_lte_stat_t {
static void
rlc_lte_stat_reset(void *phs)
{
- rlc_lte_stat_t* rlc_lte_stat = (rlc_lte_stat_t *)phs;
- rlc_lte_ep_t* list = rlc_lte_stat->ep_list;
+ rlc_lte_stat_t *rlc_lte_stat = (rlc_lte_stat_t *)phs;
+ rlc_lte_ep_t *list = rlc_lte_stat->ep_list;
rlc_lte_stat->total_frames = 0;
memset(&rlc_lte_stat->common_stats, 0, sizeof(rlc_lte_common_stats));
@@ -128,15 +128,15 @@ rlc_lte_stat_reset(void *phs)
/* Allocate a rlc_lte_ep_t struct to store info for new UE */
-static rlc_lte_ep_t* alloc_rlc_lte_ep(const struct rlc_lte_tap_info *si, packet_info *pinfo _U_)
+static rlc_lte_ep_t *alloc_rlc_lte_ep(const struct rlc_lte_tap_info *si, packet_info *pinfo _U_)
{
- rlc_lte_ep_t* ep;
+ rlc_lte_ep_t *ep;
if (!si) {
return NULL;
}
- if (!(ep = g_new(rlc_lte_ep_t,1))) {
+ if (!(ep = g_new(rlc_lte_ep_t, 1))) {
return NULL;
}
@@ -310,7 +310,7 @@ rlc_lte_stat_draw(void *phs)
/* Look up the statistics struct */
rlc_lte_stat_t *hs = (rlc_lte_stat_t *)phs;
- rlc_lte_ep_t* list = hs->ep_list, *tmp = 0;
+ rlc_lte_ep_t *list = hs->ep_list, *tmp = 0;
/* Common channel data */
printf("Common Data:\n");
@@ -379,7 +379,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
}
/* Create top-level struct */
- hs = g_new0(rlc_lte_stat_t,1);
+ hs = g_new0(rlc_lte_stat_t, 1);
hs->ep_list = NULL;
@@ -408,3 +408,15 @@ register_tap_listener_rlc_lte_stat(void)
register_stat_cmd_arg("rlc-lte,stat", rlc_lte_stat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/cli/tap-rpcprogs.c b/ui/cli/tap-rpcprogs.c
index def301131d..ba496de500 100644
--- a/ui/cli/tap-rpcprogs.c
+++ b/ui/cli/tap-rpcprogs.c
@@ -51,75 +51,75 @@ typedef struct _rpc_program_t {
nstime_t tot;
} rpc_program_t;
-static rpc_program_t *prog_list=NULL;
-static int already_enabled=0;
+static rpc_program_t *prog_list = NULL;
+static int already_enabled = 0;
static int
rpcprogs_packet(void *dummy1 _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri)
{
- const rpc_call_info_value *ri=(const rpc_call_info_value *)pri;
+ const rpc_call_info_value *ri = (const rpc_call_info_value *)pri;
nstime_t delta;
- rpc_program_t *rp=NULL;
+ rpc_program_t *rp = NULL;
- if(!prog_list){
+ if (!prog_list) {
/* the list was empty */
- rp=g_new(rpc_program_t,1);
- rp->next=NULL;
- rp->program=ri->prog;
- rp->version=ri->vers;
- rp->num=0;
- rp->min.secs=0;
- rp->min.nsecs=0;
- rp->max.secs=0;
- rp->max.nsecs=0;
- rp->tot.secs=0;
- rp->tot.nsecs=0;
- prog_list=rp;
- } else if((ri->prog==prog_list->program)
- &&(ri->vers==prog_list->version)){
- rp=prog_list;
- } else if( (ri->prog<prog_list->program)
- ||((ri->prog==prog_list->program)&&(ri->vers<prog_list->version))){
+ rp = g_new(rpc_program_t, 1);
+ rp->next = NULL;
+ rp->program = ri->prog;
+ rp->version = ri->vers;
+ rp->num = 0;
+ rp->min.secs = 0;
+ rp->min.nsecs = 0;
+ rp->max.secs = 0;
+ rp->max.nsecs = 0;
+ rp->tot.secs = 0;
+ rp->tot.nsecs = 0;
+ prog_list = rp;
+ } else if ((ri->prog == prog_list->program)
+ && (ri->vers == prog_list->version)) {
+ rp = prog_list;
+ } else if ( (ri->prog < prog_list->program)
+ || ((ri->prog == prog_list->program) && (ri->vers < prog_list->version))) {
/* we should be first entry in list */
- rp=g_new(rpc_program_t,1);
- rp->next=prog_list;
- rp->program=ri->prog;
- rp->version=ri->vers;
- rp->num=0;
- rp->min.secs=0;
- rp->min.nsecs=0;
- rp->max.secs=0;
- rp->max.nsecs=0;
- rp->tot.secs=0;
- rp->tot.nsecs=0;
- prog_list=rp;
+ rp = g_new(rpc_program_t, 1);
+ rp->next = prog_list;
+ rp->program = ri->prog;
+ rp->version = ri->vers;
+ rp->num = 0;
+ rp->min.secs = 0;
+ rp->min.nsecs = 0;
+ rp->max.secs = 0;
+ rp->max.nsecs = 0;
+ rp->tot.secs = 0;
+ rp->tot.nsecs = 0;
+ prog_list = rp;
} else {
/* we go somewhere else in the list */
- for(rp=prog_list;rp;rp=rp->next){
- if((rp->next)
- && (rp->next->program==ri->prog)
- && (rp->next->version==ri->vers)){
- rp=rp->next;
+ for (rp=prog_list; rp; rp=rp->next) {
+ if ((rp->next)
+ && (rp->next->program == ri->prog)
+ && (rp->next->version == ri->vers)) {
+ rp = rp->next;
break;
}
- if((!rp->next)
- || (rp->next->program>ri->prog)
- || ( (rp->next->program==ri->prog)
- &&(rp->next->version>ri->vers))){
+ if ((!rp->next)
+ || (rp->next->program > ri->prog)
+ || ( (rp->next->program == ri->prog)
+ && (rp->next->version > ri->vers))) {
rpc_program_t *trp;
- trp=g_new(rpc_program_t,1);
- trp->next=rp->next;
- trp->program=ri->prog;
- trp->version=ri->vers;
- trp->num=0;
- trp->min.secs=0;
- trp->min.nsecs=0;
- trp->max.secs=0;
- trp->max.nsecs=0;
- trp->tot.secs=0;
- trp->tot.nsecs=0;
- rp->next=trp;
- rp=trp;
+ trp = g_new(rpc_program_t, 1);
+ trp->next = rp->next;
+ trp->program = ri->prog;
+ trp->version = ri->vers;
+ trp->num = 0;
+ trp->min.secs = 0;
+ trp->min.nsecs = 0;
+ trp->max.secs = 0;
+ trp->max.nsecs = 0;
+ trp->tot.secs = 0;
+ trp->tot.nsecs = 0;
+ rp->next = trp;
+ rp = trp;
break;
}
}
@@ -127,42 +127,42 @@ rpcprogs_packet(void *dummy1 _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
/* we are only interested in reply packets */
- if(ri->request || !rp){
+ if (ri->request || !rp) {
return 0;
}
/* calculate time delta between request and reply */
nstime_delta(&delta, &pinfo->fd->abs_ts, &ri->req_time);
- if((rp->max.secs==0)
- && (rp->max.nsecs==0) ){
- rp->max.secs=delta.secs;
- rp->max.nsecs=delta.nsecs;
+ if ((rp->max.secs == 0)
+ && (rp->max.nsecs == 0) ) {
+ rp->max.secs = delta.secs;
+ rp->max.nsecs = delta.nsecs;
}
- if((rp->min.secs==0)
- && (rp->min.nsecs==0) ){
- rp->min.secs=delta.secs;
- rp->min.nsecs=delta.nsecs;
+ if ((rp->min.secs == 0)
+ && (rp->min.nsecs == 0) ) {
+ rp->min.secs = delta.secs;
+ rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs<rp->min.secs)
- ||( (delta.secs==rp->min.secs)
- &&(delta.nsecs<rp->min.nsecs) ) ){
- rp->min.secs=delta.secs;
- rp->min.nsecs=delta.nsecs;
+ if ( (delta.secs < rp->min.secs)
+ || ( (delta.secs == rp->min.secs)
+ && (delta.nsecs < rp->min.nsecs) ) ) {
+ rp->min.secs = delta.secs;
+ rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs>rp->max.secs)
- ||( (delta.secs==rp->max.secs)
- &&(delta.nsecs>rp->max.nsecs) ) ){
- rp->max.secs=delta.secs;
- rp->max.nsecs=delta.nsecs;
+ if ( (delta.secs > rp->max.secs)
+ || ( (delta.secs == rp->max.secs)
+ && (delta.nsecs > rp->max.nsecs) ) ) {
+ rp->max.secs = delta.secs;
+ rp->max.nsecs = delta.nsecs;
}
- rp->tot.secs += delta.secs;
+ rp->tot.secs += delta.secs;
rp->tot.nsecs += delta.nsecs;
- if(rp->tot.nsecs > NANOSECS_PER_SEC){
+ if (rp->tot.nsecs > NANOSECS_PER_SEC) {
rp->tot.nsecs -= NANOSECS_PER_SEC;
rp->tot.secs++;
}
@@ -183,23 +183,23 @@ rpcprogs_draw(void *dummy _U_)
printf("==========================================================\n");
printf("ONC-RPC Program Statistics:\n");
printf("Program Version Calls Min SRT Max SRT Avg SRT\n");
- for(rp=prog_list;rp;rp=rp->next){
+ for (rp = prog_list;rp;rp = rp->next) {
/* Only display procs with non-zero calls */
- if(rp->num==0){
+ if (rp->num == 0) {
continue;
}
/* Scale the average SRT in units of 1us and round to the nearest us. */
td = ((guint64)(rp->tot.secs)) * NANOSECS_PER_SEC + rp->tot.nsecs;
td = ((td / rp->num) + 500) / 1000;
- g_snprintf(str, sizeof(str), "%s(%d)",rpc_prog_name(rp->program),rp->program);
+ g_snprintf(str, sizeof(str), "%s(%d)", rpc_prog_name(rp->program), rp->program);
printf("%-15s %2d %6d %3d.%06d %3d.%06d %3" G_GINT64_MODIFIER "u.%06" G_GINT64_MODIFIER "u\n",
- str,
- rp->version,
- rp->num,
- (int)(rp->min.secs),(rp->min.nsecs+500)/1000,
- (int)(rp->max.secs),(rp->max.nsecs+500)/1000,
- td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
+ str,
+ rp->version,
+ rp->num,
+ (int)(rp->min.secs), (rp->min.nsecs+500)/1000,
+ (int)(rp->max.secs), (rp->max.nsecs+500)/1000,
+ td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
);
}
printf("===================================================================\n");
@@ -207,19 +207,19 @@ rpcprogs_draw(void *dummy _U_)
static void
-rpcprogs_init(const char *opt_arg _U_, void* userdata _U_)
+rpcprogs_init(const char *opt_arg _U_, void *userdata _U_)
{
GString *error_string;
- if(already_enabled){
+ if (already_enabled) {
return;
}
- already_enabled=1;
+ already_enabled = 1;
- error_string=register_tap_listener("rpc", NULL, NULL, 0, NULL, rpcprogs_packet, rpcprogs_draw);
- if(error_string){
- fprintf(stderr,"tshark: Couldn't register rpc,programs tap: %s\n",
- error_string->str);
+ error_string = register_tap_listener("rpc", NULL, NULL, 0, NULL, rpcprogs_packet, rpcprogs_draw);
+ if (error_string) {
+ fprintf(stderr, "tshark: Couldn't register rpc,programs tap: %s\n",
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -232,4 +232,15 @@ register_tap_listener_rpcprogs(void)
register_stat_cmd_arg("rpc,programs", rpcprogs_init, NULL);
}
-
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-rpcstat.c b/ui/cli/tap-rpcstat.c
index 6dc04986d1..67733b2a98 100644
--- a/ui/cli/tap-rpcstat.c
+++ b/ui/cli/tap-rpcstat.c
@@ -77,17 +77,17 @@ typedef struct _rpcstat_t {
static void
rpcstat_reset(void *prs)
{
- rpcstat_t *rs=(rpcstat_t *)prs;
+ rpcstat_t *rs = (rpcstat_t *)prs;
guint32 i;
- for(i=0;i<rs->num_procedures;i++){
- rs->procedures[i].num=0;
- rs->procedures[i].min.secs=0;
- rs->procedures[i].min.nsecs=0;
- rs->procedures[i].max.secs=0;
- rs->procedures[i].max.nsecs=0;
- rs->procedures[i].tot.secs=0;
- rs->procedures[i].tot.nsecs=0;
+ for (i=0; i<rs->num_procedures; i++) {
+ rs->procedures[i].num = 0;
+ rs->procedures[i].min.secs = 0;
+ rs->procedures[i].min.nsecs = 0;
+ rs->procedures[i].max.secs = 0;
+ rs->procedures[i].max.nsecs = 0;
+ rs->procedures[i].tot.secs = 0;
+ rs->procedures[i].tot.nsecs = 0;
}
}
@@ -122,56 +122,56 @@ rpcstat_reset(void *prs)
static int
rpcstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri)
{
- rpcstat_t *rs=(rpcstat_t *)prs;
- const rpc_call_info_value *ri=(const rpc_call_info_value *)pri;
+ rpcstat_t *rs = (rpcstat_t *)prs;
+ const rpc_call_info_value *ri = (const rpc_call_info_value *)pri;
nstime_t delta;
rpc_procedure_t *rp;
- if(ri->proc>=rs->num_procedures){
+ if (ri->proc >= rs->num_procedures) {
/* don't handle this since its outside of known table */
return 0;
}
/* we are only interested in reply packets */
- if(ri->request){
+ if (ri->request) {
return 0;
}
/* we are only interested in certain program/versions */
- if( (ri->prog!=rs->program) || (ri->vers!=rs->version) ){
+ if ( (ri->prog != rs->program) || (ri->vers != rs->version) ) {
return 0;
}
- rp=&(rs->procedures[ri->proc]);
+ rp = &(rs->procedures[ri->proc]);
/* calculate time delta between request and reply */
nstime_delta(&delta, &pinfo->fd->abs_ts, &ri->req_time);
- if(rp->num==0){
- rp->max.secs=delta.secs;
- rp->max.nsecs=delta.nsecs;
+ if (rp->num == 0) {
+ rp->max.secs = delta.secs;
+ rp->max.nsecs = delta.nsecs;
}
- if(rp->num==0){
- rp->min.secs=delta.secs;
- rp->min.nsecs=delta.nsecs;
+ if (rp->num == 0) {
+ rp->min.secs = delta.secs;
+ rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs<rp->min.secs)
- ||( (delta.secs==rp->min.secs)
- &&(delta.nsecs<rp->min.nsecs) ) ){
- rp->min.secs=delta.secs;
- rp->min.nsecs=delta.nsecs;
+ if ( (delta.secs < rp->min.secs)
+ || ( (delta.secs == rp->min.secs)
+ && (delta.nsecs < rp->min.nsecs) ) ) {
+ rp->min.secs = delta.secs;
+ rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs>rp->max.secs)
- ||( (delta.secs==rp->max.secs)
- &&(delta.nsecs>rp->max.nsecs) ) ){
- rp->max.secs=delta.secs;
- rp->max.nsecs=delta.nsecs;
+ if ( (delta.secs > rp->max.secs)
+ || ( (delta.secs == rp->max.secs)
+ && (delta.nsecs > rp->max.nsecs) ) ) {
+ rp->max.secs = delta.secs;
+ rp->max.nsecs = delta.nsecs;
}
- rp->tot.secs += delta.secs;
+ rp->tot.secs += delta.secs;
rp->tot.nsecs += delta.nsecs;
- if(rp->tot.nsecs > NANOSECS_PER_SEC){
+ if (rp->tot.nsecs > NANOSECS_PER_SEC) {
rp->tot.nsecs -= NANOSECS_PER_SEC;
rp->tot.secs++;
}
@@ -194,16 +194,16 @@ rpcstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
static void
rpcstat_draw(void *prs)
{
- rpcstat_t *rs=(rpcstat_t *)prs;
+ rpcstat_t *rs = (rpcstat_t *)prs;
guint32 i;
guint64 td;
printf("\n");
printf("==================================================================\n");
printf("%s Version %d SRT Statistics:\n", rs->prog, rs->version);
- printf("Filter: %s\n",rs->filter?rs->filter:"");
+ printf("Filter: %s\n", rs->filter ? rs->filter : "");
printf("Procedure Calls Min SRT Max SRT Avg SRT Total\n");
- for(i=0;i<rs->num_procedures;i++){
- if(rs->procedures[i].num==0){
+ for (i=0; i<rs->num_procedures; i++) {
+ if (rs->procedures[i].num == 0) {
continue;
}
/* Scale the average SRT in units of 1us and round to the nearest us. */
@@ -211,42 +211,42 @@ rpcstat_draw(void *prs)
td = ((td / rs->procedures[i].num) + 500) / 1000;
printf("%-15s %6d %3d.%06d %3d.%06d %3" G_GINT64_MODIFIER "u.%06" G_GINT64_MODIFIER "u %3d.%06d\n",
- rs->procedures[i].proc,
- rs->procedures[i].num,
- (int)(rs->procedures[i].min.secs),(rs->procedures[i].min.nsecs+500)/1000,
- (int)(rs->procedures[i].max.secs),(rs->procedures[i].max.nsecs+500)/1000,
- td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC,
- (int)(rs->procedures[i].tot.secs),(rs->procedures[i].tot.nsecs+500)/1000
+ rs->procedures[i].proc,
+ rs->procedures[i].num,
+ (int)(rs->procedures[i].min.secs), (rs->procedures[i].min.nsecs+500)/1000,
+ (int)(rs->procedures[i].max.secs), (rs->procedures[i].max.nsecs+500)/1000,
+ td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC,
+ (int)(rs->procedures[i].tot.secs), (rs->procedures[i].tot.nsecs+500)/1000
);
}
printf("==================================================================\n");
}
-static guint32 rpc_program=0;
-static guint32 rpc_version=0;
-static gint32 rpc_min_proc=-1;
-static gint32 rpc_max_proc=-1;
+static guint32 rpc_program = 0;
+static guint32 rpc_version = 0;
+static gint32 rpc_min_proc = -1;
+static gint32 rpc_max_proc = -1;
static void *
rpcstat_find_procs(gpointer *key, gpointer *value _U_, gpointer *user_data _U_)
{
- rpc_proc_info_key *k=(rpc_proc_info_key *)key;
+ rpc_proc_info_key *k = (rpc_proc_info_key *)key;
- if(k->prog!=rpc_program){
+ if (k->prog != rpc_program) {
return NULL;
}
- if(k->vers!=rpc_version){
+ if (k->vers != rpc_version) {
return NULL;
}
- if(rpc_min_proc==-1){
- rpc_min_proc=k->proc;
- rpc_max_proc=k->proc;
+ if (rpc_min_proc == -1) {
+ rpc_min_proc = k->proc;
+ rpc_max_proc = k->proc;
}
- if((gint32)k->proc<rpc_min_proc){
- rpc_min_proc=k->proc;
+ if ((gint32)k->proc < rpc_min_proc) {
+ rpc_min_proc = k->proc;
}
- if((gint32)k->proc>rpc_max_proc){
- rpc_max_proc=k->proc;
+ if ((gint32)k->proc > rpc_max_proc) {
+ rpc_max_proc = k->proc;
}
return NULL;
@@ -263,58 +263,58 @@ rpcstat_find_procs(gpointer *key, gpointer *value _U_, gpointer *user_data _U_)
* instance for the rpc tap.
*/
static void
-rpcstat_init(const char *opt_arg, void* userdata _U_)
+rpcstat_init(const char *opt_arg, void *userdata _U_)
{
rpcstat_t *rs;
guint32 i;
int program, version;
- int pos=0;
- const char *filter=NULL;
+ int pos = 0;
+ const char *filter = NULL;
GString *error_string;
- if(sscanf(opt_arg,"rpc,srt,%d,%d,%n",&program,&version,&pos)==2){
- if(pos){
- filter=opt_arg+pos;
+ if (sscanf(opt_arg, "rpc,srt,%d,%d,%n", &program, &version, &pos) == 2) {
+ if (pos) {
+ filter = opt_arg+pos;
} else {
- filter=NULL;
+ filter = NULL;
}
} else {
fprintf(stderr, "tshark: invalid \"-z rpc,srt,<program>,<version>[,<filter>]\" argument\n");
exit(1);
}
- rs=g_new(rpcstat_t,1);
- rs->prog=rpc_prog_name(program);
- rs->program=program;
- rs->version=version;
- if(filter){
- rs->filter=g_strdup(filter);
+ rs = g_new(rpcstat_t, 1);
+ rs->prog = rpc_prog_name(program);
+ rs->program = program;
+ rs->version = version;
+ if (filter) {
+ rs->filter = g_strdup(filter);
} else {
- rs->filter=NULL;
+ rs->filter = NULL;
}
- rpc_program=program;
- rpc_version=version;
- rpc_min_proc=-1;
- rpc_max_proc=-1;
+ rpc_program = program;
+ rpc_version = version;
+ rpc_min_proc = -1;
+ rpc_max_proc = -1;
g_hash_table_foreach(rpc_procs, (GHFunc)rpcstat_find_procs, NULL);
- if(rpc_min_proc==-1){
- fprintf(stderr,"tshark: Invalid -z rpc,srt,%d,%d\n",rpc_program,rpc_version);
- fprintf(stderr," Program:%d version:%d isn't supported by tshark.\n", rpc_program, rpc_version);
+ if (rpc_min_proc == -1) {
+ fprintf(stderr, "tshark: Invalid -z rpc,srt,%d,%d\n", rpc_program, rpc_version);
+ fprintf(stderr, " Program:%d version:%d isn't supported by tshark.\n", rpc_program, rpc_version);
exit(1);
}
- rs->num_procedures=rpc_max_proc+1;
- rs->procedures=g_new(rpc_procedure_t,rs->num_procedures+1);
- for(i=0;i<rs->num_procedures;i++){
- rs->procedures[i].proc=rpc_proc_name(program, version, i);
- rs->procedures[i].num=0;
- rs->procedures[i].min.secs=0;
- rs->procedures[i].min.nsecs=0;
- rs->procedures[i].max.secs=0;
- rs->procedures[i].max.nsecs=0;
- rs->procedures[i].tot.secs=0;
- rs->procedures[i].tot.nsecs=0;
+ rs->num_procedures = rpc_max_proc+1;
+ rs->procedures = g_new(rpc_procedure_t, rs->num_procedures+1);
+ for (i=0; i<rs->num_procedures; i++) {
+ rs->procedures[i].proc = rpc_proc_name(program, version, i);
+ rs->procedures[i].num = 0;
+ rs->procedures[i].min.secs = 0;
+ rs->procedures[i].min.nsecs = 0;
+ rs->procedures[i].max.secs = 0;
+ rs->procedures[i].max.nsecs = 0;
+ rs->procedures[i].tot.secs = 0;
+ rs->procedures[i].tot.nsecs = 0;
}
/* It is possible to create a filter and attach it to the callbacks. Then the
@@ -328,15 +328,15 @@ rpcstat_init(const char *opt_arg, void* userdata _U_)
* (Perhaps the user only wants the stats for nis+ traffic for certain objects?)
*/
- error_string=register_tap_listener("rpc", rs, filter, 0, rpcstat_reset, rpcstat_packet, rpcstat_draw);
- if(error_string){
+ error_string = register_tap_listener("rpc", rs, filter, 0, rpcstat_reset, rpcstat_packet, rpcstat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(rs->procedures);
g_free(rs->filter);
g_free(rs);
fprintf(stderr, "tshark: Couldn't register rpc,srt tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -346,6 +346,18 @@ rpcstat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_rpcstat(void)
{
- register_stat_cmd_arg("rpc,srt,", rpcstat_init,NULL);
+ register_stat_cmd_arg("rpc,srt,", rpcstat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-rtp.c b/ui/cli/tap-rtp.c
index 8ab5d3fe9a..765bc47bbb 100644
--- a/ui/cli/tap-rtp.c
+++ b/ui/cli/tap-rtp.c
@@ -60,7 +60,7 @@ rtp_streams_stat_draw(void *arg _U_)
GList *list;
- rtp_stream_info_t* strinfo;
+ rtp_stream_info_t *strinfo;
gchar *payload_type;
guint32 expected;
gint32 lost;
@@ -84,11 +84,11 @@ rtp_streams_stat_draw(void *arg _U_)
strinfo = (rtp_stream_info_t*)(list->data);
/* payload type */
- if(strinfo->pt>95){
- if(strinfo->info_payload_type_str != NULL){
+ if (strinfo->pt > 95) {
+ if (strinfo->info_payload_type_str != NULL) {
payload_type = g_strdup(strinfo->info_payload_type_str);
}else{
- payload_type = g_strdup_printf("Unknown(%u)",strinfo->pt);
+ payload_type = g_strdup_printf("Unknown(%u)", strinfo->pt);
}
}else{
@@ -100,7 +100,7 @@ rtp_streams_stat_draw(void *arg _U_)
expected = (strinfo->rtp_stats.stop_seq_nr + strinfo->rtp_stats.cycles*65536)
- strinfo->rtp_stats.start_seq_nr + 1;
lost = expected - strinfo->rtp_stats.total_nr;
- if (expected){
+ if (expected) {
perc = (double)(lost*100)/(double)expected;
} else {
perc = 0;
@@ -134,7 +134,7 @@ rtp_streams_stat_draw(void *arg _U_)
static void
-rtp_streams_stat_init(const char *opt_arg _U_, void* userdata _U_)
+rtp_streams_stat_init(const char *opt_arg _U_, void *userdata _U_)
{
GString *err_p;
@@ -156,7 +156,7 @@ rtp_streams_stat_init(const char *opt_arg _U_, void* userdata _U_)
void
register_tap_listener_rtp_streams(void)
{
- register_stat_cmd_arg("rtp,streams", rtp_streams_stat_init,NULL);
+ register_stat_cmd_arg("rtp,streams", rtp_streams_stat_init, NULL);
}
/*
diff --git a/ui/cli/tap-rtspstat.c b/ui/cli/tap-rtspstat.c
index bac126a1d4..34cf9047a6 100644
--- a/ui/cli/tap-rtspstat.c
+++ b/ui/cli/tap-rtspstat.c
@@ -73,12 +73,12 @@ rtsp_init_hash( rtspstat_t *sp)
for (i=0 ; rtsp_status_code_vals[i].strptr ; i++ )
{
- gint *key = g_new (gint,1);
- rtsp_response_code_t *sc = g_new (rtsp_response_code_t,1);
+ gint *key = g_new (gint, 1);
+ rtsp_response_code_t *sc = g_new (rtsp_response_code_t, 1);
*key = rtsp_status_code_vals[i].value;
- sc->packets=0;
+ sc->packets = 0;
sc->response_code = *key;
- sc->name=rtsp_status_code_vals[i].strptr;
+ sc->name = rtsp_status_code_vals[i].strptr;
sc->sp = sp;
g_hash_table_insert( sc->sp->hash_responses, key, sc);
}
@@ -87,7 +87,7 @@ rtsp_init_hash( rtspstat_t *sp)
static void
rtsp_draw_hash_requests( gchar *key _U_ , rtsp_request_methode_t *data, gchar * format)
{
- if (data->packets==0)
+ if (data->packets == 0)
return;
printf( format, data->response, data->packets);
}
@@ -95,11 +95,11 @@ rtsp_draw_hash_requests( gchar *key _U_ , rtsp_request_methode_t *data, gchar *
static void
rtsp_draw_hash_responses( gint * key _U_ , rtsp_response_code_t *data, char * format)
{
- if (data==NULL) {
+ if (data == NULL) {
g_warning("No data available, key=%d\n", *key);
exit(EXIT_FAILURE);
}
- if (data->packets==0)
+ if (data->packets == 0)
return;
/* " RTSP %3d %-35s %9d packets", */
printf(format, data->response_code, data->name, data->packets );
@@ -130,7 +130,7 @@ rtsp_reset_hash_requests(gchar *key _U_ , rtsp_request_methode_t *data, gpointer
static void
rtspstat_reset(void *psp )
{
- rtspstat_t *sp=(rtspstat_t *)psp;
+ rtspstat_t *sp = (rtspstat_t *)psp;
g_hash_table_foreach( sp->hash_responses, (GHFunc)rtsp_reset_hash_responses, NULL);
g_hash_table_foreach( sp->hash_requests, (GHFunc)rtsp_reset_hash_requests, NULL);
@@ -140,60 +140,60 @@ rtspstat_reset(void *psp )
static int
rtspstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
{
- const rtsp_info_value_t *value=(const rtsp_info_value_t *)pri;
- rtspstat_t *sp=(rtspstat_t *) psp;
+ const rtsp_info_value_t *value = (const rtsp_info_value_t *)pri;
+ rtspstat_t *sp = (rtspstat_t *) psp;
/* We are only interested in reply packets with a status code */
/* Request or reply packets ? */
- if (value->response_code!=0) {
- guint *key=g_new(guint,1);
+ if (value->response_code != 0) {
+ guint *key = g_new(guint, 1);
rtsp_response_code_t *sc;
- *key=value->response_code;
+ *key = value->response_code;
sc = (rtsp_response_code_t *)g_hash_table_lookup(
sp->hash_responses,
key);
- if (sc==NULL){
+ if (sc == NULL) {
/* non standard status code ; we classify it as others
* in the relevant category (Informational,Success,Redirection,Client Error,Server Error)
*/
int i = value->response_code;
- if ((i<100) || (i>=600)) {
+ if ((i < 100) || (i >= 600)) {
return 0;
}
- else if (i<200){
- *key=199; /* Hopefully, this status code will never be used */
+ else if (i < 200) {
+ *key = 199; /* Hopefully, this status code will never be used */
}
- else if (i<300){
- *key=299;
+ else if (i < 300) {
+ *key = 299;
}
- else if (i<400){
- *key=399;
+ else if (i < 400) {
+ *key = 399;
}
- else if (i<500){
- *key=499;
+ else if (i < 500) {
+ *key = 499;
}
- else{
- *key=599;
+ else {
+ *key = 599;
}
sc = (rtsp_response_code_t *)g_hash_table_lookup(
sp->hash_responses,
key);
- if (sc==NULL)
+ if (sc == NULL)
return 0;
}
sc->packets++;
}
- else if (value->request_method){
+ else if (value->request_method) {
rtsp_request_methode_t *sc;
sc = (rtsp_request_methode_t *)g_hash_table_lookup(
sp->hash_requests,
value->request_method);
- if (sc==NULL){
- sc=g_new(rtsp_request_methode_t,1);
- sc->response=g_strdup( value->request_method );
- sc->packets=1;
+ if (sc == NULL) {
+ sc = g_new(rtsp_request_methode_t, 1);
+ sc->response = g_strdup( value->request_method );
+ sc->packets = 1;
sc->sp = sp;
g_hash_table_insert( sp->hash_requests, sc->response, sc);
} else {
@@ -209,7 +209,7 @@ rtspstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, con
static void
rtspstat_draw(void *psp )
{
- rtspstat_t *sp=(rtspstat_t *)psp;
+ rtspstat_t *sp = (rtspstat_t *)psp;
printf("\n");
printf("===================================================================\n");
if (! sp->filter[0])
@@ -231,23 +231,23 @@ rtspstat_draw(void *psp )
/* When called, this function will create a new instance of gtk_rtspstat.
*/
static void
-gtk_rtspstat_init(const char *opt_arg,void* userdata _U_)
+gtk_rtspstat_init(const char *opt_arg, void *userdata _U_)
{
rtspstat_t *sp;
- const char *filter=NULL;
+ const char *filter = NULL;
GString *error_string;
- if (!strncmp (opt_arg, "rtsp,stat,", 10)){
- filter=opt_arg+10;
+ if (!strncmp (opt_arg, "rtsp,stat,", 10)) {
+ filter = opt_arg+10;
} else {
- filter=NULL;
+ filter = NULL;
}
sp = (rtspstat_t *)g_malloc( sizeof(rtspstat_t) );
- if(filter){
- sp->filter=g_strdup(filter);
+ if (filter) {
+ sp->filter = g_strdup(filter);
} else {
- sp->filter=NULL;
+ sp->filter = NULL;
}
/*g_hash_table_foreach( rtsp_status, (GHFunc)rtsp_reset_hash_responses, NULL);*/
@@ -260,7 +260,7 @@ gtk_rtspstat_init(const char *opt_arg,void* userdata _U_)
rtspstat_reset,
rtspstat_packet,
rtspstat_draw);
- if (error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(sp->filter);
g_free(sp);
@@ -276,5 +276,18 @@ gtk_rtspstat_init(const char *opt_arg,void* userdata _U_)
void
register_tap_listener_gtkrtspstat(void)
{
- register_stat_cmd_arg("rtsp,stat,", gtk_rtspstat_init,NULL);
+ register_stat_cmd_arg("rtsp,stat,", gtk_rtspstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-scsistat.c b/ui/cli/tap-scsistat.c
index d4f59e13b2..4d8a2477b6 100644
--- a/ui/cli/tap-scsistat.c
+++ b/ui/cli/tap-scsistat.c
@@ -88,15 +88,15 @@ scsistat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
scsi_procedure_t *rp;
/* we are only interested in response packets */
- if(ri->type != SCSI_PDU_TYPE_RSP) {
+ if (ri->type != SCSI_PDU_TYPE_RSP) {
return 0;
}
/* we are only interested in a specific commandset */
- if( (!ri->itl) || ((ri->itl->cmdset&SCSI_CMDSET_MASK) != rs->cmdset) ) {
+ if ( (!ri->itl) || ((ri->itl->cmdset&SCSI_CMDSET_MASK) != rs->cmdset) ) {
return 0;
}
/* check that the opcode looks sane */
- if( (!ri->itlq) || (ri->itlq->scsi_opcode > 255) ) {
+ if ( (!ri->itlq) || (ri->itlq->scsi_opcode > 255) ) {
return 0;
}
@@ -105,29 +105,29 @@ scsistat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
/* calculate time delta between request and reply */
nstime_delta(&delta, &pinfo->fd->abs_ts, &ri->itlq->fc_time);
- if(rp->num == 0) {
+ if (rp->num == 0) {
rp->max.secs = delta.secs;
rp->max.nsecs = delta.nsecs;
}
- if(rp->num == 0) {
+ if (rp->num == 0) {
rp->min.secs = delta.secs;
rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs < rp->min.secs)
- ||( (delta.secs == rp->min.secs)
- &&(delta.nsecs < rp->min.nsecs) ) ) {
+ if ( (delta.secs < rp->min.secs)
+ || ( (delta.secs == rp->min.secs)
+ && (delta.nsecs < rp->min.nsecs) ) ) {
rp->min.secs = delta.secs;
rp->min.nsecs = delta.nsecs;
}
- if( (delta.secs > rp->max.secs)
- ||( (delta.secs == rp->max.secs)
- &&(delta.nsecs > rp->max.nsecs) ) ) {
+ if ( (delta.secs > rp->max.secs)
+ || ( (delta.secs == rp->max.secs)
+ && (delta.nsecs > rp->max.nsecs) ) ) {
rp->max.secs = delta.secs;
rp->max.nsecs= delta.nsecs;
}
rp->tot.secs += delta.secs;
rp->tot.nsecs += delta.nsecs;
- if(rp->tot.nsecs > NANOSECS_PER_SEC) {
+ if (rp->tot.nsecs > NANOSECS_PER_SEC) {
rp->tot.nsecs -= NANOSECS_PER_SEC;
rp->tot.secs++;
}
@@ -145,10 +145,10 @@ scsistat_draw(void *prs)
printf("\n");
printf("===========================================================\n");
printf("SCSI %s SRT Statistics:\n", rs->prog);
- printf("Filter: %s\n", rs->filter?rs->filter:"");
+ printf("Filter: %s\n", rs->filter ? rs->filter : "");
printf("Procedure Calls Min SRT Max SRT Avg SRT\n");
for(i=0; i < MAX_PROCEDURES; i++) {
- if(rs->procedures[i].num == 0) {
+ if (rs->procedures[i].num == 0) {
continue;
}
/* scale it to units of 1us.*/
@@ -156,13 +156,13 @@ scsistat_draw(void *prs)
td = ((td / rs->procedures[i].num) + 500) / 1000;
printf("%-19s %6d %3d.%06u %3d.%06u %3d.%06u \n",
- rs->procedures[i].proc,
- rs->procedures[i].num,
- (int)(rs->procedures[i].min.secs),
- (rs->procedures[i].min.nsecs+500)/1000,
- (int)(rs->procedures[i].max.secs),
- (rs->procedures[i].max.nsecs+500)/1000,
- (int)(td/1000000), (int)(td%1000000)
+ rs->procedures[i].proc,
+ rs->procedures[i].num,
+ (int)(rs->procedures[i].min.secs),
+ (rs->procedures[i].min.nsecs+500)/1000,
+ (int)(rs->procedures[i].max.secs),
+ (rs->procedures[i].max.nsecs+500)/1000,
+ (int)(td/1000000), (int)(td%1000000)
);
}
printf("===========================================================\n");
@@ -178,8 +178,8 @@ scsistat_init(const char *opt_arg, void* userdata _U_)
GString *error_string;
pos = 0;
- if(sscanf(opt_arg, "scsi,srt,%d,%n", &program, &pos) == 1) {
- if(pos) {
+ if (sscanf(opt_arg, "scsi,srt,%d,%n", &program, &pos) == 1) {
+ if (pos) {
filter = opt_arg+pos;
} else {
filter = NULL;
@@ -191,7 +191,7 @@ scsistat_init(const char *opt_arg, void* userdata _U_)
scsi_program = program;
rs = g_new(scsistat_t,1);
- if(filter) {
+ if (filter) {
rs->filter = g_strdup(filter);
} else {
rs->filter = NULL;
@@ -228,17 +228,17 @@ scsistat_init(const char *opt_arg, void* userdata _U_)
}
rs->procedures = g_new(scsi_procedure_t,MAX_PROCEDURES);
for(i=0; i < MAX_PROCEDURES; i++) {
- rs->procedures[i].proc = val_to_str_ext(i, rs->cdbnames_ext, "Unknown-0x%02x");
- rs->procedures[i].num = 0;
- rs->procedures[i].min.secs = 0;
+ rs->procedures[i].proc = val_to_str_ext(i, rs->cdbnames_ext, "Unknown-0x%02x");
+ rs->procedures[i].num = 0;
+ rs->procedures[i].min.secs = 0;
rs->procedures[i].min.nsecs = 0;
- rs->procedures[i].max.secs = 0;
+ rs->procedures[i].max.secs = 0;
rs->procedures[i].max.nsecs = 0;
- rs->procedures[i].tot.secs = 0;
+ rs->procedures[i].tot.secs = 0;
rs->procedures[i].tot.nsecs = 0;
}
error_string = register_tap_listener("scsi", rs, filter, 0, scsistat_reset, scsistat_packet, scsistat_draw);
- if(error_string) {
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(rs->procedures);
g_free(rs->filter);
@@ -257,3 +257,15 @@ register_tap_listener_scsistat(void)
register_stat_cmd_arg("scsi,srt,", scsistat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-sctpchunkstat.c b/ui/cli/tap-sctpchunkstat.c
index 3981091dd4..a19e5efb25 100644
--- a/ui/cli/tap-sctpchunkstat.c
+++ b/ui/cli/tap-sctpchunkstat.c
@@ -38,7 +38,7 @@
void register_tap_listener_sctpstat(void);
typedef struct sctp_ep {
- struct sctp_ep* next;
+ struct sctp_ep *next;
address src;
address dst;
guint16 sport;
@@ -49,9 +49,9 @@ typedef struct sctp_ep {
/* used to keep track of the statistics for an entire program interface */
typedef struct _sctpstat_t {
- char* filter;
+ char *filter;
guint32 number_of_packets;
- sctp_ep_t* ep_list;
+ sctp_ep_t *ep_list;
} sctpstat_t;
@@ -83,40 +83,40 @@ typedef struct _sctpstat_t {
static void
sctpstat_reset(void *phs)
{
- sctpstat_t* sctp_stat = (sctpstat_t *)phs;
- sctp_ep_t* list = (sctp_ep_t*)sctp_stat->ep_list;
- sctp_ep_t* tmp = NULL;
- guint16 chunk_type;
+ sctpstat_t *sctp_stat = (sctpstat_t *)phs;
+ sctp_ep_t *list = (sctp_ep_t *)sctp_stat->ep_list;
+ sctp_ep_t *tmp = NULL;
+ guint16 chunk_type;
- if(!list)
+ if (!list)
return;
- for(tmp = list; tmp ; tmp=tmp->next)
- for(chunk_type = 0; chunk_type < 256; chunk_type++)
+ for (tmp = list; tmp; tmp = tmp->next)
+ for (chunk_type = 0; chunk_type < 256; chunk_type++)
tmp->chunk_count[chunk_type] = 0;
sctp_stat->number_of_packets = 0;
}
-static sctp_ep_t*
+static sctp_ep_t *
alloc_sctp_ep(const struct _sctp_info *si)
{
- sctp_ep_t* ep;
+ sctp_ep_t *ep;
guint16 chunk_type;
- if(!si)
+ if (!si)
return NULL;
- if (!(ep = g_new(sctp_ep_t,1)))
+ if (!(ep = g_new(sctp_ep_t, 1)))
return NULL;
- COPY_ADDRESS(&ep->src,&si->ip_src);
- COPY_ADDRESS(&ep->dst,&si->ip_dst);
+ COPY_ADDRESS(&ep->src, &si->ip_src);
+ COPY_ADDRESS(&ep->dst, &si->ip_dst);
ep->sport = si->sport;
ep->dport = si->dport;
- ep->next = NULL;
- for(chunk_type = 0; chunk_type < 256; chunk_type++)
+ ep->next = NULL;
+ for (chunk_type = 0; chunk_type < 256; chunk_type++)
ep->chunk_count[chunk_type] = 0;
return ep;
}
@@ -128,25 +128,25 @@ static int
sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
{
- sctpstat_t *hs=(sctpstat_t *)phs;
+ sctpstat_t *hs = (sctpstat_t *)phs;
sctp_ep_t *tmp = NULL, *te = NULL;
- const struct _sctp_info *si = (const struct _sctp_info *) phi;
+ const struct _sctp_info *si = (const struct _sctp_info *)phi;
guint32 tvb_number;
- guint8 chunk_type;
+ guint8 chunk_type;
if (!hs)
return (0);
hs->number_of_packets++;
- if(!hs->ep_list) {
+ if (!hs->ep_list) {
hs->ep_list = alloc_sctp_ep(si);
te = hs->ep_list;
} else {
- for(tmp=hs->ep_list ; tmp ; tmp=tmp->next)
+ for (tmp = hs->ep_list; tmp; tmp = tmp->next)
{
- if((!CMP_ADDRESS(&tmp->src,&si->ip_src)) &&
- (!CMP_ADDRESS(&tmp->dst,&si->ip_dst)) &&
+ if ((!CMP_ADDRESS(&tmp->src, &si->ip_src)) &&
+ (!CMP_ADDRESS(&tmp->dst, &si->ip_dst)) &&
(tmp->sport == si->sport) &&
(tmp->dport == si->dport))
{
@@ -154,7 +154,7 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
break;
}
}
- if(!te) {
+ if (!te) {
if ((te = alloc_sctp_ep(si))) {
te->next = hs->ep_list;
hs->ep_list = te;
@@ -162,7 +162,7 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
}
}
- if(!te)
+ if (!te)
return (0);
@@ -172,7 +172,7 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
(chunk_type == SCTP_INIT_ACK_CHUNK_ID)) {
te->chunk_count[chunk_type]++;
} else {
- for(tvb_number = 0; tvb_number < si->number_of_tvbs; tvb_number++)
+ for (tvb_number = 0; tvb_number < si->number_of_tvbs; tvb_number++)
te->chunk_count[CHUNK_TYPE(si->tvb[tvb_number])]++;
}
}
@@ -183,8 +183,8 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
static void
sctpstat_draw(void *phs)
{
- sctpstat_t *hs=(sctpstat_t *)phs;
- sctp_ep_t* list = hs->ep_list, *tmp;
+ sctpstat_t *hs = (sctpstat_t *)phs;
+ sctp_ep_t *list = hs->ep_list, *tmp;
printf("-------------------------------------------- SCTP Statistics --------------------------------------------------------------------------\n");
printf("| Total packets RX/TX %u\n", hs->number_of_packets);
@@ -192,10 +192,10 @@ sctpstat_draw(void *phs)
printf("| Source IP |PortA| Dest. IP |PortB| DATA | SACK | HBEAT |HBEATACK| INIT | INITACK| COOKIE |COOKIACK| ABORT | ERROR |\n");
printf("---------------------------------------------------------------------------------------------------------------------------------------\n");
- for(tmp = list ; tmp ; tmp=tmp->next) {
+ for (tmp = list; tmp; tmp = tmp->next) {
printf("|%15s|%5u|%15s|%5u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|\n",
- ep_address_to_str(&tmp->src),tmp->sport,
- ep_address_to_str(&tmp->dst),tmp->dport,
+ ep_address_to_str(&tmp->src), tmp->sport,
+ ep_address_to_str(&tmp->dst), tmp->dport,
tmp->chunk_count[SCTP_DATA_CHUNK_ID],
tmp->chunk_count[SCTP_SACK_CHUNK_ID],
tmp->chunk_count[SCTP_HEARTBEAT_CHUNK_ID],
@@ -212,30 +212,30 @@ sctpstat_draw(void *phs)
static void
-sctpstat_init(const char *opt_arg, void* userdata _U_)
+sctpstat_init(const char *opt_arg, void *userdata _U_)
{
sctpstat_t *hs;
- GString *error_string;
+ GString *error_string;
hs = (sctpstat_t *)g_malloc(sizeof(sctpstat_t));
- if(!strncmp(opt_arg,"sctp,stat,",11)){
- hs->filter=g_strdup(opt_arg+11);
+ if (!strncmp(opt_arg, "sctp,stat,", 11)) {
+ hs->filter = g_strdup(opt_arg+11);
} else {
- hs->filter=NULL;
+ hs->filter = NULL;
}
hs->ep_list = NULL;
hs->number_of_packets = 0;
sctpstat_reset(hs);
- error_string=register_tap_listener("sctp", hs, hs->filter, 0, NULL, sctpstat_packet, sctpstat_draw);
- if(error_string){
+ error_string = register_tap_listener("sctp", hs, hs->filter, 0, NULL, sctpstat_packet, sctpstat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(hs->filter);
g_free(hs);
fprintf(stderr, "tshark: Couldn't register sctp,stat tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -245,5 +245,18 @@ sctpstat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_sctpstat(void)
{
- register_stat_cmd_arg("sctp,stat", sctpstat_init,NULL);
+ register_stat_cmd_arg("sctp,stat", sctpstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-sipstat.c b/ui/cli/tap-sipstat.c
index a20332e003..06450130b7 100644
--- a/ui/cli/tap-sipstat.c
+++ b/ui/cli/tap-sipstat.c
@@ -38,160 +38,160 @@ void register_tap_listener_sipstat(void);
/* used to keep track of the statictics for an entire program interface */
typedef struct _sip_stats_t {
- char *filter;
- guint32 packets; /* number of sip packets, including continuations */
- guint32 resent_packets;
- guint32 average_setup_time;
- guint32 max_setup_time;
- guint32 min_setup_time;
- guint32 no_of_completed_calls;
- guint64 total_setup_time;
- GHashTable *hash_responses;
- GHashTable *hash_requests;
+ char *filter;
+ guint32 packets; /* number of sip packets, including continuations */
+ guint32 resent_packets;
+ guint32 average_setup_time;
+ guint32 max_setup_time;
+ guint32 min_setup_time;
+ guint32 no_of_completed_calls;
+ guint64 total_setup_time;
+ GHashTable *hash_responses;
+ GHashTable *hash_requests;
} sipstat_t;
/* used to keep track of the stats for a specific response code
* for example it can be { 3, 404, "Not Found" ,...}
* which means we captured 3 reply sip/1.1 404 Not Found */
typedef struct _sip_response_code_t {
- guint32 packets; /* 3 */
- guint response_code; /* 404 */
- const gchar *name; /* Not Found */
- sipstat_t *sp;
+ guint32 packets; /* 3 */
+ guint response_code; /* 404 */
+ const gchar *name; /* Not Found */
+ sipstat_t *sp;
} sip_response_code_t;
/* used to keep track of the stats for a specific request string */
typedef struct _sip_request_method_t {
- gchar *response; /* eg. : INVITE */
- guint32 packets;
- sipstat_t *sp;
+ gchar *response; /* eg. : INVITE */
+ guint32 packets;
+ sipstat_t *sp;
} sip_request_method_t;
/* TODO: extra codes to be added from SIP extensions? */
static const value_string vals_status_code[] = {
- { 100, "Trying"},
- { 180, "Ringing"},
- { 181, "Call Is Being Forwarded"},
- { 182, "Queued"},
- { 183, "Session Progress"},
- { 199, "Informational - Others" },
-
- { 200, "OK"},
- { 202, "Accepted"},
- { 204, "No Notification"},
- { 299, "Success - Others"}, /* used to keep track of other Success packets */
-
- { 300, "Multiple Choices"},
- { 301, "Moved Permanently"},
- { 302, "Moved Temporarily"},
- { 305, "Use Proxy"},
- { 380, "Alternative Service"},
- { 399, "Redirection - Others"},
-
- { 400, "Bad Request"},
- { 401, "Unauthorized"},
- { 402, "Payment Required"},
- { 403, "Forbidden"},
- { 404, "Not Found"},
- { 405, "Method Not Allowed"},
- { 406, "Not Acceptable"},
- { 407, "Proxy Authentication Required"},
- { 408, "Request Timeout"},
- { 410, "Gone"},
- { 412, "Conditional Request Failed"},
- { 413, "Request Entity Too Large"},
- { 414, "Request-URI Too Long"},
- { 415, "Unsupported Media Type"},
- { 416, "Unsupported URI Scheme"},
- { 420, "Bad Extension"},
- { 421, "Extension Required"},
- { 422, "Session Timer Too Small"},
- { 423, "Interval Too Brief"},
- { 428, "Use Identity Header"},
- { 429, "Provide Referrer Identity"},
- { 430, "Flow Failed"},
- { 433, "Anonymity Disallowed"},
- { 436, "Bad Identity-Info"},
- { 437, "Unsupported Certificate"},
- { 438, "Invalid Identity Header"},
- { 439, "First Hop Lacks Outbound Support"},
- { 440, "Max-Breadth Exceeded"},
- { 470, "Consent Needed"},
- { 480, "Temporarily Unavailable"},
- { 481, "Call/Transaction Does Not Exist"},
- { 482, "Loop Detected"},
- { 483, "Too Many Hops"},
- { 484, "Address Incomplete"},
- { 485, "Ambiguous"},
- { 486, "Busy Here"},
- { 487, "Request Terminated"},
- { 488, "Not Acceptable Here"},
- { 489, "Bad Event"},
- { 491, "Request Pending"},
- { 493, "Undecipherable"},
- { 494, "Security Agreement Required"},
- { 499, "Client Error - Others"},
-
- { 500, "Server Internal Error"},
- { 501, "Not Implemented"},
- { 502, "Bad Gateway"},
- { 503, "Service Unavailable"},
- { 504, "Server Time-out"},
- { 505, "Version Not Supported"},
- { 513, "Message Too Large"},
- { 599, "Server Error - Others"},
-
- { 600, "Busy Everywhere"},
- { 603, "Decline"},
- { 604, "Does Not Exist Anywhere"},
- { 606, "Not Acceptable"},
- { 699, "Global Failure - Others"},
-
- { 0, NULL}
+ { 100, "Trying"},
+ { 180, "Ringing"},
+ { 181, "Call Is Being Forwarded"},
+ { 182, "Queued"},
+ { 183, "Session Progress"},
+ { 199, "Informational - Others" },
+
+ { 200, "OK"},
+ { 202, "Accepted"},
+ { 204, "No Notification"},
+ { 299, "Success - Others"}, /* used to keep track of other Success packets */
+
+ { 300, "Multiple Choices"},
+ { 301, "Moved Permanently"},
+ { 302, "Moved Temporarily"},
+ { 305, "Use Proxy"},
+ { 380, "Alternative Service"},
+ { 399, "Redirection - Others"},
+
+ { 400, "Bad Request"},
+ { 401, "Unauthorized"},
+ { 402, "Payment Required"},
+ { 403, "Forbidden"},
+ { 404, "Not Found"},
+ { 405, "Method Not Allowed"},
+ { 406, "Not Acceptable"},
+ { 407, "Proxy Authentication Required"},
+ { 408, "Request Timeout"},
+ { 410, "Gone"},
+ { 412, "Conditional Request Failed"},
+ { 413, "Request Entity Too Large"},
+ { 414, "Request-URI Too Long"},
+ { 415, "Unsupported Media Type"},
+ { 416, "Unsupported URI Scheme"},
+ { 420, "Bad Extension"},
+ { 421, "Extension Required"},
+ { 422, "Session Timer Too Small"},
+ { 423, "Interval Too Brief"},
+ { 428, "Use Identity Header"},
+ { 429, "Provide Referrer Identity"},
+ { 430, "Flow Failed"},
+ { 433, "Anonymity Disallowed"},
+ { 436, "Bad Identity-Info"},
+ { 437, "Unsupported Certificate"},
+ { 438, "Invalid Identity Header"},
+ { 439, "First Hop Lacks Outbound Support"},
+ { 440, "Max-Breadth Exceeded"},
+ { 470, "Consent Needed"},
+ { 480, "Temporarily Unavailable"},
+ { 481, "Call/Transaction Does Not Exist"},
+ { 482, "Loop Detected"},
+ { 483, "Too Many Hops"},
+ { 484, "Address Incomplete"},
+ { 485, "Ambiguous"},
+ { 486, "Busy Here"},
+ { 487, "Request Terminated"},
+ { 488, "Not Acceptable Here"},
+ { 489, "Bad Event"},
+ { 491, "Request Pending"},
+ { 493, "Undecipherable"},
+ { 494, "Security Agreement Required"},
+ { 499, "Client Error - Others"},
+
+ { 500, "Server Internal Error"},
+ { 501, "Not Implemented"},
+ { 502, "Bad Gateway"},
+ { 503, "Service Unavailable"},
+ { 504, "Server Time-out"},
+ { 505, "Version Not Supported"},
+ { 513, "Message Too Large"},
+ { 599, "Server Error - Others"},
+
+ { 600, "Busy Everywhere"},
+ { 603, "Decline"},
+ { 604, "Does Not Exist Anywhere"},
+ { 606, "Not Acceptable"},
+ { 699, "Global Failure - Others"},
+
+ { 0, NULL}
};
/* Create tables for responses and requests */
static void
sip_init_hash(sipstat_t *sp)
{
- int i;
-
- /* Create responses table */
- sp->hash_responses = g_hash_table_new(g_int_hash, g_int_equal);
-
- /* Add all response codes */
- for (i=0 ; vals_status_code[i].strptr ; i++)
- {
- gint *key = g_new (gint,1);
- sip_response_code_t *sc = g_new (sip_response_code_t,1);
- *key = vals_status_code[i].value;
- sc->packets=0;
- sc->response_code = *key;
- sc->name=vals_status_code[i].strptr;
- sc->sp = sp;
- g_hash_table_insert(sc->sp->hash_responses, key, sc);
- }
-
- /* Create empty requests table */
- sp->hash_requests = g_hash_table_new(g_str_hash, g_str_equal);
+ int i;
+
+ /* Create responses table */
+ sp->hash_responses = g_hash_table_new(g_int_hash, g_int_equal);
+
+ /* Add all response codes */
+ for (i=0; vals_status_code[i].strptr; i++)
+ {
+ gint *key = g_new (gint, 1);
+ sip_response_code_t *sc = g_new (sip_response_code_t, 1);
+ *key = vals_status_code[i].value;
+ sc->packets = 0;
+ sc->response_code = *key;
+ sc->name = vals_status_code[i].strptr;
+ sc->sp = sp;
+ g_hash_table_insert(sc->sp->hash_responses, key, sc);
+ }
+
+ /* Create empty requests table */
+ sp->hash_requests = g_hash_table_new(g_str_hash, g_str_equal);
}
static void
-sip_draw_hash_requests( gchar *key _U_ , sip_request_method_t *data, gchar * format)
+sip_draw_hash_requests( gchar *key _U_, sip_request_method_t *data, gchar *format)
{
- if (data->packets==0)
+ if (data->packets == 0)
return;
printf( format, data->response, data->packets);
}
static void
-sip_draw_hash_responses( gint * key _U_ , sip_response_code_t *data, char * format)
+sip_draw_hash_responses( gint *key _U_ , sip_response_code_t *data, char *format)
{
- if (data==NULL) {
+ if (data == NULL) {
g_warning("C'est quoi ce borderl key=%d\n", *key);
exit(EXIT_FAILURE);
}
- if (data->packets==0)
+ if (data->packets == 0)
return;
printf(format, data->response_code, data->name, data->packets );
}
@@ -220,7 +220,7 @@ sip_reset_hash_requests(gchar *key _U_ , sip_request_method_t *data, gpointer pt
static void
sipstat_reset(void *psp )
{
- sipstat_t *sp=(sipstat_t *)psp;
+ sipstat_t *sp = (sipstat_t *)psp;
if (sp) {
sp->packets = 0;
sp->resent_packets = 0;
@@ -240,27 +240,27 @@ sipstat_reset(void *psp )
static int
sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
{
- const sip_info_value_t *value=(const sip_info_value_t *)pri;
- sipstat_t *sp = (sipstat_t *)psp;
+ const sip_info_value_t *value = (const sip_info_value_t *)pri;
+ sipstat_t *sp = (sipstat_t *)psp;
- /* Total number of packets, including continuation packets */
- sp->packets++;
+ /* Total number of packets, including continuation packets */
+ sp->packets++;
/* Calculate average setup time */
- if (value->setup_time){
+ if (value->setup_time) {
sp->no_of_completed_calls++;
/* Check if it's the first value */
- if ( sp->total_setup_time == 0 ){
+ if ( sp->total_setup_time == 0 ) {
sp->average_setup_time = value->setup_time;
sp->total_setup_time = value->setup_time;
sp->max_setup_time = value->setup_time;
sp->min_setup_time = value->setup_time;
}else{
sp->total_setup_time = sp->total_setup_time + value->setup_time;
- if (sp->max_setup_time < value->setup_time){
+ if (sp->max_setup_time < value->setup_time) {
sp->max_setup_time = value->setup_time;
}
- if (sp->min_setup_time > value->setup_time){
+ if (sp->min_setup_time > value->setup_time) {
sp->min_setup_time = value->setup_time;
}
/* Calculate average */
@@ -268,106 +268,106 @@ sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
}
}
- /* Update resent count if flag set */
- if (value->resend)
- {
- sp->resent_packets++;
- }
-
-
- /* Looking at both requests and responses */
- if (value->response_code != 0)
- {
- /* Responses */
- guint *key = g_new(guint,1);
- sip_response_code_t *sc;
-
- /* Look up response code in hash table */
- *key = value->response_code;
- sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, key);
- if (sc==NULL)
- {
- /* Non-standard status code ; we classify it as others
- * in the relevant category
- * (Informational,Success,Redirection,Client Error,Server Error,Global Failure)
- */
- int i = value->response_code;
- if ((i<100) || (i>=700))
- {
- /* Forget about crazy values */
- return 0;
- }
- else if (i<200)
- {
- *key=199; /* Hopefully, this status code will never be used */
- }
- else if (i<300)
- {
- *key=299;
- }
- else if (i<400)
- {
- *key=399;
- }
- else if (i<500)
- {
- *key=499;
- }
- else if (i<600)
- {
- *key=599;
- }
- else
- {
- *key = 699;
- }
-
- /* Now look up this fallback code to get its text description */
- sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, key);
- if (sc==NULL)
- {
- return 0;
- }
- }
- sc->packets++;
- }
- else if (value->request_method)
- {
- /* Requests */
- sip_request_method_t *sc;
-
- /* Look up the request method in the table */
- sc = (sip_request_method_t *)g_hash_table_lookup(sp->hash_requests, value->request_method);
- if (sc == NULL)
- {
- /* First of this type. Create structure and initialise */
- sc=g_new(sip_request_method_t,1);
- sc->response = g_strdup(value->request_method);
- sc->packets = 1;
- sc->sp = sp;
- /* Insert it into request table */
- g_hash_table_insert(sp->hash_requests, sc->response, sc);
- }
- else
- {
- /* Already existed, just update count for that method */
- sc->packets++;
- }
- /* g_free(value->request_method); */
- }
- else
- {
- /* No request method set. Just ignore */
- return 0;
- }
-
- return 1;
+ /* Update resent count if flag set */
+ if (value->resend)
+ {
+ sp->resent_packets++;
+ }
+
+
+ /* Looking at both requests and responses */
+ if (value->response_code != 0)
+ {
+ /* Responses */
+ guint *key = g_new(guint, 1);
+ sip_response_code_t *sc;
+
+ /* Look up response code in hash table */
+ *key = value->response_code;
+ sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, key);
+ if (sc == NULL)
+ {
+ /* Non-standard status code ; we classify it as others
+ * in the relevant category
+ * (Informational,Success,Redirection,Client Error,Server Error,Global Failure)
+ */
+ int i = value->response_code;
+ if ((i < 100) || (i >= 700))
+ {
+ /* Forget about crazy values */
+ return 0;
+ }
+ else if (i < 200)
+ {
+ *key = 199; /* Hopefully, this status code will never be used */
+ }
+ else if (i < 300)
+ {
+ *key = 299;
+ }
+ else if (i < 400)
+ {
+ *key = 399;
+ }
+ else if (i < 500)
+ {
+ *key = 499;
+ }
+ else if (i < 600)
+ {
+ *key = 599;
+ }
+ else
+ {
+ *key = 699;
+ }
+
+ /* Now look up this fallback code to get its text description */
+ sc = (sip_response_code_t *)g_hash_table_lookup(sp->hash_responses, key);
+ if (sc == NULL)
+ {
+ return 0;
+ }
+ }
+ sc->packets++;
+ }
+ else if (value->request_method)
+ {
+ /* Requests */
+ sip_request_method_t *sc;
+
+ /* Look up the request method in the table */
+ sc = (sip_request_method_t *)g_hash_table_lookup(sp->hash_requests, value->request_method);
+ if (sc == NULL)
+ {
+ /* First of this type. Create structure and initialise */
+ sc = g_new(sip_request_method_t, 1);
+ sc->response = g_strdup(value->request_method);
+ sc->packets = 1;
+ sc->sp = sp;
+ /* Insert it into request table */
+ g_hash_table_insert(sp->hash_requests, sc->response, sc);
+ }
+ else
+ {
+ /* Already existed, just update count for that method */
+ sc->packets++;
+ }
+ /* g_free(value->request_method); */
+ }
+ else
+ {
+ /* No request method set. Just ignore */
+ return 0;
+ }
+
+ return 1;
}
static void
sipstat_draw(void *psp )
{
- sipstat_t *sp=(sipstat_t *)psp;
+ sipstat_t *sp = (sipstat_t *)psp;
printf("\n");
printf("===================================================================\n");
if (sp->filter == NULL)
@@ -378,33 +378,33 @@ sipstat_draw(void *psp )
printf("\nNumber of SIP messages: %d", sp->packets);
printf("\nNumber of resent SIP messages: %d\n", sp->resent_packets);
printf( "\n* SIP Status Codes in reply packets\n");
- g_hash_table_foreach( sp->hash_responses, (GHFunc)sip_draw_hash_responses,
+ g_hash_table_foreach(sp->hash_responses, (GHFunc)sip_draw_hash_responses,
(gpointer)" SIP %3d %-15s : %5d Packets\n");
printf("\n* List of SIP Request methods\n");
- g_hash_table_foreach( sp->hash_requests, (GHFunc)sip_draw_hash_requests,
+ g_hash_table_foreach(sp->hash_requests, (GHFunc)sip_draw_hash_requests,
(gpointer)" %-15s : %5d Packets\n");
printf( "\n* Average setup time %d ms\n Min %d ms\n Max %d ms\n", sp->average_setup_time, sp->min_setup_time, sp->max_setup_time);
printf("===================================================================\n");
}
static void
-sipstat_init(const char *opt_arg, void* userdata _U_)
+sipstat_init(const char *opt_arg, void *userdata _U_)
{
- sipstat_t *sp;
- const char *filter=NULL;
- GString *error_string;
+ sipstat_t *sp;
+ const char *filter = NULL;
+ GString *error_string;
- if (strncmp (opt_arg, "sip,stat,", 9) == 0){
- filter=opt_arg+9;
+ if (strncmp (opt_arg, "sip,stat,", 9) == 0) {
+ filter = opt_arg+9;
} else {
- filter=NULL;
+ filter = NULL;
}
- sp = g_new0(sipstat_t,1);
- if(filter){
- sp->filter=g_strdup(filter);
+ sp = g_new0(sipstat_t, 1);
+ if (filter) {
+ sp->filter = g_strdup(filter);
} else {
- sp->filter=NULL;
+ sp->filter = NULL;
}
/*g_hash_table_foreach( sip_status, (GHFunc)sip_reset_hash_responses, NULL);*/
@@ -417,12 +417,12 @@ sipstat_init(const char *opt_arg, void* userdata _U_)
sipstat_reset,
sipstat_packet,
sipstat_draw);
- if (error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(sp->filter);
g_free(sp);
fprintf (stderr, "tshark: Couldn't register sip,stat tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -435,5 +435,18 @@ sipstat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_sipstat(void)
{
- register_stat_cmd_arg("sip,stat", sipstat_init,NULL);
+ register_stat_cmd_arg("sip,stat", sipstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-smbsids.c b/ui/cli/tap-smbsids.c
index fa7df526e3..289d5a9b98 100644
--- a/ui/cli/tap-smbsids.c
+++ b/ui/cli/tap-smbsids.c
@@ -44,7 +44,7 @@ smbsids_packet(void *pss _U_, packet_info *pinfo _U_, epan_dissect_t *edt _U_, c
static void
enum_sids(gpointer key _U_, gpointer value, gpointer userdata _U_)
{
- sid_name *sn=(sid_name *)value;
+ sid_name *sn = (sid_name *)value;
printf("%-60s %s\n", sn->sid, sn->name);
return;
@@ -62,24 +62,24 @@ smbsids_draw(void *pss _U_)
static void
-smbsids_init(const char *opt_arg _U_, void* userdata _U_)
+smbsids_init(const char *opt_arg _U_, void *userdata _U_)
{
GString *error_string;
- if(!sid_name_snooping){
- fprintf(stderr,"The -z smb,sids function needs SMB/SID-Snooping to be enabled.\n");
- fprintf(stderr,"Either enable Edit/Preferences/Protocols/SMB/Snoop SID name mappings in wireshark\n");
- fprintf(stderr,"or override the preference file by specifying\n");
- fprintf(stderr," -o \"smb.sid_name_snooping=TRUE\"\n");
- fprintf(stderr,"on the tshark command line.\n");
+ if (!sid_name_snooping) {
+ fprintf(stderr, "The -z smb,sids function needs SMB/SID-Snooping to be enabled.\n");
+ fprintf(stderr, "Either enable Edit/Preferences/Protocols/SMB/Snoop SID name mappings in wireshark\n");
+ fprintf(stderr, "or override the preference file by specifying\n");
+ fprintf(stderr, " -o \"smb.sid_name_snooping=TRUE\"\n");
+ fprintf(stderr, "on the tshark command line.\n");
exit(1);
}
- error_string=register_tap_listener("smb", NULL, NULL, 0, NULL, smbsids_packet, smbsids_draw);
- if(error_string){
+ error_string = register_tap_listener("smb", NULL, NULL, 0, NULL, smbsids_packet, smbsids_draw);
+ if (error_string) {
fprintf(stderr, "tshark: Couldn't register smb,sids tap:%s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -89,6 +89,18 @@ smbsids_init(const char *opt_arg _U_, void* userdata _U_)
void
register_tap_listener_smbsids(void)
{
- register_stat_cmd_arg("smb,sids", smbsids_init,NULL);
+ register_stat_cmd_arg("smb,sids", smbsids_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-smbstat.c b/ui/cli/tap-smbstat.c
index 82c3828818..8efff64a63 100644
--- a/ui/cli/tap-smbstat.c
+++ b/ui/cli/tap-smbstat.c
@@ -51,44 +51,44 @@ typedef struct _smbstat_t {
static int
smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
{
- smbstat_t *ss=(smbstat_t *)pss;
- const smb_info_t *si=(const smb_info_t *)psi;
+ smbstat_t *ss = (smbstat_t *)pss;
+ const smb_info_t *si = (const smb_info_t *)psi;
nstime_t t, deltat;
- timestat_t *sp=NULL;
+ timestat_t *sp = NULL;
/* we are only interested in reply packets */
- if(si->request){
+ if (si->request) {
return 0;
}
/* if we havnt seen the request, just ignore it */
- if(!si->sip){
+ if (!si->sip) {
return 0;
}
- if(si->cmd==0xA0 && si->sip->extra_info_type == SMB_EI_NTI){
- smb_nt_transact_info_t *sti=(smb_nt_transact_info_t *)si->sip->extra_info;
+ if (si->cmd == 0xA0 && si->sip->extra_info_type == SMB_EI_NTI) {
+ smb_nt_transact_info_t *sti = (smb_nt_transact_info_t *)si->sip->extra_info;
/*nt transaction*/
- if(sti){
- sp=&(ss->nt_trans[sti->subcmd]);
+ if (sti) {
+ sp = &(ss->nt_trans[sti->subcmd]);
}
- } else if(si->cmd==0x32 && si->sip->extra_info_type == SMB_EI_T2I){
- smb_transact2_info_t *st2i=(smb_transact2_info_t *)si->sip->extra_info;
+ } else if (si->cmd == 0x32 && si->sip->extra_info_type == SMB_EI_T2I) {
+ smb_transact2_info_t *st2i = (smb_transact2_info_t *)si->sip->extra_info;
/*transaction2*/
- if(st2i){
- sp=&(ss->trans2[st2i->subcmd]);
+ if (st2i) {
+ sp = &(ss->trans2[st2i->subcmd]);
}
} else {
- sp=&(ss->proc[si->cmd]);
+ sp = &(ss->proc[si->cmd]);
}
/* calculate time delta between request and reply */
- t=pinfo->fd->abs_ts;
+ t = pinfo->fd->abs_ts;
nstime_delta(&deltat, &t, &si->sip->req_time);
- if(sp){
- time_stat_update(sp,&deltat, pinfo);
+ if (sp) {
+ time_stat_update(sp, &deltat, pinfo);
}
return 1;
@@ -97,27 +97,27 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
static void
smbstat_draw(void *pss)
{
- smbstat_t *ss=(smbstat_t *)pss;
+ smbstat_t *ss = (smbstat_t *)pss;
guint32 i;
guint64 td;
printf("\n");
printf("=================================================================\n");
printf("SMB SRT Statistics:\n");
- printf("Filter: %s\n",ss->filter?ss->filter:"");
+ printf("Filter: %s\n", ss->filter ? ss->filter : "");
printf("Commands Calls Min SRT Max SRT Avg SRT\n");
- for(i=0;i<256;i++){
+ for (i=0; i<256; i++) {
/* nothing seen, nothing to do */
- if(ss->proc[i].num==0){
+ if (ss->proc[i].num == 0) {
continue;
}
/* we deal with transaction2 later */
- if(i==0x32){
+ if (i == 0x32) {
continue;
}
/* we deal with nt transaction later */
- if(i==0xA0){
+ if (i == 0xA0) {
continue;
}
@@ -127,19 +127,19 @@ smbstat_draw(void *pss)
td = ((td / ss->proc[i].num) + 500) / 1000;
printf("%-25s %6d %3d.%06d %3d.%06d %3" G_GINT64_MODIFIER "u.%06" G_GINT64_MODIFIER "u\n",
- val_to_str_ext(i, &smb_cmd_vals_ext, "Unknown (0x%02x)"),
- ss->proc[i].num,
- (int)(ss->proc[i].min.secs),(ss->proc[i].min.nsecs+500)/1000,
- (int)(ss->proc[i].max.secs),(ss->proc[i].max.nsecs+500)/1000,
- td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
+ val_to_str_ext(i, &smb_cmd_vals_ext, "Unknown (0x%02x)"),
+ ss->proc[i].num,
+ (int)(ss->proc[i].min.secs), (ss->proc[i].min.nsecs+500)/1000,
+ (int)(ss->proc[i].max.secs), (ss->proc[i].max.nsecs+500)/1000,
+ td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
);
}
printf("\n");
printf("Transaction2 Commands Calls Min SRT Max SRT Avg SRT\n");
- for(i=0;i<256;i++){
+ for (i=0; i<256; i++) {
/* nothing seen, nothing to do */
- if(ss->trans2[i].num==0){
+ if (ss->trans2[i].num == 0) {
continue;
}
@@ -148,19 +148,19 @@ smbstat_draw(void *pss)
td = ((td / ss->trans2[i].num) + 500) / 1000;
printf("%-25s %6d %3d.%06d %3d.%06d %3" G_GINT64_MODIFIER "u.%06" G_GINT64_MODIFIER "u\n",
- val_to_str_ext(i, &trans2_cmd_vals_ext, "Unknown (0x%02x)"),
- ss->trans2[i].num,
- (int)(ss->trans2[i].min.secs),(ss->trans2[i].min.nsecs+500)/1000,
- (int)(ss->trans2[i].max.secs),(ss->trans2[i].max.nsecs+500)/1000,
- td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
+ val_to_str_ext(i, &trans2_cmd_vals_ext, "Unknown (0x%02x)"),
+ ss->trans2[i].num,
+ (int)(ss->trans2[i].min.secs), (ss->trans2[i].min.nsecs+500)/1000,
+ (int)(ss->trans2[i].max.secs), (ss->trans2[i].max.nsecs+500)/1000,
+ td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
);
}
printf("\n");
printf("NT Transaction Commands Calls Min SRT Max SRT Avg SRT\n");
- for(i=0;i<256;i++){
+ for (i=0; i<256; i++) {
/* nothing seen, nothing to do */
- if(ss->nt_trans[i].num==0){
+ if (ss->nt_trans[i].num == 0) {
continue;
}
/* Scale the average SRT in units of 1us and round to the nearest us. */
@@ -168,11 +168,11 @@ smbstat_draw(void *pss)
td = ((td / ss->nt_trans[i].num) + 500) / 1000;
printf("%-25s %6d %3d.%06d %3d.%06d %3" G_GINT64_MODIFIER "u.%06" G_GINT64_MODIFIER "u\n",
- val_to_str_ext(i, &nt_cmd_vals_ext, "Unknown (0x%02x)"),
- ss->nt_trans[i].num,
- (int)(ss->nt_trans[i].min.secs),(ss->nt_trans[i].min.nsecs+500)/1000,
- (int)(ss->nt_trans[i].max.secs),(ss->nt_trans[i].max.nsecs+500)/1000,
- td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
+ val_to_str_ext(i, &nt_cmd_vals_ext, "Unknown (0x%02x)"),
+ ss->nt_trans[i].num,
+ (int)(ss->nt_trans[i].min.secs), (ss->nt_trans[i].min.nsecs+500)/1000,
+ (int)(ss->nt_trans[i].max.secs), (ss->nt_trans[i].max.nsecs+500)/1000,
+ td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
);
}
@@ -181,66 +181,66 @@ smbstat_draw(void *pss)
static void
-smbstat_init(const char *opt_arg,void* userdata _U_)
+smbstat_init(const char *opt_arg, void *userdata _U_)
{
smbstat_t *ss;
guint32 i;
- const char *filter=NULL;
+ const char *filter = NULL;
GString *error_string;
- if(!strncmp(opt_arg,"smb,srt,",8)){
- filter=opt_arg+8;
+ if (!strncmp(opt_arg, "smb,srt,", 8)) {
+ filter = opt_arg + 8;
} else {
- filter=NULL;
+ filter = NULL;
}
- ss=g_new(smbstat_t,1);
- if(filter){
- ss->filter=g_strdup(filter);
+ ss = g_new(smbstat_t, 1);
+ if (filter) {
+ ss->filter = g_strdup(filter);
} else {
- ss->filter=NULL;
+ ss->filter = NULL;
}
- for(i=0;i<256;i++){
- ss->proc[i].num=0;
- ss->proc[i].min_num=0;
- ss->proc[i].max_num=0;
- ss->proc[i].min.secs=0;
- ss->proc[i].min.nsecs=0;
- ss->proc[i].max.secs=0;
- ss->proc[i].max.nsecs=0;
- ss->proc[i].tot.secs=0;
- ss->proc[i].tot.nsecs=0;
-
- ss->trans2[i].num=0;
- ss->trans2[i].min_num=0;
- ss->trans2[i].max_num=0;
- ss->trans2[i].min.secs=0;
- ss->trans2[i].min.nsecs=0;
- ss->trans2[i].max.secs=0;
- ss->trans2[i].max.nsecs=0;
- ss->trans2[i].tot.secs=0;
- ss->trans2[i].tot.nsecs=0;
-
- ss->nt_trans[i].num=0;
- ss->nt_trans[i].min_num=0;
- ss->nt_trans[i].max_num=0;
- ss->nt_trans[i].min.secs=0;
- ss->nt_trans[i].min.nsecs=0;
- ss->nt_trans[i].max.secs=0;
- ss->nt_trans[i].max.nsecs=0;
- ss->nt_trans[i].tot.secs=0;
- ss->nt_trans[i].tot.nsecs=0;
+ for (i=0; i<256; i++) {
+ ss->proc[i].num = 0;
+ ss->proc[i].min_num = 0;
+ ss->proc[i].max_num = 0;
+ ss->proc[i].min.secs = 0;
+ ss->proc[i].min.nsecs = 0;
+ ss->proc[i].max.secs = 0;
+ ss->proc[i].max.nsecs = 0;
+ ss->proc[i].tot.secs = 0;
+ ss->proc[i].tot.nsecs = 0;
+
+ ss->trans2[i].num = 0;
+ ss->trans2[i].min_num = 0;
+ ss->trans2[i].max_num = 0;
+ ss->trans2[i].min.secs = 0;
+ ss->trans2[i].min.nsecs = 0;
+ ss->trans2[i].max.secs = 0;
+ ss->trans2[i].max.nsecs = 0;
+ ss->trans2[i].tot.secs = 0;
+ ss->trans2[i].tot.nsecs = 0;
+
+ ss->nt_trans[i].num = 0;
+ ss->nt_trans[i].min_num = 0;
+ ss->nt_trans[i].max_num = 0;
+ ss->nt_trans[i].min.secs = 0;
+ ss->nt_trans[i].min.nsecs = 0;
+ ss->nt_trans[i].max.secs = 0;
+ ss->nt_trans[i].max.nsecs = 0;
+ ss->nt_trans[i].tot.secs = 0;
+ ss->nt_trans[i].tot.nsecs = 0;
}
- error_string=register_tap_listener("smb", ss, filter, 0, NULL, smbstat_packet, smbstat_draw);
- if(error_string){
+ error_string = register_tap_listener("smb", ss, filter, 0, NULL, smbstat_packet, smbstat_draw);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(ss->filter);
g_free(ss);
fprintf(stderr, "tshark: Couldn't register smb,srt tap: %s\n",
- error_string->str);
+ error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
@@ -250,6 +250,18 @@ smbstat_init(const char *opt_arg,void* userdata _U_)
void
register_tap_listener_smbstat(void)
{
- register_stat_cmd_arg("smb,srt", smbstat_init,NULL);
+ register_stat_cmd_arg("smb,srt", smbstat_init, NULL);
}
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-stats_tree.c b/ui/cli/tap-stats_tree.c
index 1093d3b431..9bc82702fc 100644
--- a/ui/cli/tap-stats_tree.c
+++ b/ui/cli/tap-stats_tree.c
@@ -40,7 +40,7 @@ struct _st_node_pres {
};
struct _tree_pres {
- void** dummy;
+ void **dummy;
};
struct _tree_cfg_pres {
@@ -54,10 +54,10 @@ draw_stats_tree(void *psp)
GString *s;
s= stats_tree_format_as_str(st, ST_FORMAT_PLAIN, stats_tree_get_default_sort_col(st),
- stats_tree_is_default_sort_DESC(st));
+ stats_tree_is_default_sort_DESC(st));
- printf("%s",s->str);
- g_string_free(s,TRUE);
+ printf("%s", s->str);
+ g_string_free(s, TRUE);
}
static void
@@ -72,21 +72,21 @@ init_stats_tree(const char *opt_arg, void *userdata _U_)
cfg = stats_tree_get_cfg_by_abbr(abbr);
if (cfg != NULL) {
- if (strncmp (opt_arg, cfg->pr->init_string, strlen(cfg->pr->init_string)) == 0){
- st = stats_tree_new(cfg,NULL,opt_arg+strlen(cfg->pr->init_string));
+ if (strncmp (opt_arg, cfg->pr->init_string, strlen(cfg->pr->init_string)) == 0) {
+ st = stats_tree_new(cfg, NULL, opt_arg+strlen(cfg->pr->init_string));
} else {
- report_failure("Wrong stats_tree (%s) found when looking at ->init_string",abbr);
+ report_failure("Wrong stats_tree (%s) found when looking at ->init_string", abbr);
return;
}
} else {
- report_failure("no such stats_tree (%s) found in stats_tree registry",abbr);
+ report_failure("no such stats_tree (%s) found in stats_tree registry", abbr);
return;
}
g_free(abbr);
} else {
- report_failure("could not obtain stats_tree abbr (%s) from arg '%s'",abbr,opt_arg);
+ report_failure("could not obtain stats_tree abbr (%s) from arg '%s'", abbr, opt_arg);
return;
}
@@ -99,7 +99,7 @@ init_stats_tree(const char *opt_arg, void *userdata _U_)
draw_stats_tree);
if (error_string) {
- report_failure("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string->str);
+ report_failure("stats_tree for: %s failed to attach to the tap: %s", cfg->name, error_string->str);
return;
}
@@ -132,3 +132,16 @@ register_tap_listener_stats_tree_stat(void)
stats_tree_presentation(register_stats_tree_tap, NULL, NULL, NULL, NULL,
NULL, free_tree_presentation, NULL, NULL, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-sv.c b/ui/cli/tap-sv.c
index 19e6064a51..70ab3b68cd 100644
--- a/ui/cli/tap-sv.c
+++ b/ui/cli/tap-sv.c
@@ -42,7 +42,7 @@ sv_packet(void *prs _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void
printf("%f %u ", nstime_to_sec(&pinfo->rel_ts), sv_data->smpCnt);
- for(i = 0; i < sv_data->num_phsMeas; i++) {
+ for (i = 0; i < sv_data->num_phsMeas; i++) {
printf("%d ", sv_data->phsMeas[i].value);
}
@@ -52,19 +52,19 @@ sv_packet(void *prs _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void
}
static void
-svstat_init(const char *opt_arg _U_, void* userdata _U_)
+svstat_init(const char *opt_arg _U_, void *userdata _U_)
{
GString *error_string;
error_string = register_tap_listener(
- "sv",
- NULL,
- NULL,
- 0,
- NULL,
- sv_packet,
- NULL);
- if (error_string){
+ "sv",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ sv_packet,
+ NULL);
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
fprintf(stderr, "tshark: Couldn't register sv,stat tap: %s\n",
error_string->str);
@@ -78,3 +78,16 @@ register_tap_listener_sv(void)
{
register_stat_cmd_arg("sv", svstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-wspstat.c b/ui/cli/tap-wspstat.c
index a52266abd4..d7e9e66f39 100644
--- a/ui/cli/tap-wspstat.c
+++ b/ui/cli/tap-wspstat.c
@@ -58,15 +58,15 @@ typedef struct _wsp_stats_t {
} wspstat_t;
static void
-wsp_reset_hash(gchar *key _U_ , wsp_status_code_t *data, gpointer ptr _U_ )
+wsp_reset_hash(gchar *key _U_ , wsp_status_code_t *data, gpointer ptr _U_)
{
data->packets = 0;
}
static void
-wsp_print_statuscode(gint *key, wsp_status_code_t *data, char* format)
+wsp_print_statuscode(gint *key, wsp_status_code_t *data, char *format)
{
- if (data && (data->packets!=0))
- printf(format, *key, data->packets ,data->name);
+ if (data && (data->packets != 0))
+ printf(format, *key, data->packets , data->name);
}
static void
wsp_free_hash_table( gpointer key, gpointer value, gpointer user_data _U_ )
@@ -77,12 +77,12 @@ wsp_free_hash_table( gpointer key, gpointer value, gpointer user_data _U_ )
static void
wspstat_reset(void *psp)
{
- wspstat_t *sp=(wspstat_t *)psp;
+ wspstat_t *sp = (wspstat_t *)psp;
guint32 i;
- for(i=1;i<=sp->num_pdus;i++)
+ for (i=1; i<=sp->num_pdus; i++)
{
- sp->pdu_stats[i].packets=0;
+ sp->pdu_stats[i].packets = 0;
}
g_hash_table_foreach( sp->hash, (GHFunc)wsp_reset_hash, NULL);
}
@@ -102,12 +102,13 @@ wspstat_reset(void *psp)
static gint
pdut2index(gint pdut)
{
- if (pdut<=0x09) return pdut;
- if (pdut>=0x40){
- if (pdut <= 0x44){
- return pdut-54;
- } else if (pdut==0x60||pdut==0x61){
- return pdut-81;
+ if (pdut <= 0x09)
+ return pdut;
+ if (pdut >= 0x40) {
+ if (pdut <= 0x44) {
+ return pdut - 54;
+ } else if (pdut == 0x60 || pdut == 0x61) {
+ return pdut - 81;
}
}
return 0;
@@ -115,31 +116,31 @@ pdut2index(gint pdut)
static gint
index2pdut(gint pdut)
{
- if (pdut<=0x09)
+ if (pdut <= 0x09)
return pdut;
- if (pdut<=14)
- return pdut+54;
- if (pdut<=16)
- return pdut+81;
+ if (pdut <= 14)
+ return pdut + 54;
+ if (pdut <= 16)
+ return pdut + 81;
return 0;
}
static int
wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
{
- wspstat_t *sp=(wspstat_t *)psp;
- const wsp_info_value_t *value=(const wsp_info_value_t *)pri;
+ wspstat_t *sp = (wspstat_t *)psp;
+ const wsp_info_value_t *value = (const wsp_info_value_t *)pri;
gint idx = pdut2index(value->pdut);
- int retour=0;
+ int retour = 0;
if (value->status_code != 0) {
- gint *key=g_new(gint,1);
+ gint *key = g_new(gint, 1);
wsp_status_code_t *sc;
- *key=value->status_code ;
+ *key = value->status_code ;
sc = (wsp_status_code_t *)g_hash_table_lookup(
sp->hash,
key);
if (!sc) {
- sc = g_new(wsp_status_code_t,1);
+ sc = g_new(wsp_status_code_t, 1);
sc -> packets = 1;
sc -> name = NULL;
g_hash_table_insert(
@@ -149,13 +150,13 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
} else {
sc->packets++;
}
- retour=1;
+ retour = 1;
}
- if (idx!=0) {
- sp->pdu_stats[ idx ].packets++;
+ if (idx != 0) {
+ sp->pdu_stats[idx].packets++;
retour = 1;
}
return retour;
@@ -176,16 +177,16 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
static void
wspstat_draw(void *psp)
{
- wspstat_t *sp=(wspstat_t *)psp;
+ wspstat_t *sp = (wspstat_t *)psp;
guint32 i;
printf("\n");
printf("===================================================================\n");
printf("WSP Statistics:\n");
- printf("%-23s %9s || %-23s %9s\n","PDU Type", "Packets", "PDU Type", "Packets");
- for(i=1; i<= ((sp->num_pdus+1)/2) ; i++)
+ printf("%-23s %9s || %-23s %9s\n", "PDU Type", "Packets", "PDU Type", "Packets");
+ for (i=1; i <= ((sp->num_pdus+1)/2); i++)
{
- guint32 ii=i+sp->num_pdus/2;
+ guint32 ii = i+sp->num_pdus/2;
printf("%-23s %9d", sp->pdu_stats[i ].type, sp->pdu_stats[i ].packets);
printf(" || ");
if (ii< (sp->num_pdus) )
@@ -208,48 +209,48 @@ wspstat_draw(void *psp)
* new instance for the wsp tap.
*/
static void
-wspstat_init(const char *opt_arg, void* userdata _U_)
+wspstat_init(const char *opt_arg, void *userdata _U_)
{
wspstat_t *sp;
- const char *filter=NULL;
+ const char *filter = NULL;
guint32 i;
GString *error_string;
wsp_status_code_t *sc;
const value_string *wsp_vals_status_p;
- if (!strncmp (opt_arg, "wsp,stat," , 9)){
- filter=opt_arg+9;
+ if (!strncmp (opt_arg, "wsp,stat,", 9)) {
+ filter = opt_arg+9;
} else {
- filter=NULL;
+ filter = NULL;
}
- sp = g_new(wspstat_t,1);
+ sp = g_new(wspstat_t, 1);
sp->hash = g_hash_table_new( g_int_hash, g_int_equal);
wsp_vals_status_p = VALUE_STRING_EXT_VS_P(&wsp_vals_status_ext);
- for (i=0 ; wsp_vals_status_p[i].strptr ; i++ )
+ for (i=0; wsp_vals_status_p[i].strptr; i++ )
{
gint *key;
- sc=g_new(wsp_status_code_t,1);
- key=g_new(gint,1);
- sc->packets=0;
- sc->name=wsp_vals_status_p[i].strptr;
- *key=wsp_vals_status_p[i].value;
+ sc = g_new(wsp_status_code_t, 1);
+ key = g_new(gint, 1);
+ sc->packets = 0;
+ sc->name = wsp_vals_status_p[i].strptr;
+ *key = wsp_vals_status_p[i].value;
g_hash_table_insert(
sp->hash,
key,
sc);
}
sp->num_pdus = 16;
- sp->pdu_stats=g_new(wsp_pdu_t,(sp->num_pdus+1));
- if(filter){
- sp->filter=g_strdup(filter);
+ sp->pdu_stats = g_new(wsp_pdu_t, (sp->num_pdus+1));
+ if (filter) {
+ sp->filter = g_strdup(filter);
} else {
- sp->filter=NULL;
+ sp->filter = NULL;
}
- for (i=0;i<sp->num_pdus; i++)
+ for (i=0; i<sp->num_pdus; i++)
{
- sp->pdu_stats[i].packets=0;
+ sp->pdu_stats[i].packets = 0;
sp->pdu_stats[i].type = try_val_to_str_ext( index2pdut( i ), &wsp_vals_pdu_type_ext) ;
}
@@ -261,7 +262,7 @@ wspstat_init(const char *opt_arg, void* userdata _U_)
wspstat_reset,
wspstat_packet,
wspstat_draw);
- if (error_string){
+ if (error_string) {
/* error, we failed to attach to the tap. clean up */
g_free(sp->pdu_stats);
g_free(sp->filter);
@@ -277,5 +278,18 @@ wspstat_init(const char *opt_arg, void* userdata _U_)
void
register_tap_listener_wspstat(void)
{
- register_stat_cmd_arg("wsp,stat,", wspstat_init,NULL);
+ register_stat_cmd_arg("wsp,stat,", wspstat_init, NULL);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */