diff options
author | Ryan Mullen <rmmullen@gmail.com> | 2015-11-29 22:05:58 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-12-01 09:44:07 +0000 |
commit | 7332001c0a09d3d3f5ba0ac2a441c8f059b84036 (patch) | |
tree | 8bf4828f3861c933a86f00676a0294cd2a25f2d7 | |
parent | 5b4ada17723ed8af7e85cb48d537437ed614e417 (diff) |
Art-Net: Fix ArtAddress dissection
Parse and display NetSwitch and SubSwitch fields, treating 0x00 and 0x7f
as "special" values with meaning beyond what is usually offered by these
fields.
Change-Id: Idf94361793441f5f4b32c23e7f7f9250ed952a37
Reviewed-on: https://code.wireshark.org/review/12279
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-artnet.c | 115 |
1 files changed, 111 insertions, 4 deletions
diff --git a/epan/dissectors/packet-artnet.c b/epan/dissectors/packet-artnet.c index 5dbe403055..7017d78740 100644 --- a/epan/dissectors/packet-artnet.c +++ b/epan/dissectors/packet-artnet.c @@ -52,7 +52,7 @@ void proto_reg_handoff_artnet(void); #define ARTNET_POLL_REPLY_GOOD_OUTPUT_LENGTH 4 #define ARTNET_POLL_REPLY_SWIN_LENGTH 4 #define ARTNET_POLL_REPLY_SWOUT_LENGTH 4 -#define ARTNET_ADDRESS_LENGTH 97 +#define ARTNET_ADDRESS_LENGTH 95 #define ARTNET_ADDRESS_SWIN_LENGTH 4 #define ARTNET_ADDRESS_SWOUT_LENGTH 4 #define ARTNET_OUTPUT_LENGTH 1 @@ -1734,6 +1734,10 @@ static int hf_artnet_output_length = -1; /* ArtAddress */ static int hf_artnet_address = -1; +static int hf_artnet_address_netswitch = -1; +static int hf_artnet_address_netswitch_special = -1; +static int hf_artnet_address_netswitch_net = -1; +static int hf_artnet_address_netswitch_write = -1; static int hf_artnet_address_short_name = -1; static int hf_artnet_address_long_name = -1; static int hf_artnet_address_swin = -1; @@ -1746,9 +1750,34 @@ static int hf_artnet_address_swout_1 = -1; static int hf_artnet_address_swout_2 = -1; static int hf_artnet_address_swout_3 = -1; static int hf_artnet_address_swout_4 = -1; +static int hf_artnet_address_subswitch = -1; +static int hf_artnet_address_subswitch_special = -1; +static int hf_artnet_address_subswitch_sub = -1; +static int hf_artnet_address_subswitch_write = -1; static int hf_artnet_address_swvideo = -1; static int hf_artnet_address_command = -1; +static gint ett_artnet_address_netswitch = -1; +static gint ett_artnet_address_subswitch = -1; + +static const int *artnet_address_netswitch_fields[] = { + &hf_artnet_address_netswitch_net, + &hf_artnet_address_netswitch_write, + NULL +}; + +static const int *artnet_address_subswitch_fields[] = { + &hf_artnet_address_subswitch_sub, + &hf_artnet_address_subswitch_write, + NULL +}; + +static const value_string artnet_address_switch_vals[] = { + { 0x00, "Reset to Physical Switch" }, + { 0x7f, "No Change" }, + { 0x00, NULL } +}; + /* ArtInput */ static int hf_artnet_input = -1; static int hf_artnet_input_num_ports = -1; @@ -2310,10 +2339,25 @@ dissect_artnet_output(tvbuff_t *tvb, guint offset, proto_tree *tree, packet_info static guint dissect_artnet_address(tvbuff_t *tvb, guint offset, proto_tree *tree) { proto_tree *hi, *si, *ti; + guint8 net, sub; + + net = tvb_get_guint8(tvb, offset); + + /* Treat the "special" values differently */ + if (net == 0x00 || net == 0x7F) { + proto_tree_add_uint(tree,hf_artnet_address_netswitch_special, tvb, + offset, 0, net); + } else { + proto_tree_add_bitmask_text(tree, tvb, offset, 1, "NetSwitch: ", + "NetSwitch Error: ", ett_artnet_address_netswitch, + artnet_address_netswitch_fields, ENC_BIG_ENDIAN, 0); + } + + offset += 1; proto_tree_add_item(tree, hf_artnet_filler, tvb, - offset, 2, ENC_NA); - offset += 2; + offset, 1, ENC_NA); + offset += 1; proto_tree_add_item(tree, hf_artnet_address_short_name, tvb, offset, 18, ENC_ASCII|ENC_NA); @@ -2373,6 +2417,19 @@ dissect_artnet_address(tvbuff_t *tvb, guint offset, proto_tree *tree) { offset, 1, ENC_BIG_ENDIAN); offset += 1; + sub = tvb_get_guint8(tvb, offset); + + /* Treat the "special" values differently */ + if (sub == 0x00 || sub == 0x7F) { + proto_tree_add_uint(tree,hf_artnet_address_subswitch_special, tvb, + offset, 0, sub); + } else { + proto_tree_add_bitmask_text(tree, tvb, offset, 1, "SubSwitch: ", + "SubSwitch Error: ", ett_artnet_address_subswitch, + artnet_address_subswitch_fields, ENC_BIG_ENDIAN, 0); + } + offset += 1; + proto_tree_add_item(tree, hf_artnet_address_swvideo, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -4443,6 +4500,30 @@ proto_register_artnet(void) { FT_NONE, BASE_NONE, NULL, 0, "Art-Net ArtAddress packet", HFILL }}, + { &hf_artnet_address_netswitch_special, + { "NetSwitch", + "artnet.address.netswitch_special", + FT_UINT8, BASE_HEX, VALS(artnet_address_switch_vals), 0, + NULL, HFILL }}, + + { &hf_artnet_address_netswitch, + { "NetSwitch", + "artnet.address.netswitch", + FT_UINT8, BASE_HEX, NULL, 0, + NULL, HFILL }}, + + { &hf_artnet_address_netswitch_net, + { "Net", + "artnet.address.netswitch_net", + FT_UINT8, BASE_DEC, NULL, 0x7F, + NULL, HFILL }}, + + { &hf_artnet_address_netswitch_write, + { "Write Net", + "artnet.address.netswitch_write", + FT_BOOLEAN, 8, NULL, 0x80, + NULL, HFILL }}, + { &hf_artnet_address_short_name, { "Short Name", "artnet.address.short_name", @@ -4515,6 +4596,30 @@ proto_register_artnet(void) { FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_artnet_address_subswitch_special, + { "NetSwitch", + "artnet.address.subswitch_special", + FT_UINT8, BASE_HEX, VALS(artnet_address_switch_vals), 0, + NULL, HFILL }}, + + { &hf_artnet_address_subswitch, + { "SubSwitch", + "artnet.address.subswitch", + FT_UINT8, BASE_HEX, NULL, 0, + NULL, HFILL }}, + + { &hf_artnet_address_subswitch_sub, + { "Sub-Net", + "artnet.address.subswitch_sub", + FT_UINT8, BASE_DEC, NULL, 0x0F, + NULL, HFILL }}, + + { &hf_artnet_address_subswitch_write, + { "Write Sub-Net", + "artnet.address.subswitch_write", + FT_BOOLEAN, 8, NULL, 0x80, + NULL, HFILL }}, + { &hf_artnet_address_swvideo, { "SwVideo", "artnet.address.swvideo", @@ -5300,7 +5405,9 @@ proto_register_artnet(void) { &ett_artnet_poll_reply_good_output_4, &ett_artnet_poll_reply_status2, &ett_artnet_ip_prog_command, - &ett_artnet_ip_prog_reply_status + &ett_artnet_ip_prog_reply_status, + &ett_artnet_address_netswitch, + &ett_artnet_address_subswitch }; proto_artnet = proto_register_protocol("Art-Net", "ARTNET", "artnet"); |