aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/rpc_stat.c24
-rw-r--r--gtk/service_response_time_table.c22
2 files changed, 38 insertions, 8 deletions
diff --git a/gtk/rpc_stat.c b/gtk/rpc_stat.c
index 79750ef09d..2d510d8899 100644
--- a/gtk/rpc_stat.c
+++ b/gtk/rpc_stat.c
@@ -1,7 +1,7 @@
/* rpc_stat.c
* rpc_stat 2002 Ronnie Sahlberg
*
- * $Id: rpc_stat.c,v 1.43 2004/03/13 15:15:25 ulfl Exp $
+ * $Id: rpc_stat.c,v 1.44 2004/04/07 04:31:32 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -92,10 +92,6 @@ rpcstat_reset(rpcstat_t *rs)
static int
rpcstat_packet(rpcstat_t *rs, packet_info *pinfo, epan_dissect_t *edt _U_, rpc_call_info_value *ri)
{
- if(ri->proc>=rs->num_procedures){
- /* dont handle this since its outside of known table */
- return 0;
- }
/* we are only interested in reply packets */
if(ri->request){
return 0;
@@ -104,7 +100,23 @@ rpcstat_packet(rpcstat_t *rs, packet_info *pinfo, epan_dissect_t *edt _U_, rpc_c
if( (ri->prog!=rs->program) || (ri->vers!=rs->version) ){
return 0;
}
-
+ /* maybe we have discovered a new procedure?
+ * then we might need to extend our tables
+ */
+ if(ri->proc>=rs->num_procedures){
+ guint32 i;
+ if(ri->proc>256){
+ /* no program have probably ever more than this many
+ * procedures anyway and it prevent us from allocating
+ * infinite memory if passed a garbage procedure id
+ */
+ return 0;
+ }
+ for(i=rs->num_procedures;i<=ri->proc;i++){
+ init_srt_table_row(&rs->srt_table, i, rpc_proc_name(rs->program, rs->version, i));
+ }
+ rs->num_procedures=ri->proc+1;
+ }
add_srt_table_data(&rs->srt_table, ri->proc, &ri->req_time, pinfo);
return 1;
diff --git a/gtk/service_response_time_table.c b/gtk/service_response_time_table.c
index bebe8d534e..3092096252 100644
--- a/gtk/service_response_time_table.c
+++ b/gtk/service_response_time_table.c
@@ -3,7 +3,7 @@
* Helper routines common to all service response time statistics
* tap.
*
- * $Id: service_response_time_table.c,v 1.16 2004/03/13 15:15:25 ulfl Exp $
+ * $Id: service_response_time_table.c,v 1.17 2004/04/07 04:31:32 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -430,7 +430,25 @@ init_srt_table_row(srt_stat_table *rst, int index, char *procedure)
{
char str[10];
-
+ /* we have discovered a new procedure. Extend the table accordingly */
+ if(index>=rst->num_procs){
+ int old_num_procs=rst->num_procs;
+ int i,j;
+ rst->num_procs=index+1;
+ rst->procedures=g_realloc(rst->procedures, sizeof(srt_procedure_t)*(rst->num_procs));
+ for(i=old_num_procs;i<rst->num_procs;i++){
+ rst->procedures[i].num=0;
+ rst->procedures[i].min.secs=0;
+ rst->procedures[i].min.nsecs=0;
+ rst->procedures[i].max.secs=0;
+ rst->procedures[i].max.nsecs=0;
+ rst->procedures[i].tot.secs=0;
+ rst->procedures[i].tot.nsecs=0;
+ for(j=0;j<6;j++){
+ rst->procedures[i].entries[j]=NULL;
+ }
+ }
+ }
g_snprintf(str, 10, "%d",index);
rst->procedures[index].entries[0]=g_strdup(str);