diff options
author | Michael Mann <mmann78@netscape.net> | 2014-06-26 20:33:02 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-06-29 13:10:02 +0000 |
commit | fe4b7ee625c046bc09a7d8ae55afb0e16cb17fc3 (patch) | |
tree | c4311cf830bd0ccc100f7a59808f39609ba02b24 /epan/dissectors/packet-gprs-llc.c | |
parent | e1a8c9599fadc787253115316c549e849f377fd2 (diff) | |
download | wireshark-fe4b7ee625c046bc09a7d8ae55afb0e16cb17fc3.tar.gz |
convert to proto_tree_add_subtree[_format]
Change-Id: If110de1e0555637264f86f1508858d569871a9c7
Reviewed-on: https://code.wireshark.org/review/2675
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-gprs-llc.c')
-rw-r--r-- | epan/dissectors/packet-gprs-llc.c | 77 |
1 files changed, 31 insertions, 46 deletions
diff --git a/epan/dissectors/packet-gprs-llc.c b/epan/dissectors/packet-gprs-llc.c index a6ce57bc31..ce855f2d96 100644 --- a/epan/dissectors/packet-gprs-llc.c +++ b/epan/dissectors/packet-gprs-llc.c @@ -326,7 +326,6 @@ static void llc_gprs_dissect_xid(tvbuff_t *tvb, guint8 xid_param_len = 0, byte1 = 0, byte2 = 0, item_len = 0, tmp = 0; guint16 location = 0; guint16 loop_counter = 0; - proto_item *u_ti = NULL; proto_item *uinfo_field = NULL; proto_tree *uinfo_tree = NULL; proto_tree *xid_tree = NULL; @@ -334,9 +333,8 @@ static void llc_gprs_dissect_xid(tvbuff_t *tvb, info_len = tvb_reported_length(tvb); - u_ti = proto_tree_add_text(llcgprs_tree, tvb, 0, info_len, - "Information Field: Length = %u", info_len); - xid_tree = proto_item_add_subtree(u_ti, ett_ui); + xid_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, 0, info_len, + ett_ui, NULL, "Information Field: Length = %u", info_len); while (location < info_len) { @@ -379,9 +377,8 @@ static void llc_gprs_dissect_xid(tvbuff_t *tvb, tvbuff_t *sndcp_xid_tvb; guint8 sndcp_xid_offset; - uinfo_field = proto_tree_add_text(xid_tree, tvb, location, item_len, - "XID parameter Type: L3 parameters"); - uinfo_tree = proto_item_add_subtree(uinfo_field, ett_ui); + uinfo_tree = proto_tree_add_subtree(xid_tree, tvb, location, item_len, + ett_ui, NULL, "XID parameter Type: L3 parameters"); proto_tree_add_uint(uinfo_tree, hf_llcgprs_xid_xl, tvb, location, 1, byte1); proto_tree_add_uint(uinfo_tree, hf_llcgprs_xid_type, tvb, location, 1, byte1); proto_tree_add_uint(uinfo_tree, hf_llcgprs_xid_len1, tvb, location, 1, byte1); @@ -468,7 +465,7 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 addr_fld=0, sapi=0, ctrl_fld_fb=0, frame_format, tmp=0; guint16 offset=0 , epm = 0, nu=0, ctrl_fld_ui_s=0; guint16 crc_length=0, llc_data_reported_length=0, llc_data_length = 0; - proto_item *ti, *addres_field_item, *ctrl_field_item, *ui_ti; + proto_item *ti, *addres_field_item, *ui_ti; proto_tree *llcgprs_tree=NULL , *ad_f_tree =NULL, *ctrl_f_tree=NULL, *ui_tree=NULL; tvbuff_t *next_tvb; guint length; @@ -482,7 +479,6 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 k = 0; guint8 m_bits = 0; guint8 info_len = 0; - proto_item *uinfo_field = NULL; proto_tree *uinfo_tree = NULL; /* END MLT CHANGES */ proto_item* fcs_item = NULL; @@ -655,10 +651,9 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint32 tmpx; - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, (offset-3), - 3, "Information format: %s: N(S) = %u, N(R) = %u", + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, (offset-3), + 3, ett_llcgprs_sframe, NULL, "Information format: %s: N(S) = %u, N(R) = %u", val_to_str(epm, cr_formats_ipluss, "Unknown (%d)"), ns, nr); - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_sframe); /* retrieve the second octet */ tmpx = tvb_get_ntohs(tvb, (offset-3)) << 16; @@ -697,10 +692,9 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 r_byte = 0; guint16 location = offset; - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, (offset-1), - (k+1), "SACK FRAME: k = %u", k); + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, (offset-1), + (k+1), ett_llcgprs_sframe, NULL, "SACK FRAME: k = %u", k); - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_sframe); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_kmask, tvb, offset-1, 1, kmask); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_k, tvb, offset-1, 1, k); @@ -731,12 +725,11 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) remaining_length = (tom_byte >> 4) & 0x0F; tom_pd = tom_byte & 0x0F; - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, offset, - (llc_data_reported_length-offset), "TOM Envelope - Protocol: %s", + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, offset, + (llc_data_reported_length-offset), ett_llcgprs_sframe, NULL, + "TOM Envelope - Protocol: %s", val_to_str(tom_pd, tompd_formats, "Unknown (%d)")); - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_sframe); - proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_tom_rl, tvb, offset, 1, tom_byte); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_tom_pd, tvb, offset, 1, tom_byte); @@ -799,11 +792,10 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, offset-2, 2, - "Supervisory format: %s: N(R) = %u", + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, offset-2, 2, + ett_llcgprs_sframe, NULL, "Supervisory format: %s: N(R) = %u", val_to_str(epm, cr_formats_ipluss, "Unknown (%d)"), nu); - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_sframe); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_S_fmt, tvb, offset-2, 2, ctrl_fld_ui_s); proto_tree_add_boolean(ctrl_f_tree, hf_llcgprs_As, tvb, offset-2, @@ -830,9 +822,8 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint loop_count; guint8 r_byte; guint16 location = offset; - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, offset, - sack_length, "SACK FRAME: length = %u", sack_length); - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_sframe); + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, offset, sack_length, + ett_llcgprs_sframe, NULL, "SACK FRAME: length = %u", sack_length); /* display the R Bitmap */ for (loop_count = 0; loop_count < sack_length; loop_count++) { @@ -862,11 +853,9 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) remaining_length = (tom_byte >> 4) & 0x0F; tom_pd = tom_byte & 0x0F; - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, offset, - (llc_data_reported_length-offset), "TOM Envelope - Protocol: %s", - val_to_str(tom_pd, tompd_formats, "Unknown (%d)")); - - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_sframe); + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, offset, + (llc_data_reported_length-offset), ett_llcgprs_sframe, NULL, + "TOM Envelope - Protocol: %s", val_to_str(tom_pd, tompd_formats, "Unknown (%d)")); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_tom_rl, tvb, offset, 1, tom_byte); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_tom_pd, tvb, offset, 1, tom_byte); @@ -924,9 +913,9 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, offset-2, - 2, "Unconfirmed Information format - UI, N(U) = %u", nu); - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_ctrlf); + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, offset-2, + 2, ett_llcgprs_ctrlf, NULL, + "Unconfirmed Information format - UI, N(U) = %u", nu); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_U_fmt, tvb, offset-2, 2, ctrl_fld_ui_s); @@ -967,12 +956,11 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) remaining_length = (tom_byte >> 4) & 0x0F; tom_pd = tom_byte & 0x0F; - ctrl_field_item = proto_tree_add_text(llcgprs_tree, tvb, offset, - (llc_data_reported_length-offset), "TOM Envelope - Protocol: %s", + ctrl_f_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, offset, + (llc_data_reported_length-offset), ett_llcgprs_sframe, NULL, + "TOM Envelope - Protocol: %s", val_to_str(tom_pd, tompd_formats, "Unknown (%d)")); - ctrl_f_tree = proto_item_add_subtree(ctrl_field_item, ett_llcgprs_sframe); - proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_tom_rl, tvb, offset, 1, tom_byte); proto_tree_add_uint(ctrl_f_tree, hf_llcgprs_tom_pd, tvb, offset, 1, tom_byte); @@ -1097,13 +1085,11 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int loop_counter = 0; int location = 0; - ui_ti = proto_tree_add_text(llcgprs_tree, tvb, offset, (llc_data_reported_length-2), - "Information Field: Length = %u", info_len); - ui_tree = proto_item_add_subtree(ui_ti, ett_ui); + ui_tree = proto_tree_add_subtree_format(llcgprs_tree, tvb, offset, (llc_data_reported_length-2), + ett_ui, NULL, "Information Field: Length = %u", info_len); - uinfo_field = proto_tree_add_text(ui_tree, tvb, offset, 6, - "Rejected Frame Control Field"); - uinfo_tree = proto_item_add_subtree(uinfo_field, ett_ui); + uinfo_tree = proto_tree_add_subtree(ui_tree, tvb, offset, 6, + ett_ui, NULL, "Rejected Frame Control Field"); location = offset; for (loop_counter = 0; loop_counter < 3; loop_counter++) @@ -1116,9 +1102,8 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) location += 2; } - uinfo_field = proto_tree_add_text(ui_tree, tvb, location, 4, - "Information Field Data"); - uinfo_tree = proto_item_add_subtree(uinfo_field, ett_ui); + uinfo_tree = proto_tree_add_subtree(ui_tree, tvb, location, 4, + ett_ui, NULL, "Information Field Data"); fld_vars = tvb_get_ntohl(tvb, location); proto_tree_add_uint(uinfo_tree, hf_llcgprs_frmr_spare, tvb, location, |