+
+ switch(it->calc_type){
+ case CALC_TYPE_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){
+ it->counter+=gp->len;
+ }
+ break;
+ case CALC_TYPE_SUM:
+ gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if(gp){
+ for(i=0;i<gp->len;i++){
+ it->counter+=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
+ }
+ }
+ break;
+ case CALC_TYPE_MIN:
+ gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if(gp){
+ int type;
+ guint32 val;
+ nstime_t *new_time;
+
+ type=proto_registrar_get_ftype(it->hf_index);
+ for(i=0;i<gp->len;i++){
+ switch(type){
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
+ if((it->frames==1)&&(i==0)){
+ it->counter=val;
+ } else if(val<it->counter){
+ it->counter=val;
+ }
+ break;
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
+ if((it->frames==1)&&(i==0)){
+ it->counter=val;
+ } else if((gint32)val<(gint32)(it->counter)){
+ it->counter=val;
+ }
+ break;
+ case FT_RELATIVE_TIME:
+ new_time=fvalue_get(&((field_info *)gp->pdata[i])->value);
+ val=new_time->secs*1000+new_time->nsecs/1000000;
+ if((it->frames==1)&&(i==0)){
+ it->counter=val;
+ } else if(val<it->counter){
+ it->counter=val;
+ }
+ break;
+ }
+ }
+ }
+ break;
+ case CALC_TYPE_MAX:
+ gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if(gp){
+ int type;
+ guint32 val;
+ nstime_t *new_time;
+
+ type=proto_registrar_get_ftype(it->hf_index);
+ for(i=0;i<gp->len;i++){
+ switch(type){
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
+ if((it->frames==1)&&(i==0)){
+ it->counter=val;
+ } else if(val>it->counter){
+ it->counter=val;
+ }
+ break;
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
+ if((it->frames==1)&&(i==0)){
+ it->counter=val;
+ } else if((gint32)val>(gint32)(it->counter)){
+ it->counter=val;
+ }
+ break;
+ case FT_RELATIVE_TIME:
+ new_time=fvalue_get(&((field_info *)gp->pdata[i])->value);
+ val=new_time->secs*1000+new_time->nsecs/1000000;
+ if((it->frames==1)&&(i==0)){
+ it->counter=val;
+ } else if(val>it->counter){
+ it->counter=val;
+ }
+ break;
+ }
+ }
+ }
+ break;
+ case CALC_TYPE_AVG:
+ gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ if(gp){
+ int type;
+ guint32 val;
+ nstime_t *new_time;
+
+ type=proto_registrar_get_ftype(it->hf_index);
+ for(i=0;i<gp->len;i++){
+ it->num++;
+ switch(type){
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
+ it->counter+=val;
+ break;
+ case FT_RELATIVE_TIME:
+ new_time=fvalue_get(&((field_info *)gp->pdata[i])->value);
+ val=new_time->secs*1000+new_time->nsecs/1000000;
+ it->counter+=val;
+ break;
+ }
+ }
+ }
+ break;
+ }
+