aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2012-10-16 03:07:06 +0000
committerMichael Mann <mmann78@netscape.net>2012-10-16 03:07:06 +0000
commit7fb78ec5b9cccbad9bd98f4a9cf1802bf6117737 (patch)
tree6b52d76ad59817c00338c5ba8cbdee0b84aec675 /epan
parent8a10d8ddb526dabd895c8d3a02c84fe0ce1870b0 (diff)
replace proto_tree_add_text with filterable items and expert info to get a few dissectors off of the checkAPIs.pl "naughty" list
svn path=/trunk/; revision=45572
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-amr.c19
-rw-r--r--epan/dissectors/packet-ipvs-syncd.c102
-rw-r--r--epan/dissectors/packet-ipxwan.c111
-rw-r--r--epan/dissectors/packet-nbipx.c125
-rw-r--r--epan/dissectors/packet-noe.c433
-rw-r--r--epan/dissectors/packet-xdmcp.c241
6 files changed, 568 insertions, 463 deletions
diff --git a/epan/dissectors/packet-amr.c b/epan/dissectors/packet-amr.c
index 09c5ab60fa..6efef0b0e9 100644
--- a/epan/dissectors/packet-amr.c
+++ b/epan/dissectors/packet-amr.c
@@ -211,17 +211,18 @@ static const true_false_string amr_sti_vals = {
/* See 3GPP TS 26.101 chapter 4 for AMR-NB IF1 */
static void
-dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree){
+dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){
int offset = 0;
guint8 octet;
+ proto_item *ti;
proto_tree_add_item(tree, hf_amr_nb_if1_ft, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_amr_if1_fqi, tvb, offset, 1, ENC_BIG_ENDIAN);
octet = (tvb_get_guint8(tvb,offset) & 0xf0) >> 4;
if (octet == AMR_NB_SID){
- proto_tree_add_item(tree, hf_amr_nb_if1_mode_req, tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(tree, hf_amr_nb_if1_mode_req, tvb, offset+1, 1, ENC_BIG_ENDIAN);
if (tvb_get_guint8(tvb,offset+1) & 0x1f)
- proto_tree_add_text(tree, tvb, offset+1, 1, "Error:Spare bits not 0");
+ expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Error:Spare bits not 0");
proto_tree_add_text(tree, tvb, offset+2, 5, "Speech data");
proto_tree_add_item(tree, hf_amr_if1_sti, tvb, offset+7, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_amr_nb_if1_sti_mode_ind, tvb, offset+7, 1, ENC_BIG_ENDIAN);
@@ -230,9 +231,9 @@ dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree){
proto_tree_add_item(tree, hf_amr_nb_if1_mode_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
- proto_tree_add_item(tree, hf_amr_nb_if1_mode_req, tvb, offset, 1, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(tree, hf_amr_nb_if1_mode_req, tvb, offset, 1, ENC_BIG_ENDIAN);
if (tvb_get_guint8(tvb,offset) & 0x1f)
- proto_tree_add_text(tree, tvb, offset, 1, "Error:Spare bits not 0");
+ expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Error:Spare bits not 0");
offset++;
proto_tree_add_text(tree, tvb, offset, -1, "Speech data");
@@ -240,13 +241,15 @@ dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree){
/* See 3GPP TS 26.201 for AMR-WB */
static void
-dissect_amr_wb_if1(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree){
+dissect_amr_wb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){
int offset = 0;
guint8 octet;
+ proto_item *ti;
+
proto_tree_add_item(tree, hf_amr_wb_if1_ft, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(tree, hf_amr_if1_fqi, tvb, offset, 1, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(tree, hf_amr_if1_fqi, tvb, offset, 1, ENC_BIG_ENDIAN);
if (tvb_get_guint8(tvb,offset) & 0x03)
- proto_tree_add_text(tree, tvb, offset, 1, "Error:Spare bits not 0");
+ expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Error:Spare bits not 0");
octet = (tvb_get_guint8(tvb,offset) & 0xf0) >> 4;
if (octet == AMR_WB_SID){
proto_tree_add_item(tree, hf_amr_wb_if1_mode_req, tvb, offset+1, 1, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-ipvs-syncd.c b/epan/dissectors/packet-ipvs-syncd.c
index dba50786c1..8084736a0b 100644
--- a/epan/dissectors/packet-ipvs-syncd.c
+++ b/epan/dissectors/packet-ipvs-syncd.c
@@ -43,6 +43,13 @@ static int hf_caddr = -1;
static int hf_vaddr = -1;
static int hf_daddr = -1;
static int hf_flags = -1;
+static int hf_flags_conn_type = -1;
+static int hf_flags_hashed_entry = -1;
+static int hf_flags_no_output_packets = -1;
+static int hf_flags_conn_not_established = -1;
+static int hf_flags_adjust_output_seq = -1;
+static int hf_flags_adjust_input_seq = -1;
+static int hf_flags_no_client_port_set = -1;
static int hf_state = -1;
static int hf_in_seq_init = -1;
static int hf_in_seq_delta = -1;
@@ -89,6 +96,14 @@ static const value_string state_strings[] = {
#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
+static const value_string connection_type_strings[] = {
+ {IP_VS_CONN_F_MASQ, "Masquerade"},
+ {IP_VS_CONN_F_LOCALNODE, "Local Node"},
+ {IP_VS_CONN_F_TUNNEL, "Tunnel"},
+ {IP_VS_CONN_F_DROUTE, "Direct Routing"},
+ {0x00, NULL},
+};
+
static void
dissect_ipvs_syncd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
@@ -152,58 +167,13 @@ dissect_ipvs_syncd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
flags = tvb_get_ntohs(tvb, offset);
fi = proto_tree_add_item(ctree, hf_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
ftree = proto_item_add_subtree(fi, ett_flags);
-
- if ( (flags & 0x0F) == IP_VS_CONN_F_MASQ )
- {
- proto_tree_add_text(ftree, tvb, offset+1, 1, "Connection Type: Masquerade");
- }
- else if ( (flags & 0x0F) == IP_VS_CONN_F_LOCALNODE )
- {
- proto_tree_add_text(ftree, tvb, offset+1, 1, "Connection Type: Local Node");
- }
- else if ( (flags & 0x0F) == IP_VS_CONN_F_TUNNEL )
- {
- proto_tree_add_text(ftree, tvb, offset+1, 1, "Connection Type: Tunnel");
- }
- else if ( (flags & 0x0F) == IP_VS_CONN_F_DROUTE )
- {
- proto_tree_add_text(ftree, tvb, offset+1, 1, "Connection Type: Direct Routing");
- }
- else
- {
- proto_tree_add_text(ftree, tvb, offset+1, 1, "Connection Type: Unknown (%d)",
- flags & IP_VS_CONN_F_FWD_MASK);
- }
-
- if ( flags & IP_VS_CONN_F_HASHED )
- {
- proto_tree_add_text(ftree, tvb, offset+1, 1, "Hashed Entry");
- }
-
- if ( flags & IP_VS_CONN_F_NOOUTPUT )
- {
- proto_tree_add_text(ftree, tvb, offset+1, 1, "No Output Packets");
- }
-
- if ( flags & IP_VS_CONN_F_INACTIVE )
- {
- proto_tree_add_text(ftree, tvb, offset, 1, "Connection Not Established");
- }
-
- if ( flags & IP_VS_CONN_F_OUT_SEQ )
- {
- proto_tree_add_text(ftree, tvb, offset, 1, "Adjust Output Sequence");
- }
-
- if ( flags & IP_VS_CONN_F_IN_SEQ )
- {
- proto_tree_add_text(ftree, tvb, offset, 1, "Adjust Input Sequence");
- }
-
- if ( flags & IP_VS_CONN_F_NO_CPORT )
- {
- proto_tree_add_text(ftree, tvb, offset, 1, "No Client Port Set");
- }
+ proto_tree_add_item(ctree, hf_flags_conn_type, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(ctree, hf_flags_hashed_entry, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(ctree, hf_flags_no_output_packets, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(ctree, hf_flags_conn_not_established, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(ctree, hf_flags_adjust_output_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(ctree, hf_flags_adjust_input_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(ctree, hf_flags_no_client_port_set, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
@@ -287,6 +257,34 @@ proto_register_ipvs_syncd(void)
{ "Flags", "ipvs.flags", FT_UINT16, BASE_HEX,
NULL, 0, NULL, HFILL }},
+ { &hf_flags_conn_type,
+ { "Connection Type", "ipvs.flags.conn_type", FT_UINT16, BASE_HEX,
+ VALS(connection_type_strings), 0x0F, NULL, HFILL }},
+
+ { &hf_flags_hashed_entry,
+ { "Hashed Entry", "ipvs.flags.hashed_entry", FT_BOOLEAN, 16,
+ TFS(&tfs_true_false), IP_VS_CONN_F_HASHED, NULL, HFILL }},
+
+ { &hf_flags_no_output_packets,
+ { "No Output Packets", "ipvs.flags.no_output_packets", FT_BOOLEAN, 16,
+ TFS(&tfs_true_false), IP_VS_CONN_F_NOOUTPUT, NULL, HFILL }},
+
+ { &hf_flags_conn_not_established,
+ { "Connection Not Established", "ipvs.flags.conn_not_established", FT_BOOLEAN, 16,
+ TFS(&tfs_true_false), IP_VS_CONN_F_INACTIVE, NULL, HFILL }},
+
+ { &hf_flags_adjust_output_seq,
+ { "Adjust Output Sequence", "ipvs.flags.adjust_output_seq", FT_BOOLEAN, 16,
+ TFS(&tfs_true_false), IP_VS_CONN_F_OUT_SEQ, NULL, HFILL }},
+
+ { &hf_flags_adjust_input_seq,
+ { "Adjust Input Sequence", "ipvs.flags.adjust_input_seq", FT_BOOLEAN, 16,
+ TFS(&tfs_true_false), IP_VS_CONN_F_IN_SEQ, NULL, HFILL }},
+
+ { &hf_flags_no_client_port_set,
+ { "No Client Port Set", "ipvs.flags.no_client_port_set", FT_BOOLEAN, 16,
+ TFS(&tfs_true_false), IP_VS_CONN_F_NO_CPORT, NULL, HFILL }},
+
{ &hf_state,
{ "State", "ipvs.state", FT_UINT16, BASE_HEX,
VALS(state_strings), 0, NULL, HFILL }},
diff --git a/epan/dissectors/packet-ipxwan.c b/epan/dissectors/packet-ipxwan.c
index 481fe003fe..a22e1df91b 100644
--- a/epan/dissectors/packet-ipxwan.c
+++ b/epan/dissectors/packet-ipxwan.c
@@ -26,6 +26,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include "packet-ipx.h"
/*
@@ -53,6 +54,11 @@ static int hf_ipxwan_delta_time = -1;
static int hf_ipxwan_extended_node_id = -1;
static int hf_ipxwan_node_number = -1;
static int hf_ipxwan_compression_type = -1;
+static int hf_ipxwan_compression_options = -1;
+static int hf_ipxwan_compression_slots = -1;
+static int hf_ipxwan_compression_parameters = -1;
+static int hf_ipxwan_padding = -1;
+static int hf_ipxwan_option_value = -1;
static gint ett_ipxwan = -1;
static gint ett_ipxwan_option = -1;
@@ -190,10 +196,8 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case OPT_ROUTING_TYPE:
if (option_data_len != 1) {
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Bogus length: %u, should be 1",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be 1", option_data_len);
} else {
proto_tree_add_item(option_tree,
hf_ipxwan_routing_type, tvb,
@@ -203,10 +207,8 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case OPT_RIP_SAP_INFO_EXCHANGE:
if (option_data_len != 54) {
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Bogus length: %u, should be 54",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be 54", option_data_len);
} else {
wan_link_delay = tvb_get_ntohs(tvb,
offset);
@@ -226,10 +228,8 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case OPT_NLSP_INFORMATION:
if (option_data_len != 8) {
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Bogus length: %u, should be 8",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be 8", option_data_len);
} else {
delay = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint_format(option_tree,
@@ -247,10 +247,8 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case OPT_NLSP_RAW_THROUGHPUT_DATA:
if (option_data_len != 8) {
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Bogus length: %u, should be 8",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be 8", option_data_len);
} else {
proto_tree_add_item(option_tree,
hf_ipxwan_request_size, tvb,
@@ -266,10 +264,8 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case OPT_EXTENDED_NODE_ID:
if (option_data_len != 4) {
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Bogus length: %u, should be 4",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be 4", option_data_len);
} else {
proto_tree_add_item(option_tree,
hf_ipxwan_extended_node_id, tvb,
@@ -279,10 +275,8 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case OPT_NODE_NUMBER:
if (option_data_len != 6) {
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Bogus length: %u, should be 6",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be 6", option_data_len);
} else {
proto_tree_add_item(option_tree,
hf_ipxwan_node_number, tvb,
@@ -292,61 +286,44 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case OPT_COMPRESSION:
if (option_data_len < 1) {
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Bogus length: %u, should be >= 1",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be >= 1", option_data_len);
} else {
compression_type = tvb_get_guint8(tvb,
offset);
- proto_tree_add_uint(option_tree,
+ ti = proto_tree_add_uint(option_tree,
hf_ipxwan_compression_type, tvb,
offset, 1, compression_type);
switch (compression_type) {
case COMP_TYPE_TELEBIT:
if (option_data_len < 3) {
- proto_tree_add_text(option_tree,
- tvb, offset+1,
- option_data_len-1,
- "Bogus length: %u, should be >= 3",
- option_data_len);
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Bogus length: %u, should be >= 3", option_data_len);
} else {
- proto_tree_add_text(
- option_tree,
- tvb, offset+1, 1,
- "Compression options: 0x%02x",
- tvb_get_guint8(tvb,
- offset+1));
- proto_tree_add_text(
- option_tree,
- tvb, offset+2, 1,
- "Number of compression slots: %u",
- tvb_get_guint8(tvb,
- offset+2));
+ proto_tree_add_item(option_tree, hf_ipxwan_compression_options,
+ tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(option_tree, hf_ipxwan_compression_slots,
+ tvb, offset+2, 1, ENC_BIG_ENDIAN);
}
break;
default:
- proto_tree_add_text(option_tree,
- tvb, offset+1,
- option_data_len-1,
- "Option parameters");
+ proto_tree_add_item(option_tree, hf_ipxwan_compression_parameters,
+ tvb, offset+1, option_data_len-1, ENC_NA);
break;
}
}
break;
case OPT_PAD:
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Padding");
+ proto_tree_add_item(option_tree, hf_ipxwan_padding,
+ tvb, offset, option_data_len, ENC_NA);
break;
default:
- proto_tree_add_text(option_tree,
- tvb, offset, option_data_len,
- "Option value");
+ proto_tree_add_item(option_tree, hf_ipxwan_option_value,
+ tvb, offset, option_data_len, ENC_NA);
break;
}
@@ -437,6 +414,28 @@ proto_register_ipxwan(void)
{ "Compression Type", "ipxwan.compression.type",
FT_UINT8, BASE_DEC, VALS(ipxwan_compression_type_vals), 0x0,
NULL, HFILL }},
+
+ { &hf_ipxwan_compression_options,
+ { "Compression options", "ipxwan.compression.options",
+ FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_ipxwan_compression_slots,
+ { "Number of compression slots", "ipxwan.compression.slots",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ { &hf_ipxwan_compression_parameters,
+ { "Option parameters", "ipxwan.compression.parameters",
+ FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+
+ { &hf_ipxwan_padding,
+ { "Padding", "ipxwan.padding",
+ FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+
+ { &hf_ipxwan_option_value,
+ { "Option value", "ipxwan.option_value",
+ FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
};
static gint *ett[] = {
&ett_ipxwan,
diff --git a/epan/dissectors/packet-nbipx.c b/epan/dissectors/packet-nbipx.c
index d2e20016c4..e83e87abc5 100644
--- a/epan/dissectors/packet-nbipx.c
+++ b/epan/dissectors/packet-nbipx.c
@@ -31,6 +31,7 @@
#include "packet-netbios.h"
static int proto_nbipx = -1;
+static int hf_nbipx_packettype = -1;
static int hf_nbipx_name_flags = -1;
static int hf_nbipx_name_flags_group = -1;
static int hf_nbipx_name_flags_in_use = -1;
@@ -43,14 +44,20 @@ static int hf_nbipx_conn_control_ack = -1;
static int hf_nbipx_conn_control_attention = -1;
static int hf_nbipx_conn_control_end_msg = -1;
static int hf_nbipx_conn_control_resend = -1;
+static int hf_nbipx_session_src_conn_id = -1;
+static int hf_nbipx_session_dest_conn_id = -1;
+static int hf_nbipx_session_send_seq_number = -1;
+static int hf_nbipx_session_total_data_length = -1;
+static int hf_nbipx_session_offset = -1;
+static int hf_nbipx_session_data_length = -1;
+static int hf_nbipx_session_recv_seq_number = -1;
+static int hf_nbipx_session_bytes_received = -1;
static gint ett_nbipx = -1;
static gint ett_nbipx_conn_ctrl = -1;
static gint ett_nbipx_name_type_flags = -1;
static void dissect_conn_control(tvbuff_t *tvb, int offset, proto_tree *tree);
-static void dissect_packet_type(tvbuff_t *tvb, int offset, guint8 packet_type,
- proto_tree *tree);
/* There is no RFC or public specification of Netware or Microsoft
* NetBIOS over IPX packets. I have had to decode the protocol myself,
@@ -208,6 +215,7 @@ add_routers(proto_tree *tree, tvbuff_t *tvb, int offset)
rtr_offset = offset + (i << 2);
tvb_memcpy(tvb, (guint8 *)&router, rtr_offset, 4);
if (router != 0) {
+ /* XXX - proto_tree_add_item with FT_IPXNET type? */
proto_tree_add_text(tree, tvb, rtr_offset, 4,
"IPX Network: %s",
ipxnet_to_string((guint8*)&router));
@@ -309,7 +317,7 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
offset += 1;
- dissect_packet_type(tvb, offset, packet_type, nbipx_tree);
+ proto_tree_add_uint(nbipx_tree, hf_nbipx_packettype, tvb, offset, 1, packet_type);
offset += 1;
if (nbipx_tree)
@@ -332,63 +340,31 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_conn_control(tvb, offset, nbipx_tree);
offset += 1;
- dissect_packet_type(tvb, offset, packet_type, nbipx_tree);
+ proto_tree_add_uint(nbipx_tree, hf_nbipx_packettype, tvb, offset, 1, packet_type);
offset += 1;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Source connection ID: 0x%04X",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_src_conn_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Destination connection ID: 0x%04X",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_dest_conn_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Send sequence number: %u",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_send_seq_number, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Total data length: %u",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_total_data_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Offset: %u",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Data length: %u",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_data_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Receive sequence number: %u",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_recv_seq_number, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- if (nbipx_tree) {
- proto_tree_add_text(nbipx_tree, tvb, offset, 2,
- "Bytes received: %u",
- tvb_get_letohs(tvb, offset));
- }
+ proto_tree_add_item(nbipx_tree, hf_nbipx_session_bytes_received, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
/*
@@ -405,7 +381,7 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_conn_control(tvb, offset, nbipx_tree);
offset += 1;
- dissect_packet_type(tvb, offset, packet_type, nbipx_tree);
+ proto_tree_add_uint(nbipx_tree, hf_nbipx_packettype, tvb, offset, 1, packet_type);
offset += 1;
if (nbipx_tree)
@@ -438,7 +414,7 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* The second byte is a data stream type byte.
*/
- dissect_packet_type(tvb, offset, packet_type, nbipx_tree);
+ proto_tree_add_uint(nbipx_tree, hf_nbipx_packettype, tvb, offset, 1, packet_type);
offset += 1;
/*
@@ -476,22 +452,15 @@ dissect_conn_control(tvbuff_t *tvb, int offset, proto_tree *tree)
}
}
-static void
-dissect_packet_type(tvbuff_t *tvb, int offset, guint8 packet_type,
- proto_tree *tree)
-{
- if (tree) {
- proto_tree_add_text(tree, tvb, offset, 1,
- "Packet Type: %s (%02X)",
- val_to_str_const(packet_type, nbipx_data_stream_type_vals, "Unknown"),
- packet_type);
- }
-}
-
void
proto_register_nbipx(void)
{
static hf_register_info hf[] = {
+ { &hf_nbipx_packettype,
+ { "Packet Type", "nmpi.packettype",
+ FT_UINT8, BASE_HEX, VALS(nbipx_data_stream_type_vals), 0,
+ NULL, HFILL }
+ },
{ &hf_nbipx_name_flags,
{ "Name type flag", "nmpi.name_flags",
FT_UINT8, BASE_HEX, NULL, 0,
@@ -552,6 +521,46 @@ proto_register_nbipx(void)
FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
NULL, HFILL }
},
+ { &hf_nbipx_session_src_conn_id,
+ { "Source connection ID", "nmpi.session.src_conn_id",
+ FT_UINT16, BASE_HEX, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_nbipx_session_dest_conn_id,
+ { "Destination connection ID", "nmpi.session.dest_conn_id",
+ FT_UINT16, BASE_HEX, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_nbipx_session_send_seq_number,
+ { "Send sequence number", "nmpi.session.send_seq_number",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_nbipx_session_total_data_length,
+ { "Total data length", "nmpi.session.total_data_length",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_nbipx_session_offset,
+ { "Offset", "nmpi.session.offset",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_nbipx_session_data_length,
+ { "Data length", "nmpi.session.data_length",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_nbipx_session_recv_seq_number,
+ { "Receive sequence number", "nmpi.session.recv_seq_number",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_nbipx_session_bytes_received,
+ { "Bytes received", "nmpi.session.bytes_received",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
};
static gint *ett[] = {
diff --git a/epan/dissectors/packet-noe.c b/epan/dissectors/packet-noe.c
index e4d73e04e5..33b3f67987 100644
--- a/epan/dissectors/packet-noe.c
+++ b/epan/dissectors/packet-noe.c
@@ -592,18 +592,29 @@ static gint ett_noe = -1;
static gint ett_body = -1;
static gint ett_property = -1;
static gint ett_value = -1;
-static int hf_noe_length = -1;
-static int hf_noe_server = -1;
-static int hf_noe_method_ack = -1;
-static int hf_noe_method = -1;
-static int hf_noe_class = -1;
-static int hf_noe_event = -1;
-static int hf_noe_objectid = -1;
-static int hf_noe_method_index = -1;
-static int hf_noe_pcode = -1;
-static int hf_noe_psize = -1;
-static int hf_noe_aindx = -1;
-static int hf_noe_errcode = -1;
+
+static int hf_noe_length = -1;
+static int hf_noe_server = -1;
+static int hf_noe_method_ack = -1;
+static int hf_noe_method = -1;
+static int hf_noe_class = -1;
+static int hf_noe_event = -1;
+static int hf_noe_objectid = -1;
+static int hf_noe_method_index = -1;
+static int hf_noe_pcode = -1;
+static int hf_noe_psize = -1;
+static int hf_noe_aindx = -1;
+static int hf_noe_errcode = -1;
+static int hf_noe_value = -1;
+static int hf_noe_message = -1;
+static int hf_noe_property_item_u8 = -1;
+static int hf_noe_property_item_u16 = -1;
+static int hf_noe_property_item_u24 = -1;
+static int hf_noe_property_item_u32 = -1;
+static int hf_noe_property_item_bytes = -1;
+static int hf_event_value_u8 = -1;
+static int hf_event_context_switch = -1;
+static int hf_event_widget_gc = -1;
static const value_string servers_vals[] = {
{0x15, "Call Server"},
@@ -768,6 +779,12 @@ static const value_string str_key_name[] = {
};
static value_string_ext str_key_name_ext = VALUE_STRING_EXT_INIT(str_key_name);
+static const value_string noe_event_str_struct[] = {
+ {0x00, "RJ9 Plug"},
+ {0x01, "BT Handset Link"},
+ {0, NULL}
+ };
+
/*-----------------------------------------------------------------------------
DECODE UTF8 TO UNICODE
This function translates an UTF8 vale to an UNICODE one.
@@ -871,38 +888,26 @@ static void decode_evt_error(proto_tree *tree,
guint offset,
guint length)
{
- guint8 method, class, property;
- guint16 errcode;
- guint32 Pdata;
-
if (!tree)
return;
- errcode = tvb_get_ntohs (tvb, offset);
- proto_tree_add_uint_format_value(tree, hf_noe_errcode, tvb, offset, 2,
- errcode, "%s (%d)", val_to_str_ext_const(errcode, &errcode_vals_ext, "Unknown"), errcode);
+ proto_tree_add_item(tree, hf_noe_errcode, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
length -= 2;
- method = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint_format_value(tree, hf_noe_method, tvb, offset, 1,
- method, "%s (%d)", val_to_str_const(method, methods_vals, "Unknown"), method);
+ proto_tree_add_item(tree, hf_noe_method, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
length -= 1;
- class = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format_value(tree, hf_noe_class, tvb, offset, 1,
- class, "%s (%d)", val_to_str_ext_const(class, &val_str_class_ext, "Unknown"), class);
+ proto_tree_add_item(tree, hf_noe_class, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
length -= 1;
- proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
+ proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
length -= 2;
- property = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format_value(tree, hf_noe_pcode, tvb, offset, 1,
- property, "%s (0x%02x)", val_to_str_ext_const(property, &val_str_props_ext, "Unknown"), property);
+ proto_tree_add_item(tree, hf_noe_pcode, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
length -= 1;
@@ -910,26 +915,15 @@ static void decode_evt_error(proto_tree *tree,
offset += 1;
length -= 1;
- proto_tree_add_uint(tree, hf_noe_length, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
+ proto_tree_add_item(tree, hf_noe_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
length -= 2;
- Pdata = tvb_get_ntohl (tvb, offset);
- proto_tree_add_text(tree,
- tvb,
- offset,
- 4,
- "Value: %x",
- Pdata);
+ proto_tree_add_item(tree, hf_noe_value, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
length -= 4;
- proto_tree_add_text(tree,
- tvb,
- offset,
- length,
- "Message: %s",
- tvb_bytes_to_str(tvb, offset, length));
+ proto_tree_add_item(tree, hf_noe_message, tvb, offset, length, ENC_NA);
}
@@ -942,10 +936,10 @@ static void decode_tlv(proto_tree *tree,
guint offset,
guint length)
{
- proto_item *property_item, *value_item;
- proto_tree *property_tree, *value_tree;
+ proto_item *property_item;
+ proto_tree *property_tree;
guint8 property_type;
- guint16 property_length, property_value_index;
+ guint16 property_length;
/* guint64 property_index;*/
/* add text to the frame tree */
@@ -959,8 +953,7 @@ static void decode_tlv(proto_tree *tree,
while(length > 0)
{
property_type = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format_value(property_tree, hf_noe_pcode, tvb, offset, 1,
- property_type, "%s (0x%02x)", val_to_str_ext_const(property_type, &val_str_props_ext, "Unknown"), property_type);
+ proto_tree_add_item(property_tree, hf_noe_pcode, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
length -= 1;
@@ -996,86 +989,30 @@ static void decode_tlv(proto_tree *tree,
break;
}
case 1:
- {
- proto_tree_add_text(property_item,
- tvb,
- offset,
- 1,
- "Value: %d",
- tvb_get_guint8(tvb, offset));
- offset += 1;
- length -= 1;
- break;
- }
+ proto_tree_add_item(property_tree, hf_noe_property_item_u8, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ length -= 1;
+ break;
case 2:
- {
- guint16 property_value;
- property_value = tvb_get_ntohs(tvb, offset);
- proto_tree_add_text(property_item,
- tvb,
- offset,
- 2,
- "Value: %d",
- property_value);
- offset += 2;
- length -= 2;
- break;
- }
+ proto_tree_add_item(property_tree, hf_noe_property_item_u16, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ length -= 2;
+ break;
case 3:
- {
- guint32 property_value;
- property_value = tvb_get_ntoh24(tvb, offset);
- proto_tree_add_text(property_item,
- tvb,
- offset,
- 3,
- "Value: %u",
- property_value);
- offset += 3;
- length -= 3;
- break;
- }
+ proto_tree_add_item(property_tree, hf_noe_property_item_u24, tvb, offset, 3, ENC_BIG_ENDIAN);
+ offset += 3;
+ length -= 3;
+ break;
case 4:
- {
- guint32 property_value;
- property_value = tvb_get_ntohl(tvb, offset);
- proto_tree_add_text(property_item,
- tvb,
- offset,
- 4,
- "Value: %u",
- property_value);
- offset += 4;
- length -= 4;
- break;
- }
+ proto_tree_add_item(property_tree, hf_noe_property_item_u32, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ length -= 4;
+ break;
default:
- {
- /* add text to the frame tree */
- value_item = proto_tree_add_text(property_item,
- tvb,
- offset,
- property_length,
- "Value (> 4 bytes)");
-
- value_tree = proto_item_add_subtree(value_item, ett_value);
-
- property_value_index = 0;
- while(property_length > 0)
- {
- property_value_index += 1;
- proto_tree_add_text(value_tree,
- tvb,
- offset,
- 1,
- "Value %5d: 0x%02x",
- property_value_index, tvb_get_guint8(tvb, offset));
- offset += 1;
- length -= 1;
- property_length -= 1;
- }
- break;
- }
+ proto_tree_add_item(property_tree, hf_noe_property_item_bytes, tvb, offset, property_length, ENC_NA);
+ offset += property_length;
+ length -= property_length;
+ break;
}
}
}
@@ -1106,8 +1043,7 @@ static void decode_getproperty_tlv(proto_tree *tree,
while(length > 0)
{
body_type = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format_value(body_tree, hf_noe_pcode, tvb, offset, 1,
- body_type, "%s (0x%02x)", val_to_str_ext_const(body_type, &val_str_props_ext, "Unknown"), body_type);
+ proto_tree_add_item(body_tree, hf_noe_pcode, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
length -= 1;
@@ -1133,24 +1069,16 @@ static void decode_evt(proto_tree *tree,
guint offset,
guint length)
{
+ proto_item *ti;
guint8 event = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint_format_value(tree,
- hf_noe_event,
- tvb,
- offset,
- 1,
- event,
- "%s (%d)",
- val_to_str_ext_const(event, &val_str_event_ext, "Unknown"),
- event);
+ proto_tree_add_item(tree, hf_noe_event, tvb, offset, 1, ENC_BIG_ENDIAN);
/* add text to the frame "INFO" column */
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
val_to_str_ext_const(event, &val_str_event_ext, "Unknown"));
/* update text of the main proto item */
- /* XXX: Just dups the above proto_tree_add_uint_format_value() ?? */
proto_item_append_text(tree, ", %s",
val_to_str_ext_const(event, &val_str_event_ext, "Unknown"));
@@ -1165,20 +1093,9 @@ static void decode_evt(proto_tree *tree,
case OPCODE_EVT_KEY_LINE:
case OPCODE_EVT_ONHOOK:
case OPCODE_EVT_OFFHOOK:
- {
- static const value_string str_struct[] = {
- {0x00, "RJ9 Plug"},
- {0x01, "BT Handset Link"},
- {0, NULL}
- };
- proto_tree_add_text(tree,
- tvb,
- offset,
- length,
- "Value: %s (%d)",
- val_to_str_const(tvb_get_guint8(tvb, offset), str_struct, "Unknown"), tvb_get_guint8(tvb, offset));
- break;
- }
+ ti = proto_tree_add_item(tree, hf_event_value_u8, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_item_set_len(ti, length);
+ break;
case OPCODE_EVT_KEY_PRESS:
case OPCODE_EVT_KEY_RELEASE:
case OPCODE_EVT_KEY_SHORTPRESS:
@@ -1230,42 +1147,25 @@ static void decode_evt(proto_tree *tree,
break;
}
case OPCODE_EVT_CONTEXT_SWITCH:
- {
- proto_tree_add_text(tree,
- tvb,
- offset,
- 1,
- "Context: %s",
- val_to_str_const(tvb_get_guint8(tvb, offset),
- servers_vals,
- "Unknown"));
- break;
- }
+ proto_tree_add_item(tree, hf_event_context_switch, tvb, offset, 1, ENC_BIG_ENDIAN);
+ break;
case OPCODE_EVT_SUCCESS_CREATE:
case OPCODE_EVT_SUCCESS_DELETE:
case OPCODE_EVT_SUCCESS_SET_PROPERTY:
case OPCODE_EVT_SUCCESS_INSERT_ITEM:
case OPCODE_EVT_SUCCESS_DELETE_ITEM:
- {
- proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
- break;
- }
+ proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
+ break;
case OPCODE_EVT_WIDGETS_GC:
- {
- proto_tree_add_text(tree,
- tvb,
- offset,
- 4,
- "FreeMem: %d bytes",
- tvb_get_ntohl(tvb, offset));
- break;
- }
+ proto_tree_add_item(tree, hf_event_widget_gc, tvb, offset, 4, ENC_BIG_ENDIAN);
+ break;
case OPCODE_EVT_BT_BONDING_RESULT:
{
- proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
+ proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/*length -= 2;*/
+ /* XXX - should a 16-bit value be gotten if the size is only 8-bit? */
proto_tree_add_text(tree,
tvb,
offset,
@@ -1284,15 +1184,13 @@ static void decode_evt(proto_tree *tree,
break;
}
default:
- {
- proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
- offset += 2;
- length -= 2;
+ proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ length -= 2;
- if (length > 0)
- decode_tlv(tree, tvb, offset, length);
- break;
- }
+ if (length > 0)
+ decode_tlv(tree, tvb, offset, length);
+ break;
}
}
@@ -1311,22 +1209,13 @@ static void decode_mtd(proto_tree *tree,
{
guint8 class = tvb_get_guint8(tvb, offset);
- proto_tree_add_int_format_value(tree,
- hf_noe_class,
- tvb,
- offset,
- 1,
- class,
- "%s (%d)",
- val_to_str_ext_const(class, &val_str_class_ext, "Unknown"),
- class);
+ proto_tree_add_item(tree, hf_noe_class, tvb, offset, 1, ENC_BIG_ENDIAN);
/* add text to the frame "INFO" column */
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
val_to_str_ext_const(class, &val_str_class_ext, "Unknown"));
/* update text of the main proto item */
- /* XXX: Just dups the above proto_tree_add_int_format_value() ?? */
proto_item_append_text(tree, ", %s",
val_to_str_ext_const(class, &val_str_class_ext, "Unknown"));
@@ -1335,7 +1224,7 @@ static void decode_mtd(proto_tree *tree,
if (class >= C_DYNAMIC)
{
- proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
+ proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
length -= 2;
}
@@ -1344,12 +1233,7 @@ static void decode_mtd(proto_tree *tree,
{
case METHOD_INSERT_ITEM:
{
- proto_tree_add_uint(tree,
- hf_noe_method_index,
- tvb,
- offset,
- 1,
- tvb_get_guint8(tvb, offset));
+ proto_tree_add_item(tree, hf_noe_method_index, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
length -= 1;
if (length > 0)
@@ -1358,12 +1242,7 @@ static void decode_mtd(proto_tree *tree,
}
case METHOD_DELETE_ITEM:
{
- proto_tree_add_uint(tree,
- hf_noe_method_index,
- tvb,
- offset,
- 1,
- tvb_get_guint8(tvb, offset));
+ proto_tree_add_item(tree, hf_noe_method_index, tvb, offset, 1, ENC_BIG_ENDIAN);
break;
}
case METHOD_GET_PROPERTY:
@@ -1537,9 +1416,9 @@ void proto_register_noe(void)
{
"Class",
"noe.class",
- FT_INT8,
- BASE_DEC,
- NULL,
+ FT_UINT8,
+ BASE_DEC|BASE_EXT_STRING,
+ &val_str_class_ext,
0x0,
"Class Opcode",
HFILL
@@ -1550,8 +1429,8 @@ void proto_register_noe(void)
"Event",
"noe.event",
FT_UINT8,
- BASE_DEC,
- NULL,
+ BASE_DEC|BASE_EXT_STRING,
+ &val_str_event_ext,
0x0,
"Event Opcode",
HFILL
@@ -1585,9 +1464,9 @@ void proto_register_noe(void)
{
"Property",
"noe.property",
- FT_INT8,
- BASE_DEC,
- NULL,
+ FT_UINT8,
+ BASE_HEX|BASE_EXT_STRING,
+ &val_str_props_ext,
0x0,
"Property Identifier",
HFILL
@@ -1610,8 +1489,8 @@ void proto_register_noe(void)
"ErrCode",
"noe.errcode",
FT_UINT16,
- BASE_DEC,
- NULL,
+ BASE_DEC|BASE_EXT_STRING,
+ &errcode_vals_ext,
0x0,
"Error Code",
HFILL
@@ -1628,7 +1507,127 @@ void proto_register_noe(void)
"Array Index",
HFILL
}
- }
+ },
+ { &hf_noe_value,
+ {
+ "Value",
+ "noe.value",
+ FT_UINT32,
+ BASE_HEX,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_noe_message,
+ {
+ "Message",
+ "noe.messages",
+ FT_BYTES,
+ BASE_NONE,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_noe_property_item_u8,
+ {
+ "Value",
+ "noe.property_item.uint",
+ FT_UINT8,
+ BASE_DEC,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_noe_property_item_u16,
+ {
+ "Value",
+ "noe.property_item.uint",
+ FT_UINT16,
+ BASE_DEC,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_noe_property_item_u24,
+ {
+ "Value",
+ "noe.property_item.uint",
+ FT_UINT24,
+ BASE_DEC,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_noe_property_item_u32,
+ {
+ "Value",
+ "noe.property_item.uint",
+ FT_UINT32,
+ BASE_DEC,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_noe_property_item_bytes,
+ {
+ "Value",
+ "noe.property_item.bytes",
+ FT_BYTES,
+ BASE_NONE,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_event_value_u8,
+ {
+ "Value",
+ "noe.event_value.uint",
+ FT_UINT8,
+ BASE_DEC,
+ VALS(noe_event_str_struct),
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_event_context_switch,
+ {
+ "Context",
+ "noe.event_context_switch",
+ FT_UINT8,
+ BASE_DEC,
+ VALS(servers_vals),
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_event_widget_gc,
+ {
+ "FreeMem (bytes)",
+ "noe.event_widget_gc",
+ FT_UINT32,
+ BASE_DEC,
+ NULL,
+ 0x0,
+ NULL,
+ HFILL
+ }
+ },
};
static gint *ett[] =
diff --git a/epan/dissectors/packet-xdmcp.c b/epan/dissectors/packet-xdmcp.c
index fab360f05e..cee7987276 100644
--- a/epan/dissectors/packet-xdmcp.c
+++ b/epan/dissectors/packet-xdmcp.c
@@ -30,6 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#define UDP_PORT_XDMCP 177
@@ -87,6 +88,26 @@ static gint hf_xdmcp_hostname = -1;
static gint hf_xdmcp_status = -1;
static gint hf_xdmcp_session_id = -1;
static gint hf_xdmcp_display_number = -1;
+static gint hf_xdmcp_manufacturer_display_id = -1;
+static gint hf_xdmcp_manufacturer_display_id_len = -1;
+static gint hf_xdmcp_display_class = -1;
+static gint hf_xdmcp_display_class_len = -1;
+static gint hf_xdmcp_client_address_ipv4 = -1;
+static gint hf_xdmcp_client_address_ipv6 = -1;
+static gint hf_xdmcp_client_address_bytes = -1;
+static gint hf_xdmcp_client_address_bytes_len = -1;
+static gint hf_xdmcp_client_port_u16 = -1;
+static gint hf_xdmcp_client_port_bytes = -1;
+static gint hf_xdmcp_client_port_len = -1;
+static gint hf_xdmcp_authentication_data = -1;
+static gint hf_xdmcp_authentication_data_len = -1;
+static gint hf_xdmcp_authorization_data = -1;
+static gint hf_xdmcp_authorization_data_len = -1;
+static gint hf_xdmcp_connection_type = -1;
+static gint hf_xdmcp_connection_address_ipv4 = -1;
+static gint hf_xdmcp_connection_address_ipv6 = -1;
+static gint hf_xdmcp_connection_address_bytes = -1;
+static gint hf_xdmcp_session_running = -1;
static gint ett_xdmcp = -1;
static gint ett_xdmcp_authentication_names = -1;
@@ -107,26 +128,14 @@ static gint xdmcp_add_string(proto_tree *tree, gint hf,
return len+2;
}
-static gint xdmcp_add_text(proto_tree *tree, const char *text,
+static gint xdmcp_add_bytes(proto_tree *tree, gint hf_byte, gint hf_length,
tvbuff_t *tvb, gint offset)
{
- char *str;
guint len;
-
len = tvb_get_ntohs(tvb, offset);
- str = tvb_get_ephemeral_string(tvb, offset+2, len);
- proto_tree_add_text(tree, tvb, offset, len+2, "%s: %s", text, str);
-
- return len+2;
-}
-static gint xdmcp_add_bytes(proto_tree *tree, const char *text,
- tvbuff_t *tvb, gint offset)
-{
- guint len;
- len = tvb_get_ntohs(tvb, offset);
- proto_tree_add_text(tree, tvb, offset, len+2,
- "%s (%u byte%s)", text, len, plurality(len, "", "s"));
+ proto_tree_add_item(tree, hf_length, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_byte, tvb, offset, len+2, ENC_NA);
return len+2;
}
@@ -206,13 +215,12 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "XDMCP");
col_clear(pinfo->cinfo, COL_INFO);
- if (tree) {
- ti = proto_tree_add_item(tree, proto_xdmcp, tvb, offset, -1, ENC_NA);
- xdmcp_tree = proto_item_add_subtree(ti, ett_xdmcp);
+ ti = proto_tree_add_item(tree, proto_xdmcp, tvb, offset, -1, ENC_NA);
+ xdmcp_tree = proto_item_add_subtree(ti, ett_xdmcp);
- proto_tree_add_uint(xdmcp_tree, hf_xdmcp_version, tvb,
+ proto_tree_add_uint(xdmcp_tree, hf_xdmcp_version, tvb,
offset, 2, version);
- }
+
offset += 2;
opcode = tvb_get_ntohs(tvb, offset);
@@ -241,27 +249,23 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* but in theory the protocol should support other address
* families. */
if (alen == 4) {
- proto_tree_add_text(xdmcp_tree, tvb, offset, alen+2,
- "Client address: %s",
- tvb_ip_to_str(tvb, offset+2));
+ proto_tree_add_item(xdmcp_tree, hf_xdmcp_client_address_ipv4, tvb, offset+2, alen, ENC_BIG_ENDIAN);
offset += 6;
} else if (alen == 16) {
- proto_tree_add_text(xdmcp_tree, tvb, offset, alen+2,
- "Client address: %s",
- tvb_ip6_to_str(tvb, offset+2));
+ proto_tree_add_item(xdmcp_tree, hf_xdmcp_client_address_ipv6, tvb, offset+2, alen, ENC_BIG_ENDIAN);
offset += 18;
} else {
- offset += xdmcp_add_bytes(xdmcp_tree, "Client address", tvb, offset);
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_client_address_bytes, hf_xdmcp_client_address_bytes_len,
+ tvb, offset);
}
plen = tvb_get_ntohs(tvb, offset);
if (plen == 2) {
- proto_tree_add_text(xdmcp_tree, tvb, offset, plen+2,
- "Client port: %u",
- tvb_get_ntohs(tvb, offset+2));
+ proto_tree_add_item(xdmcp_tree, hf_xdmcp_client_port_u16, tvb, offset+2, plen, ENC_BIG_ENDIAN);
offset += 4;
} else {
- offset += xdmcp_add_bytes(xdmcp_tree, "Client port", tvb, offset);
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_client_port_bytes, hf_xdmcp_client_port_len,
+ tvb, offset);
}
}
/* fall-through */
@@ -295,7 +299,7 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint ctypes_len, caddrs_len, n;
gint ctypes_start_offset, caddrs_offset;
- proto_tree_add_item(xdmcp_tree, hf_xdmcp_display_number, tvb,
+ ti = proto_tree_add_item(xdmcp_tree, hf_xdmcp_display_number, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
@@ -304,8 +308,7 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
caddrs_offset = offset + 1 + 2*ctypes_len;
caddrs_len = tvb_get_guint8(tvb, caddrs_offset);
if (ctypes_len != caddrs_len) {
- proto_tree_add_text(xdmcp_tree, NULL, 0, 0,
- "Error: Connection type/address arrays don't match");
+ expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Error: Connection type/address arrays don't match");
return;
}
@@ -322,7 +325,6 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
while (ctypes_len > 0) {
proto_item *connection_ti;
proto_tree *connection_tree;
- const char *ip_string;
gint alen;
gint ctype = tvb_get_ntohs(tvb, offset);
@@ -330,34 +332,24 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
alen = tvb_get_ntohs(tvb, caddrs_offset);
caddrs_offset += 2;
- if ((ctype == 0) && (alen == 4)) {
- ip_string = tvb_ip_to_str(tvb, caddrs_offset);
- } else if ((ctype == 6) && (alen == 16)) {
- ip_string = tvb_ip6_to_str(tvb, caddrs_offset);
- } else {
- ip_string = NULL;
- }
-
connection_ti = proto_tree_add_text(clist_tree, NULL, 0, 0,
- "Connection %d%s%s", n,
- (ip_string ? ": " : ""),
- (ip_string ? ip_string : ""));
+ "Connection %d%", n);
connection_tree = proto_item_add_subtree(connection_ti,
ett_xdmcp_connection);
- proto_tree_add_text(connection_tree, tvb, offset-2, 2,
- "Type: %s",
- val_to_str(ctype, family_vals,
- "Unknown (0x%04x)"));
- if (ip_string) {
- proto_tree_add_text(connection_tree, tvb, caddrs_offset-2, alen+2,
- "Address: %s", ip_string);
- } else {
- proto_tree_add_text(connection_tree, tvb, caddrs_offset-2, alen+2,
- "Address: (%u byte%s)", alen,
- plurality(alen, "", "s"));
- }
- caddrs_offset += alen;
+ proto_tree_add_item(connection_tree, hf_xdmcp_connection_type, tvb, offset-2, 2, ENC_BIG_ENDIAN);
+
+ if ((ctype == 0) && (alen == 4)) {
+ proto_tree_add_item(connection_tree, hf_xdmcp_connection_address_ipv4, tvb, caddrs_offset, alen, ENC_BIG_ENDIAN);
+ proto_item_append_text(connection_ti, ": %s", tvb_ip_to_str(tvb, caddrs_offset));
+ } else if ((ctype == 6) && (alen == 16)) {
+ proto_tree_add_item(connection_tree, hf_xdmcp_connection_address_ipv6, tvb, caddrs_offset, alen, ENC_BIG_ENDIAN);
+ proto_item_append_text(connection_ti, ": %s", tvb_ip6_to_str(tvb, caddrs_offset));
+ } else {
+ proto_tree_add_item(connection_tree, hf_xdmcp_connection_address_bytes, tvb, caddrs_offset, alen, ENC_NA);
+ }
+
+ caddrs_offset += alen;
ctypes_len--;
n++;
}
@@ -366,12 +358,12 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += xdmcp_add_string(xdmcp_tree, hf_xdmcp_authentication_name,
tvb, offset);
- offset += xdmcp_add_bytes(xdmcp_tree, "Authentication data",
- tvb, offset);
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authentication_data, hf_xdmcp_authentication_data_len,
+ tvb, offset);
offset += xdmcp_add_authorization_names(xdmcp_tree, tvb, offset);
- offset += xdmcp_add_text(xdmcp_tree, "Manufacturer display ID",
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_manufacturer_display_id, hf_xdmcp_manufacturer_display_id_len,
tvb, offset);
break;
}
@@ -382,12 +374,12 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 4;
offset += xdmcp_add_string(xdmcp_tree, hf_xdmcp_authentication_name,
tvb, offset);
- offset += xdmcp_add_bytes(xdmcp_tree, "Authentication data",
- tvb, offset);
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authentication_data, hf_xdmcp_authentication_data_len,
+ tvb, offset);
offset += xdmcp_add_string(xdmcp_tree, hf_xdmcp_authorization_name,
tvb, offset);
- offset += xdmcp_add_bytes(xdmcp_tree, "Authorization data",
- tvb, offset);
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authorization_data, hf_xdmcp_authorization_data_len,
+ tvb, offset);
break;
case XDMCP_DECLINE:
@@ -395,8 +387,8 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, offset);
offset += xdmcp_add_string(xdmcp_tree, hf_xdmcp_authentication_name,
tvb, offset);
- offset += xdmcp_add_bytes(xdmcp_tree, "Authentication data",
- tvb, offset);
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_authentication_data, hf_xdmcp_authentication_data_len,
+ tvb, offset);
break;
case XDMCP_MANAGE:
@@ -408,7 +400,7 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
- offset += xdmcp_add_text(xdmcp_tree, "Display class",
+ offset += xdmcp_add_bytes(xdmcp_tree, hf_xdmcp_display_class, hf_xdmcp_display_class_len,
tvb, offset);
break;
@@ -438,14 +430,16 @@ static void dissect_xdmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case XDMCP_ALIVE:
- proto_tree_add_text(xdmcp_tree, tvb, offset, 1,
- "Session running: %s",
- (tvb_get_guint8(tvb, offset) ? "Yes" : "No"));
+ {
+ guint8 session_running = tvb_get_guint8(tvb, offset);
+ proto_tree_add_uint_format(xdmcp_tree, hf_xdmcp_session_running, tvb,
+ offset, 1, session_running, "Session running: %s", session_running ? "Yes" : "No");
offset++;
proto_tree_add_item(xdmcp_tree, hf_xdmcp_session_id, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
+ }
break;
}
}
@@ -501,6 +495,109 @@ void proto_register_xdmcp(void)
FT_UINT16, BASE_DEC, NULL, 0,
NULL, HFILL }
},
+ { &hf_xdmcp_manufacturer_display_id_len,
+ { "Manufacturer display ID Length", "xdmcp.manufacturer_display_id_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_manufacturer_display_id,
+ { "Manufacturer display ID", "xdmcp.manufacturer_display_id",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_display_class_len,
+ { "Display class Length", "xdmcp.display_class_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_display_class,
+ { "Display class", "xdmcp.display_class",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ /* XXX - the following 3 could be the same filter, but mixed types of the same filter seem to cause issues */
+ { &hf_xdmcp_client_address_ipv4,
+ { "Client Address", "xdmcp.client_address_ipv4",
+ FT_IPv4, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_client_address_ipv6,
+ { "Client Address", "xdmcp.client_address_ipv6",
+ FT_IPv6, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_client_address_bytes,
+ { "Client Address", "xdmcp.client_address_bytes",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_client_address_bytes_len,
+ { "Client Address Length", "xdmcp.client_address_bytes_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_client_port_len,
+ { "Client port Length", "xdmcp.client_port_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_client_port_bytes,
+ { "Client port", "xdmcp.client_port_bytes",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_client_port_u16,
+ { "Client port", "xdmcp.client_port",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_authentication_data_len,
+ { "Authentication data Length", "xdmcp.authentication_data_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_authentication_data,
+ { "Authentication data", "xdmcp.authentication_data",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_authorization_data_len,
+ { "Authorization data Length", "xdmcp.authorization_data_len",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_authorization_data,
+ { "Authorization data", "xdmcp.authorization_data",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ /* XXX - the following 3 could be the same filter, but mixed types of the same filter seem to cause issues */
+ { &hf_xdmcp_connection_address_ipv4,
+ { "Address", "xdmcp.connection_address_ipv4",
+ FT_IPv4, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_connection_address_ipv6,
+ { "Address", "xdmcp.connection_address_ipv6",
+ FT_IPv6, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_connection_address_bytes,
+ { "Address", "xdmcp.connection_address_bytes",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_connection_type,
+ { "Type", "xdmcp.connection_type",
+ FT_UINT16, BASE_HEX, VALS(family_vals), 0,
+ NULL, HFILL }
+ },
+ { &hf_xdmcp_session_running,
+ { "Session running", "xdmcp.session_running",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+
};
/* Setup protocol subtree array */