Eliminate proto_tree_add_text from some plugin dissector files.

Change-Id: Ib2d900833a8763307be6b1cfc8df20d7019d2706
Reviewed-on: https://code.wireshark.org/review/5313
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2014-11-14 15:18:23 -05:00
parent ba3bc1e726
commit 62fd2acc96
4 changed files with 109 additions and 83 deletions

View File

@ -207,9 +207,7 @@ dissect_ehdr (tvbuff_t * tvb, proto_tree * tree, gboolean isfrag)
len = (tvb_get_guint8 (tvb, pos) & 0x0F);
if ((((type >> 4) & 0x0F)== 6) && (len == 2))
{
item = proto_tree_add_item(ehdr_tree, hf_docsis_eh_type, tvb, pos, 1, ENC_BIG_ENDIAN);
PROTO_ITEM_SET_HIDDEN(item);
proto_tree_add_text(ehdr_tree, tvb, pos, 1, "0110 .... = Unsolicited Grant Sync EHDR Sub-Element" );
proto_tree_add_uint_format_value(ehdr_tree, hf_docsis_eh_type, tvb, pos, 1, 0x60, "Unsolicited Grant Sync EHDR Sub-Element");
}
else
proto_tree_add_item (ehdr_tree, hf_docsis_eh_type, tvb, pos, 1, ENC_BIG_ENDIAN);
@ -284,14 +282,11 @@ dissect_ehdr (tvbuff_t * tvb, proto_tree * tree, gboolean isfrag)
case EH_SFLOW_HDR_DOWN:
case EH_SFLOW_HDR_UP:
val = tvb_get_guint8 (tvb, pos+1);
item = proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, ENC_BIG_ENDIAN);
if (val == 0)
{
item = proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, ENC_BIG_ENDIAN);
PROTO_ITEM_SET_HIDDEN(item);
proto_tree_add_text (ehdr_tree, tvb, pos+1, 1, "0000 0000 = No PHS on current packet" );
proto_item_append_text(item, " (No PHS on current packet)" );
}
else
proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, ENC_BIG_ENDIAN);
if (len == 2)
{

View File

@ -224,6 +224,15 @@ static int hf_docsis_tlv_sflow_vendor_spec = -1;
static int hf_docsis_tlv_sflow_max_concat_burst = -1;
static int hf_docsis_tlv_sflow_sched_type = -1;
static int hf_docsis_tlv_sflow_reqxmit_pol = -1;
static int hf_docsis_tlv_sflow_reqxmit_all_cm_broadcast = -1;
static int hf_docsis_tlv_sflow_reqxmit_priority_multicast = -1;
static int hf_docsis_tlv_sflow_reqxmit_req_data_requests = -1;
static int hf_docsis_tlv_sflow_reqxmit_req_data_data = -1;
static int hf_docsis_tlv_sflow_reqxmit_piggy_back = -1;
static int hf_docsis_tlv_sflow_reqxmit_concatenate_data = -1;
static int hf_docsis_tlv_sflow_reqxmit_fragment = -1;
static int hf_docsis_tlv_sflow_reqxmit_suppress_payload = -1;
static int hf_docsis_tlv_sflow_reqxmit_drop_packets = -1;
static int hf_docsis_tlv_sflow_nominal_polling = -1;
static int hf_docsis_tlv_sflow_tolerated_jitter = -1;
static int hf_docsis_tlv_sflow_ugs_size = -1;
@ -814,47 +823,26 @@ dissect_phs (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
} /* while */
}
static const true_false_string tfs_must_not_must = { "MUST NOT", "MUST" };
static const true_false_string tfs_must_must_not = { "MUST", "MUST NOT" };
static void
dissect_reqxmit_policy (tvbuff_t * tvb, proto_tree * tree, int start)
{
guint32 value;
proto_item *it;
proto_tree *pol_tree;
value = tvb_get_ntohl (tvb, start);
it =
proto_tree_add_item (tree, hf_docsis_tlv_sflow_reqxmit_pol, tvb, start, 4,
ENC_BIG_ENDIAN);
pol_tree = proto_item_add_subtree (it, ett_docsis_tlv_reqxmitpol);
if (value & 0x01)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT use \"all CMs\" broadcast request opportunities");
if (value & 0x02)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT use priority multicast request opportunities");
if (value & 0x04)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT use Request/Data opportunities for requests");
if (value & 0x08)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT use Request/Data opportunities for data");
if (value & 0x10)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT use piggy back requests with data");
if (value & 0x20)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT concatenate data");
if (value & 0x40)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT fragment data");
if (value & 0x80)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST NOT suppress payload headers");
if (value & 0x100)
proto_tree_add_text (pol_tree, tvb, start, 4,
"Service flow MUST drop packets that do not fit in the UGS size");
static const gint *requests[] = {
&hf_docsis_tlv_sflow_reqxmit_all_cm_broadcast,
&hf_docsis_tlv_sflow_reqxmit_priority_multicast,
&hf_docsis_tlv_sflow_reqxmit_req_data_requests,
&hf_docsis_tlv_sflow_reqxmit_req_data_data,
&hf_docsis_tlv_sflow_reqxmit_piggy_back,
&hf_docsis_tlv_sflow_reqxmit_concatenate_data,
&hf_docsis_tlv_sflow_reqxmit_fragment,
&hf_docsis_tlv_sflow_reqxmit_suppress_payload,
&hf_docsis_tlv_sflow_reqxmit_drop_packets,
NULL
};
proto_tree_add_bitmask(tree, tvb, start, hf_docsis_tlv_sflow_reqxmit_pol,
ett_docsis_tlv_reqxmitpol, requests, ENC_BIG_ENDIAN);
}
static void
@ -4984,6 +4972,51 @@ proto_register_docsis_tlv (void)
FT_UINT32, BASE_HEX, NULL, 0x0,
"Request/Transmission Policy", HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_all_cm_broadcast,
{"Service flow use \"all CMs\" broadcast request opportunities", "docsis_tlv.sflow.reqxmitpol.all_cm_broadcast",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x01,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_priority_multicast,
{"Service flow use priority multicast request opportunities", "docsis_tlv.sflow.reqxmitpol.priority_multicast",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x02,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_req_data_requests,
{"Service flow use Request/Data opportunities for requests", "docsis_tlv.sflow.reqxmitpol.req_data_requests",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x04,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_req_data_data,
{"Service flow use Request/Data opportunities for data", "docsis_tlv.sflow.reqxmitpol.req_data_data",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x08,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_piggy_back,
{"Service flow use piggy back requests with data", "docsis_tlv.sflow.reqxmitpol.piggy_back",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x10,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_concatenate_data,
{"Service flow concatenate data", "docsis_tlv.sflow.reqxmitpol.concatenate_data",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x20,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_fragment,
{"Service flow fragment data", "docsis_tlv.sflow.reqxmitpol.fragment",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x40,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_suppress_payload,
{"Service flow suppress payload headers", "docsis_tlv.sflow.reqxmitpol.suppress_payload",
FT_BOOLEAN, 32, TFS(&tfs_must_not_must), 0x80,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_reqxmit_drop_packets,
{"Service flow drop packets that do not fit in the UGS size", "docsis_tlv.sflow.reqxmitpol.drop_packets",
FT_BOOLEAN, 32, TFS(&tfs_must_must_not), 0x100,
NULL, HFILL}
},
{&hf_docsis_tlv_sflow_nominal_polling,
{".17 Nominal Polling Interval(usec)", "docsis_tlv.sflow.nominal_polling",
FT_UINT32, BASE_DEC, NULL, 0x0,

View File

@ -92,10 +92,6 @@ static gint dissect_uftp_message(proto_tree *unistim_tree, packet_info *pinfo,
tvbuff_t *tvb,gint offset);
static void set_ascii_item(proto_tree *unistim_tree, tvbuff_t *tvb,
gint offset,guint msg_len);
static int proto_unistim = -1;
static int hf_unistim_seq_nu = -1;
static int hf_unistim_packet_type = -1;
@ -123,6 +119,7 @@ static int hf_network_switch_cmd=-1;
static int hf_network_phone_cmd=-1;
static int hf_expansion_switch_cmd=-1;
static int hf_expansion_phone_cmd=-1;
static int hf_module_key_number=-1;
static int hf_generic_data=-1;
static int hf_generic_string=-1;
@ -578,7 +575,7 @@ dissect_basic_phone(proto_tree *msg_tree,
break;
case 0x0b:
/*not in pdf but get them*/
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0xff:
@ -963,12 +960,12 @@ dissect_display_switch(proto_tree *msg_tree,
break;
case 0x12:
/*Display Scroll with Data (before)*/
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x13:
/*Display Scroll with Data (after)*/
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x14:
@ -985,12 +982,12 @@ dissect_display_switch(proto_tree *msg_tree,
break;
case 0x15:
/*Month Labels Download*/
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x16:
/*Call Duration Timer Label Download*/
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=1;msg_len-=1;
break;
case 0x17:
@ -1008,7 +1005,7 @@ dissect_display_switch(proto_tree *msg_tree,
break;
case 0x18:
/*address|no control|no tag|no*/
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x19:
@ -1056,7 +1053,7 @@ dissect_display_switch(proto_tree *msg_tree,
if(msg_len>0){
/* I'm guessing this will work flakily at best */
uinfo->string_data = tvb_get_string(wmem_packet_scope(), tvb,offset,msg_len);
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
}
offset+=msg_len;
@ -1077,7 +1074,7 @@ dissect_display_switch(proto_tree *msg_tree,
proto_tree_add_item(msg_tree,hf_display_write_highlight,
tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
proto_tree_add_item(msg_tree,hf_generic_string,
tvb,offset,msg_len,ENC_ASCII|ENC_NA);
@ -1139,14 +1136,14 @@ dissect_display_switch(proto_tree *msg_tree,
proto_tree_add_item(msg_tree,hf_display_write_highlight,
tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x1c:
/*address|no control|no tag|yes*/
proto_tree_add_item(msg_tree,hf_display_write_tag,tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x1d:
@ -1185,7 +1182,7 @@ dissect_display_switch(proto_tree *msg_tree,
tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
}
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x1e:
@ -1209,7 +1206,7 @@ dissect_display_switch(proto_tree *msg_tree,
offset+=msg_len;
proto_tree_add_item(msg_tree,hf_display_write_tag,tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x1f:
@ -1267,7 +1264,7 @@ dissect_display_switch(proto_tree *msg_tree,
proto_tree_add_item(msg_tree,hf_display_write_tag,
tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x20:
@ -1332,7 +1329,7 @@ dissect_display_switch(proto_tree *msg_tree,
offset+=1;msg_len-=1;
proto_tree_add_item(msg_tree,hf_display_layer_number,tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x31:
@ -1881,7 +1878,7 @@ dissect_expansion_switch(proto_tree *msg_tree,
offset+=1;
msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
break;
case 0x59:
/*skip a byte for now, not sure what it means*/
@ -1918,7 +1915,7 @@ dissect_expansion_phone(proto_tree *msg_tree,
switch(expansion_cmd){
case 0x59:
proto_tree_add_text(msg_tree,tvb,offset,msg_len,"Module Key Number: %i",key_number);
proto_tree_add_int(msg_tree,hf_module_key_number,tvb,offset,1,key_number);
offset+=1;
msg_len-=1;
break;
@ -2589,7 +2586,7 @@ dissect_audio_phone(proto_tree *msg_tree,
proto_tree_add_item(msg_tree,hf_audio_sdes_rpt_source_desc,tvb,offset,1,ENC_BIG_ENDIAN);
proto_tree_add_item(msg_tree,hf_audio_sdes_rpt_buk_id,tvb,offset,1,ENC_BIG_ENDIAN);
offset+=1;msg_len-=1;
set_ascii_item(msg_tree,tvb,offset,msg_len);
proto_tree_add_item(msg_tree,hf_generic_string,tvb,offset,msg_len,ENC_ASCII|ENC_NA);
offset+=msg_len;
break;
case 0x11:
@ -2694,12 +2691,6 @@ dissect_audio_phone(proto_tree *msg_tree,
return offset;
}
static void
set_ascii_item(proto_tree *msg_tree,tvbuff_t *tvb, gint offset,guint msg_len){
proto_tree_add_text(msg_tree,tvb,offset,msg_len,"DATA: %s",
tvb_format_text(tvb,offset,msg_len));
}
void
proto_register_unistim(void){
@ -2715,23 +2706,23 @@ proto_register_unistim(void){
BASE_HEX,VALS(command_address),0x0,NULL,HFILL}
},
{ &hf_uftp_command,
{ "UFTP CMD","uftp.cmd",FT_UINT8,
{ "UFTP CMD","unistim.uftp.cmd",FT_UINT8,
BASE_HEX,VALS(uftp_commands),0x0,NULL,HFILL}
},
{ &hf_uftp_datablock_size,
{ "UFTP Datablock Size","uftp.blocksize",FT_UINT32,
{ "UFTP Datablock Size","unistim.uftp.blocksize",FT_UINT32,
BASE_DEC,NULL,0x0,NULL,HFILL}
},
{ &hf_uftp_datablock_limit,
{ "UFTP Datablock Limit","uftp.limit",FT_UINT8,
{ "UFTP Datablock Limit","unistim.uftp.limit",FT_UINT8,
BASE_DEC,NULL,0x0,NULL,HFILL}
},
{ &hf_uftp_filename,
{ "UFTP Filename","uftp.filename",FT_STRINGZ,
{ "UFTP Filename","unistim.uftp.filename",FT_STRINGZ,
BASE_NONE,NULL,0x0,NULL,HFILL}
},
{ &hf_uftp_datablock,
{ "UFTP Data Block","uftp.datablock",FT_BYTES,
{ "UFTP Data Block","unistim.uftp.datablock",FT_BYTES,
BASE_NONE,NULL,0x0,NULL,HFILL}
},
{ &hf_unistim_packet_type,
@ -4011,6 +4002,10 @@ proto_register_unistim(void){
{"Expansion CMD (phone)","unistim.expansion.phone",FT_UINT8,
BASE_HEX,VALS(expansion_phone_msgs),0x0,NULL,HFILL}
},
{ &hf_module_key_number,
{"Module Key Number","unistim.expansion.phone",FT_INT32,
BASE_DEC,NULL,0x0,NULL,HFILL}
},
{ &hf_expansion_softlabel_number,
{"Module Soft Label Number","unistim.expansion.label.number",FT_UINT8,
BASE_DEC,NULL,0x00,NULL,HFILL}
@ -4019,7 +4014,7 @@ proto_register_unistim(void){
/****LAST****/
{ &hf_generic_string,
{"DATA","unistim.generic.data",FT_STRING,
{"DATA","unistim.generic.string_data",FT_STRING,
BASE_NONE,NULL,0x00,NULL,HFILL}
},
{ &hf_generic_data,

View File

@ -105,6 +105,7 @@ static gint ett_wimaxasncp_tlv_ip_address_mask_list = -1;
static gint ett_wimaxasncp_tlv_ip_address_mask = -1;
static gint ett_wimaxasncp_tlv_eap = -1;
static gint ett_wimaxasncp_tlv_vendor_specific_information_field = -1;
static gint ett_wimaxasncp_port_range = -1;
static expert_field ei_wimaxasncp_tlv_type = EI_INIT;
static expert_field ei_wimaxasncp_function_type = EI_INIT;
@ -1395,24 +1396,25 @@ static void wimaxasncp_dissect_tlv_value(
{
guint16 portLow;
guint16 portHigh;
proto_tree* range_tree;
portLow = tvb_get_ntohs(tvb, offset);
portHigh = tvb_get_ntohs(tvb, offset + 2);
proto_tree_add_text(
range_tree = proto_tree_add_subtree_format(
port_range_list_tree, tvb, offset, 4,
"Port Range: %u-%u", portLow, portHigh);
ett_wimaxasncp_port_range, NULL, "Port Range: %u-%u", portLow, portHigh);
/* hidden items are for filtering */
item = proto_tree_add_item(
port_range_list_tree, tlv_info->hf_port_low,
range_tree, tlv_info->hf_port_low,
tvb, offset, 2, ENC_BIG_ENDIAN);
PROTO_ITEM_SET_HIDDEN(item);
item = proto_tree_add_item(
port_range_list_tree, tlv_info->hf_port_high,
range_tree, tlv_info->hf_port_high,
tvb, offset + 2, 2, ENC_BIG_ENDIAN);
PROTO_ITEM_SET_HIDDEN(item);
@ -3244,7 +3246,8 @@ register_wimaxasncp_fields(const char* unused _U_)
&ett_wimaxasncp_tlv_ip_address_mask_list,
&ett_wimaxasncp_tlv_ip_address_mask,
&ett_wimaxasncp_tlv_eap,
&ett_wimaxasncp_tlv_vendor_specific_information_field
&ett_wimaxasncp_tlv_vendor_specific_information_field,
&ett_wimaxasncp_port_range
};
static ei_register_info ei[] = {