aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ber.c
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2005-06-26 05:48:50 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2005-06-26 05:48:50 +0000
commitb0a6e02e5b8e8e84673c904a371d2b99152eaad3 (patch)
tree1bfaf8b92a640262162e7f0432a43a84d0381e6d /epan/dissectors/packet-ber.c
parent4796e185b2503b9eba23480eb93f52ab02d07266 (diff)
make dissect_ber_choice take a guint* that will return the
index of the branch taken or -1 to make prettifications easier to implement. change the signature of dissect_ber_choice and rename it to dissect_ber_CHOICE to catch all occurences of the use of this function update asn2eth to use the new name/signature update all occurences of this function to the new name and new signature. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14758 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-ber.c')
-rw-r--r--epan/dissectors/packet-ber.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index 11e13729c3..ffce260143 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -1067,7 +1067,7 @@ printf("SEQUENCE dissect_ber_sequence(%s) subdissector ate %d bytes\n",name,coun
* in case it was a CHOICE { } OPTIONAL
*/
int
-dissect_ber_choice(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_choice_t *choice, gint hf_id, gint ett_id)
+dissect_ber_CHOICE(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_choice_t *choice, gint hf_id, gint ett_id, gint *branch_taken)
{
gint8 class;
gboolean pc, ind;
@@ -1093,9 +1093,9 @@ name=hfinfo->name;
name="unnamed";
}
if(tvb_length_remaining(tvb,offset)>3){
-printf("CHOICE dissect_ber_choice(%s) entered offset:%d len:%d %02x:%02x:%02x\n",name,offset,tvb_length_remaining(tvb,offset),tvb_get_guint8(tvb,offset),tvb_get_guint8(tvb,offset+1),tvb_get_guint8(tvb,offset+2));
+printf("CHOICE dissect_ber_CHOICE(%s) entered offset:%d len:%d %02x:%02x:%02x\n",name,offset,tvb_length_remaining(tvb,offset),tvb_get_guint8(tvb,offset),tvb_get_guint8(tvb,offset+1),tvb_get_guint8(tvb,offset+2));
}else{
-printf("CHOICE dissect_ber_choice(%s) entered len:%d\n",name,tvb_length_remaining(tvb,offset));
+printf("CHOICE dissect_ber_CHOICE(%s) entered len:%d\n",name,tvb_length_remaining(tvb,offset));
}
}
#endif
@@ -1127,8 +1127,8 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n",name,tvb_length_remainin
case FT_UINT32:
break;
default:
- proto_tree_add_text(tree, tvb, offset, len,"dissect_ber_choice(): Was passed a HF field that was not integer type : %s",hfinfo->abbrev);
- fprintf(stderr,"dissect_ber_choice(): frame:%d offset:%d Was passed a HF field that was not integer type : %s\n",pinfo->fd->num,offset,hfinfo->abbrev);
+ proto_tree_add_text(tree, tvb, offset, len,"dissect_ber_CHOICE(): Was passed a HF field that was not integer type : %s",hfinfo->abbrev);
+ fprintf(stderr,"dissect_ber_CHOICE(): frame:%d offset:%d Was passed a HF field that was not integer type : %s\n",pinfo->fd->num,offset,hfinfo->abbrev);
return end_offset;
}
}
@@ -1138,8 +1138,14 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n",name,tvb_length_remainin
/* loop over all entries until we find the right choice or
run out of entries */
ch = choice;
+ if(branch_taken){
+ branch_taken=-1;
+ }
while(ch->func){
choice_try_again:
+ if(branch_taken){
+ branch_taken++;
+ }
#ifdef DEBUG_BER
printf("CHOICE testing potential subdissector class:%d:(expected)%d tag:%d:(expected)%d flags:%d\n",class,ch->class,tag,ch->tag,ch->flags);
#endif
@@ -1177,9 +1183,9 @@ name=hfinfo->name;
name="unnamed";
}
if(tvb_length_remaining(next_tvb,0)>3){
-printf("CHOICE dissect_ber_choice(%s) calling subdissector start_offset:%d offset:%d len:%d %02x:%02x:%02x\n",name,start_offset,offset,tvb_length_remaining(next_tvb,0),tvb_get_guint8(next_tvb,0),tvb_get_guint8(next_tvb,1),tvb_get_guint8(next_tvb,2));
+printf("CHOICE dissect_ber_CHOICE(%s) calling subdissector start_offset:%d offset:%d len:%d %02x:%02x:%02x\n",name,start_offset,offset,tvb_length_remaining(next_tvb,0),tvb_get_guint8(next_tvb,0),tvb_get_guint8(next_tvb,1),tvb_get_guint8(next_tvb,2));
}else{
-printf("CHOICE dissect_ber_choice(%s) calling subdissector len:%d\n",name,tvb_length(next_tvb));
+printf("CHOICE dissect_ber_CHOICE(%s) calling subdissector len:%d\n",name,tvb_length(next_tvb));
}
}
#endif
@@ -1194,7 +1200,7 @@ name=hfinfo->name;
} else {
name="unnamed";
}
-printf("CHOICE dissect_ber_choice(%s) subdissector ate %d bytes\n",name,count);
+printf("CHOICE dissect_ber_CHOICE(%s) subdissector ate %d bytes\n",name,count);
}
#endif
if((count==0)&&(ch->class==class)&&(ch->tag==-1)&&(ch->flags&BER_FLAGS_NOOWNTAG)){
@@ -1217,6 +1223,12 @@ printf("CHOICE dissect_ber_choice(%s) subdissector ate %d bytes\n",name,count);
}
ch++;
}
+
+ if(branch_taken){
+ /* none of the branches were taken so set the param
+ back to -1 */
+ branch_taken=-1;
+ }
#ifdef REMOVED
/*XXX here we should have another flag to the CHOICE to distinguish
* between teh case when we know it is a mandatory or if the CHOICE is optional == no arm matched */