aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-zbee-zdp-management.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-11-22 19:15:18 -0500
committerAnders Broman <a.broman58@gmail.com>2017-11-23 05:36:24 +0000
commitb4419eacce6d76f0e854280f8c20d4849ba2c067 (patch)
tree4c6c11cb3e76e81db23c681ced68cf16e88e370a /epan/dissectors/packet-zbee-zdp-management.c
parentc369db08eaecfd1ad6b87d43b1b99be0224752f4 (diff)
zbee_parse_uint -> proto_tree_add_item[_ret_uint]
We don't need to unnecessarily wrap proto_tree_* functions. Change-Id: Id2853cfb9059cd90af81e529bcec57eba10e6ab3 Reviewed-on: https://code.wireshark.org/review/24540 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-zbee-zdp-management.c')
-rw-r--r--epan/dissectors/packet-zbee-zdp-management.c186
1 files changed, 102 insertions, 84 deletions
diff --git a/epan/dissectors/packet-zbee-zdp-management.c b/epan/dissectors/packet-zbee-zdp-management.c
index 00b68bed82..8e4331c411 100644
--- a/epan/dissectors/packet-zbee-zdp-management.c
+++ b/epan/dissectors/packet-zbee-zdp-management.c
@@ -204,8 +204,6 @@ dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
guint offset = 0;
guint32 channels;
- /*guint8 duration;*/
- /*guint8 idx;*/
/* Get the channel bitmap. */
channels = tvb_get_letohl(tvb, offset);
@@ -228,8 +226,10 @@ dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
}
offset += 4;
- /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, 1, NULL);
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_duration, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
/* Dump any leftover bytes. */
zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -246,9 +246,9 @@ void
dissect_zbee_zdp_req_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
- /*guint8 idx;*/
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
/* Dump any leftover bytes. */
zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -265,9 +265,9 @@ void
dissect_zbee_zdp_req_mgmt_rtg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
- /*guint8 idx;*/
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
/* Dump any leftover bytes. */
zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -284,9 +284,9 @@ void
dissect_zbee_zdp_req_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
- /*guint8 idx;*/
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
/* Dump any leftover bytes. */
zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -357,11 +357,11 @@ void
dissect_zbee_zdp_req_mgmt_permit_join(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
- /*guint8 duration;*/
- /*guint8 significance;*/
- /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, 1, NULL);
- /*significance =*/ zbee_parse_uint(tree, hf_zbee_zdp_significance, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_duration, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_significance, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
/* Dump any leftover bytes. */
zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -378,9 +378,9 @@ void
dissect_zbee_zdp_req_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
- /*guint8 idx;*/
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
/* Dump any leftover bytes. */
zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -397,19 +397,25 @@ void
dissect_zbee_zdp_req_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
- guint8 duration;
+ guint32 duration;
zdp_parse_chanmask(tree, tvb, &offset, hf_zbee_zdp_channel_page, hf_zbee_zdp_channel_mask);
- duration = zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, 1, NULL);
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_duration, tvb, offset, 1, ENC_LITTLE_ENDIAN, &duration);
+ offset += 1;
+
if (duration == ZBEE_ZDP_NWKUPDATE_PARAMETERS) {
- zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, 1, NULL);
- zbee_parse_uint(tree, hf_zbee_zdp_manager, tvb, &offset, 2, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_update_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_manager, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
}
else if (duration == ZBEE_ZDP_NWKUPDATE_CHANNEL_HOP) {
- zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_update_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
}
else if (duration <= ZBEE_ZDP_NWKUPDATE_SCAN_MAX) {
- zbee_parse_uint(tree, hf_zbee_zdp_scan_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_scan_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
}
/* Dump any leftover bytes. */
@@ -427,25 +433,31 @@ void
dissect_zbee_zdp_req_mgmt_nwkupdate_enh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
- guint8 duration;
- guint8 count;
- int i;
+ guint32 i, duration, count;
+
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_channel_page_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &count);
+ offset += 1;
- count = zbee_parse_uint(tree, hf_zbee_zdp_channel_page_count, tvb, &offset, 1, NULL);
for (i=0; i<count; i++) {
zdp_parse_chanmask(tree, tvb, &offset, hf_zbee_zdp_channel_page, hf_zbee_zdp_channel_mask);
}
- duration = zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, 1, NULL);
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_duration, tvb, offset, 1, ENC_LITTLE_ENDIAN, &duration);
+ offset += 1;
+
if (duration == ZBEE_ZDP_NWKUPDATE_PARAMETERS) {
- zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, 1, NULL);
- zbee_parse_uint(tree, hf_zbee_zdp_manager, tvb, &offset, 2, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_update_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_manager, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
}
else if (duration == ZBEE_ZDP_NWKUPDATE_CHANNEL_HOP) {
- zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_update_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
}
else if (duration <= ZBEE_ZDP_NWKUPDATE_SCAN_MAX) {
- zbee_parse_uint(tree, hf_zbee_zdp_scan_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_scan_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
}
/* Dump any leftover bytes. */
@@ -464,7 +476,8 @@ dissect_zbee_zdp_req_mgmt_ieee_join_list(tvbuff_t *tvb, packet_info *pinfo, prot
{
guint offset = 0;
- zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_start_index, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_ieee_join_start_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
/* Dump any leftover bytes. */
zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -486,17 +499,17 @@ dissect_zbee_zdp_rsp_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree
{
proto_tree *field_tree = NULL;
guint offset = 0;
- guint i;
guint8 status;
- /*guint8 table_size;*/
- /*guint8 idx;*/
- guint8 table_count;
+ guint32 i, table_count;
status = zdp_parse_status(tree, tvb, &offset);
- /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, 1, NULL);
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
- table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &table_count);
+ offset += 1;
if (tree && table_count) {
field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_nwk, NULL, "Network List");
@@ -523,17 +536,17 @@ dissect_zbee_zdp_rsp_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
{
proto_tree *field_tree = NULL;
guint offset = 0;
- guint i;
guint8 status;
- /*guint8 table_size;*/
- /*guint8 idx;*/
- guint8 table_count;
+ guint32 i, table_count;
status = zdp_parse_status(tree, tvb, &offset);
- /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, 1, NULL);
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
- table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &table_count);
+ offset += 1;
if (table_count) {
field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_lqi, NULL, "Neighbor Table");
@@ -561,17 +574,17 @@ dissect_zbee_zdp_rsp_mgmt_rtg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_item *ti;
proto_tree *field_tree = NULL;
guint offset = 0;
- guint i;
guint8 status;
- /*guint8 table_size;*/
- /*guint8 idx;*/
- guint8 table_count;
+ guint32 i, table_count;
status = zdp_parse_status(tree, tvb, &offset);
- /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, 1, NULL);
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
- table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &table_count);
+ offset += 1;
if (tree && table_count) {
ti = proto_tree_add_item(tree, hf_zbee_zdp_rtg, tvb, offset, -1, ENC_NA);
@@ -599,17 +612,18 @@ dissect_zbee_zdp_rsp_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
{
proto_tree *field_tree = NULL;
guint offset = 0;
- guint i;
guint8 status;
- /*guint8 table_size;*/
- /*guint8 idx;*/
- guint8 table_count;
+ guint32 i, table_count;
status = zdp_parse_status(tree, tvb, &offset);
- /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, 1, NULL);
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
- table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &table_count);
+ offset += 1;
+
if (tree && table_count) {
field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding Table");
@@ -700,17 +714,17 @@ dissect_zbee_zdp_rsp_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
proto_tree *field_tree = NULL;
proto_tree *ti;
guint offset = 0;
- guint i;
guint8 status;
- /*guint8 table_size;*/
- /*guint8 idx;*/
- guint8 table_count;
+ guint32 i, table_count;
status = zdp_parse_status(tree, tvb, &offset);
- /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, 1, NULL);
- /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, 1, NULL);
- table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &table_count);
+ offset += 1;
if (table_count) {
field_tree = proto_tree_add_subtree(tree, tvb, offset, table_count*(2+8),
@@ -747,16 +761,16 @@ dissect_zbee_zdp_rsp_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre
guint i, j;
/*guint8 status;*/
- guint32 channels;
- /*guint16 tx_total;*/
- /*guint16 tx_fail;*/
- guint8 channel_count;
+ guint32 channels, channel_count;
/*status =*/ zdp_parse_status(tree, tvb, &offset);
channels = zdp_parse_chanmask(tree, tvb, &offset, hf_zbee_zdp_channel_page, hf_zbee_zdp_channel_mask);
- /*tx_total =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_total, tvb, &offset, 2, NULL);
- /*tx_fail =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_fail, tvb, &offset, 2, NULL);
- channel_count = zbee_parse_uint(tree, hf_zbee_zdp_channel_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_tx_total, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+ proto_tree_add_item(tree, hf_zbee_zdp_tx_fail, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_channel_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &channel_count);
+ offset += 1;
/* Display the channel list. */
for (i=0, j=0; i<(8*4); i++) {
@@ -792,20 +806,24 @@ dissect_zbee_zdp_rsp_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre
void
dissect_zbee_zdp_rsp_mgmt_ieee_join_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- guint8 status;
- guint8 list_total;
- guint8 list_count;
+ guint32 i, status, list_total, list_count;
guint offset = 0;
- int i;
- status = zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_status, tvb, &offset, 1, NULL);
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_ieee_join_status, tvb, offset, 1, ENC_LITTLE_ENDIAN, &status);
+ offset += 1;
if (status == 0x00) {
- zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_update_id, tvb, &offset, 1, NULL);
- zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_policy, tvb, &offset, 1, NULL);
- list_total = zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_list_total, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_ieee_join_update_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(tree, hf_zbee_zdp_ieee_join_policy, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_ieee_join_list_total, tvb, offset, 1, ENC_LITTLE_ENDIAN, &list_total);
+ offset += 1;
+
if (list_total > 0) {
- zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_list_start, tvb, &offset, 1, NULL);
- list_count = zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_list_count, tvb, &offset, 1, NULL);
+ proto_tree_add_item(tree, hf_zbee_zdp_ieee_join_list_start, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_ieee_join_list_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &list_count);
+ offset += 1;
for(i=0; i<list_count; i++) {
zbee_parse_eui64(tree, hf_zbee_zdp_ieee_join_list_ieee, tvb, &offset, 8, NULL);