aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-tipc.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-tipc.c')
-rw-r--r--epan/dissectors/packet-tipc.c73
1 files changed, 45 insertions, 28 deletions
diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c
index 667e257c9a..ae93661a63 100644
--- a/epan/dissectors/packet-tipc.c
+++ b/epan/dissectors/packet-tipc.c
@@ -34,6 +34,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/etypes.h>
#include <epan/wmem/wmem.h>
#include <epan/reassemble.h>
@@ -97,6 +98,7 @@ static int hf_tipc_seq_gap = -1;
static int hf_tipc_nxt_snt_pkg = -1;
static int hf_tipc_unused3 = -1;
static int hf_tipc_bearer_name = -1;
+static int hf_tipc_data = -1;
static int hf_tipc_name_dist_type = -1;
static int hf_tipc_name_dist_lower = -1;
@@ -183,6 +185,8 @@ static gint ett_tipc_msg_fragments = -1;
static gint ett_tipc = -1;
static gint ett_tipc_data = -1;
+static expert_field ei_tipc_words_unused_for_user = EI_INIT;
+
/* protocol preferences */
static gboolean tipc_defragment = TRUE;
static gboolean dissect_tipc_data = TRUE;
@@ -867,11 +871,11 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
offset = offset + 4;
if (handle_v2_as & (V2_AS_1_6)) {
/* W4-8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 20, "words 4-8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 20, "words 4-8 unused for this user");
offset = offset + 20;
} else {
/* W4 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 4 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 4 unused for this user");
offset = offset + 4;
/* W5 */
proto_tree_add_item(tipc_tree, hf_tipcv2_network_id, tipc_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -887,7 +891,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
offset = offset + 4;
/* W8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 8 unused for this user");
offset = offset + 4;
}
/* W9 */
@@ -899,7 +903,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
if (handle_v2_as & (V2_AS_1_6)) {
/* W1+W2 */
/* No message types */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 1+2 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 8, "words 1+2 unused for this user");
offset = offset + 8;
} else {
/* W1 */
@@ -918,11 +922,11 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
offset = offset + 4;
if (handle_v2_as & (V2_AS_1_6)) {
/* W4-8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 20, "words 4-8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 20, "words 4-8 unused for this user");
offset = offset + 20;
} else {
/* W4+5 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 4+5 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 8, "words 4+5 unused for this user");
offset = offset + 8;
/* W6 */
dword = tvb_get_ntohl(tipc_tvb, offset);
@@ -935,7 +939,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
offset = offset + 4;
/* W8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 8 unused for this user");
offset = offset + 4;
}
/* W9 */
@@ -1013,7 +1017,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
offset = offset + 4;
if (handle_v2_as & (V2_AS_1_6)) {
/* W6-8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 12, "words 6-8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 12, "words 6-8 unused for this user");
offset = offset + 12;
} else {
/* W6 */
@@ -1104,7 +1108,8 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
/* according to Allan Stephens this was never verfied by the receiver
proto_tree_add_item(tipc_tree, hf_tipcv2_transport_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN);
*/
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user (might be set prior to 1.7.3 but was never verified)");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4,
+ "word 8 unused for this user (might be set prior to 1.7.3 but was never verified)");
offset = offset + 4;
@@ -1149,11 +1154,11 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
if (handle_v2_as & V2_AS_1_6) {
/* W4-9 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 24, "words 4-9 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 24, "words 4-9 unused for this user");
offset = offset + 24;
} else {
/* W4 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 4 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 4 unused for this user");
offset = offset + 4;
/* W5 */
proto_tree_add_item(tipc_tree, hf_tipc_dst_port, tipc_tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -1169,7 +1174,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
offset = offset + 4;
/* W8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 8 unused for this user");
offset = offset + 4;
/* W9 */
dword = tvb_get_ntohl(tipc_tvb, offset);
@@ -1238,7 +1243,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
offset = offset + 4;
/* W4 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 4 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 4 unused for this user");
offset = offset + 4;
/* W5 */
/* the following two fields appear in this user according to */
@@ -1253,7 +1258,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
/* W6-W8 */
if (handle_v2_as & (V2_AS_1_6)) {
/* W6-8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 12, "words 6-8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 12, "words 6-8 unused for this user");
offset = offset + 12;
} else {
/* W6 */
@@ -1267,7 +1272,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
offset = offset + 4;
/* W8 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 8 unused for this user");
offset = offset + 4;
}
/* W9 */
@@ -1275,7 +1280,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
{
case 0:
/* DUPLICATE_MSG */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 9 unused for this message type");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 9 unused for this message type");
break;
case 1:
/* ORIGINAL_MSG */
@@ -1302,7 +1307,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr);
offset = offset + 4;
/* W4+W5 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 4+5 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 8, "words 4+5 unused for this user");
offset = offset + 8;
/* W6 */
/* Originating Node: 32 bits. */
@@ -1322,12 +1327,12 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_item(tipc_tree, hf_tipcv2_transport_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN);
offset = offset + 4;
} else {
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 8 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 8 unused for this user");
offset = offset + 4;
}
/* W9 */
if (handle_v2_as & V2_AS_1_6) {
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 9 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 9 unused for this user");
offset = offset + 4;
} else {
dword = tvb_get_ntohl(tipc_tvb, offset);
@@ -1365,11 +1370,11 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
offset = offset + 4;
if (handle_v2_as & (V2_AS_1_6)) {
/* W5-W9 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 20, "words 5-9 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 20, "words 5-9 unused for this user");
offset = offset + 20;
} else {
/* W5 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "word 5 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 4, "word 5 unused for this user");
offset = offset + 4;
/* W6 */
dword = tvb_get_ntohl(tipc_tvb, offset);
@@ -1382,7 +1387,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr);
offset = offset + 4;
/* W8+9 */
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, 8, "words 8+9 unused for this user");
+ proto_tree_add_expert_format(tipc_tree, pinfo, &ei_tipc_words_unused_for_user, tipc_tvb, offset, 8, "words 8+9 unused for this user");
offset = offset + 8;
}
@@ -1997,7 +2002,7 @@ dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tr
}
break;
default:
- proto_tree_add_text(tipc_tree, tvb, offset, -1, "%u bytes Data", (msg_size - 28));
+ proto_tree_add_item(tipc_tree, hf_tipc_data, tvb, offset, -1, ENC_NA);
break;
}
}
@@ -2216,7 +2221,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
should be by far the most frequent one this small optimization pays off.
*/
if (hdr_size <= 6) {
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "%u bytes Data", (msg_size - hdr_size*4));
+ proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA);
} else {
switch (user) {
case TIPC_NAME_DISTRIBUTOR:
@@ -2280,18 +2285,18 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
guint32 *name_type_p = &msg_type32;
switch (msg_type) {
case TIPC_CONNECTED_MSG:
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "%u bytes Data", (msg_size - hdr_size*4));
+ proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA);
break;
case TIPC_NAMED_MSG:
data_tvb = tvb_new_subset_remaining(tipc_tvb, offset+14);
proto_tree_add_text(tipc_tree, tipc_tvb, offset, 14, "TIPC_NAMED_MSG Hdr");
- proto_tree_add_text(tipc_tree, data_tvb, 0, -1, "%u bytes Data", (msg_size - hdr_size*4));
+ proto_tree_add_item(tipc_tree, hf_tipc_data, data_tvb, 0, -1, ENC_NA);
break;
case TIPC_DIRECT_MSG:
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "%u bytes Data", (msg_size - hdr_size*4));
+ proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA);
break;
default:
- proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "%u bytes Data", (msg_size - hdr_size*4));
+ proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA);
break;
}
/* tipc data type user doesn't change format, reuse v2 function */
@@ -2538,6 +2543,11 @@ proto_register_tipc(void)
FT_STRINGZ, BASE_NONE, NULL, 0x0,
"TIPC Bearer name", HFILL }
},
+ { &hf_tipc_data,
+ { "Data", "tipc.data",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
{ &hf_tipc_name_dist_type,
{ "Published port name type", "tipc.name_dist_type",
FT_UINT32, BASE_DEC, NULL, 0xffffffff,
@@ -2890,7 +2900,12 @@ proto_register_tipc(void)
&ett_tipc_msg_fragments
};
+ static ei_register_info ei[] = {
+ { &ei_tipc_words_unused_for_user, { "tipc.words_unused_for_user", PI_PROTOCOL, PI_WARN, "words unused for this user", EXPFILL }},
+ };
+
module_t *tipc_module;
+ expert_module_t* expert_tipc;
/* options for the enum in the protocol preferences */
static const enum_val_t handle_v2_as_options[] = {
@@ -2907,6 +2922,8 @@ proto_register_tipc(void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_tipc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_tipc = expert_register_protocol(proto_tipc);
+ expert_register_field_array(expert_tipc, ei, array_length(ei));
/* allow other protocols to be called according to specific values in order to
* dissect the protocols sent by TIPC */