Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area. Change-Id: Id8dab02df6f111c3462238c3de1bf201e037ca48 Reviewed-on: https://code.wireshark.org/review/4022 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
f76b4d9346
commit
2b27d91f26
|
@ -77,12 +77,14 @@ static int hf_wfd_subelem_session_dev_info_max_throughput = -1;
|
|||
static int hf_wfd_subelem_session_coupled_sink_status_bitmap = -1;
|
||||
static int hf_wfd_subelem_session_coupled_sink_reserved = -1;
|
||||
static int hf_wfd_subelem_session_coupled_sink_addr = -1;
|
||||
static int hf_wfd_subelem_session_extra_info = -1;
|
||||
|
||||
static gint ett_wfd_subelem = -1;
|
||||
static gint ett_wfd_dev_info_descr = -1;
|
||||
|
||||
static expert_field ei_wfd_subelem_len_invalid = EI_INIT;
|
||||
static expert_field ei_wfd_subelem_session_descr_invalid = EI_INIT;
|
||||
static expert_field ei_wfd_subelem_id = EI_INIT;
|
||||
|
||||
enum wifi_display_subelem {
|
||||
WFD_SUBELEM_DEVICE_INFO = 0,
|
||||
|
@ -298,8 +300,7 @@ dissect_wfd_subelem_session_info(packet_info *pinfo, proto_tree *tree,
|
|||
offset += 6;
|
||||
|
||||
if (offset < next) {
|
||||
proto_tree_add_text(descr, tvb, offset, next - offset,
|
||||
"Extra info in the end of descriptor");
|
||||
proto_tree_add_item(descr, hf_wfd_subelem_session_extra_info, tvb, offset, next - offset, ENC_NA);
|
||||
}
|
||||
|
||||
offset = next;
|
||||
|
@ -352,8 +353,7 @@ void dissect_wifi_display_ie(packet_info *pinfo, proto_tree *tree,
|
|||
dissect_wfd_subelem_session_info(pinfo, wfd_tree, tvb, offset, len);
|
||||
break;
|
||||
default:
|
||||
proto_tree_add_text(wfd_tree, tvb, offset, len,
|
||||
"Unknown subelement payload");
|
||||
expert_add_info(pinfo, subelem, &ei_wfd_subelem_id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,11 @@ proto_register_wifi_display(void)
|
|||
{ &hf_wfd_subelem_session_coupled_sink_addr,
|
||||
{ "Coupled peer sink address",
|
||||
"wifi_display.subelem.session.coupled_peer_sink_addr",
|
||||
FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }}
|
||||
FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
|
||||
{ &hf_wfd_subelem_session_extra_info,
|
||||
{ "Extra info in the end of descriptor",
|
||||
"wifi_display.subelem.session.extra_info",
|
||||
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_wfd_subelem,
|
||||
|
@ -525,6 +529,7 @@ proto_register_wifi_display(void)
|
|||
static ei_register_info ei[] = {
|
||||
{ &ei_wfd_subelem_len_invalid, { "wifi_display.subelem.length.invalid", PI_MALFORMED, PI_ERROR, "Subelement length invalid", EXPFILL }},
|
||||
{ &ei_wfd_subelem_session_descr_invalid, { "wifi_display.subelem.session.descr_invalid", PI_MALFORMED, PI_ERROR, "Invalid WFD Device Info Descriptor", EXPFILL }},
|
||||
{ &ei_wfd_subelem_id, { "wifi_display.subelem.id.unknown", PI_PROTOCOL, PI_WARN, "Unknown subelement payload", EXPFILL }},
|
||||
};
|
||||
|
||||
expert_module_t* expert_wifi_display;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/exceptions.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/tap.h>
|
||||
|
@ -102,6 +103,8 @@ static gint ett_winsrepl_send_reply = -1;
|
|||
|
||||
static gint ett_winsrepl_flags = -1;
|
||||
|
||||
static expert_field ei_winsrepl_name_len = EI_INIT;
|
||||
|
||||
#define WINS_REPLICATION_PORT ( 42 )
|
||||
#define WREPL_OPCODE_BITS ( 0x7800 )
|
||||
|
||||
|
@ -375,7 +378,7 @@ dissect_winsrepl_wins_name(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
|
|||
int winsrepl_offset, proto_tree *winsrepl_tree,
|
||||
proto_tree *sub_tree, guint32 idx)
|
||||
{
|
||||
proto_item *name_item = NULL;
|
||||
proto_item *name_item = NULL, *ti;
|
||||
proto_tree *name_tree = NULL;
|
||||
proto_item *flags_item;
|
||||
proto_tree *flags_tree;
|
||||
|
@ -397,12 +400,11 @@ dissect_winsrepl_wins_name(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
|
|||
|
||||
/* NAME_LEN */
|
||||
name_len = tvb_get_ntohl(winsrepl_tvb, winsrepl_offset);
|
||||
ti = proto_tree_add_uint(name_tree, hf_winsrepl_name_len, winsrepl_tvb, winsrepl_offset, 4, name_len);
|
||||
if ((gint) name_len < 1) {
|
||||
proto_tree_add_text(name_tree, winsrepl_tvb, winsrepl_offset,
|
||||
4, "Bad name length: %u", name_len);
|
||||
expert_add_info(pinfo, ti, &ei_winsrepl_name_len);
|
||||
THROW(ReportedBoundsError);
|
||||
}
|
||||
proto_tree_add_uint(name_tree, hf_winsrepl_name_len, winsrepl_tvb, winsrepl_offset, 4, name_len);
|
||||
winsrepl_offset += 4;
|
||||
|
||||
/* NAME: TODO! */
|
||||
|
@ -853,12 +855,19 @@ proto_register_winsrepl(void)
|
|||
&ett_winsrepl_flags,
|
||||
};
|
||||
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_winsrepl_name_len, { "winsrepl.name_len.invalid", PI_MALFORMED, PI_ERROR, "Bad name length", EXPFILL }},
|
||||
};
|
||||
|
||||
module_t *winsrepl_module;
|
||||
expert_module_t* expert_winsrepl;
|
||||
|
||||
proto_winsrepl = proto_register_protocol("WINS (Windows Internet Name Service) Replication",
|
||||
"WINS-Replication", "winsrepl");
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
proto_register_field_array(proto_winsrepl, hf, array_length(hf));
|
||||
expert_winsrepl = expert_register_protocol(proto_winsrepl);
|
||||
expert_register_field_array(expert_winsrepl, ei, array_length(ei));
|
||||
|
||||
winsrepl_module = prefs_register_protocol(proto_winsrepl, NULL);
|
||||
prefs_register_bool_preference(winsrepl_module, "reassemble",
|
||||
|
|
|
@ -454,7 +454,6 @@ add_session_id(proto_tree *tree, int hf, int hf_str, tvbuff_t *tvb, int offset)
|
|||
guint count;
|
||||
guint i;
|
||||
guint64 session_id;
|
||||
header_field_info *hfinfo;
|
||||
|
||||
count = tvb_get_guint8(tvb, offset);
|
||||
if (count == 0)
|
||||
|
@ -465,9 +464,7 @@ add_session_id(proto_tree *tree, int hf, int hf_str, tvbuff_t *tvb, int offset)
|
|||
session_id = (session_id << 8) | tvb_get_guint8(tvb, offset + i);
|
||||
proto_tree_add_uint64 (tree, hf, tvb, offset, count+1, session_id);
|
||||
} else {
|
||||
hfinfo = proto_registrar_get_nth(hf);
|
||||
proto_tree_add_text (tree, tvb, offset, count+1, "%s: %s",
|
||||
hfinfo->name, tvb_bytes_to_ep_str(tvb, offset+1, count));
|
||||
proto_tree_add_item(tree, hf, tvb, offset, count+1, ENC_NA);
|
||||
}
|
||||
return offset+1+count;
|
||||
}
|
||||
|
|
|
@ -182,6 +182,7 @@ static int hf_wtp_header_Abort_reason_provider = HF_EMPTY;
|
|||
static int hf_wtp_header_Abort_reason_user = HF_EMPTY;
|
||||
static int hf_wtp_header_sequence_number = HF_EMPTY;
|
||||
static int hf_wtp_header_missing_packets = HF_EMPTY;
|
||||
static int hf_wtp_payload = HF_EMPTY;
|
||||
|
||||
/* These fields used when reassembling WTP fragments */
|
||||
static int hf_wtp_fragments = HF_EMPTY;
|
||||
|
@ -738,14 +739,14 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
"%s (WTP payload reassembled in packet %u)",
|
||||
szInfo, fd_wtp->reassembled_in);
|
||||
|
||||
proto_tree_add_text(wtp_tree, tvb, dataOffset, -1, "Payload");
|
||||
proto_tree_add_item(wtp_tree, hf_wtp_payload, tvb, dataOffset, -1, ENC_NA);
|
||||
}
|
||||
} else {
|
||||
/* Not reassembled yet, or not reassembled at all */
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO,
|
||||
"%s (Unreassembled fragment %u)",
|
||||
szInfo, psn);
|
||||
proto_tree_add_text(wtp_tree, tvb, dataOffset, -1, "Payload");
|
||||
proto_tree_add_item(wtp_tree, hf_wtp_payload, tvb, dataOffset, -1, ENC_NA);
|
||||
}
|
||||
/* Now reset fragmentation information in pinfo */
|
||||
pinfo->fragmented = save_fragmented;
|
||||
|
@ -917,6 +918,12 @@ proto_register_wtp(void)
|
|||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
{ &hf_wtp_payload,
|
||||
{ "Payload", "wtp.payload",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x00,
|
||||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
#if 0
|
||||
{ &hf_wtp_header_variable_part,
|
||||
{ "Header: Variable part", "wtp.header_variable_part",
|
||||
|
|
|
@ -207,6 +207,7 @@ static gint ett_x11_event = -1;
|
|||
|
||||
static expert_field ei_x11_invalid_format = EI_INIT;
|
||||
static expert_field ei_x11_request_length = EI_INIT;
|
||||
static expert_field ei_x11_keycode_value_out_of_range = EI_INIT;
|
||||
|
||||
/* desegmentation of X11 messages */
|
||||
static gboolean x11_desegment = TRUE;
|
||||
|
@ -1154,20 +1155,18 @@ static const value_string zero_is_none_vals[] = {
|
|||
tvbuff_t *next_tvb; \
|
||||
unsigned char eventcode; \
|
||||
const char *sent; \
|
||||
proto_item *event_ti; \
|
||||
proto_tree *event_proto_tree; \
|
||||
next_tvb = tvb_new_subset(tvb, offset, next_offset - offset, \
|
||||
next_offset - offset); \
|
||||
eventcode = tvb_get_guint8(next_tvb, 0); \
|
||||
sent = (eventcode & 0x80) ? "Sent-" : ""; \
|
||||
event_ti = proto_tree_add_text(t, next_tvb, 0, -1, \
|
||||
"event: %d (%s)", \
|
||||
event_proto_tree = proto_tree_add_subtree_format(t, next_tvb, \
|
||||
0, -1, ett_x11_event, NULL, \
|
||||
"event: %d (%s)", \
|
||||
eventcode, \
|
||||
val_to_str(eventcode & 0x7F, \
|
||||
state->eventcode_vals, \
|
||||
"<Unknown eventcode %u>")); \
|
||||
event_proto_tree = proto_item_add_subtree(event_ti, \
|
||||
ett_x11_event); \
|
||||
decode_x11_event(next_tvb, eventcode, sent, event_proto_tree, \
|
||||
state, byte_order); \
|
||||
offset = next_offset; \
|
||||
|
@ -1184,7 +1183,7 @@ static const value_string zero_is_none_vals[] = {
|
|||
#define LISTofKEYCODE(map, name, length) { listOfKeycode(tvb, offsetp, t, hf_x11_##name, map, (length), byte_order); }
|
||||
#define LISTofKEYSYM(name, map, keycode_first, keycode_count, \
|
||||
keysyms_per_keycode) {\
|
||||
listOfKeysyms(tvb, offsetp, t, hf_x11_##name, hf_x11_##name##_item, map, (keycode_first), (keycode_count), (keysyms_per_keycode), byte_order); }
|
||||
listOfKeysyms(tvb, pinfo, offsetp, t, hf_x11_##name, hf_x11_##name##_item, map, (keycode_first), (keycode_count), (keysyms_per_keycode), byte_order); }
|
||||
#define LISTofPOINT(name, length) { listOfPoint(tvb, offsetp, t, hf_x11_##name, (length) / 4, byte_order); }
|
||||
#define LISTofRECTANGLE(name) { listOfRectangle(tvb, offsetp, t, hf_x11_##name, (next_offset - *offsetp) / 8, byte_order); }
|
||||
#define LISTofSEGMENT(name) { listOfSegment(tvb, offsetp, t, hf_x11_##name, (next_offset - *offsetp) / 8, byte_order); }
|
||||
|
@ -1952,7 +1951,7 @@ static void listOfKeycode(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf,
|
|||
}
|
||||
}
|
||||
|
||||
static void listOfKeysyms(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf,
|
||||
static void listOfKeysyms(tvbuff_t *tvb, packet_info *pinfo, int *offsetp, proto_tree *t, int hf,
|
||||
int hf_item, int *keycodemap[256],
|
||||
int keycode_first, int keycode_count,
|
||||
int keysyms_per_keycode, guint byte_order)
|
||||
|
@ -1968,14 +1967,14 @@ static void listOfKeysyms(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf,
|
|||
|
||||
for (keycode = keycode_first; keycode_count > 0;
|
||||
++keycode, --keycode_count) {
|
||||
tti = proto_tree_add_none_format(tt, hf_item, tvb, *offsetp,
|
||||
4 * keysyms_per_keycode, "keysyms (keycode %d):", keycode);
|
||||
if (keycode >= 256) {
|
||||
proto_tree_add_text(tt, tvb, *offsetp, 4 * keysyms_per_keycode,
|
||||
expert_add_info_format(pinfo, tti, &ei_x11_keycode_value_out_of_range,
|
||||
"keycode value %d is out of range", keycode);
|
||||
*offsetp += 4 * keysyms_per_keycode;
|
||||
continue;
|
||||
}
|
||||
tti = proto_tree_add_none_format(tt, hf_item, tvb, *offsetp,
|
||||
4 * keysyms_per_keycode, "keysyms (keycode %d):", keycode);
|
||||
|
||||
ttt = proto_item_add_subtree(tti, ett_x11_keysym);
|
||||
|
||||
|
@ -4356,7 +4355,6 @@ static void dissect_x11_requests(tvbuff_t *tvb, packet_info *pinfo,
|
|||
guint8 opcode;
|
||||
volatile int plen;
|
||||
proto_item *ti;
|
||||
proto_tree *t;
|
||||
volatile gboolean is_initial_creq;
|
||||
guint16 auth_proto_len, auth_data_len;
|
||||
const char *volatile sep = NULL;
|
||||
|
@ -4430,11 +4428,8 @@ static void dissect_x11_requests(tvbuff_t *tvb, packet_info *pinfo,
|
|||
* helped.
|
||||
* Give up.
|
||||
*/
|
||||
ti = proto_tree_add_item(tree, proto_x11, tvb, offset, -1,
|
||||
ENC_NA);
|
||||
t = proto_item_add_subtree(ti, ett_x11);
|
||||
proto_tree_add_text(t, tvb, offset, -1,
|
||||
"Bogus request length (0)");
|
||||
ti = proto_tree_add_item(tree, proto_x11, tvb, offset, -1, ENC_NA);
|
||||
expert_add_info_format(pinfo, ti, &ei_x11_request_length, "Bogus request length (0)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5686,6 +5681,7 @@ void proto_register_x11(void)
|
|||
static ei_register_info ei[] = {
|
||||
{ &ei_x11_invalid_format, { "x11.invalid_format", PI_PROTOCOL, PI_WARN, "Invalid Format", EXPFILL }},
|
||||
{ &ei_x11_request_length, { "x11.request-length.invalid", PI_PROTOCOL, PI_WARN, "Invalid Length", EXPFILL }},
|
||||
{ &ei_x11_keycode_value_out_of_range, { "x11.keycode_value_out_of_range", PI_PROTOCOL, PI_WARN, "keycode value is out of range", EXPFILL }},
|
||||
};
|
||||
|
||||
module_t *x11_module;
|
||||
|
|
|
@ -102,7 +102,6 @@ xmpp_conference_info(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_e
|
|||
static void
|
||||
xmpp_conf_desc(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
|
||||
{
|
||||
proto_item *desc_item;
|
||||
proto_tree *desc_tree;
|
||||
|
||||
xmpp_attr_info attrs_info [] = {
|
||||
|
@ -121,8 +120,7 @@ xmpp_conf_desc(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element
|
|||
};
|
||||
*/
|
||||
|
||||
desc_item = proto_tree_add_text(tree, tvb, element->offset, element->length, "CONFERENCE DESCRIPTION");
|
||||
desc_tree = proto_item_add_subtree(desc_item, ett_xmpp_conf_desc);
|
||||
desc_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_desc, NULL, "CONFERENCE DESCRIPTION");
|
||||
|
||||
xmpp_change_elem_to_attrib("subject", "subject", element, xmpp_transform_func_cdata);
|
||||
xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata);
|
||||
|
|
|
@ -304,6 +304,8 @@ static int hf_xtp_btag = -1;
|
|||
static int hf_xtp_diag_code = -1;
|
||||
static int hf_xtp_diag_val = -1;
|
||||
static int hf_xtp_diag_msg = -1;
|
||||
static int hf_xtp_checksum = -1;
|
||||
static int hf_xtp_data = -1;
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_xtp = -1;
|
||||
|
@ -646,9 +648,7 @@ dissect_xtp_data(tvbuff_t *tvb, proto_tree *tree, guint32 offset, gboolean have_
|
|||
len -= 8;
|
||||
}
|
||||
|
||||
proto_tree_add_text(xtp_subtree, tvb, offset, len,
|
||||
"Data (%u byte%s)", len,
|
||||
plurality(len, "", "s"));
|
||||
proto_tree_add_item(xtp_subtree, hf_xtp_data, tvb, offset, len, ENC_NA);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1057,18 +1057,18 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, check_len);
|
||||
computed_cksum = in_cksum(cksum_vec, 1);
|
||||
if (computed_cksum == 0) {
|
||||
proto_tree_add_text(xtp_tree, tvb, offset, 2,
|
||||
"Checksum: 0x%04x [correct]", xtph->check);
|
||||
proto_tree_add_uint_format_value(xtp_tree, hf_xtp_checksum, tvb, offset, 2,
|
||||
xtph->check, "0x%04x [correct]", xtph->check);
|
||||
} else {
|
||||
proto_tree_add_text(xtp_tree, tvb, offset, 2,
|
||||
"Checksum: 0x%04x [incorrect, should be 0x%04x]",
|
||||
proto_tree_add_uint_format_value(xtp_tree, hf_xtp_checksum, tvb, offset, 2,
|
||||
xtph->check, "0x%04x [incorrect, should be 0x%04x]",
|
||||
xtph->check,
|
||||
in_cksum_shouldbe(xtph->check, computed_cksum));
|
||||
}
|
||||
}
|
||||
else {
|
||||
proto_tree_add_text(xtp_tree, tvb, offset, 2,
|
||||
"Checksum: 0x%04x", xtph->check);
|
||||
proto_tree_add_uint_format_value(xtp_tree, hf_xtp_checksum, tvb, offset, 2,
|
||||
xtph->check, "0x%04x", xtph->check);
|
||||
}
|
||||
offset += 2;
|
||||
/* sort(2) */
|
||||
|
@ -1383,6 +1383,14 @@ proto_register_xtp(void)
|
|||
{ "Message", "xtp.diag.msg",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_xtp_checksum,
|
||||
{ "Checksum", "xtp.checksum",
|
||||
FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_xtp_data,
|
||||
{ "Data", "xtp.data",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
|
|
|
@ -40,6 +40,7 @@ static int hf_xyplex_server_port = -1;
|
|||
static int hf_xyplex_return_port = -1;
|
||||
static int hf_xyplex_reserved = -1;
|
||||
static int hf_xyplex_reply = -1;
|
||||
static int hf_xyplex_data = -1;
|
||||
|
||||
static gint ett_xyplex = -1;
|
||||
|
||||
|
@ -147,8 +148,7 @@ dissect_xyplex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d Data",
|
||||
pinfo->srcport, pinfo->destport);
|
||||
|
||||
proto_tree_add_text(xyplex_tree, tvb, offset, -1,
|
||||
"Data (%d bytes)", tvb_reported_length_remaining(tvb, offset));
|
||||
proto_tree_add_item(xyplex_tree, hf_xyplex_data, tvb, offset, -1, ENC_NA);
|
||||
|
||||
return tvb_reported_length_remaining(tvb, offset);
|
||||
}
|
||||
|
@ -188,6 +188,11 @@ proto_register_xyplex(void)
|
|||
FT_UINT16, BASE_DEC, VALS(xyplex_reg_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_xyplex_data,
|
||||
{ "Data", "xyplex.data",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_xyplex,
|
||||
|
|
|
@ -90,6 +90,14 @@ static int hf_zbee_aps_src = -1;
|
|||
static int hf_zbee_aps_counter = -1;
|
||||
static int hf_zbee_aps_fragmentation = -1;
|
||||
static int hf_zbee_aps_block_number = -1;
|
||||
static int hf_zbee_aps_block_ack1 = -1;
|
||||
static int hf_zbee_aps_block_ack2 = -1;
|
||||
static int hf_zbee_aps_block_ack3 = -1;
|
||||
static int hf_zbee_aps_block_ack4 = -1;
|
||||
static int hf_zbee_aps_block_ack5 = -1;
|
||||
static int hf_zbee_aps_block_ack6 = -1;
|
||||
static int hf_zbee_aps_block_ack7 = -1;
|
||||
static int hf_zbee_aps_block_ack8 = -1;
|
||||
|
||||
static int hf_zbee_aps_cmd_id = -1;
|
||||
static int hf_zbee_aps_cmd_initiator = -1;
|
||||
|
@ -654,7 +662,6 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
|
|||
proto_tree *aps_tree;
|
||||
proto_tree *field_tree;
|
||||
proto_item *proto_root;
|
||||
proto_item *ti;
|
||||
|
||||
zbee_aps_packet packet;
|
||||
zbee_nwk_packet *nwk;
|
||||
|
@ -696,9 +703,8 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
|
|||
/* Display the FCF */
|
||||
|
||||
/* Create the subtree */
|
||||
ti = proto_tree_add_text(aps_tree, tvb, offset, 1, "Frame Control Field: %s (0x%02x)",
|
||||
field_tree = proto_tree_add_subtree_format(aps_tree, tvb, offset, 1, ett_zbee_aps_fcf, NULL, "Frame Control Field: %s (0x%02x)",
|
||||
val_to_str_const(packet.type, zbee_aps_frame_types, "Unknown"), fcf);
|
||||
field_tree = proto_item_add_subtree(ti, ett_zbee_aps_fcf);
|
||||
|
||||
/* Add the frame type and delivery mode. */
|
||||
proto_tree_add_uint(field_tree, hf_zbee_aps_fcf_frame_type, tvb, offset, 1, fcf & ZBEE_APS_FCF_FRAME_TYPE);
|
||||
|
@ -871,8 +877,7 @@ dissect_zbee_aps_no_endpt:
|
|||
fcf = tvb_get_guint8(tvb, offset);
|
||||
packet.fragmentation = fcf & ZBEE_APS_EXT_FCF_FRAGMENT;
|
||||
/* Create a subtree */
|
||||
ti = proto_tree_add_text(aps_tree, tvb, offset, 1, "Extended Frame Control Field (0x%02x)", fcf);
|
||||
field_tree = proto_item_add_subtree(ti, ett_zbee_aps_fcf);
|
||||
field_tree = proto_tree_add_subtree_format(aps_tree, tvb, offset, 1, ett_zbee_aps_fcf, NULL, "Extended Frame Control Field (0x%02x)", fcf);
|
||||
|
||||
/* Display the fragmentation sub-field. */
|
||||
proto_tree_add_uint(field_tree, hf_zbee_aps_fragmentation, tvb, offset, 1, packet.fragmentation);
|
||||
|
@ -891,14 +896,22 @@ dissect_zbee_aps_no_endpt:
|
|||
if ((packet.fragmentation != ZBEE_APS_EXT_FCF_FRAGMENT_NONE) && (packet.type == ZBEE_APS_FCF_ACK)) {
|
||||
packet.ack_bitfield = tvb_get_guint8(tvb, offset);
|
||||
if (tree) {
|
||||
int i, mask;
|
||||
gchar tmp[16];
|
||||
for (i=0; i<8; i++) {
|
||||
mask = (1<<i);
|
||||
decode_bitfield_value(tmp, packet.ack_bitfield, mask, 8);
|
||||
proto_tree_add_text(field_tree, tvb, offset, 1, "%sBlock %d: %s",
|
||||
tmp, packet.block_number+i, (packet.ack_bitfield & mask)?"Acknowledged":"Not Acknowledged");
|
||||
} /* for */
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack1, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number, (packet.ack_bitfield & 0x01)?"Acknowledged":"Not Acknowledged");
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack2, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number+1, (packet.ack_bitfield & 0x02)?"Acknowledged":"Not Acknowledged");
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack3, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number+2, (packet.ack_bitfield & 0x04)?"Acknowledged":"Not Acknowledged");
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack4, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number+3, (packet.ack_bitfield & 0x08)?"Acknowledged":"Not Acknowledged");
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack5, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number+4, (packet.ack_bitfield & 0x10)?"Acknowledged":"Not Acknowledged");
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack6, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number+5, (packet.ack_bitfield & 0x20)?"Acknowledged":"Not Acknowledged");
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack7, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number+6, (packet.ack_bitfield & 0x40)?"Acknowledged":"Not Acknowledged");
|
||||
proto_tree_add_uint_format_value(field_tree, hf_zbee_aps_block_ack8, tvb, offset, 1,
|
||||
packet.ack_bitfield, " (%d) %s", packet.block_number+7, (packet.ack_bitfield & 0x80)?"Acknowledged":"Not Acknowledged");
|
||||
}
|
||||
offset += 1;
|
||||
}
|
||||
|
@ -1868,6 +1881,38 @@ void proto_register_zbee_aps(void)
|
|||
{ "Block Number", "zbee_aps.block", FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||
"A block identifier within a fragmented transmission, or the number of expected blocks if the first block.", HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack1,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x01,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack2,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x02,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack3,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x04,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack4,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x08,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack5,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x10,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack6,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x20,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack7,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x40,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_block_ack8,
|
||||
{ "Block", "zbee_aps.block_ack", FT_BOOLEAN, 8, NULL, 0x80,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_aps_cmd_id,
|
||||
{ "Command Identifier", "zbee_aps.cmd.id", FT_UINT8, BASE_HEX, VALS(zbee_aps_cmd_names), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
|
|
@ -58,6 +58,7 @@ static gboolean zbee_security_parse_key(const gchar *, guint8 *, gboolean);
|
|||
static void proto_init_zbee_security(void);
|
||||
|
||||
/* Field pointers. */
|
||||
static int hf_zbee_sec_field = -1;
|
||||
static int hf_zbee_sec_key_id = -1;
|
||||
static int hf_zbee_sec_nonce = -1;
|
||||
static int hf_zbee_sec_counter = -1;
|
||||
|
@ -65,12 +66,14 @@ static int hf_zbee_sec_src64 = -1;
|
|||
static int hf_zbee_sec_key_seqno = -1;
|
||||
static int hf_zbee_sec_mic = -1;
|
||||
static int hf_zbee_sec_key_origin = -1;
|
||||
static int hf_zbee_sec_decryption_key = -1;
|
||||
|
||||
/* Subtree pointers. */
|
||||
static gint ett_zbee_sec = -1;
|
||||
static gint ett_zbee_sec_control = -1;
|
||||
|
||||
static expert_field ei_zbee_sec_encrypted_payload = EI_INIT;
|
||||
static expert_field ei_zbee_sec_extended_source_unknown = EI_INIT;
|
||||
|
||||
static dissector_handle_t data_handle;
|
||||
|
||||
|
@ -209,6 +212,10 @@ static GSList *zbee_pc_keyring = NULL;
|
|||
void zbee_security_register(module_t *zbee_prefs, int proto)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_zbee_sec_field,
|
||||
{ "Security Control Field", "zbee.sec.field", FT_UINT8, BASE_HEX, NULL,
|
||||
0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_sec_key_id,
|
||||
{ "Key Id", "zbee.sec.key", FT_UINT8, BASE_HEX, VALS(zbee_sec_key_names),
|
||||
ZBEE_SEC_CONTROL_KEY, NULL, HFILL }},
|
||||
|
@ -235,6 +242,10 @@ void zbee_security_register(module_t *zbee_prefs, int proto)
|
|||
|
||||
{ &hf_zbee_sec_key_origin,
|
||||
{ "Key Origin", "zbee.sec.key.origin", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_zbee_sec_decryption_key,
|
||||
{ "Decryption Key", "zbee.sec.decryption_key", FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }}
|
||||
};
|
||||
|
||||
|
@ -245,6 +256,7 @@ void zbee_security_register(module_t *zbee_prefs, int proto)
|
|||
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_zbee_sec_encrypted_payload, { "zbee_sec.encrypted_payload", PI_UNDECODED, PI_WARN, "Encrypted Payload", EXPFILL }},
|
||||
{ &ei_zbee_sec_extended_source_unknown, { "zbee_sec.extended_source_unknown", PI_PROTOCOL, PI_NOTE, "Extended Source: Unknown", EXPFILL }},
|
||||
};
|
||||
|
||||
expert_module_t* expert_zbee_sec;
|
||||
|
@ -423,7 +435,6 @@ tvbuff_t *
|
|||
dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint offset)
|
||||
{
|
||||
proto_tree *sec_tree;
|
||||
proto_tree *field_tree;
|
||||
proto_item *ti;
|
||||
|
||||
zbee_security_packet packet;
|
||||
|
@ -443,6 +454,12 @@ dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint o
|
|||
ieee802154_hints_t *ieee_hints;
|
||||
ieee802154_map_rec *map_rec = NULL;
|
||||
|
||||
static const int * sec_flags[] = {
|
||||
&hf_zbee_sec_key_id,
|
||||
&hf_zbee_sec_nonce,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Init */
|
||||
memset(&packet, 0, sizeof(zbee_security_packet));
|
||||
|
||||
|
@ -481,15 +498,8 @@ dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint o
|
|||
packet.level = zbee_get_bit_field(packet.control, ZBEE_SEC_CONTROL_LEVEL);
|
||||
packet.key_id = zbee_get_bit_field(packet.control, ZBEE_SEC_CONTROL_KEY);
|
||||
packet.nonce = zbee_get_bit_field(packet.control, ZBEE_SEC_CONTROL_NONCE);
|
||||
if (tree) {
|
||||
ti = proto_tree_add_text(sec_tree, tvb, offset, 1, "Security Control Field");
|
||||
field_tree = proto_item_add_subtree(ti, ett_zbee_sec_control);
|
||||
|
||||
proto_tree_add_uint(field_tree, hf_zbee_sec_key_id, tvb, offset, 1,
|
||||
packet.control & ZBEE_SEC_CONTROL_KEY);
|
||||
proto_tree_add_boolean(field_tree, hf_zbee_sec_nonce, tvb, offset, 1,
|
||||
packet.control & ZBEE_SEC_CONTROL_NONCE);
|
||||
}
|
||||
proto_tree_add_bitmask(sec_tree, tvb, offset, hf_zbee_sec_field, ett_zbee_sec_control, sec_flags, ENC_NA);
|
||||
offset += 1;
|
||||
|
||||
/* Get and display the frame counter field. */
|
||||
|
@ -542,16 +552,16 @@ dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint o
|
|||
/* use the ieee extended source address for NWK decryption */
|
||||
if ( ieee_hints && (map_rec = ieee_hints->map_rec) )
|
||||
packet.src64 = map_rec->addr64;
|
||||
else if (tree)
|
||||
proto_tree_add_text(sec_tree, tvb, 0, 0, "[Extended Source: Unknown]");
|
||||
else
|
||||
proto_tree_add_expert(sec_tree, pinfo, &ei_zbee_sec_extended_source_unknown, tvb, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* use the nwk extended source address for APS decryption */
|
||||
if ( nwk_hints && (map_rec = nwk_hints->map_rec) )
|
||||
packet.src64 = map_rec->addr64;
|
||||
else if (tree)
|
||||
proto_tree_add_text(sec_tree, tvb, 0, 0, "[Extended Source: Unknown]");
|
||||
else
|
||||
proto_tree_add_expert(sec_tree, pinfo, &ei_zbee_sec_extended_source_unknown, tvb, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -707,7 +717,7 @@ dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint o
|
|||
if ( decrypted ) {
|
||||
if ( tree && key_rec ) {
|
||||
if ( key_rec->frame_num == ZBEE_SEC_PC_KEY ) {
|
||||
ti = proto_tree_add_text(sec_tree, tvb, 0, 0, "Decryption Key: %s", key_rec->label);
|
||||
ti = proto_tree_add_string(sec_tree, hf_zbee_sec_decryption_key, tvb, 0, 0, key_rec->label);
|
||||
} else {
|
||||
ti = proto_tree_add_uint(sec_tree, hf_zbee_sec_key_origin, tvb, 0, 0,
|
||||
key_rec->frame_num);
|
||||
|
|
|
@ -267,8 +267,7 @@ dissect_zcl_appl_idt_attr_id(proto_tree *tree, tvbuff_t *tvb, guint *offset)
|
|||
void
|
||||
dissect_zcl_appl_idt_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
|
||||
{
|
||||
proto_item *ti = NULL;
|
||||
proto_tree *sub_tree = NULL;
|
||||
proto_tree *sub_tree;
|
||||
guint64 value64;
|
||||
|
||||
/* Dissect attribute data type and data */
|
||||
|
@ -276,8 +275,8 @@ dissect_zcl_appl_idt_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, g
|
|||
|
||||
case ZBEE_ZCL_ATTR_ID_APPL_IDT_BASIC_IDENT:
|
||||
value64 = tvb_get_letoh56(tvb, *offset);
|
||||
ti = proto_tree_add_text(tree, tvb, *offset, 8, "Basic Identification: 0x%" G_GINT64_MODIFIER "x", value64);
|
||||
sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_appl_idt_basic);
|
||||
sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 8, ett_zbee_zcl_appl_idt_basic, NULL,
|
||||
"Basic Identification: 0x%" G_GINT64_MODIFIER "x", value64);
|
||||
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_appl_idt_company_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
|
||||
*offset += 2;
|
||||
|
@ -938,7 +937,6 @@ dissect_zcl_appl_evtalt_get_alerts_rsp(tvbuff_t *tvb, proto_tree *tree, guint *o
|
|||
|
||||
/* Retrieve "Alert Count" field */
|
||||
count = tvb_get_guint8(tvb, *offset) & ZBEE_ZCL_APPL_EVTALT_COUNT_NUM_MASK;
|
||||
proto_tree_add_text(tree, tvb, *offset, 1, "Alert Count: 0x%02x", count);
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_appl_evtalt_count_num, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_appl_evtalt_count_type, tvb, *offset, 1, ENC_NA);
|
||||
*offset += 1;
|
||||
|
|
|
@ -98,6 +98,7 @@ static int proto_zbee_zcl_msg = -1;
|
|||
static int hf_zbee_zcl_msg_srv_tx_cmd_id = -1;
|
||||
static int hf_zbee_zcl_msg_srv_rx_cmd_id = -1;
|
||||
static int hf_zbee_zcl_msg_message_id = -1;
|
||||
static int hf_zbee_zcl_msg_ctrl = -1;
|
||||
static int hf_zbee_zcl_msg_ctrl_tx = -1;
|
||||
static int hf_zbee_zcl_msg_ctrl_importance = -1;
|
||||
static int hf_zbee_zcl_msg_ctrl_reserved = -1;
|
||||
|
@ -257,24 +258,23 @@ dissect_zbee_zcl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
|
|||
static void
|
||||
dissect_zcl_msg_display(tvbuff_t *tvb, proto_tree *tree, guint *offset)
|
||||
{
|
||||
proto_tree *sub_tree = NULL;
|
||||
proto_item *ti;
|
||||
guint8 control;
|
||||
guint msg_len;
|
||||
guint8 *msg_data;
|
||||
|
||||
static const int * message_ctrl_flags[] = {
|
||||
&hf_zbee_zcl_msg_ctrl_tx,
|
||||
&hf_zbee_zcl_msg_ctrl_importance,
|
||||
&hf_zbee_zcl_msg_ctrl_reserved,
|
||||
&hf_zbee_zcl_msg_ctrl_confirm,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Retrieve "Message ID" field */
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_msg_message_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
|
||||
*offset += 4;
|
||||
|
||||
/* Retrieve "Message Control" field */
|
||||
control = tvb_get_guint8(tvb, *offset);
|
||||
ti = proto_tree_add_text(tree, tvb, *offset, 1, "Message Control: 0x%02x", control);
|
||||
sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_msg_message_control);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_tx, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_importance, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_reserved, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_confirm, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_msg_ctrl, ett_zbee_zcl_msg_message_control, message_ctrl_flags, ENC_NA);
|
||||
*offset += 1;
|
||||
|
||||
/* Retrieve "Start Time" field */
|
||||
|
@ -313,22 +313,20 @@ dissect_zcl_msg_display(tvbuff_t *tvb, proto_tree *tree, guint *offset)
|
|||
static void
|
||||
dissect_zcl_msg_cancel(tvbuff_t *tvb, proto_tree *tree, guint *offset)
|
||||
{
|
||||
proto_tree *sub_tree = NULL;
|
||||
proto_item *ti;
|
||||
guint8 control;
|
||||
static const int * message_ctrl_flags[] = {
|
||||
&hf_zbee_zcl_msg_ctrl_tx,
|
||||
&hf_zbee_zcl_msg_ctrl_importance,
|
||||
&hf_zbee_zcl_msg_ctrl_reserved,
|
||||
&hf_zbee_zcl_msg_ctrl_confirm,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Retrieve "Message ID" field */
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_msg_message_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
|
||||
*offset += 4;
|
||||
|
||||
/* Retrieve "Message Control" field */
|
||||
control = tvb_get_guint8(tvb, *offset);
|
||||
ti = proto_tree_add_text(tree, tvb, *offset, 1, "Message Control: 0x%02x", control);
|
||||
sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_msg_message_control);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_tx, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_importance, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_reserved, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_item(sub_tree, hf_zbee_zcl_msg_ctrl_confirm, tvb, *offset, 1, ENC_NA);
|
||||
proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_msg_ctrl, ett_zbee_zcl_msg_message_control, message_ctrl_flags, ENC_NA);
|
||||
*offset += 1;
|
||||
}
|
||||
|
||||
|
@ -461,6 +459,10 @@ proto_register_zbee_zcl_msg(void)
|
|||
0x00, NULL, HFILL } },
|
||||
|
||||
/* Start of 'Message Control' fields */
|
||||
{ &hf_zbee_zcl_msg_ctrl,
|
||||
{ "Message Control", "zbee_zcl_se.msg.message.ctrl", FT_UINT8, BASE_HEX, NULL,
|
||||
0x0, NULL, HFILL } },
|
||||
|
||||
{ &hf_zbee_zcl_msg_ctrl_tx,
|
||||
{ "Transmission", "zbee_zcl_se.msg.message.ctrl.tx", FT_UINT8, BASE_HEX, VALS(zbee_zcl_msg_ctrl_tx_names),
|
||||
ZBEE_ZCL_MSG_CTRL_TX_MASK, NULL, HFILL } },
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <glib.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/conversation.h>
|
||||
|
||||
#include "packet-ziop.h"
|
||||
|
@ -70,6 +71,7 @@ static gint hf_ziop_original_length = -1;
|
|||
|
||||
static gint ett_ziop = -1;
|
||||
|
||||
static expert_field ei_ziop_version = EI_INIT;
|
||||
|
||||
static dissector_handle_t data_handle;
|
||||
static dissector_handle_t ziop_tcp_handle;
|
||||
|
@ -114,33 +116,58 @@ dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
|
|||
|
||||
proto_tree *ziop_tree = NULL;
|
||||
proto_item *ti;
|
||||
guint8 flags;
|
||||
guint byte_order;
|
||||
const char *label = "none";
|
||||
|
||||
if (tvb_reported_length(tvb) < 7)
|
||||
return 0;
|
||||
|
||||
col_set_str (pinfo->cinfo, COL_PROTOCOL, ZIOP_MAGIC);
|
||||
|
||||
/* Clear out stuff in the info column */
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
giop_version_major = tvb_get_guint8(tvb, 4);
|
||||
giop_version_minor = tvb_get_guint8(tvb, 5);
|
||||
message_type = tvb_get_guint8(tvb, 7);
|
||||
ti = proto_tree_add_item (tree, proto_ziop, tvb, 0, -1, ENC_NA);
|
||||
ziop_tree = proto_item_add_subtree (ti, ett_ziop);
|
||||
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_magic, tvb, offset, 4, ENC_ASCII|ENC_NA);
|
||||
offset += 4;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_giop_version_major, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
giop_version_major = tvb_get_guint8(tvb, offset);
|
||||
offset++;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_giop_version_minor, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
giop_version_minor = tvb_get_guint8(tvb, offset);
|
||||
offset++;
|
||||
|
||||
if ( (giop_version_major < 1) ||
|
||||
(giop_version_minor < 2) ) /* earlier than GIOP 1.2 */
|
||||
{
|
||||
{
|
||||
col_add_fstr (pinfo->cinfo, COL_INFO, "Version %u.%u",
|
||||
giop_version_major, giop_version_minor);
|
||||
if (tree)
|
||||
{
|
||||
ti = proto_tree_add_item (tree, proto_ziop, tvb, 0, -1, ENC_NA);
|
||||
ziop_tree = proto_item_add_subtree (ti, ett_ziop);
|
||||
proto_tree_add_text (ziop_tree, tvb, 4, 2,
|
||||
|
||||
expert_add_info_format(pinfo, ti, &ei_ziop_version,
|
||||
"Version %u.%u not supported",
|
||||
giop_version_major,
|
||||
giop_version_minor);
|
||||
}
|
||||
|
||||
call_dissector(data_handle, tvb, pinfo, tree);
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
return tvb_reported_length(tvb);
|
||||
}
|
||||
|
||||
flags = tvb_get_guint8(tvb, offset);
|
||||
byte_order = (flags & 0x01) ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN;
|
||||
|
||||
if (flags & 0x01) {
|
||||
label = "little-endian";
|
||||
}
|
||||
proto_tree_add_uint_format_value(ziop_tree, hf_ziop_flags, tvb, offset, 1,
|
||||
flags, "0x%02x (%s)", flags, label);
|
||||
offset++;
|
||||
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_message_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
message_type = tvb_get_guint8(tvb, offset);
|
||||
offset++;
|
||||
|
||||
col_add_fstr (pinfo->cinfo, COL_INFO, "ZIOP %u.%u %s",
|
||||
giop_version_major,
|
||||
|
@ -149,43 +176,13 @@ dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
|
|||
"Unknown message type (0x%02x)")
|
||||
);
|
||||
|
||||
if (tree)
|
||||
{
|
||||
guint8 flags;
|
||||
guint byte_order;
|
||||
const char *label = "none";
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_message_size, tvb, offset, 4, byte_order);
|
||||
offset += 4;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_compressor_id, tvb, offset, 2, byte_order);
|
||||
offset += 4;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_original_length, tvb, offset, 4, byte_order);
|
||||
|
||||
ti = proto_tree_add_item (tree, proto_ziop, tvb, 0, -1, ENC_NA);
|
||||
ziop_tree = proto_item_add_subtree (ti, ett_ziop);
|
||||
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_magic, tvb, offset, 4, ENC_ASCII|ENC_NA);
|
||||
offset += 4;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_giop_version_major, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_giop_version_minor, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
||||
flags = tvb_get_guint8(tvb, offset);
|
||||
byte_order = (flags & 0x01) ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN;
|
||||
|
||||
if (flags & 0x01) {
|
||||
label = "little-endian";
|
||||
}
|
||||
proto_tree_add_uint_format_value(ziop_tree, hf_ziop_flags, tvb, offset, 1,
|
||||
flags, "0x%02x (%s)", flags, label);
|
||||
offset++;
|
||||
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_message_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_message_size, tvb, offset, 4, byte_order);
|
||||
offset += 4;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_compressor_id, tvb, offset, 2, byte_order);
|
||||
offset += 4;
|
||||
proto_tree_add_item(ziop_tree, hf_ziop_original_length, tvb, offset, 4, byte_order);
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
return tvb_reported_length(tvb);
|
||||
}
|
||||
|
||||
static guint
|
||||
|
@ -315,10 +312,18 @@ proto_register_ziop (void)
|
|||
&ett_ziop
|
||||
};
|
||||
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_ziop_version, { "ziop.version_not_supported", PI_PROTOCOL, PI_WARN, "Version not supported", EXPFILL }},
|
||||
};
|
||||
|
||||
expert_module_t* expert_ziop;
|
||||
|
||||
proto_ziop = proto_register_protocol("Zipped Inter-ORB Protocol", "ZIOP",
|
||||
"ziop");
|
||||
proto_register_field_array (proto_ziop, hf, array_length (hf));
|
||||
proto_register_subtree_array (ett, array_length (ett));
|
||||
expert_ziop = expert_register_protocol(proto_ziop);
|
||||
expert_register_field_array(expert_ziop, ei, array_length(ei));
|
||||
|
||||
new_register_dissector("ziop", dissect_ziop, proto_ziop);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue