diff options
author | Michael Mann <mmann78@netscape.net> | 2013-12-26 14:28:22 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-12-26 14:28:22 +0000 |
commit | 60b1c303828139a96b424c8fe99dc3607940faee (patch) | |
tree | 842a81f2ff54180e85f07215e18fd5cd01d5e12c /epan/dissectors | |
parent | a2abd0eef45c1622d6dfd99a3ba5994566cc1809 (diff) |
Bugfix attribute id parsing in zbee dissectors. Bug 9566 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9566)
From Fabio Tarabelloni
svn path=/trunk/; revision=54465
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-zbee-zcl-general.c | 70 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl-ha.c | 21 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl-meas-sensing.c | 28 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl.h | 3 |
5 files changed, 51 insertions, 78 deletions
diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c index bf2b889f5d..044588443c 100644 --- a/epan/dissectors/packet-zbee-zcl-general.c +++ b/epan/dissectors/packet-zbee-zcl-general.c @@ -98,7 +98,7 @@ void proto_register_zbee_zcl_basic(void); void proto_reg_handoff_zbee_zcl_basic(void); /* Command Dissector Helpers */ -static void dissect_zcl_basic_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_basic_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); static void dissect_zcl_basic_cmd_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 cmd_dir); @@ -238,16 +238,15 @@ dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ void -dissect_zcl_basic_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_basic_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_basic_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_basic_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_basic_attr_id*/ @@ -489,7 +488,7 @@ void proto_reg_handoff_zbee_zcl_identify(void); static void dissect_zcl_identify_identify (tvbuff_t *tvb, proto_tree *tree, guint *offset); static void dissect_zcl_identify_identifyqueryrsp (tvbuff_t *tvb, proto_tree *tree, guint *offset); -static void dissect_zcl_identify_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_identify_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_identify_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); static void dissect_zcl_identify_cmd_id (proto_tree* tree, tvbuff_t* tvb, guint* offset, guint8 cmd_dir); @@ -680,16 +679,15 @@ dissect_zcl_identify_identifyqueryrsp(tvbuff_t *tvb, proto_tree *tree, guint *of * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ void -dissect_zcl_identify_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_identify_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_identify_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_identify_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_identify_attr_id*/ @@ -859,7 +857,7 @@ void proto_register_zbee_zcl_on_off(void); void proto_reg_handoff_zbee_zcl_on_off(void); /* Command Dissector Helpers */ -static void dissect_zcl_on_off_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_on_off_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_on_off_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); static void dissect_zcl_on_off_cmd_id (proto_tree* tree, tvbuff_t* tvb, guint* offset, guint8 cmd_dir); @@ -955,16 +953,15 @@ dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ void -dissect_zcl_on_off_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_on_off_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_on_off_attr_id*/ @@ -1147,12 +1144,12 @@ void proto_reg_handoff_zbee_zcl_part(void); /* Command Dissector Helpers */ static void dissect_zcl_part_trasfpartframe (tvbuff_t *tvb, proto_tree *tree, guint *offset); -static void dissect_zcl_part_rdhandshakeparam (tvbuff_t *tvb, proto_tree *tree, guint *offset); +static void dissect_zcl_part_rdhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); static void dissect_zcl_part_wrhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); static void dissect_zcl_part_multiack (tvbuff_t *tvb, proto_tree *tree, guint *offset); static void dissect_zcl_part_rdhandshakeparamrsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset); -static void dissect_zcl_part_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_part_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_part_cmd_id (proto_tree* tree, tvbuff_t* tvb, guint* offset, guint8 cmd_dir); /* Private functions prototype */ @@ -1280,7 +1277,7 @@ dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* break; case ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM: - dissect_zcl_part_rdhandshakeparam(tvb, payload_tree, &offset); + dissect_zcl_part_rdhandshakeparam(tvb, pinfo, payload_tree, &offset); break; case ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM: @@ -1394,6 +1391,7 @@ static void dissect_zcl_part_trasfpartframe(tvbuff_t *tvb, proto_tree *tree, gui * This function manages the ReadHandshakeParam payload * PARAMETERS * tvbuff_t *tvb - pointer to buffer containing raw packet. + * packet_info *pinfo - pointer to packet information fields * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * offset - offset * RETURNS @@ -1401,25 +1399,14 @@ static void dissect_zcl_part_trasfpartframe(tvbuff_t *tvb, proto_tree *tree, gui *--------------------------------------------------------------- */ static void -dissect_zcl_part_rdhandshakeparam(tvbuff_t *tvb, proto_tree *tree, guint *offset) +dissect_zcl_part_rdhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset) { - gint tvb_len; - guint16 attr_id; - /* Retrieve "Partitioned Cluster ID" field */ proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; /* Dissect the attribute id list */ - tvb_len = tvb_reported_length_remaining(tvb, *offset); - if ( tvb_len > 0 ) { - while ( *offset < (guint)tvb_len ) { - /* Dissect the attribute identifier */ - attr_id = tvb_get_letohs(tvb, *offset); - dissect_zcl_part_attr_id(tree, tvb, offset, attr_id); - *offset += 2; - } - } + dissect_zcl_read_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION); } /*dissect_zcl_part_rdhandshakeparam*/ /*FUNCTION:------------------------------------------------------ @@ -1440,12 +1427,11 @@ static void dissect_zcl_part_wrhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset) { /* Retrieve "Partitioned Cluster ID" field */ - guint16 cluster_id = tvb_get_letohs(tvb, *offset); proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; /* Dissect the attributes list */ - dissect_zcl_write_attr(tvb, pinfo, tree, offset, cluster_id); + dissect_zcl_write_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION); } /*dissect_zcl_part_wrhandshakeparam*/ @@ -1524,7 +1510,7 @@ dissect_zcl_part_multiack(tvbuff_t *tvb, proto_tree *tree, guint *offset) /*FUNCTION:------------------------------------------------------ * NAME - * dissect_zcl_part_multiack + * dissect_zcl_part_rdhandshakeparamrsp * DESCRIPTION * This function manages the ReadHandshakeParamResponse payload * PARAMETERS @@ -1540,12 +1526,11 @@ static void dissect_zcl_part_rdhandshakeparamrsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset) { /* Retrieve "Partitioned Cluster ID" field */ - guint16 cluster_id = tvb_get_letohs(tvb, *offset); proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; /* Dissect the attributes list */ - dissect_zcl_read_attr_resp(tvb, pinfo, tree, offset, cluster_id); + dissect_zcl_read_attr_resp(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION); } /*dissect_zcl_part_rdhandshakeparamrsp*/ @@ -1559,16 +1544,15 @@ dissect_zcl_part_rdhandshakeparamrsp(tvbuff_t *tvb, packet_info *pinfo, proto_tr * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_part_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_part_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_part_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_part_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_part_attr_id*/ /*FUNCTION:------------------------------------------------------ @@ -1825,7 +1809,7 @@ static void dissect_zcl_pwr_prof_pwrprofstatersp (tvbuff_t *tvb, prot static void dissect_zcl_pwr_prof_pwrprofschedcontrsnotif (tvbuff_t *tvb, proto_tree *tree, guint *offset); static void dissect_zcl_pwr_prof_pwrprofpriceext (tvbuff_t *tvb, proto_tree *tree, guint *offset); -static void dissect_zcl_pwr_prof_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_pwr_prof_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_pwr_prof_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); static void dissect_zcl_pwr_prof_cmd_id (proto_tree* tree, tvbuff_t* tvb, guint* offset, guint8 cmd_dir); @@ -2493,16 +2477,15 @@ dissect_zcl_pwr_prof_pwrprofpriceext(tvbuff_t *tvb, proto_tree *tree, guint *off * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_pwr_prof_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_pwr_prof_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_pwr_prof_attr_id*/ @@ -3024,7 +3007,7 @@ static void dissect_zcl_appl_ctrl_wr_funcs (tvbuff_t *tvb, proto_tr static void dissect_zcl_appl_ctrl_ovrl_warning (tvbuff_t *tvb, proto_tree *tree, guint *offset); static void dissect_zcl_appl_ctrl_signal_state_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset); -static void dissect_zcl_appl_ctrl_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_appl_ctrl_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_appl_ctrl_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); static void dissect_zcl_appl_ctrl_cmd_id (proto_tree* tree, tvbuff_t* tvb, guint* offset, guint8 cmd_dir); @@ -3429,16 +3412,15 @@ dissect_zcl_appl_ctrl_signal_state_rsp(tvbuff_t *tvb, proto_tree *tree, guint *o * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_appl_ctrl_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_appl_ctrl_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_uint(tree, hf_zbee_zcl_appl_ctrl_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_appl_ctrl_attr_id*/ /*FUNCTION:------------------------------------------------------ diff --git a/epan/dissectors/packet-zbee-zcl-ha.c b/epan/dissectors/packet-zbee-zcl-ha.c index 5964e6d9e1..f61f33f3a4 100644 --- a/epan/dissectors/packet-zbee-zcl-ha.c +++ b/epan/dissectors/packet-zbee-zcl-ha.c @@ -111,7 +111,7 @@ void proto_register_zbee_zcl_appl_idt(void); void proto_reg_handoff_zbee_zcl_appl_idt(void); /* Command Dissector Helpers */ -static void dissect_zcl_appl_idt_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_appl_idt_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_appl_idt_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); /* Private functions prototype */ @@ -238,16 +238,15 @@ dissect_zbee_zcl_appl_idt(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ void -dissect_zcl_appl_idt_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_appl_idt_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_appl_idt_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_appl_idt_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_appl_idt_attr_id*/ @@ -465,7 +464,7 @@ void proto_register_zbee_zcl_met_idt(void); void proto_reg_handoff_zbee_zcl_met_idt(void); /* Command Dissector Helpers */ -static void dissect_zcl_met_idt_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_met_idt_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_met_idt_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); /* Private functions prototype */ @@ -557,16 +556,15 @@ dissect_zbee_zcl_met_idt(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree * * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ void -dissect_zcl_met_idt_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_met_idt_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_met_idt_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_met_idt_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_met_idt_attr_id*/ @@ -1175,7 +1173,7 @@ static void dissect_zcl_appl_stats_log_req (tvbuff_t *tvb, proto_tr static void dissect_zcl_appl_stats_log_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset); static void dissect_zcl_appl_stats_log_queue_rsp (tvbuff_t *tvb, proto_tree *tree, guint *offset); -static void dissect_zcl_appl_stats_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_appl_stats_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_appl_stats_cmd_id (proto_tree* tree, tvbuff_t* tvb, guint* offset, guint8 cmd_dir); /* Private functions prototype */ @@ -1428,16 +1426,15 @@ dissect_zcl_appl_stats_log_queue_rsp(tvbuff_t *tvb, proto_tree *tree, guint *off * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_appl_stats_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_appl_stats_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_appl_stats_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_appl_stats_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_appl_stats_attr_id*/ /*FUNCTION:------------------------------------------------------ diff --git a/epan/dissectors/packet-zbee-zcl-meas-sensing.c b/epan/dissectors/packet-zbee-zcl-meas-sensing.c index bdc59e8a76..347396f548 100644 --- a/epan/dissectors/packet-zbee-zcl-meas-sensing.c +++ b/epan/dissectors/packet-zbee-zcl-meas-sensing.c @@ -82,7 +82,7 @@ void proto_register_zbee_zcl_illum_meas(void); void proto_reg_handoff_zbee_zcl_illum_meas(void); /* Command Dissector Helpers */ -static void dissect_zcl_illum_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_illum_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_illum_meas_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); /* Private functions prototype */ @@ -157,16 +157,15 @@ dissect_zbee_zcl_illum_meas(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tre * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_illum_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_illum_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_illum_meas_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_illum_meas_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_illum_meas_attr_id*/ /*FUNCTION:------------------------------------------------------ @@ -436,7 +435,7 @@ void proto_register_zbee_zcl_temp_meas(void); void proto_reg_handoff_zbee_zcl_temp_meas(void); /* Command Dissector Helpers */ -static void dissect_zcl_temp_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_temp_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_temp_meas_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); /* Private functions prototype */ @@ -503,16 +502,15 @@ dissect_zbee_zcl_temp_meas(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_temp_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_temp_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_temp_meas_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_temp_meas_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_temp_meas_attr_id*/ /*FUNCTION:------------------------------------------------------ @@ -778,7 +776,7 @@ void proto_register_zbee_zcl_press_meas(void); void proto_reg_handoff_zbee_zcl_press_meas(void); /* Command Dissector Helpers */ -static void dissect_zcl_press_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_press_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_press_meas_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); /* Private functions prototype */ @@ -855,16 +853,15 @@ dissect_zbee_zcl_press_meas(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tre * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_press_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_press_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_press_meas_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_press_meas_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_press_meas_attr_id*/ /*FUNCTION:------------------------------------------------------ @@ -1170,7 +1167,7 @@ void proto_register_zbee_zcl_relhum_meas(void); void proto_reg_handoff_zbee_zcl_relhum_meas(void); /* Command Dissector Helpers */ -static void dissect_zcl_relhum_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +static void dissect_zcl_relhum_meas_attr_id (proto_tree *tree, tvbuff_t *tvb, guint *offset); static void dissect_zcl_relhum_meas_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); /* Private functions prototype */ @@ -1237,16 +1234,15 @@ dissect_zbee_zcl_relhum_meas(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tr * proto_tree *tree - pointer to data tree Wireshark uses to display packet. * tvbuff_t *tvb - pointer to buffer containing raw packet. * guint *offset - pointer to buffer offset - * guint16 attr_id - attribute identifier * * RETURNS * none *--------------------------------------------------------------- */ static void -dissect_zcl_relhum_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id) +dissect_zcl_relhum_meas_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset) { - proto_tree_add_item(tree, hf_zbee_zcl_relhum_meas_attr_id, tvb, *offset, 2, attr_id); + proto_tree_add_item(tree, hf_zbee_zcl_relhum_meas_attr_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); } /*dissect_zcl_relhum_meas_attr_id*/ /*FUNCTION:------------------------------------------------------ diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c index c6e0227a2e..90b67cdc1c 100644 --- a/epan/dissectors/packet-zbee-zcl.c +++ b/epan/dissectors/packet-zbee-zcl.c @@ -46,7 +46,6 @@ void proto_register_zbee_zcl(void); void proto_reg_handoff_zbee_zcl(void); /* Command Dissector Helpers */ -static void dissect_zcl_read_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); static void dissect_zcl_write_attr_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); static void dissect_zcl_config_report (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); static void dissect_zcl_config_report_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); @@ -1645,7 +1644,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * guint - offset after command dissection. *--------------------------------------------------------------- */ -static void dissect_zcl_read_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id) +void dissect_zcl_read_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id) { guint tvb_len; @@ -2129,13 +2128,11 @@ static void dissect_zcl_discover_attr_resp(tvbuff_t *tvb, packet_info *pinfo _U_ */ static void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint16 cluster_id) { - guint16 attr_id; zbee_zcl_cluster_desc *desc; - attr_id = tvb_get_letohs(tvb, *offset); desc = zbee_zcl_get_cluster_desc(cluster_id); if ((desc != NULL) && (desc->fn_attr_id != NULL)) { - desc->fn_attr_id(tree, tvb, offset, attr_id); + desc->fn_attr_id(tree, tvb, offset); } else { /* Add the identifier */ diff --git a/epan/dissectors/packet-zbee-zcl.h b/epan/dissectors/packet-zbee-zcl.h index 0c12b335dd..915b2cb48b 100644 --- a/epan/dissectors/packet-zbee-zcl.h +++ b/epan/dissectors/packet-zbee-zcl.h @@ -178,7 +178,7 @@ typedef struct{ #define MONTHS_PER_YEAR 12 #define YEAR_OFFSET 1900 -typedef void (*zbee_zcl_fn_attr_id) (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id); +typedef void (*zbee_zcl_fn_attr_id) (proto_tree *tree, tvbuff_t *tvb, guint *offset); typedef void (*zbee_zcl_fn_attr_data) (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type); typedef void (*zbee_zcl_fn_cmd_id) (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 dir); @@ -196,6 +196,7 @@ typedef struct _zbee_zcl_cluster_desc { extern const value_string zbee_zcl_short_data_type_names[]; /* Dissector functions */ +extern void dissect_zcl_read_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); extern void dissect_zcl_write_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); extern void dissect_zcl_read_attr_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id); |