Add Robert Hogan. Also update my entry.
[obnox/wireshark/wip.git] / tap-rpcprogs.c
index ab84e6983509439801e590a9748174253554d1df..ecf49016883a137825a7535c9b2d522c5b835ae0 100644 (file)
@@ -22,8 +22,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-/* This module provides rpc call/reply SRT statistics to tethereal.
- * It is only used by tethereal and not ethereal
+/* This module provides rpc call/reply SRT statistics to tshark.
+ * It is only used by tshark and not wireshark
  */
 
 #ifdef HAVE_CONFIG_H
@@ -130,7 +130,7 @@ rpcprogs_packet(void *dummy1 _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
 
        
        /* we are only interested in reply packets */
-       if(ri->request){
+       if(ri->request || !rp){
                return 0;
        }
 
@@ -178,11 +178,7 @@ rpcprogs_packet(void *dummy1 _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
 static void
 rpcprogs_draw(void *dummy _U_)
 {
-#ifdef G_HAVE_UINT64
        guint64 td;
-#else
-       guint32 td;
-#endif
        rpc_program_t *rp;
        char str[64];
 
@@ -192,8 +188,7 @@ rpcprogs_draw(void *dummy _U_)
        printf("Program    Version  Calls   Min SRT   Max SRT   Avg SRT\n");
        for(rp=prog_list;rp;rp=rp->next){
                /* scale it to units of 10us.*/
-               /* for long captures with a large tot time, this can overflow on 32bit */
-               td=(int)rp->tot.secs;
+               td=rp->tot.secs;
                td=td*100000+(int)rp->tot.nsecs/10000;
                if(rp->num){
                        td/=rp->num;
@@ -202,7 +197,7 @@ rpcprogs_draw(void *dummy _U_)
                }
 
                g_snprintf(str, sizeof(str), "%s(%d)",rpc_prog_name(rp->program),rp->program);
-               printf("%-15s %2d %6d %3d.%05d %3d.%05d %3d.%05d\n",
+               printf("%-15s %2d %6d %3d.%05d %3d.%05d %3" G_GINT64_MODIFIER "u.%05" G_GINT64_MODIFIER "u\n",
                        str,
                        rp->version,
                        rp->num,
@@ -225,9 +220,9 @@ rpcprogs_init(const char *optarg _U_, void* userdata _U_)
        }
        already_enabled=1;
 
-       error_string=register_tap_listener("rpc", NULL, NULL, NULL, rpcprogs_packet, rpcprogs_draw);
+       error_string=register_tap_listener("rpc", NULL, NULL, 0, NULL, rpcprogs_packet, rpcprogs_draw);
        if(error_string){
-               fprintf(stderr,"tethereal: Couldn't register rpc,programs tap: %s\n",
+               fprintf(stderr,"tshark: Couldn't register rpc,programs tap: %s\n",
                    error_string->str);
                g_string_free(error_string, TRUE);
                exit(1);