diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index ec6a2c5820..44eec4cb1e 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -287,6 +287,7 @@ DISSECTOR_SRC = \ packet-enc.c \ packet-enip.c \ packet-enrp.c \ + packet-epl.c \ packet-esis.c \ packet-ess.c \ packet-eth.c \ @@ -776,6 +777,7 @@ DISSECTOR_INCLUDES = \ packet-e212.h \ packet-edonkey.h \ packet-enc.h \ + packet-epl.h \ packet-esis.h \ packet-ess.h \ packet-eth.h \ diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c new file mode 100644 index 0000000000..3db7de405f --- /dev/null +++ b/epan/dissectors/packet-epl.c @@ -0,0 +1,1164 @@ +/* packet-epl.c + * Routines for "Ethernet Powerlink 2.0" dissection + * (ETHERNET Powerlink V2.0 Communication Profile Specification Draft Standard Version 1.0.0) + * + * Copyright (c) 2006: Zurich University of Applied Sciences Winterthur (ZHW) + * Institute of Embedded Systems (InES) + * http://ines.zhwin.ch + * + * - Dominic Bchaz + * - Damir Bursic + * - David Bchi + * + * + * $Id$ + * + * A plugin for: + * Wireshark - Network traffic analyzer + * By Gerald Combs + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include +#include +#include +#include + +#include "packet-epl.h" + + + +/* Initialize the protocol and registered fields */ +static gint proto_epl = -1; +static gint hf_epl_mtyp = -1; +static gint hf_epl_dest = -1; +static gint hf_epl_src = -1; + +static gint hf_epl_soc_mc = -1; +static gint hf_epl_soc_ps = -1; +static gint hf_epl_soc_nettime = -1; +static gint hf_epl_soc_relativetime = -1; + +static gint hf_epl_preq_ms = -1; +static gint hf_epl_preq_ea = -1; +static gint hf_epl_preq_rd = -1; +static gint hf_epl_preq_pdov = -1; +static gint hf_epl_preq_size = -1; +static gint hf_epl_preq_pl = -1; + +static gint hf_epl_pres_stat_ms = -1; +static gint hf_epl_pres_stat_cs = -1; +static gint hf_epl_pres_ms = -1; +static gint hf_epl_pres_en = -1; +static gint hf_epl_pres_rd = -1; +static gint hf_epl_pres_pr = -1; +static gint hf_epl_pres_rs = -1; +static gint hf_epl_pres_pdov = -1; +static gint hf_epl_pres_size = -1; +static gint hf_epl_pres_pl = -1; + +static gint hf_epl_soa_stat_ms = -1; +static gint hf_epl_soa_stat_cs = -1; +static gint hf_epl_soa_ea = -1; +static gint hf_epl_soa_er = -1; +static gint hf_epl_soa_svid = -1; +static gint hf_epl_soa_svtg = -1; +static gint hf_epl_soa_eplv = -1; + +static gint hf_epl_asnd_svid = -1; +static gint hf_epl_asnd_data = -1; + +/*IdentResponse*/ +static gint hf_epl_asnd_identresponse_en = -1; +static gint hf_epl_asnd_identresponse_ec = -1; +static gint hf_epl_asnd_identresponse_pr = -1; +static gint hf_epl_asnd_identresponse_rs = -1; +static gint hf_epl_asnd_identresponse_stat_ms = -1; +static gint hf_epl_asnd_identresponse_stat_cs = -1; +static gint hf_epl_asnd_identresponse_ever = -1; +static gint hf_epl_asnd_identresponse_feat = -1; +static gint hf_epl_asnd_identresponse_mtu = -1; +static gint hf_epl_asnd_identresponse_pis = -1; +static gint hf_epl_asnd_identresponse_pos = -1; +static gint hf_epl_asnd_identresponse_rst = -1; +static gint hf_epl_asnd_identresponse_dt = -1; +static gint hf_epl_asnd_identresponse_vid = -1; +static gint hf_epl_asnd_identresponse_productcode = -1; +static gint hf_epl_asnd_identresponse_rno = -1; +static gint hf_epl_asnd_identresponse_sno = -1; +static gint hf_epl_asnd_identresponse_vex1 = -1; +static gint hf_epl_asnd_identresponse_vcd = -1; +static gint hf_epl_asnd_identresponse_vct = -1; +static gint hf_epl_asnd_identresponse_ad = -1; +static gint hf_epl_asnd_identresponse_at = -1; +static gint hf_epl_asnd_identresponse_ipa = -1; +static gint hf_epl_asnd_identresponse_snm = -1; +static gint hf_epl_asnd_identresponse_gtw = -1; +static gint hf_epl_asnd_identresponse_hn = -1; +static gint hf_epl_asnd_identresponse_vex2 = -1; + +/*StatusResponse*/ +static gint hf_epl_asnd_statusresponse_en = -1; +static gint hf_epl_asnd_statusresponse_ec = -1; +static gint hf_epl_asnd_statusresponse_pr = -1; +static gint hf_epl_asnd_statusresponse_rs = -1; +static gint hf_epl_asnd_statusresponse_stat_ms = -1; +static gint hf_epl_asnd_statusresponse_stat_cs = -1; +static gint hf_epl_asnd_statusresponse_seb = -1; + +/*StaticErrorBitField */ +static gint hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit0 = -1; +static gint hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit1 = -1; +static gint hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit2 = -1; +static gint hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit3 = -1; +static gint hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit4 = -1; +static gint hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit5 = -1; +static gint hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit7 = -1; +static gint hf_epl_asnd_statusresponse_seb_devicespecific_err = -1; + +/*List of Errors/Events*/ +static gint hf_epl_asnd_statusresponse_el = -1; +static gint hf_epl_asnd_statusresponse_el_entry = -1; +static gint hf_epl_asnd_statusresponse_el_entry_type = -1; +static gint hf_epl_asnd_statusresponse_el_entry_type_profile = -1; +static gint hf_epl_asnd_statusresponse_el_entry_type_mode = -1; +static gint hf_epl_asnd_statusresponse_el_entry_type_bit14 = -1; +static gint hf_epl_asnd_statusresponse_el_entry_type_bit15 = -1; +static gint hf_epl_asnd_statusresponse_el_entry_code = -1; +static gint hf_epl_asnd_statusresponse_el_entry_time = -1; +static gint hf_epl_asnd_statusresponse_el_entry_add = -1; + +/*NMTRequest*/ +static gint hf_epl_asnd_nmtrequest_rcid = -1; +static gint hf_epl_asnd_nmtrequest_rct = -1; +static gint hf_epl_asnd_nmtrequest_rcd = -1; + +/*NMTCommand*/ +static gint hf_epl_asnd_nmtcommand_cid = -1; +static gint hf_epl_asnd_nmtcommand_cdat = -1; +static gint hf_epl_asnd_nmtcommand_nmtnetparameterset_mtu = -1; +static gint hf_epl_asnd_nmtcommand_nmtnethostnameset_hn = -1; +static gint hf_epl_asnd_nmtcommand_nmtflusharpentry_nid = -1; +static gint hf_epl_asnd_nmtcommand_nmtpublishtime_dt = -1; + +/*Asynchronuous SDO Sequence Layer*/ +static gint hf_epl_asnd_sdo_seq_receive_sequence_number = -1; +static gint hf_epl_asnd_sdo_seq_receive_con = -1; +static gint hf_epl_asnd_sdo_seq_send_sequence_number = -1; +static gint hf_epl_asnd_sdo_seq_send_con = -1; + +/*Asynchronuous SDO Command Layer*/ +static gint hf_epl_asnd_sdo_cmd_transaction_id = -1; +static gint hf_epl_asnd_sdo_cmd_response = -1; +static gint hf_epl_asnd_sdo_cmd_abort = -1; + +static gint hf_epl_asnd_sdo_cmd_segmentation = -1; +static gint hf_epl_asnd_sdo_cmd_command_id = -1; +static gint hf_epl_asnd_sdo_cmd_segment_size = -1; +static gint hf_epl_asnd_sdo_cmd_data_size = -1; + +static gint hf_epl_asnd_sdo_cmd_abort_code = -1; +static gint hf_epl_asnd_sdo_cmd_abort_flag = -1; +static gint hf_epl_asnd_sdo_cmd_segmentation_flag = -1; +static gint hf_epl_asnd_sdo_cmd_cmd_valid_test = -1; + +static gint hf_epl_asnd_sdo_actual_command_id = -1; + +static gint hf_epl_asnd_sdo_cmd_write_by_index_index = -1; +static gint hf_epl_asnd_sdo_cmd_write_by_index_subindex = -1; +static gint hf_epl_asnd_sdo_cmd_write_by_index_data = -1; +static gint hf_epl_asnd_sdo_cmd_write_by_index_response = -1; + +static gint hf_epl_asnd_sdo_cmd_read_by_index_index = -1; +static gint hf_epl_asnd_sdo_cmd_read_by_index_subindex = -1; +static gint hf_epl_asnd_sdo_cmd_read_by_index_data = -1; +static gint hf_epl_asnd_sdo_cmd_read_by_index_response = -1; + +static gint hf_epl_asnd_sdo_actual_segment_size = -1; +static gint hf_epl_asnd_sdo_actual_payload_size_read = -1; + +/* Initialize the subtree pointers */ +static gint ett_epl = -1; +static gint ett_epl_seb = -1; +static gint ett_epl_el = -1; +static gint ett_epl_el_entry = -1; +static gint ett_epl_el_entry_type = -1; +static gint ett_epl_sdo_entry_type = -1; + +/* Define the tap for epl */ +/*static gint epl_tap = -1;*/ + + + +/* Code to actually dissect the packets */ +static gboolean +dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint8 epl_mtyp, epl_src, epl_dest, epl_soa_svid, epl_asnd_svid; + const gchar *src_str, *dest_str, *src_str_abbr, *dest_str_abbr; + gchar *info_str; + /* static epl_info_t mi; */ + /* Set up structures needed to add the protocol subtree and manage it */ + proto_item *ti; + proto_tree *epl_tree, *epl_src_item, *epl_dest_item; + gint offset = 0; + + info_str = ep_alloc(200); + info_str[0] = 0; + + if (tvb_length_remaining(tvb, offset) < 3) + { + /* Not enough data for an EPL header; don't try to interpret it */ + return FALSE; + } + + /* Make entries in Protocol column and Info column on summary display */ + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + { + col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL"); + } + + /* Get message type */ + epl_mtyp = tvb_get_guint8(tvb, EPL_MTYP_OFFSET) & 0x7F; + + /* tap */ + /* mi.epl_mtyp = epl_mtyp; + tap_queue_packet(epl_tap, pinfo, &mi); + */ + + /* Get Destination */ + epl_dest = tvb_get_guint8(tvb, EPL_DEST_OFFSET); + dest_str = decode_epl_address(epl_dest); + dest_str_abbr = decode_epl_address_abbrev(epl_dest); + + /* Get Source */ + epl_src = tvb_get_guint8(tvb, EPL_SRC_OFFSET); + src_str = decode_epl_address(epl_src); + src_str_abbr = decode_epl_address_abbrev(epl_src); + + /* Choose the right string for "Info" column (message type) */ + switch (epl_mtyp) + { + case EPL_SOC: + g_snprintf(info_str, 200, "SoC dest = %3d%s src = %3d%s ", epl_dest, dest_str_abbr, epl_src, src_str_abbr); + break; + + case EPL_PREQ: + g_snprintf(info_str, 200, "PReq dest = %3d%s src = %3d%s ", epl_dest, dest_str_abbr, epl_src, src_str_abbr); + break; + + case EPL_PRES: + g_snprintf(info_str, 200, "PRes dest = %3d%s src = %3d%s ", epl_dest, dest_str_abbr, epl_src, src_str_abbr); + break; + + case EPL_SOA: + epl_soa_svid = tvb_get_guint8(tvb, EPL_SOA_SVID_OFFSET); /* Get RequestedServiceID */ + g_snprintf(info_str, 200, "SoA dest = %3d%s src = %3d%s %s ", + epl_dest, dest_str_abbr, epl_src, src_str_abbr, match_strval(epl_soa_svid, soa_svid_vals)); + break; + + case EPL_ASND: + epl_asnd_svid = tvb_get_guint8(tvb, EPL_ASND_SVID_OFFSET); /* Get ServiceID */ + g_snprintf(info_str, 200, "ASnd dest = %3d%s src = %3d%s %s ", + epl_dest, dest_str_abbr, epl_src, src_str_abbr, match_strval(epl_asnd_svid, asnd_svid_vals)); + break; + + default: /* no valid EPL packet */ + return FALSE; + + } + + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_clear(pinfo->cinfo, COL_INFO); + } + + if (check_col(pinfo->cinfo, COL_INFO)) + { + col_add_str(pinfo->cinfo, COL_INFO, info_str); + } + + if (tree) + { + /* create display subtree for the protocol */ + ti = proto_tree_add_item(tree, proto_epl, tvb, 0, -1, TRUE); + epl_tree = proto_item_add_subtree(ti, ett_epl); + + proto_tree_add_item(epl_tree, + hf_epl_mtyp, tvb, offset, 1, TRUE); + offset += 1; + + epl_dest_item = proto_tree_add_item(epl_tree, hf_epl_dest, tvb, offset, 1, TRUE); + proto_item_append_text (epl_dest_item, dest_str); + offset += 1; + + epl_src_item = proto_tree_add_item(epl_tree, hf_epl_src, tvb, offset, 1, TRUE); + proto_item_append_text (epl_src_item, src_str); + offset += 1; + + /* The rest of the epl-dissector depends on the message type */ + switch (epl_mtyp) + { + case EPL_SOC: + offset = dissect_epl_soc(epl_tree, tvb, offset); + break; + + case EPL_PREQ: + offset = dissect_epl_preq(epl_tree, tvb, offset); + break; + + case EPL_PRES: + offset = dissect_epl_pres(epl_tree, tvb, epl_src, offset); + break; + + case EPL_SOA: + offset = dissect_epl_soa(epl_tree, tvb, epl_src, offset); + break; + + case EPL_ASND: + offset = dissect_epl_asnd(tree, epl_tree, tvb, epl_src, offset); + break; + + default: /* no valid EPL packet */ + return FALSE; + } + } + return TRUE; +} + + + +const gchar* +decode_epl_address (guchar adr) +{ + const gchar *addr_str; + + addr_str = match_strval(adr, addr_str_vals); + + if (addr_str != NULL) + { + return addr_str; + } + else + { + if (( adr < EPL_MN_NODEID) && (adr > EPL_INVALID_NODEID)) + { + return addr_str_cn; + } + else + { + return addr_str_res; + } + } +} + + + +/* Get the abbreviation for an EPL NodeID */ +const gchar* +decode_epl_address_abbrev (guchar adr) +{ + const gchar *addr_str; + + addr_str = match_strval(adr, addr_str_abbr_vals); + + if (addr_str != NULL) + { + return addr_str; + } + else + { + if (( adr < EPL_MN_NODEID) && (adr > EPL_INVALID_NODEID)) + { + return addr_str_abbr_cn; + } + else + { + return addr_str_abbr_res; + } + } +} + + + +gint +dissect_epl_soc(proto_tree *epl_tree, tvbuff_t *tvb, gint offset) +{ + nstime_t nettime; + + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_soc_mc, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_soc_ps, tvb, offset, 1, TRUE); + offset += 2; + + nettime.secs = tvb_get_letohl(tvb, offset); + nettime.nsecs = tvb_get_letohl(tvb, offset+4); + proto_tree_add_time_format_value(epl_tree, hf_epl_soc_nettime, + tvb, offset, 8, &nettime, "%s", abs_time_to_str(&nettime)); + offset += 8; + + proto_tree_add_item(epl_tree, hf_epl_soc_relativetime, tvb, offset, 8, TRUE); + offset += 8; + + return offset; +} + + + +gint +dissect_epl_preq(proto_tree *epl_tree, tvbuff_t *tvb, gint offset) +{ + guint16 len; + guint8 pdoversion; + + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_preq_ms, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_preq_ea, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_preq_rd, tvb, offset, 1, TRUE); + offset += 2; + + pdoversion = tvb_get_guint8(tvb, offset); + proto_tree_add_string_format(epl_tree, hf_epl_preq_pdov, tvb, offset, + 1, "", "PDOVersion %d.%d", hi_nibble(pdoversion), lo_nibble(pdoversion)); + offset += 2; + + proto_tree_add_item(epl_tree, hf_epl_preq_size, tvb, offset, 2, TRUE); + + /* get size of payload */ + len = tvb_get_letohs(tvb, offset); + offset += 2; + + if (len > 0) + { + proto_tree_add_item(epl_tree, hf_epl_preq_pl, tvb, offset, len, TRUE); + } + offset += len; + + return offset; +} + + + +gint +dissect_epl_pres(proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset) +{ + guint16 len; + guint8 pdoversion; + + if (epl_src != EPL_MN_NODEID) /* check if the sender is CN or MN */ + { + proto_tree_add_item(epl_tree, hf_epl_pres_stat_cs, tvb, offset, 1, TRUE); + } + else /* MN */ + { + proto_tree_add_item(epl_tree, hf_epl_pres_stat_ms, tvb, offset, 1, TRUE); + } + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_pres_ms, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_pres_en, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_pres_rd, tvb, offset, 1, TRUE); + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_pres_pr, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_pres_rs, tvb, offset, 1, TRUE); + offset += 1; + + pdoversion = tvb_get_guint8(tvb, offset); + proto_tree_add_string_format(epl_tree, hf_epl_pres_pdov, tvb, offset, + 1, "", "PDOVersion %d.%d", hi_nibble(pdoversion), lo_nibble(pdoversion)); + offset += 2; + + proto_tree_add_item(epl_tree, hf_epl_pres_size, tvb, offset, 2, TRUE); + + /* get size of payload */ + len = tvb_get_letohs(tvb, offset); + offset += 2; + if (len > 0) + { + proto_tree_add_item(epl_tree, hf_epl_pres_pl, tvb, offset, len, TRUE); + } + offset += len; + + return offset; +} + + + +gint +dissect_epl_soa(proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset) +{ + guint8 eplversion; + + if (epl_src != EPL_MN_NODEID) /* check if CN or MN */ + { + proto_tree_add_item(epl_tree, hf_epl_soa_stat_cs, tvb, offset, 1, TRUE); + } + else /* MN */ + { + proto_tree_add_item(epl_tree, hf_epl_soa_stat_ms, tvb, offset, 1, TRUE); + } + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_soa_ea, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_soa_er, tvb, offset, 1, TRUE); + offset += 2; + + proto_tree_add_item(epl_tree, hf_epl_soa_svid, tvb, offset, 1, TRUE); + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_soa_svtg, tvb, offset, 1, TRUE); + offset += 1; + + eplversion = tvb_get_guint8(tvb, offset); + proto_tree_add_string_format(epl_tree, hf_epl_soa_eplv, tvb, offset, + 1, "", "EPLVersion %d.%d", hi_nibble(eplversion), lo_nibble(eplversion)); + offset += 1; + + return offset; +} + + + +gint +dissect_epl_asnd(proto_tree *tree, proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset) +{ + guint16 svid; + + proto_tree_add_item(epl_tree, hf_epl_asnd_svid, tvb, offset, 1, TRUE); + + /* get ServiceID of payload */ + svid = tvb_get_guint8(tvb, offset); + offset += 1; + + switch (svid) + { + case EPL_ASND_IDENTRESPONSE: + offset = dissect_epl_asnd_ires(epl_tree, tvb, epl_src, offset); + break; + + case EPL_ASND_STATUSRESPONSE: + offset = dissect_epl_asnd_sres(tree, epl_tree, tvb, epl_src, offset); + break; + + case EPL_ASND_NMTREQUEST: + offset = dissect_epl_asnd_nmtreq(epl_tree, tvb, offset); + break; + + case EPL_ASND_NMTCOMMAND: + offset = dissect_epl_asnd_nmtcmd(epl_tree, tvb, offset); + break; + + case EPL_ASND_SDO: + offset = dissect_epl_asnd_sdo(epl_tree, tvb, offset); + break; + } + + return offset; +} + + + +gint +dissect_epl_asnd_nmtreq(proto_tree *epl_tree, tvbuff_t *tvb, gint offset) +{ + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtrequest_rcid, tvb, offset, 1, TRUE); + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtrequest_rct, tvb, offset, 1, TRUE); + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtrequest_rcd, tvb, offset, -1, TRUE); + + return offset; +} + + + +gint +dissect_epl_asnd_nmtcmd(proto_tree *epl_tree, tvbuff_t *tvb, gint offset) +{ + guint8 epl_asnd_nmtcommand_cid; + + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtcommand_cid, tvb, offset, 1, TRUE); + epl_asnd_nmtcommand_cid = tvb_get_guint8(tvb, offset); + offset += 2; + + switch (epl_asnd_nmtcommand_cid) + { + case EPL_ASND_NMTCOMMAND_NMTNETHOSTNAMESET: + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtcommand_nmtnethostnameset_hn, tvb, offset, 32, TRUE); + offset += 32; + break; + + case EPL_ASND_NMTCOMMAND_NMTFLUSHARPENTRY: + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtcommand_nmtflusharpentry_nid, tvb, offset, 1, TRUE); + offset += 1; + break; + + case EPL_ASND_NMTCOMMAND_NMTPUBLISHTIME: + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtcommand_nmtpublishtime_dt, tvb, offset, 6, TRUE); + offset += 6; + break; + + default: + proto_tree_add_item(epl_tree, hf_epl_asnd_nmtcommand_cdat, tvb, offset, -1, TRUE); + } + return offset; +} + + + +gint +dissect_epl_asnd_ires(proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset) +{ + guint8 eplversion; + guint32 epl_asnd_identresponse_ipa, epl_asnd_identresponse_snm, epl_asnd_identresponse_gtw; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_en, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_ec, tvb, offset, 1, TRUE); + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_pr, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_rs, tvb, offset, 1, TRUE); + offset += 1; + + if (epl_src != EPL_MN_NODEID) /* check if CN or MN */ + { + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_stat_cs, tvb, offset, 1, TRUE); + } + else /* MN */ + { + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_stat_ms, tvb, offset, 1, TRUE); + } + offset += 2; + + eplversion = tvb_get_guint8(tvb, offset); + proto_tree_add_string_format(epl_tree, hf_epl_asnd_identresponse_ever, tvb, offset, + 1, "", "EPLVersion %d.%d", hi_nibble(eplversion), lo_nibble(eplversion)); + offset += 2; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_feat, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_mtu, tvb, offset, 2, TRUE); + offset += 2; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_pis, tvb, offset, 2, TRUE); + offset += 2; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_pos, tvb, offset, 2, TRUE); + offset += 2; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_rst, tvb, offset, 4, TRUE); + offset += 6; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_dt, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_vid, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_productcode, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_rno, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_sno, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_vex1, tvb, offset, 8, TRUE); + offset += 8; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_vcd, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_vct, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_ad, tvb, offset, 4, TRUE); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_at, tvb, offset, 4, TRUE); + offset += 4; + + epl_asnd_identresponse_ipa = tvb_get_ntohl(tvb, offset); + proto_tree_add_ipv4(epl_tree , hf_epl_asnd_identresponse_ipa, tvb, offset, 4, epl_asnd_identresponse_ipa); + offset += 4; + + epl_asnd_identresponse_snm = tvb_get_ntohl(tvb, offset); + proto_tree_add_ipv4(epl_tree , hf_epl_asnd_identresponse_snm, tvb, offset, 4, epl_asnd_identresponse_snm); + offset += 4; + + epl_asnd_identresponse_gtw = tvb_get_ntohl(tvb, offset); + proto_tree_add_ipv4(epl_tree , hf_epl_asnd_identresponse_gtw, tvb, offset, 4, epl_asnd_identresponse_gtw); + offset += 4; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_hn, tvb, offset, 32, TRUE); + offset += 32; + + proto_tree_add_item(epl_tree, hf_epl_asnd_identresponse_vex2, tvb, offset, 48, TRUE); + offset += 48; + + return offset; +} + + + +gint +dissect_epl_asnd_sres(proto_tree *tree, proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset) +{ + proto_item *ti_seb, *ti_el, *ti_el_entry, *ti_el_entry_type; + proto_tree *epl_seb_tree, *epl_el_tree, *epl_el_entry_tree, *epl_el_entry_type_tree; + guint number_of_entries, cnt; /* used for dissection of ErrorCodeList */ + + proto_tree_add_item(epl_tree, hf_epl_asnd_statusresponse_en, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_asnd_statusresponse_ec, tvb, offset, 1, TRUE); + offset += 1; + + proto_tree_add_item(epl_tree, hf_epl_asnd_statusresponse_pr, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_tree, hf_epl_asnd_statusresponse_rs, tvb, offset, 1, TRUE); + offset += 1; + + if (epl_src != EPL_MN_NODEID) /* check if CN or MN */ + { + proto_tree_add_item(epl_tree, hf_epl_asnd_statusresponse_stat_cs, tvb, offset, 1, TRUE); + } + else /* MN */ + { + proto_tree_add_item(epl_tree, hf_epl_asnd_statusresponse_stat_ms, tvb, offset, 1, TRUE); + } + offset += 4; + + /* Subtree for the static errorr bitfield */ + if (tree) + { + ti_seb = proto_tree_add_text(epl_tree, tvb, offset, 8, "StaticErrorBitfield"); + + epl_seb_tree = proto_item_add_subtree(ti_seb, ett_epl_seb); + + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit0, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit1, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit2, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit3, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit4, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit5, tvb, offset, 1, TRUE); + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit7, tvb, offset, 1, TRUE); + offset += 2; + + proto_tree_add_item(epl_seb_tree, hf_epl_asnd_statusresponse_seb_devicespecific_err, tvb,offset, 8, TRUE); + offset += 8; + } + + /* List of errors / events */ + if (tree) + { + /* get the number of entries in the error code list*/ + number_of_entries = (tvb_length(tvb)-offset)/20; + + ti_el = proto_tree_add_text(epl_tree, tvb, offset, -1, "ErrorCodeList: %d entries", number_of_entries); + + epl_el_tree = proto_item_add_subtree(ti_el, ett_epl_el); + + /*Dissect the whole Error List (display each entry)*/ + for (cnt = 0; cntIdentResponse */ +{ &hf_epl_asnd_identresponse_en, { "EN (Exception New)", "epl.asnd.ires.en", FT_UINT8, BASE_DEC, NULL, 0x10, "", HFILL }}, +{ &hf_epl_asnd_identresponse_ec, { "EC (Exception Clear)", "epl.asnd.ires.ec", FT_UINT8, BASE_DEC, NULL, 0x08, "", HFILL }}, +{ &hf_epl_asnd_identresponse_pr, { "PR (Priority)", "epl.asnd.ires.pr", FT_UINT8, BASE_DEC, VALS(epl_pr_vals), 0x38, "", HFILL }}, +{ &hf_epl_asnd_identresponse_rs, { "RS (RequestToSend)", "epl.asnd.ires.rs", FT_UINT8, BASE_DEC, NULL, 0x07, "", HFILL }}, +{ &hf_epl_asnd_identresponse_stat_ms, { "NMTStatus", "epl.asnd.ires.state", FT_UINT8, BASE_DEC, VALS(epl_nmt_ms_vals),0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_stat_cs, { "NMTStatus", "epl.asnd.ires.state", FT_UINT8, BASE_DEC, VALS(epl_nmt_cs_vals),0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_ever, { "EPLVersion", "epl.asnd.ires.eplver", FT_STRING, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_feat, { "FeatureFlags", "epl.asnd.ires.features", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_mtu, { "MTU", "epl.asnd.ires.mtu", FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_pis, { "PollInSize", "epl.asnd.ires.pollinsize", FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_pos, { "PollOutSize", "epl.asnd.ires.polloutsizes", FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_rst, { "ResponseTime", "epl.asnd.ires.resptime", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_dt, { "DeviceType", "epl.asnd.ires.devicetype", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_vid, { "VendorId", "epl.asnd.ires.vendorid", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_productcode,{ "ProductCode", "epl.asnd.ires.productcode", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_rno, { "RevisionNumber", "epl.asnd.ires.revisionno", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_sno, { "SerialNumber", "epl.asnd.ires.serialno", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_vex1, { "VendorSpecificExtension1", "epl.asnd.ires.vendorext1", FT_UINT64, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_vcd, { "VerifyConfigurationDate", "epl.asnd.ires.confdate", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_vct, { "VerifyConfigurationTime", "epl.asnd.ires.conftime", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_ad, { "applicationSwDate", "epl.asnd.ires.appswdate", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_at, { "applicationSwTime", "epl.asnd.ires.appswtime", FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_ipa, { "IPAddress", "epl.asnd.ires.ip", FT_IPv4, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_snm, { "SubnetMask", "epl.asnd.ires.subnet", FT_IPv4, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_gtw, { "DefaultGateway", "epl.asnd.ires.gateway", FT_IPv4, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_hn, { "HostName", "epl.asnd.ires.hostname", FT_STRING, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_identresponse_vex2, { "VendorSpecificExtension2", "epl.asnd.ires.vendorext2", FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL }}, + + +/* ASnd-->StatusResponse */ +{ &hf_epl_asnd_statusresponse_en, { "EN (Exception New)", "epl.asnd.sres.en", FT_UINT8, BASE_DEC, NULL, 0x10, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_ec, { "EC (Exception Clear)", "epl.asnd.sres.ec", FT_UINT8, BASE_DEC, NULL, 0x08, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_pr, { "PR (Priority)", "epl.asnd.sres.pr", FT_UINT8, BASE_DEC, VALS(epl_pr_vals), 0x38, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_rs, { "RS (RequestToSend)", "epl.asnd.sres.rs", FT_UINT8, BASE_DEC, NULL, 0x07, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_stat_ms, { "NMTStatus", "epl.asnd.sres.stat", FT_UINT8, BASE_DEC, VALS(epl_nmt_ms_vals), 0x00, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_stat_cs, { "NMTStatus", "epl.asnd.sres.stat", FT_UINT8, BASE_DEC, VALS(epl_nmt_cs_vals), 0x00, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb, { "StaticErrorBitField", "epl.asnd.sres.seb", FT_BYTES, BASE_HEX, NULL, 0x00, "", HFILL }}, + +/*StaticErrorBitField */ +{ &hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit0, { "Generic error", "epl.asnd.res.seb.bit0", FT_UINT8, BASE_DEC, NULL, 0x01, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit1, { "Current", "epl.asnd.res.seb.bit1", FT_UINT8, BASE_DEC, NULL, 0x02, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit2, { "Voltage", "epl.asnd.res.seb.bit2", FT_UINT8, BASE_DEC, NULL, 0x04, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit3, { "Temperature", "epl.asnd.res.seb.bit3", FT_UINT8, BASE_DEC, NULL, 0x08, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit4, { "Communication error", "epl.asnd.res.seb.bit4", FT_UINT8, BASE_DEC, NULL, 0x10, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit5, { "Device profile specific", "epl.asnd.res.seb.bit5", FT_UINT8, BASE_DEC, NULL, 0x20, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb_err_errorregister_u8_bit7, { "Manufacturer specific", "epl.asnd.res.seb.bit7", FT_UINT8, BASE_DEC, NULL, 0x80, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_seb_devicespecific_err, { "Device profile specific", "epl.asnd.res.seb.devicespecific_err",FT_BYTES, BASE_DEC,NULL, 0x00, "", HFILL }}, + +{ &hf_epl_asnd_statusresponse_el, { "ErrorsCodeList", "epl.asnd.sres.el", FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry, { "Entry", "epl.asnd.sres.el.entry", FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL }}, + +/*List of Errors/Events*/ +{ &hf_epl_asnd_statusresponse_el_entry_type, { "Entry Type", "epl.asnd.sres.el.entry.type", FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry_type_profile, { "Profile", "epl.asnd.sres.el.entry.type.profile", FT_UINT16, BASE_DEC, NULL, 0x0FFF, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry_type_mode, { "Mode", "epl.asnd.sres.el.entry.type.mode", FT_UINT16, BASE_DEC, NULL, 0x3000, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry_type_bit14, { "Bit14", "epl.asnd.sres.el.entry.type.bit14", FT_UINT16, BASE_DEC, NULL, 0x4000, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry_type_bit15, { "Bit15", "epl.asnd.sres.el.entry.type.bit15", FT_UINT16, BASE_DEC, NULL, 0x8000, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry_code, { "Error Code", "epl.asnd.sres.el.entry.code", FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry_time, { "Time Stamp", "epl.asnd.sres.el.entry.time", FT_UINT64, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_statusresponse_el_entry_add, { "Additional Information", "epl.asnd.sres.el.entry.add", FT_UINT64, BASE_DEC, NULL, 0x00, "", HFILL }}, + + +/* ASnd-->NMTRequest */ +{ &hf_epl_asnd_nmtrequest_rcid, { "NMTRequestedCommandID", "epl.asnd.nmtrequest.rcid", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_nmtrequest_rct, { "NMTRequestedCommandTarget", "epl.asnd.nmtrequest.rct", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_nmtrequest_rcd, { "NMTRequestedCommandData", "epl.asnd.nmtrequest.rcd", FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL }}, + +/* ASnd-->NMTCommand */ +{ &hf_epl_asnd_nmtcommand_cid, { "NMTCommandId", "epl.asnd.nmtcommand.cid", FT_UINT8, BASE_DEC, VALS(asnd_cid_vals), 0x00, "", HFILL }}, +{ &hf_epl_asnd_nmtcommand_cdat, { "NMTCommandData", "epl.asnd.nmtcommand.cdat", FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL }}, + +{ &hf_epl_asnd_nmtcommand_nmtnethostnameset_hn, { "HostName", "epl.asnd.nmtcommand.nmtnethostnameset.hn", FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_nmtcommand_nmtflusharpentry_nid, { "NodeID", "epl.asnd.nmtcommand.nmtflusharpentry.nid", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_nmtcommand_nmtpublishtime_dt, { "DateTime", "epl.asnd.nmtcommand.nmtpublishtime.dt", FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL }}, + +/* ASnd-->SDO */ +{ &hf_epl_asnd_sdo_seq_receive_sequence_number, { "ReceiveSequenceNumber", "epl.asnd.sdo.seq.receive.sequence.number", FT_UINT8, BASE_DEC, NULL, 0xfc, "", HFILL }}, +{ &hf_epl_asnd_sdo_seq_receive_con, { "ReceiveCon", "epl.asnd.sdo.seq.receive.con", FT_UINT8, BASE_DEC, VALS(epl_sdo_receive_con_vals), 0x03, "", HFILL }}, +{ &hf_epl_asnd_sdo_seq_send_sequence_number, { "SendSequenceNumber", "epl.asnd.sdo.seq.send.sequence.number", FT_UINT8, BASE_DEC, NULL, 0xfc, "", HFILL }}, +{ &hf_epl_asnd_sdo_seq_send_con, { "SendCon", "epl.asnd.sdo.seq.send.con", FT_UINT8, BASE_DEC, VALS(epl_sdo_send_con_vals), 0x03, "", HFILL }}, + +{ &hf_epl_asnd_sdo_cmd_transaction_id, { "SDO Transaction ID", "epl.asnd.sdo.cmd.transaction.id", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_response, { "SDO Response", "epl.asnd.sdo.cmd.response", FT_UINT8, BASE_DEC, VALS(epl_sdo_asnd_cmd_response), 0x80, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_abort, { "SDO Abort", "epl.asnd.sdo.cmd.abort", FT_UINT8, BASE_DEC, VALS(epl_sdo_asnd_cmd_abort), 0x40, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_segmentation, { "SDO Segmentation", "epl.asnd.sdo.cmd.segmentation", FT_UINT8, BASE_DEC, VALS(epl_sdo_asnd_cmd_segmentation), 0x30, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_command_id, { "SDO Command ID", "epl.asnd.sdo.cmd.command.id", FT_UINT8, BASE_DEC, VALS(epl_sdo_asnd_commands), 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_segment_size, { "SDO Segment size", "epl.asnd.sdo.cmd.segment.size", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_data_size, { "SDO Data size", "epl.asnd.sdo.cmd.data.size", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL } }, +{ &hf_epl_asnd_sdo_cmd_abort_code, { "SDO Transfer Abort", "epl.asnd.sdo.cmd.abort.code", FT_UINT8, BASE_HEX, VALS(sdo_cmd_abort_code), 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_write_by_index_index, { "SDO Write by Index, Index", "epl.asnd.sdo.cmd.write.by.index.index", FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_write_by_index_subindex, { "SDO Write by Index, SubIndex", "epl.asnd.sdo.cmd.write.by.index.subindex", FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_read_by_index_index, { "SDO Read by Index, Index", "epl.asnd.sdo.cmd.read.by.index.index", FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_read_by_index_subindex, { "SDO Read by Index, SubIndex", "epl.asnd.sdo.cmd.read.by.index.subindex", FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_write_by_index_data, { "Payload", "epl.asnd.sdo.cmd.write.by.index.data", FT_BYTES, BASE_HEX, NULL, 0x00, "", HFILL }}, +{ &hf_epl_asnd_sdo_cmd_read_by_index_data, { "Payload", "epl.asnd.sdo.cmd.read.by.index.data", FT_BYTES, BASE_HEX, NULL, 0x00, "", HFILL }}, +}; + + + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_epl, + &ett_epl_seb, + &ett_epl_el, + &ett_epl_el_entry, + &ett_epl_el_entry_type, + &ett_epl_sdo_entry_type, + }; + + /* Register the protocol name and description */ + proto_epl = proto_register_protocol("ETHERNET Powerlink v2", "EPL", "epl"); + + /* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_epl, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + /* tap-registration */ + /* epl_tap = register_tap("epl");*/ +} + + + +void +proto_reg_handoff_epl(void) +{ + dissector_handle_t epl_handle; + + epl_handle = create_dissector_handle(dissect_epl, proto_epl); + dissector_add("ethertype", ETHERTYPE_EPL_V2, epl_handle); +} diff --git a/epan/dissectors/packet-epl.h b/epan/dissectors/packet-epl.h new file mode 100644 index 0000000000..b6a74d9c10 --- /dev/null +++ b/epan/dissectors/packet-epl.h @@ -0,0 +1,428 @@ +/* packet-epl.h + * Routines for "Ethernet Powerlink 2.0" dissection + * (ETHERNET Powerlink V2.0 Communication Profile Specification Draft Standard Version 1.0.0) + * + * Copyright (c) 2006: Zurich University of Applied Sciences Winterthur (ZHW) + * Institute of Embedded Systems (InES) + * http://ines.zhwin.ch + * + * - Dominic Bchaz + * - Damir Bursic + * - David Bchi + * + * + * $Id$ + * + * A plugin for: + * Wireshark - Network traffic analyzer + * By Gerald Combs + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __PACKET_EPL_H__ +#define __PACKET_EPL_H__ + +/* function prototypes */ +static gboolean dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void proto_register_epl(void); +void proto_reg_handoff_epl(void); + +gint dissect_epl_soc(proto_tree *epl_tree, tvbuff_t *tvb, gint offset); +gint dissect_epl_preq(proto_tree *epl_tree, tvbuff_t *tvb, gint offset); +gint dissect_epl_pres(proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset); +gint dissect_epl_soa(proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset); + +gint dissect_epl_asnd(proto_tree *tree, proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset); +gint dissect_epl_asnd_ires(proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset); +gint dissect_epl_asnd_sres(proto_tree *tree, proto_tree *epl_tree, tvbuff_t *tvb, guint8 epl_src, gint offset); +gint dissect_epl_asnd_nmtcmd(proto_tree *epl_tree, tvbuff_t *tvb, gint offset); +gint dissect_epl_asnd_nmtreq(proto_tree *epl_tree, tvbuff_t *tvb, gint offset); + +gint dissect_epl_asnd_sdo(proto_tree *epl_tree, tvbuff_t *tvb, gint offset); +gint dissect_epl_sdo_sequence(proto_tree *epl_tree, tvbuff_t *tvb, gint offset); +gint dissect_epl_sdo_command(proto_tree *epl_tree, tvbuff_t *tvb, gint offset); +gint dissect_epl_sdo_command_write_by_index(proto_tree *epl_tree, tvbuff_t *tvb, gint offset, gboolean segmented, gboolean response); +gint dissect_epl_sdo_command_read_by_index(proto_tree *epl_tree, tvbuff_t *tvb, gint offset, gboolean response); + +const gchar* decode_epl_address(guchar adr); +const gchar* decode_epl_address_abbrev(guchar adr); + + + +/* Container for tapping relevant data */ +typedef struct _epl_info_t { + unsigned char epl_mtyp; +} epl_info_t; + + +/*EPL Addressing*/ +#define EPL_INVALID_NODEID 0 +#define EPL_MN_NODEID 240 +#define EPL_DIAGNOSTIC_DEVICE_NODEID 253 +#define EPL_TO_LEGACY_ETHERNET_ROUTER_NODEID 254 +#define EPL_BROADCAST_NODEID 255 + +static const value_string addr_str_vals[] = { + {EPL_INVALID_NODEID, " (invalid)" }, + {EPL_MN_NODEID, " (Managing Node)" }, + {EPL_DIAGNOSTIC_DEVICE_NODEID, " (Diagnostic Device)" }, + {EPL_TO_LEGACY_ETHERNET_ROUTER_NODEID, " (EPL to legacy Ethernet Router)" }, + {EPL_BROADCAST_NODEID, " (broadcast)" }, + {0,NULL} +}; +static const gchar* addr_str_cn = " (Controlled Node)"; +static const gchar* addr_str_res = " (reserved)"; + +static const value_string addr_str_abbr_vals[] = { + {EPL_INVALID_NODEID, " (inv.)" }, + {EPL_MN_NODEID, " (MN)" }, + {EPL_DIAGNOSTIC_DEVICE_NODEID, " (diag.)" }, + {EPL_TO_LEGACY_ETHERNET_ROUTER_NODEID, " (router)" }, + {EPL_BROADCAST_NODEID, " (bc)" }, + {0,NULL} +}; +static const gchar* addr_str_abbr_cn = " (CN)"; +static const gchar* addr_str_abbr_res = " (res.)"; + + +/* Offsets of fields within an EPL packet. */ +#define EPL_MTYP_OFFSET 0 /* same offset for all message types*/ +#define EPL_DEST_OFFSET 1 /* same offset for all message types*/ +#define EPL_SRC_OFFSET 2 /* same offset for all message types*/ + +#define EPL_SOA_SVID_OFFSET 6 +#define EPL_SOA_SVTG_OFFSET 7 +#define EPL_SOA_EPLV_OFFSET 8 + +#define EPL_ASND_SVID_OFFSET 3 +#define EPL_ASND_DATA_OFFSET 4 + + +/* EPL message types */ +#define EPL_SOC 0x01 +#define EPL_PREQ 0x03 +#define EPL_PRES 0x04 +#define EPL_SOA 0x05 +#define EPL_ASND 0x06 + +static const value_string mtyp_vals[] = { + {EPL_SOC, "Start of Cycle (SoC)" }, + {EPL_PREQ, "PollRequest (PReq)" }, + {EPL_PRES, "PollResponse (PRes)" }, + {EPL_SOA, "Start of Asynchronous (SoA)"}, + {EPL_ASND, "Asynchronous Send (ASnd)" }, + {0,NULL} +}; + +/* RequestedServiceID s for EPL message type "SoA" */ +#define EPL_SOA_NOSERVICE 0 +#define EPL_SOA_IDENTREQUEST 1 +#define EPL_SOA_STATUSREQUEST 2 +#define EPL_SOA_NMTREQUESTINVITE 3 +#define EPL_SOA_UNSPECIFIEDINVITE 255 + +static const value_string soa_svid_vals[] = { + {EPL_SOA_NOSERVICE, "NoService" }, + {EPL_SOA_IDENTREQUEST, "IdentRequest" }, + {EPL_SOA_STATUSREQUEST, "StatusRequest" }, + {EPL_SOA_NMTREQUESTINVITE, "NMTRequestInvite" }, + {EPL_SOA_UNSPECIFIEDINVITE, "UnspecifiedInvite"}, + {0,NULL} +}; + +/* ServiceID values for EPL message type "ASnd" */ +#define EPL_ASND_IDENTRESPONSE 1 +#define EPL_ASND_STATUSRESPONSE 2 +#define EPL_ASND_NMTREQUEST 3 +#define EPL_ASND_NMTCOMMAND 4 +#define EPL_ASND_SDO 5 + +static const value_string asnd_svid_vals[] = { + {EPL_ASND_IDENTRESPONSE, "IdentResponse" }, + {EPL_ASND_STATUSRESPONSE, "StatusResponse"}, + {EPL_ASND_NMTREQUEST, "NMTRequest" }, + {EPL_ASND_NMTCOMMAND, "NMTCommand" }, + {EPL_ASND_SDO, "SDO" }, + {0,NULL} +}; + +/* NMTCommand values for EPL message type "ASnd" */ +#define EPL_ASND_NMTCOMMAND_NMTSTARTNODE 0x21 +#define EPL_ASND_NMTCOMMAND_NMTSTOPNODE 0x22 +#define EPL_ASND_NMTCOMMAND_NMTENTERPREOPERATIONAL2 0x23 +#define EPL_ASND_NMTCOMMAND_NMTENABLEREADYTOOPERATE 0x24 +#define EPL_ASND_NMTCOMMAND_NMTRESETNODE 0x28 +#define EPL_ASND_NMTCOMMAND_NMTRESETCOMMUNICATION 0x29 +#define EPL_ASND_NMTCOMMAND_NMTRESETCONFIGURATION 0x2A +#define EPL_ASND_NMTCOMMAND_NMTSWRESET 0x2B + +#define EPL_ASND_NMTCOMMAND_NMTSTARTNODEEX 0x41 +#define EPL_ASND_NMTCOMMAND_NMTSTOPNODEEX 0x42 +#define EPL_ASND_NMTCOMMAND_NMTENTERPREOPERATIONAL2EX 0x43 +#define EPL_ASND_NMTCOMMAND_NMTENABLEREADYTOOPERATEEX 0x44 +#define EPL_ASND_NMTCOMMAND_NMTRESETNODEEX 0x48 +#define EPL_ASND_NMTCOMMAND_NMTRESETCOMMUNICATIONEX 0x49 +#define EPL_ASND_NMTCOMMAND_NMTRESETCONFIGURATIONEX 0x4A +#define EPL_ASND_NMTCOMMAND_NMTSWRESETEX 0x4B + +#define EPL_ASND_NMTCOMMAND_NMTNETHOSTNAMESET 0x62 +#define EPL_ASND_NMTCOMMAND_NMTFLUSHARPENTRY 0x63 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHCONFIGUREDNODES 0x80 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHACTIVENODES 0x90 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHPREOPERATIONAL1 0x91 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHPREOPERATIONAL2 0x92 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHREADYTOOPERATE 0x93 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHOPERATIONAL 0x94 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHSTOPPED 0x95 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHEMERGENCYNEW 0xA0 +#define EPL_ASND_NMTCOMMAND_NMTPUBLISHTIME 0XB0 +#define EPL_ASND_NMTCOMMAND_NMTINVALIDSERVICE 0xFF + +static const value_string asnd_cid_vals[] = { + {EPL_ASND_NMTCOMMAND_NMTSTARTNODE, "NMTStartNode" }, + {EPL_ASND_NMTCOMMAND_NMTSTOPNODE, "NMTStopNode" }, + {EPL_ASND_NMTCOMMAND_NMTENTERPREOPERATIONAL2, "NMTEnterPreOperational2" }, + {EPL_ASND_NMTCOMMAND_NMTENABLEREADYTOOPERATE, "NMTEnableReadyToOperate" }, + {EPL_ASND_NMTCOMMAND_NMTRESETNODE, "NMTResetNode" }, + {EPL_ASND_NMTCOMMAND_NMTRESETCOMMUNICATION, "NMTResetCommunication" }, + {EPL_ASND_NMTCOMMAND_NMTRESETCONFIGURATION, "NMTResetConfiguration" }, + {EPL_ASND_NMTCOMMAND_NMTSWRESET, "NMTSwReset" }, + {EPL_ASND_NMTCOMMAND_NMTSTARTNODEEX, "NMTStartNodeEx" }, + {EPL_ASND_NMTCOMMAND_NMTSTOPNODEEX, "NMTStopNodeEx" }, + {EPL_ASND_NMTCOMMAND_NMTENTERPREOPERATIONAL2EX, "NMTEnterPreOperational2Ex" }, + {EPL_ASND_NMTCOMMAND_NMTENABLEREADYTOOPERATEEX, "NMTEnableReadyToOperateEx" }, + {EPL_ASND_NMTCOMMAND_NMTRESETNODEEX, "NMTResetNodeEx" }, + {EPL_ASND_NMTCOMMAND_NMTRESETCOMMUNICATIONEX, "NMTCommunicationEx" }, + {EPL_ASND_NMTCOMMAND_NMTRESETCONFIGURATIONEX, "NMTResetConfigurationEx" }, + {EPL_ASND_NMTCOMMAND_NMTSWRESETEX, "NMTSwResetEx" }, + {EPL_ASND_NMTCOMMAND_NMTNETHOSTNAMESET, "NMTNetHostNameSet" }, + {EPL_ASND_NMTCOMMAND_NMTFLUSHARPENTRY, "NMTFlushArpEntry" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHCONFIGUREDNODES, "NMTPublishConfiguredNodes" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHACTIVENODES, "NMTPublishActiveNodes" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHPREOPERATIONAL1, "NMTPublishPreOperational1" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHPREOPERATIONAL2, "NMTPublishPreOperational2" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHREADYTOOPERATE, "NMTPublishReadyToOperate" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHOPERATIONAL, "NMTPublishOperational" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHSTOPPED, "NMTPublishStopped" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHEMERGENCYNEW, "NMTPublishEmergencyNew" }, + {EPL_ASND_NMTCOMMAND_NMTPUBLISHTIME, "NMTPublishTime" }, + {EPL_ASND_NMTCOMMAND_NMTINVALIDSERVICE, "NMTInvalidService" }, + {0,NULL} +}; + +/* Priority values for EPL message type "ASnd", "", "", field PR */ +#define EPL_PR_GENERICREQUEST 0x00 +#define EPL_PR_NMTREQUEST 0x07 + +static const value_string epl_pr_vals[] = { + {EPL_PR_GENERICREQUEST, "GenericRequest"}, + {EPL_PR_NMTREQUEST, "NMTRequest" }, + {0,NULL} +}; + +/* NMT State values (for CN)*/ +#define EPL_NMT_GS_OFF 0x00 +#define EPL_NMT_GS_INITIALIZING 0x19 +#define EPL_NMT_GS_RESET_APPLICATION 0x29 +#define EPL_NMT_GS_RESET_COMMUNICATION 0x39 +#define EPL_NMT_CS_NOT_ACTIVE 0x1C +#define EPL_NMT_CS_PRE_OPERATIONAL_1 0x1D +#define EPL_NMT_CS_PRE_OPERATIONAL_2 0x5D +#define EPL_NMT_CS_READY_TO_OPERATE 0x6D +#define EPL_NMT_CS_OPERATIONAL 0xFD +#define EPL_NMT_CS_STOPPED 0x4D +#define EPL_NMT_CS_BASIC_ETHERNET 0x1E + +static const value_string epl_nmt_cs_vals[] = { + {EPL_NMT_GS_OFF, "NMT_GS_OFF" }, + {EPL_NMT_GS_INITIALIZING, "NMT_GS_INITIALIZING" }, + {EPL_NMT_GS_RESET_APPLICATION, "NMT_GS_RESET_APPLICATION" }, + {EPL_NMT_GS_RESET_COMMUNICATION, "NMT_GS_RESET_COMMUNICATION"}, + {EPL_NMT_CS_NOT_ACTIVE, "NMT_CS_NOT_ACTIVE" }, + {EPL_NMT_CS_PRE_OPERATIONAL_1, "NMT_CS_PRE_OPERATIONAL_1" }, + {EPL_NMT_CS_PRE_OPERATIONAL_2, "NMT_CS_PRE_OPERATIONAL_2" }, + {EPL_NMT_CS_READY_TO_OPERATE, "NMT_CS_READY_TO_OPERATE" }, + {EPL_NMT_CS_OPERATIONAL, "NMT_CS_OPERATIONAL" }, + {EPL_NMT_CS_STOPPED, "NMT_CS_STOPPED" }, + {EPL_NMT_CS_BASIC_ETHERNET, "NMT_CS_BASIC_ETHERNET" }, + {0,NULL} +}; + +/* NMT State values (for MN)*/ +#define EPL_NMT_GS_OFF 0x00 +#define EPL_NMT_GS_INITIALIZING 0x19 +#define EPL_NMT_GS_RESET_APPLICATION 0x29 +#define EPL_NMT_GS_RESET_COMMUNICATION 0x39 +#define EPL_NMT_MS_NOT_ACTIVE 0x1C +#define EPL_NMT_MS_PRE_OPERATIONAL_1 0x1D +#define EPL_NMT_MS_PRE_OPERATIONAL_2 0x5D +#define EPL_NMT_MS_READY_TO_OPERATE 0x6D +#define EPL_NMT_MS_OPERATIONAL 0xFD +#define EPL_NMT_MS_BASIC_ETHERNET 0x1E + +static const value_string epl_nmt_ms_vals[] = { + {EPL_NMT_GS_OFF, "NMT_GS_OFF" }, + {EPL_NMT_GS_INITIALIZING, "NMT_GS_INITIALIZING" }, + {EPL_NMT_GS_RESET_APPLICATION, "NMT_GS_RESET_APPLICATION" }, + {EPL_NMT_GS_RESET_COMMUNICATION, "NMT_GS_RESET_COMMUNICATION"}, + {EPL_NMT_MS_NOT_ACTIVE, "NMT_MS_NOT_ACTIVE" }, + {EPL_NMT_MS_PRE_OPERATIONAL_1, "NMT_MS_PRE_OPERATIONAL_1" }, + {EPL_NMT_MS_PRE_OPERATIONAL_2, "NMT_MS_PRE_OPERATIONAL_2" }, + {EPL_NMT_MS_READY_TO_OPERATE, "NMT_MS_READY_TO_OPERATE" }, + {EPL_NMT_MS_OPERATIONAL, "NMT_MS_OPERATIONAL" }, + {EPL_NMT_MS_BASIC_ETHERNET, "NMT_MS_BASIC_ETHERNET" }, + {0,NULL} +}; + +/* SDO SequenceLayer */ +#define EPL_ASND_SDO_SEQ_RECEIVE_SEQUENCE_NUMBER_OFFSET 4 +#define EPL_ASND_SDO_SEQ_RECEIVE_CON_OFFSET 4 + +#define EPL_ASND_SDO_SEQ_SEND_SEQUENCE_NUMBER_OFFSET 5 +#define EPL_ASND_SDO_SEQ_SEND_CON_OFFSET 5 + +#define EPL_ASND_SDO_SEQ_RECEIVE_CON_NO_CONNECTION 0x00 +#define EPL_ASND_SDO_SEQ_RECEIVE_CON_INITIALIZATION 0x01 +#define EPL_ASND_SDO_SEQ_RECEIVE_CON_CONNECTION_VALID 0x02 +#define EPL_ASND_SDO_SEQ_RECEIVE_CON_ERROR_RESPONSE 0x03 + +static const value_string epl_sdo_receive_con_vals[] = { + {EPL_ASND_SDO_SEQ_RECEIVE_CON_NO_CONNECTION, "No connection" }, + {EPL_ASND_SDO_SEQ_RECEIVE_CON_INITIALIZATION, "Initialization" }, + {EPL_ASND_SDO_SEQ_RECEIVE_CON_CONNECTION_VALID, "Connection valid" }, + {EPL_ASND_SDO_SEQ_RECEIVE_CON_ERROR_RESPONSE, "Error Response (retransmission request)"}, + {0,NULL} +}; + +#define EPL_ASND_SDO_SEQ_SEND_CON_NO_CONNECTION 0x00 +#define EPL_ASND_SDO_SEQ_SEND_CON_INITIALIZATION 0x01 +#define EPL_ASND_SDO_SEQ_SEND_CON_CONNECTION_VALID 0x02 +#define EPL_ASND_SDO_SEQ_SEND_CON_ERROR_VALID_ACK_REQ 0x03 + +static const value_string epl_sdo_send_con_vals[] = { + {EPL_ASND_SDO_SEQ_SEND_CON_NO_CONNECTION, "No connection" }, + {EPL_ASND_SDO_SEQ_SEND_CON_INITIALIZATION, "Initialization" }, + {EPL_ASND_SDO_SEQ_SEND_CON_CONNECTION_VALID, "Connection valid" }, + {EPL_ASND_SDO_SEQ_SEND_CON_ERROR_VALID_ACK_REQ, "Connection valid with acknowledge request" }, + {0,NULL} +}; + +/* SDO EPL Command Layer Protocol */ +#define EPL_ASND_SDO_CMD_ABORT_FILTER 0x40 +#define EPL_ASND_SDO_CMD_SEGMENTATION_FILTER 0x10 +#define EPL_ASND_SDO_CMD_RESPONSE_FILTER 0x80 + + +/* SDO - Abort Transfer */ +static const value_string sdo_cmd_abort_code[] = { + {0x05030000, "reserved" }, + {0x05040000, "SDO protocol timed out." }, + {0x05040001, "Client/server Command ID not valid or unknown." }, + {0x05040002, "Invalid block size." }, + {0x05040003, "Invalid sequence number." }, + {0x05040004, "reserved" }, + {0x05040005, "Out of memory." }, + {0x06010000, "Unsupported access to an object." }, + {0x06010001, "Attempt to read a write-only object." }, + {0x06010002, "Attempt to write a read-only object." }, + {0x06020000, "Object does not exist in the object dictionary." }, + {0x06040041, "Object can not be mapped to the PDO." }, + {0x06040042, "The number and length of the objects to be mapped would exceed PDO length." }, + {0x06040043, "General parameter incompatibility." }, + {0x06040047, "General internal incompatibility in the device." }, + {0x06060000, "Access failed due to an hardware error." }, + {0x06070010, "Data type does not match, length of service parameter does not match." }, + {0x06070012, "Data type does not match, length of service parameter too high." }, + {0x06070013, "Data type does not match, length of service parameter too low." }, + {0x06090011, "Sub-index does not exist." }, + {0x06090030, "Value range of parameter exceeded (only for write access)." }, + {0x06090031, "Value of parameter writen to high." }, + {0x06090032, "Value of parameter writen to low." }, + {0x06090036, "maximum value is less then minimum value." }, + {0x08000000, "General error" }, + {0x08000020, "Data cannot be transferred or stored to the application." }, + {0x08000021, "Data cannot be transferred or stored to the application because of local control." }, + {0x08000022, "Data cannot be transferred or stored to the application because of the present device state." }, + {0x08000023, "Object dictionary dynamic generation fails or no object dictionary is present." }, + {0x08000024, "EDS, DCF or Concise DCF Data set empty." }, + {0,NULL} +}; + + +#define EPL_ASND_SDO_CMD_RESPONSE_RESPONSE 0 +#define EPL_ASND_SDO_CMD_RESPONSE_REQUEST 1 + +static const value_string epl_sdo_asnd_cmd_response[] = { + {EPL_ASND_SDO_CMD_RESPONSE_RESPONSE, "Request" }, + {EPL_ASND_SDO_CMD_RESPONSE_REQUEST, "Response" }, + {0,NULL} +}; + +#define EPL_ASND_SDO_CMD_ABORT_TRANSFER_OK 0 +#define EPL_ASND_SDO_CMD_ABORT_ABORT_TRANSFER 1 + +static const value_string epl_sdo_asnd_cmd_abort[] = { + {EPL_ASND_SDO_CMD_ABORT_TRANSFER_OK, "Transfer OK" }, + {EPL_ASND_SDO_CMD_ABORT_ABORT_TRANSFER, "Abort Transfer" }, + {0,NULL} +}; + +#define EPL_ASND_SDO_CMD_SEGMENTATION_EPEDITED_TRANSFER 0 +#define EPL_ASND_SDO_CMD_SEGMENTATION_INITIALE_TRANSFER 1 +#define EPL_ASND_SDO_CMD_SEGMENTATION_SEGMENT 2 +#define EPL_ASND_SDO_CMD_SEGMENTATION_TRANSFER_COMPLETE 3 + +static const value_string epl_sdo_asnd_cmd_segmentation[] = { + {EPL_ASND_SDO_CMD_SEGMENTATION_EPEDITED_TRANSFER, "Expedited Transfer" }, + {EPL_ASND_SDO_CMD_SEGMENTATION_INITIALE_TRANSFER, "Initiate Transfer" }, + {EPL_ASND_SDO_CMD_SEGMENTATION_SEGMENT, "Segment" }, + {EPL_ASND_SDO_CMD_SEGMENTATION_TRANSFER_COMPLETE, "Transfer Complete" }, + {0,NULL} +}; + +#define EPL_ASND_SDO_COMMAND_NOT_IN_LIST 0x00 +#define EPL_ASND_SDO_COMMAND_WRITE_BY_INDEX 0x01 +#define EPL_ASND_SDO_COMMAND_READ_BY_INDEX 0x02 +#define EPL_ASND_SDO_COMMAND_WRITE_ALL_BY_INDEX 0x03 +#define EPL_ASND_SDO_COMMAND_READ_ALL_BY_INDEX 0x04 +#define EPL_ASND_SDO_COMMAND_WRITE_BY_NAME 0x05 +#define EPL_ASND_SDO_COMMAND_READ_BY_NAME 0x06 +#define EPL_ASND_SDO_COMMAND_FILE_WRITE 0x20 +#define EPL_ASND_SDO_COMMAND_FILE_READ 0x21 +#define EPL_ASND_SDO_COMMAND_WRITE_MULTIPLE_PARAMETER_BY_INDEX 0x31 +#define EPL_ASND_SDO_COMMAND_READ_MULTIPLE_PARAMETER_BY_INDEX 0x32 +#define EPL_ASND_SDO_COMMAND_MAXIMUM_SEGMENT_SIZE 0x70 +#define EPL_ASND_SDO_COMMAND_LINK_NAME_TO_INDEX 0x71 + +static const value_string epl_sdo_asnd_commands[] = { + {EPL_ASND_SDO_COMMAND_NOT_IN_LIST , "Not in List" }, + {EPL_ASND_SDO_COMMAND_WRITE_BY_INDEX , "Write by Index" }, + {EPL_ASND_SDO_COMMAND_READ_BY_INDEX , "Read by Index" }, + {EPL_ASND_SDO_COMMAND_WRITE_ALL_BY_INDEX , "Write All by Index" }, + {EPL_ASND_SDO_COMMAND_READ_ALL_BY_INDEX , "Read All by Index" }, + {EPL_ASND_SDO_COMMAND_WRITE_BY_NAME , "Write by Name" }, + {EPL_ASND_SDO_COMMAND_READ_BY_NAME , "Read by Name" }, + {EPL_ASND_SDO_COMMAND_FILE_WRITE , "File Write" }, + {EPL_ASND_SDO_COMMAND_FILE_READ , "File Read" }, + {EPL_ASND_SDO_COMMAND_WRITE_MULTIPLE_PARAMETER_BY_INDEX, "Write Multiple Parameter by Index" }, + {EPL_ASND_SDO_COMMAND_READ_MULTIPLE_PARAMETER_BY_INDEX , "Read Multiple Parameter by Index" }, + {EPL_ASND_SDO_COMMAND_MAXIMUM_SEGMENT_SIZE , "Maximum Segment Size" }, + {EPL_ASND_SDO_COMMAND_LINK_NAME_TO_INDEX , "Link objects only accessible via name to an index/sub-index"}, + {0,NULL} +}; + +#endif /* __PACKET_EPL_H__ */ diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c index c3196f42ef..eba96ecaba 100644 --- a/epan/dissectors/packet-ethertype.c +++ b/epan/dissectors/packet-ethertype.c @@ -96,6 +96,7 @@ const value_string etype_vals[] = { {ETHERTYPE_PROFINET, "PROFINET" }, {ETHERTYPE_AOE, "ATA over Ethernet" }, {ETHERTYPE_TELKONET, "Telkonet powerline" }, + {ETHERTYPE_EPL_V2, "ETHERNET Powerlink v2" }, {ETHERTYPE_CSM_ENCAPS, "CSM_ENCAPS Protocol" }, {ETHERTYPE_IEEE802_OUI_EXTENDED, "IEEE 802a OUI Extended Ethertype" }, {ETHERTYPE_IEC61850_GOOSE, "IEC 61850/GOOSE" }, diff --git a/epan/etypes.h b/epan/etypes.h index a65f3a5657..08b2ac3771 100644 --- a/epan/etypes.h +++ b/epan/etypes.h @@ -260,6 +260,10 @@ #define ETHERTYPE_AOE 0x88A2 #endif +#ifndef ETHERTYPE_EPL_V2 +#define ETHERTYPE_EPL_V2 0x88AB +#endif + #ifndef ETHERTYPE_BRDWALK #define ETHERTYPE_BRDWALK 0x88AE #endif diff --git a/manuf b/manuf index 915009fe4e..aa80a09ab3 100644 --- a/manuf +++ b/manuf @@ -6506,13 +6506,24 @@ 00:19:5D ShenzhenXi # ShenZhen XinHuaTong Opto Electronics Co.,Ltd 00:19:5E MotorolaCh # Motorola CHS 00:19:5F ValemountN # Valemount Networks Corporation -00:19:60 Opticom # Opticom Inc. +00:19:60 Docomo # DoCoMo Systems, Inc. 00:19:61 Blaupunkt # Blaupunkt GmbH 00:19:62 Commercian # Commerciant, LP 00:19:63 SonyEricss # Sony Ericsson Mobile Communications AB 00:19:64 Doorking # Doorking Inc. 00:19:65 YuhuaTelte # YuHua TelTech (ShangHai) Co., Ltd. 00:19:66 AsiarockTe # Asiarock Technology Limited +00:19:67 TeldatSpJ # TELDAT Sp.J. +00:19:68 DigitalVid # Digital Video Networks(Shanghai) CO. LTD. +00:19:69 Nortel +00:19:6A Mikrom # MikroM GmbH +00:19:6B Danpex # Danpex Corporation +00:19:6C Etrovision # ETROVISION TECHNOLOGY +00:19:6D RaybitKore # Raybit Systems Korea, Inc +00:19:6E Metacom +00:19:6F Sensopart # SensoPart GmbH +00:19:70 Z-Com # Z-Com, Inc. +00:19:71 GuangzhouU # Guangzhou Unicomp Technology Co.,Ltd 00:1C:7C Perq # PERQ SYSTEMS CORPORATION 00:20:00 LexmarkInt # LEXMARK INTERNATIONAL, INC. 00:20:01 DspSolutio # DSP SOLUTIONS, INC. @@ -9646,6 +9657,10 @@ EC:10:00 EnanceSour # Enance Source Co., Ltd. PC clones(?) 01-00-81-00-00-02 Synoptics-Network-Management 01-00-81-00-01-00 Bay-Networks-(Synoptics)-autodiscovery 01-00-81-00-01-01 Bay-Networks-(Synoptics)-autodiscovery +01-11-1E-00-00-01 EPLv2_SoC +01-11-1E-00-00-02 EPLv2_PRes +01-11-1E-00-00-03 EPLv2_SoA +01-11-1E-00-00-04 EPLv2_ASnd 01-20-25/25 Control-Technology-Inc's-Industrial-Ctrl-Proto. 01-80-24-00-00-00 Kalpana-Etherswitch-every-60-seconds 01-80-C2-00-00-00/44 Spanning-tree-(for-bridges) diff --git a/wka.tmpl b/wka.tmpl index c8caa5a8a1..d682cbf21e 100644 --- a/wka.tmpl +++ b/wka.tmpl @@ -58,6 +58,10 @@ 01-00-81-00-00-02 Synoptics-Network-Management 01-00-81-00-01-00 Bay-Networks-(Synoptics)-autodiscovery 01-00-81-00-01-01 Bay-Networks-(Synoptics)-autodiscovery +01-11-1E-00-00-01 EPLv2_SoC +01-11-1E-00-00-02 EPLv2_PRes +01-11-1E-00-00-03 EPLv2_SoA +01-11-1E-00-00-04 EPLv2_ASnd 01-20-25/25 Control-Technology-Inc's-Industrial-Ctrl-Proto. 01-80-24-00-00-00 Kalpana-Etherswitch-every-60-seconds 01-80-C2-00-00-00/44 Spanning-tree-(for-bridges)