convert some proto_tree_add_texts into expert_add_info_format. Didn't quite make checkAPIs.pl happy, but given the nature of the dissector (mostly raw text), I'm not sure it can hit the 50% ratio.

svn path=/trunk/; revision=49022
This commit is contained in:
Michael Mann 2013-04-24 23:17:44 +00:00
parent 2d9a44e0fa
commit a18e128b44
1 changed files with 15 additions and 15 deletions

View File

@ -416,7 +416,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_previous_offset = tvb_find_guint8(tvb, 0, tvb_previous_offset = tvb_find_guint8(tvb, 0,
tvb_len, '/'); tvb_len, '/');
if (tvb_previous_offset == -1) { if (tvb_previous_offset == -1) {
proto_tree_add_text(megaco_tree, tvb, 0, -1, expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"Sorry, no \"/\" in the MEGACO header, I can't parse this packet"); "Sorry, no \"/\" in the MEGACO header, I can't parse this packet");
return; return;
} }
@ -440,7 +440,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_previous_offset); tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_previous_offset);
if (tvb_previous_offset == tvb_current_offset) { if (tvb_previous_offset == tvb_current_offset) {
proto_tree_add_text(megaco_tree, tvb, 0, -1, expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"[ Parse error: missing SEP in MEGACO header ]"); "[ Parse error: missing SEP in MEGACO header ]");
return; return;
} }
@ -459,7 +459,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_current_offset = tvb_pbrk_guint8(tvb, tvb_current_offset, -1, " \t\r\n", &needle); tvb_current_offset = tvb_pbrk_guint8(tvb, tvb_current_offset, -1, " \t\r\n", &needle);
if (tvb_current_offset == -1) { if (tvb_current_offset == -1) {
proto_tree_add_text(megaco_tree, tvb, 0, -1, expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"[ Parse error: no body in MEGACO message (missing SEP after mId) ]"); "[ Parse error: no body in MEGACO message (missing SEP after mId) ]");
return; return;
} }
@ -693,8 +693,8 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default : default :
ti = proto_tree_add_item(tree,proto_megaco,tvb, 0, -1, ENC_NA); ti = proto_tree_add_item(tree,proto_megaco,tvb, 0, -1, ENC_NA);
megaco_tree = proto_item_add_subtree(ti, ett_megaco); megaco_tree = proto_item_add_subtree(ti, ett_megaco);
proto_tree_add_text(megaco_tree, tvb, 0, -1, expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"Sorry, can't understand errorDescriptor / transactionList = %s, can't parse it pos %u", "Sorry, can't understand errorDescriptor / transactionList = %s, can't parse it pos %u",
tvb_format_text(tvb,tvb_previous_offset,2),tvb_previous_offset); tvb_format_text(tvb,tvb_previous_offset,2),tvb_previous_offset);
return; return;
} /* end switch */ } /* end switch */
@ -728,7 +728,7 @@ nextcontext:
tvb_transaction_end_offset, '=')+1; tvb_transaction_end_offset, '=')+1;
tvb_previous_offset = megaco_tvb_skip_wsp(tvb, tvb_previous_offset); tvb_previous_offset = megaco_tvb_skip_wsp(tvb, tvb_previous_offset);
if (tvb_current_offset >= tvb_next_offset) { if (tvb_current_offset >= tvb_next_offset) {
proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Invalid offset ]"); expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Invalid offset ]");
return; return;
} }
tvb_current_offset = tvb_next_offset; tvb_current_offset = tvb_next_offset;
@ -903,13 +903,13 @@ nextcontext:
if ( tempchar == 'P' || tempchar == 'O'){ if ( tempchar == 'P' || tempchar == 'O'){
gint tvb_topology_end_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_transaction_end_offset, '}'); gint tvb_topology_end_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_transaction_end_offset, '}');
if ( tvb_topology_end_offset == -1 ){ if ( tvb_topology_end_offset == -1 ){
proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Missing \"}\" ]"); expert_add_info_format(pinfo, sub_ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Missing \"}\" ]");
return; return;
} }
tvb_command_start_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_transaction_end_offset, '{'); tvb_command_start_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_transaction_end_offset, '{');
if ( tvb_command_start_offset == -1 ){ if ( tvb_command_start_offset == -1 ){
proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Missing \"{\" ]"); expert_add_info_format(pinfo, sub_ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Missing \"{\" ]");
return; return;
} }
dissect_megaco_topologydescriptor(tvb, megaco_tree_command_line, tvb_topology_end_offset-1, tvb_command_start_offset+1); dissect_megaco_topologydescriptor(tvb, megaco_tree_command_line, tvb_topology_end_offset-1, tvb_command_start_offset+1);
@ -955,7 +955,7 @@ nextcontext:
tvb_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_offset = tvb_find_guint8(tvb, tvb_command_start_offset,
tvb_transaction_end_offset, '='); tvb_transaction_end_offset, '=');
if (tvb_offset == -1 ) { if (tvb_offset == -1 ) {
proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Missing \"=\" ]"); expert_add_info_format(pinfo, sub_ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Missing \"=\" ]");
return; return;
} }
tvb_offset = megaco_tvb_skip_wsp_return(tvb, tvb_offset -1); tvb_offset = megaco_tvb_skip_wsp_return(tvb, tvb_offset -1);
@ -1235,13 +1235,13 @@ nextcontext:
tvb_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_offset = tvb_find_guint8(tvb, tvb_command_start_offset,
tvb_transaction_end_offset, '='); tvb_transaction_end_offset, '=');
if (tvb_offset == -1 ) { if (tvb_offset == -1 ) {
proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Missing \"=\" ]"); expert_add_info_format(pinfo, sub_ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Missing \"=\" ]");
return; return;
} }
tvb_offset = megaco_tvb_skip_wsp(tvb, tvb_offset+1); tvb_offset = megaco_tvb_skip_wsp(tvb, tvb_offset+1);
tokenlen = tvb_next_offset - tvb_offset; tokenlen = tvb_next_offset - tvb_offset;
if (tokenlen+1 <= 0) { if (tokenlen+1 <= 0) {
proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Invalid token length (%d) ]", tokenlen+1); expert_add_info_format(pinfo, sub_ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Invalid token length (%d) ]", tokenlen+1);
return; return;
} }
@ -1257,7 +1257,7 @@ nextcontext:
case 'E': case 'E':
if ((tokenlen+1 > (int) sizeof(TermID))) { if ((tokenlen+1 > (int) sizeof(TermID))) {
proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Invalid TermID length (%d) ]", tokenlen+1); expert_add_info_format(pinfo, sub_ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Invalid TermID length (%d) ]", tokenlen+1);
return; return;
} }
tvb_get_nstringz0(tvb,tvb_offset,tokenlen+1,TermID); tvb_get_nstringz0(tvb,tvb_offset,tokenlen+1,TermID);
@ -1455,7 +1455,7 @@ dissect_megaco_descriptors(tvbuff_t *tvb, proto_tree *megaco_tree_command_line,
} }
if (tvb_current_offset <= tvb_previous_offset) { if (tvb_current_offset <= tvb_previous_offset) {
proto_tree_add_text(megaco_tree_command_line, tvb, 0, 0, "[ Parse error: Invalid offset ]"); expert_add_info_format(pinfo, megaco_tree_command_line, PI_MALFORMED, PI_ERROR, "[ Parse error: Invalid offset ]");
return; return;
} }
@ -2235,7 +2235,7 @@ dissect_megaco_auditdescriptor(tvbuff_t *tvb, proto_tree *megaco_tree, packet_in
tvb_next = tvb_find_guint8(tvb, tvb_offset, tvb_stop, '{'); /* find opening LBRKT - is this already checked by caller?*/ tvb_next = tvb_find_guint8(tvb, tvb_offset, tvb_stop, '{'); /* find opening LBRKT - is this already checked by caller?*/
if( tvb_next == -1 ) /* complain and give up if not there */ if( tvb_next == -1 ) /* complain and give up if not there */
{ {
proto_tree_add_text(megaco_tree, tvb, tvb_offset, tvb_stop+1-tvb_offset, "Badly constructed audit descriptor (no { )"); expert_add_info_format(pinfo, megaco_tree, PI_MALFORMED, PI_ERROR, "Badly constructed audit descriptor (no { )");
return; return;
} }
tokenlen = (tvb_stop + 1) - tvb_offset; tokenlen = (tvb_stop + 1) - tvb_offset;
@ -2629,7 +2629,7 @@ dissect_megaco_observedeventsdescriptor(tvbuff_t *tvb, packet_info *pinfo, proto
tvb_current_offset = tvb_observedevents_end_offset; tvb_current_offset = tvb_observedevents_end_offset;
} }
if (tvb_current_offset < tvb_previous_offset) { if (tvb_current_offset < tvb_previous_offset) {
proto_tree_add_text(megaco_observedevent_tree, tvb, 0, 0, "[ Parse error: Invalid offset ]"); expert_add_info_format(pinfo, megaco_observedevent_ti, PI_MALFORMED, PI_ERROR, "[ Parse error: Invalid offset ]");
return; return;
} }