summaryrefslogtreecommitdiff
path: root/ui/cli/tap-h225counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/cli/tap-h225counter.c')
-rw-r--r--ui/cli/tap-h225counter.c193
1 files changed, 103 insertions, 90 deletions
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:
+ */