From Lars Roland: add message counts to the SIP statistics.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 1 May 2004 21:34:24 +0000 (21:34 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 1 May 2004 21:34:24 +0000 (21:34 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10763 f5534014-38df-0310-8fa8-9805f1628bb7

tap-sipstat.c

index 715247d1f7959a6b372c6be39f1209aefcbb263d..3856f400c5921a34eeb5c05561a6fc93ca57ca0b 100644 (file)
@@ -1,7 +1,7 @@
 /* tap_sipstat.c
  * sip message counter for ethereal
  *
- * $Id: tap-sipstat.c,v 1.1 2004/03/30 18:55:46 guy Exp $
+ * $Id: tap-sipstat.c,v 1.2 2004/05/01 21:34:24 guy Exp $
  * Copied from gtk/sip_stat.c and tap-httpstat.c
  *
  * Ethereal - Network traffic analyzer
@@ -43,6 +43,8 @@
 /* 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;
        GHashTable      *hash_responses;
        GHashTable      *hash_requests;
 } sipstat_t;
@@ -205,6 +207,8 @@ sipstat_reset(void *psp  )
 {
        sipstat_t *sp=psp;
        if (sp) {
+               sp->packets = 0;
+               sp->resent_packets = 0;
                g_hash_table_foreach( sp->hash_responses, (GHFunc)sip_reset_hash_responses, NULL);
                g_hash_table_foreach( sp->hash_requests, (GHFunc)sip_reset_hash_requests, NULL);
        }
@@ -217,7 +221,17 @@ sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, void
 {
     sip_info_value_t *value=pri;
     sipstat_t *sp = (sipstat_t *)psp;
+    
+    /* Total number of packets, including continuation packets */
+    sp->packets++;
+    
+    /* Update resent count if flag set */
+    if (value->resend)
+    {
+        sp->resent_packets++;
+    }
 
+    
     /* Looking at both requests and responses */
     if (value->response_code != 0)
     {
@@ -318,6 +332,8 @@ sipstat_draw(void *psp  )
        else
                printf("SIP Statistics with filter %s\n", sp->filter);
 
+       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,
                "  SIP %3d %-15s : %5d Packets\n");
@@ -366,6 +382,8 @@ sipstat_init(char *optarg)
                exit(1);
        }
 
+       sp->packets = 0;
+       sp->resent_packets = 0;
        sip_init_hash(sp);
 }