From Erwin Rol:

Artnet, RDM and DMX dissector updates

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7286

svn path=/trunk/; revision=42880
This commit is contained in:
Anders Broman 2012-05-28 15:24:54 +00:00
parent 55261641d9
commit 14eb5154ac
9 changed files with 4845 additions and 354 deletions

View File

@ -519,6 +519,11 @@ set(DISSECTOR_SRC
dissectors/packet-dlm3.c
dissectors/packet-dlsw.c
dissectors/packet-dmp.c
dissectors/packet-dmx.c
dissectors/packet-dmx-chan.c
dissectors/packet-dmx-test.c
dissectors/packet-dmx-text.c
dissectors/packet-dmx-sip.c
dissectors/packet-dnp.c
dissectors/packet-dns.c
dissectors/packet-dplay.c

View File

@ -439,6 +439,11 @@ DISSECTOR_SRC = \
packet-dlm3.c \
packet-dlsw.c \
packet-dmp.c \
packet-dmx.c \
packet-dmx-chan.c \
packet-dmx-test.c \
packet-dmx-text.c \
packet-dmx-sip.c \
packet-dnp.c \
packet-dns.c \
packet-dplay.c \

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,216 @@
/* packet-dmx-chan.c
* DMX Channel Data packet disassembly.
*
* $Id: $
*
* This dissector is written by
*
* Erwin Rol <erwin@erwinrol.com>
* Copyright 2011 Erwin Rol
*
* Wireshark - Network traffic analyzer
* Gerald Combs <gerald@wireshark.org>
* Copyright 1999 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
/*
* This dissector is based on;
* American National Standard E1.11 - 2004
* Entertainment Technology USITT DMX512-A
* Asynchronous Serial Digital Data Transmission Standard
* for Controlling Lighting Equipment and Accessories
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
#include <epan/strutil.h>
void proto_reg_handoff_dmx_chan(void);
static int proto_dmx_chan = -1;
static int hf_dmx_chan_output_dmx_data = -1;
static int hf_dmx_chan_output_data_filter = -1;
static int ett_dmx_chan = -1;
/*
* Here are the global variables associated with the preferences for DMX
*/
static gint global_disp_chan_val_type = 0;
static gint global_disp_col_count = 16;
static gint global_disp_chan_nr_type = 0;
static void
dissect_dmx_chan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX Channels");
col_clear(pinfo->cinfo, COL_INFO);
if (tree != NULL) {
const char* chan_format[] = {
"%2u%% ",
"0x%02x ",
"%3u "
};
const char* string_format[] = {
"0x%03x: %s",
"%3u: %s"
};
static char string[255];
proto_item *item;
guint16 length,r,c,row_count;
guint8 v;
char* ptr;
unsigned offset = 0;
proto_tree *ti = proto_tree_add_item(tree, proto_dmx_chan, tvb,
offset, -1, FALSE);
proto_tree *dmx_chan_tree = proto_item_add_subtree(ti, ett_dmx_chan);
length = tvb_reported_length_remaining(tvb, offset);
row_count = (length / global_disp_col_count) + ((length % global_disp_col_count) == 0 ? 0 : 1);
ptr = string;
/* XX: In theory the g_snprintf statements below could store '\0' bytes off the end of the */
/* 'string' buffer'. This is so since g_snprint returns the number of characters which */
/* "would have been written" (whether or not there was room) and since ptr is always */
/* incremented by this amount. In practice the string buffer is large enough such that the */
/* string buffer size is not exceeded even with the maximum number of columns which might */
/* be displayed. */
/* ToDo: consider recoding slightly ... */
for (r = 0; r < row_count;r++) {
for (c = 0;(c < global_disp_col_count) && (((r * global_disp_col_count) + c) < length);c++) {
if ((c % (global_disp_col_count / 2)) == 0) {
ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)), " ");
}
v = tvb_get_guint8(tvb, (offset + (r * global_disp_col_count) + c));
if (global_disp_chan_val_type == 0) {
v = (v * 100) / 255;
if (v == 100) {
ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)), "FL ");
} else {
ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)),
chan_format[global_disp_chan_val_type], v);
}
} else {
ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)),
chan_format[global_disp_chan_val_type], v);
}
}
proto_tree_add_none_format(dmx_chan_tree, hf_dmx_chan_output_dmx_data, tvb,
offset+(r * global_disp_col_count), c,
string_format[global_disp_chan_nr_type],
(r * global_disp_col_count) + 1, string);
ptr = string;
}
/* Add the real type hidden */
item = proto_tree_add_item(dmx_chan_tree, hf_dmx_chan_output_data_filter, tvb,
offset, length, ENC_NA );
PROTO_ITEM_SET_HIDDEN(item);
offset += length;
}
}
void
proto_register_dmx_chan(void)
{
static hf_register_info hf[] = {
{ &hf_dmx_chan_output_data_filter,
{ "DMX data filter",
"dmx_chan.data_filter",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_chan_output_dmx_data,
{ "DMX data",
"dmx_chan.dmx_data",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
};
static gint *ett[] = {
&ett_dmx_chan
};
module_t *dmx_chan_module;
static enum_val_t disp_chan_val_types[] = {
{ "pro", "Percent", 0 },
{ "hex", "Hexadecimal", 1 },
{ "dec", "Decimal", 2 },
{ NULL, NULL, 0 }
};
static enum_val_t disp_chan_nr_types[] = {
{ "hex", "Hexadecimal", 0 },
{ "dec", "Decimal", 1 },
{ NULL, NULL, 0 }
};
static enum_val_t col_count[] = {
{ "6", "6", 6 },
{ "10", "10", 10 },
{ "12", "12", 12 },
{ "16", "16", 16 },
{ "24", "24", 24 },
{ NULL, NULL, 0 }
};
proto_dmx_chan = proto_register_protocol("DMX Channels","DMX Channels", "dmx-chan");
proto_register_field_array(proto_dmx_chan, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("dmx-chan", dissect_dmx_chan, proto_dmx_chan);
dmx_chan_module = prefs_register_protocol(proto_dmx_chan, NULL);
prefs_register_enum_preference(dmx_chan_module, "dmx_disp_chan_val_type",
"DMX Display channel value type",
"The way DMX values are displayed",
&global_disp_chan_val_type,
disp_chan_val_types, ENC_BIG_ENDIAN);
prefs_register_enum_preference(dmx_chan_module, "dmx_disp_chan_nr_type",
"DMX Display channel nr. type",
"The way DMX channel numbers are displayed",
&global_disp_chan_nr_type,
disp_chan_nr_types, ENC_BIG_ENDIAN);
prefs_register_enum_preference(dmx_chan_module, "dmx_disp_col_count",
"DMX Display Column Count",
"The number of columns for the DMX display",
&global_disp_col_count,
col_count, ENC_BIG_ENDIAN);
}
void
proto_reg_handoff_dmx_chan(void)
{
}

View File

@ -0,0 +1,320 @@
/* packet-dmx-sip.c
* DMX SIP packet disassembly.
*
* $Id: $
*
* This dissector is written by
*
* Erwin Rol <erwin@erwinrol.com>
* Copyright 2011 Erwin Rol
*
* Wireshark - Network traffic analyzer
* Gerald Combs <gerald@wireshark.org>
* Copyright 1999 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
/*
* This dissector is based on;
* American National Standard E1.11 - 2004
* Entertainment Technology USITT DMX512-A
* Asynchronous Serial Digital Data Transmission Standard
* for Controlling Lighting Equipment and Accessories
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
#include <epan/strutil.h>
#define DMX_SC_SIP 0xCF
void proto_reg_handoff_dmx_sip(void);
static int proto_dmx_sip = -1;
static int hf_dmx_sip_byte_count = -1;
static int hf_dmx_sip_control_bit_field = -1;
static int hf_dmx_sip_prev_packet_checksum = -1;
static int hf_dmx_sip_seq_nr = -1;
static int hf_dmx_sip_dmx_universe_nr = -1;
static int hf_dmx_sip_dmx_proc_level = -1;
static int hf_dmx_sip_dmx_software_version = -1;
static int hf_dmx_sip_dmx_packet_len = -1;
static int hf_dmx_sip_dmx_nr_packets = -1;
static int hf_dmx_sip_orig_dev_id = -1;
static int hf_dmx_sip_sec_dev_id = -1;
static int hf_dmx_sip_third_dev_id = -1;
static int hf_dmx_sip_fourth_dev_id = -1;
static int hf_dmx_sip_fifth_dev_id = -1;
static int hf_dmx_sip_reserved = -1;
static int hf_dmx_sip_checksum = -1;
static int hf_dmx_sip_checksum_good = -1;
static int hf_dmx_sip_checksum_bad = -1;
static int hf_dmx_sip_trailer = -1;
static int ett_dmx_sip = -1;
static guint8
dmx_sip_checksum(tvbuff_t *tvb, unsigned length)
{
guint8 sum = DMX_SC_SIP;
unsigned i;
for (i = 0; i < length; i++)
sum += tvb_get_guint8(tvb, i);
return sum;
}
static void
dissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX SIP");
col_clear(pinfo->cinfo, COL_INFO);
if (tree != NULL) {
unsigned offset = 0;
unsigned byte_count;
unsigned checksum, checksum_shouldbe;
proto_item *item;
proto_tree *checksum_tree;
proto_tree *ti = proto_tree_add_item(tree, proto_dmx_sip, tvb,
offset, -1, FALSE);
proto_tree *dmx_sip_tree = proto_item_add_subtree(ti, ett_dmx_sip);
byte_count = tvb_get_guint8(tvb, offset);
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_byte_count, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_control_bit_field, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_prev_packet_checksum, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_seq_nr, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_universe_nr, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_proc_level, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_software_version, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_packet_len, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_nr_packets, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_orig_dev_id, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_sec_dev_id, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_third_dev_id, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_fourth_dev_id, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_fifth_dev_id, tvb,
offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if (offset < byte_count) {
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_reserved, tvb,
offset, byte_count - offset, ENC_BIG_ENDIAN);
offset += (byte_count - offset);
}
dmx_sip_checksum(tvb, offset);
checksum_shouldbe = dmx_sip_checksum(tvb, offset);
checksum = tvb_get_guint8(tvb, offset);
item = proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_checksum, tvb,
offset, 1, ENC_BIG_ENDIAN);
if (checksum == checksum_shouldbe) {
proto_item_append_text(item, " [correct]");
checksum_tree = proto_item_add_subtree(item, ett_dmx_sip);
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_good, tvb,
offset, 1, TRUE);
PROTO_ITEM_SET_GENERATED(item);
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_bad, tvb,
offset, 1, FALSE);
PROTO_ITEM_SET_GENERATED(item);
} else {
proto_item_append_text(item, " [incorrect, should be 0x%02x]", checksum_shouldbe);
checksum_tree = proto_item_add_subtree(item, ett_dmx_sip);
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_good, tvb,
offset, 1, FALSE);
PROTO_ITEM_SET_GENERATED(item);
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_bad, tvb,
offset, 1, TRUE);
PROTO_ITEM_SET_GENERATED(item);
}
offset += 1;
if (offset < tvb_length(tvb))
proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_trailer, tvb,
offset, -1, ENC_NA);
}
}
void
proto_register_dmx_sip(void)
{
static hf_register_info hf[] = {
{ &hf_dmx_sip_byte_count,
{ "Byte Count", "dmx_sip.byte_count",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_control_bit_field,
{ "Control Bit Field", "dmx_sip.control_bit_field",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_prev_packet_checksum,
{ "Checksum of prev. packet", "dmx_sip.prev_packet_checksum",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_seq_nr,
{ "SIP sequence nr.", "dmx_sip.seq_nr",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_dmx_universe_nr,
{ "DMX512 universe nr.", "dmx_sip.dmx_universe_nr",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_dmx_proc_level,
{ "DMX512 processing level", "dmx_sip.dmx_proc_level",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_dmx_software_version,
{ "Software Version", "dmx_sip.dmx_software_version",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_dmx_packet_len,
{ "Standard Packet Len", "dmx_sip.dmx_packet_len",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_dmx_nr_packets,
{ "Number of Packets", "dmx_sip.dmx_nr_packets",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_orig_dev_id,
{ "1st Device's ID", "dmx_sip.orig_dev_id",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_sec_dev_id,
{ "2nd Device's ID", "dmx_sip.sec_dev_id",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_third_dev_id,
{ "3rd Device's ID", "dmx_sip.third_dev_id",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_fourth_dev_id,
{ "4th Device's ID", "dmx_sip.fourth_dev_id",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_fifth_dev_id,
{ "5th Device's ID", "dmx_sip.fifth_dev_id",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_reserved,
{ "Reserved", "dmx_sip.reserved",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_checksum,
{ "Checksum", "dmx_sip.checksum",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_sip_checksum_good,
{ "Good Checksum", "dmx_sip.checksum_good",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"True: checksum matches packet content; False: doesn't match content", HFILL }},
{ &hf_dmx_sip_checksum_bad,
{ "Bad Checksum", "dmx_sip.checksum_bad",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"True: checksum doesn't match packet content; False: matches content", HFILL }},
{ &hf_dmx_sip_trailer,
{ "Trailer", "dmx_sip.trailer",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
};
static gint *ett[] = {
&ett_dmx_sip
};
proto_dmx_sip = proto_register_protocol("DMX SIP", "DMX SIP", "dmx-sip");
proto_register_field_array(proto_dmx_sip, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("dmx-sip", dissect_dmx_sip, proto_dmx_sip);
}
void
proto_reg_handoff_dmx_sip(void)
{
}

View File

@ -0,0 +1,158 @@
/* packet-dmx-test.c
* DMX Test packet disassembly.
*
* $Id: $
*
* This dissector is written by
*
* Erwin Rol <erwin@erwinrol.com>
* Copyright 2011 Erwin Rol
*
* Wireshark - Network traffic analyzer
* Gerald Combs <gerald@wireshark.org>
* Copyright 1999 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
/*
* This dissector is based on;
* American National Standard E1.11 - 2004
* Entertainment Technology USITT DMX512-A
* Asynchronous Serial Digital Data Transmission Standard
* for Controlling Lighting Equipment and Accessories
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
#include <epan/strutil.h>
#define DMX_TEST_PACKET_SIZE 512
#define DMX_TEST_VALUE 0x55
void proto_reg_handoff_dmx_test(void);
static int proto_dmx_test = -1;
static int hf_dmx_test_data = -1;
static int hf_dmx_test_data_good = -1;
static int hf_dmx_test_data_bad = -1;
static int ett_dmx_test = -1;
static void
dissect_dmx_test(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX Test Frame");
col_clear(pinfo->cinfo, COL_INFO);
if (tree != NULL) {
unsigned offset = 0;
unsigned size, i, test_data_is_ok;
proto_tree* test_data_tree;
proto_item *item;
proto_tree *ti = proto_tree_add_item(tree, proto_dmx_test, tvb,
offset, -1, FALSE);
proto_tree *dmx_test_tree = proto_item_add_subtree(ti, ett_dmx_test);
size = tvb_reported_length_remaining(tvb, offset);
item = proto_tree_add_item(dmx_test_tree, hf_dmx_test_data, tvb,
offset, size, ENC_BIG_ENDIAN);
offset += size;
if (size == DMX_TEST_PACKET_SIZE) {
test_data_is_ok = TRUE;
for (i = 0; i < DMX_TEST_PACKET_SIZE; i++) {
if (tvb_get_guint8(tvb, i) != DMX_TEST_VALUE) {
test_data_is_ok = FALSE;
break;
}
}
} else {
test_data_is_ok = FALSE;
}
if (test_data_is_ok) {
proto_item_append_text(ti, ", Data correct");
proto_item_append_text(item, " [correct]");
test_data_tree = proto_item_add_subtree(item, ett_dmx_test);
item = proto_tree_add_boolean(test_data_tree, hf_dmx_test_data_good, tvb,
offset, size, TRUE);
PROTO_ITEM_SET_GENERATED(item);
item = proto_tree_add_boolean(test_data_tree, hf_dmx_test_data_bad, tvb,
offset, size, FALSE);
PROTO_ITEM_SET_GENERATED(item);
} else {
proto_item_append_text(ti, ", Data incorrect");
proto_item_append_text(item, " [incorrect]");
test_data_tree = proto_item_add_subtree(item, ett_dmx_test);
item = proto_tree_add_boolean(test_data_tree, hf_dmx_test_data_good, tvb,
offset, size, FALSE);
PROTO_ITEM_SET_GENERATED(item);
item = proto_tree_add_boolean(test_data_tree, hf_dmx_test_data_bad, tvb,
offset, size, TRUE);
PROTO_ITEM_SET_GENERATED(item);
}
}
}
void
proto_register_dmx_test(void)
{
static hf_register_info hf[] = {
{ &hf_dmx_test_data,
{ "Test Data", "dmx_test.data",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_test_data_good,
{ "Data Good", "dmx_test.data_good",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"True: test data is correct; False: test data is incorrect", HFILL }},
{ &hf_dmx_test_data_bad,
{ "Data Bad", "dmx_test.data_bad",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"True: test data is incorrect; False: test data is correct", HFILL }},
};
static gint *ett[] = {
&ett_dmx_test
};
proto_dmx_test = proto_register_protocol("DMX Test Frame", "DMX Test Frame", "dmx-test");
proto_register_field_array(proto_dmx_test, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("dmx-test", dissect_dmx_test, proto_dmx_test);
}
void
proto_reg_handoff_dmx_test(void)
{
}

View File

@ -0,0 +1,126 @@
/* packet-dmx-text.c
* DMX Text packet disassembly.
*
* $Id: $
*
* This dissector is written by
*
* Erwin Rol <erwin@erwinrol.com>
* Copyright 2011 Erwin Rol
*
* Wireshark - Network traffic analyzer
* Gerald Combs <gerald@wireshark.org>
* Copyright 1999 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
/*
* This dissector is based on;
* American National Standard E1.11 - 2004
* Entertainment Technology USITT DMX512-A
* Asynchronous Serial Digital Data Transmission Standard
* for Controlling Lighting Equipment and Accessories
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
#include <epan/strutil.h>
void proto_reg_handoff_dmx_text(void);
static int proto_dmx_text = -1;
static int hf_dmx_text_page_nr = -1;
static int hf_dmx_text_line_len = -1;
static int hf_dmx_text_string = -1;
static int ett_dmx_text = -1;
static void
dissect_dmx_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX Text");
col_clear(pinfo->cinfo, COL_INFO);
if (tree != NULL) {
unsigned offset = 0;
unsigned size;
proto_tree *ti = proto_tree_add_item(tree, proto_dmx_text, tvb,
offset, -1, FALSE);
proto_tree *dmx_text_tree = proto_item_add_subtree(ti, ett_dmx_text);
proto_tree_add_item(dmx_text_tree, hf_dmx_text_page_nr, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dmx_text_tree, hf_dmx_text_line_len, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
size = tvb_reported_length_remaining(tvb, offset);
proto_tree_add_item(dmx_text_tree, hf_dmx_text_string, tvb,
offset, size, ENC_BIG_ENDIAN);
offset += size;
}
}
void
proto_register_dmx_text(void)
{
static hf_register_info hf[] = {
{ &hf_dmx_text_page_nr,
{ "Page Number",
"dmx_text.page_nr",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_text_line_len,
{ "Line Length",
"dmx_text.line_length",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dmx_text_string,
{ "Text String",
"dmx_text.string",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
};
static gint *ett[] = {
&ett_dmx_text
};
proto_dmx_text = proto_register_protocol("DMX Text Frame", "DMX Text Frame", "dmx-text");
proto_register_field_array(proto_dmx_text, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("dmx-text", dissect_dmx_text, proto_dmx_text);
}
void
proto_reg_handoff_dmx_text(void)
{
}

View File

@ -0,0 +1,169 @@
/* packet-dmx.c
* DMX packet disassembly.
*
* $Id: $
*
* This dissector is written by
*
* Erwin Rol <erwin@erwinrol.com>
* Copyright 2012 Erwin Rol
*
* Wireshark - Network traffic analyzer
* Gerald Combs <gerald@wireshark.org>
* Copyright 1999 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
/*
* This dissector is based on;
* American National Standard E1.11 - 2004
* Entertainment Technology USITT DMX512-A
* Asynchronous Serial Digital Data Transmission Standard
* for Controlling Lighting Equipment and Accessories
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
#include <epan/strutil.h>
#define DMX_SC_DMX 0x00
#define DMX_SC_TEXT 0x17
#define DMX_SC_TEST 0x55
#define DMX_SC_RDM 0xCC
#define DMX_SC_SIP 0xCF
static const value_string dmx_sc_vals[] = {
{ DMX_SC_DMX, "DMX" },
{ DMX_SC_TEXT, "Text" },
{ DMX_SC_TEST, "Test" },
{ DMX_SC_RDM, "RDM" },
{ DMX_SC_SIP, "SIP" },
{ 0, NULL },
};
void proto_reg_handoff_dmx(void);
static int proto_dmx = -1;
static int hf_dmx_start_code = -1;
static int hf_dmx_frame_data = -1;
static int ett_dmx = -1;
static dissector_handle_t rdm_handle;
static dissector_handle_t dmx_chan_handle;
static dissector_handle_t dmx_test_handle;
static dissector_handle_t dmx_text_handle;
static dissector_handle_t dmx_sip_handle;
static void
dissect_dmx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
tvbuff_t *next_tvb = NULL;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX");
col_clear(pinfo->cinfo, COL_INFO);
if (tree != NULL) {
unsigned offset = 0;
guint8 start_code;
start_code = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_dmx_start_code, tvb,
offset, 1, ENC_BIG_ENDIAN);
offset++;
switch (start_code) {
case DMX_SC_DMX:
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(dmx_chan_handle, next_tvb, pinfo, tree);
break;
case DMX_SC_TEXT:
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(dmx_text_handle, next_tvb, pinfo, tree);
break;
case DMX_SC_TEST:
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(dmx_test_handle, next_tvb, pinfo, tree);
break;
case DMX_SC_RDM:
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(rdm_handle, next_tvb, pinfo, tree);
break;
case DMX_SC_SIP:
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(dmx_sip_handle, next_tvb, pinfo, tree);
break;
default:
if (offset < tvb_length(tvb))
proto_tree_add_item(tree, hf_dmx_frame_data, tvb,
offset, -1, ENC_NA);
break;
}
}
}
void
proto_register_dmx(void)
{
static hf_register_info hf[] = {
{ &hf_dmx_start_code,
{ "Start Code", "dmx.start_code",
FT_UINT8, BASE_HEX, VALS(dmx_sc_vals), 0x0,
NULL, HFILL }},
{ &hf_dmx_frame_data,
{ "Frame Data", "dmx.frame_data",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
};
static gint *ett[] = {
&ett_dmx
};
proto_dmx = proto_register_protocol("DMX", "DMX", "dmx");
proto_register_field_array(proto_dmx, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void
proto_reg_handoff_dmx(void)
{
static gboolean dmx_initialized = FALSE;
static dissector_handle_t dmx_handle;
if (!dmx_initialized) {
dmx_handle = create_dissector_handle(dissect_dmx, proto_dmx);
rdm_handle = find_dissector("rdm");
dmx_test_handle = find_dissector("dmx-chan");
dmx_test_handle = find_dissector("dmx-test");
dmx_text_handle = find_dissector("dmx-text");
dmx_sip_handle = find_dissector("dmx-sip");
dmx_initialized = TRUE;
}
}

File diff suppressed because it is too large Load Diff