diff options
author | Bill Meier <wmeier@newsguy.com> | 2010-10-02 14:54:09 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2010-10-02 14:54:09 +0000 |
commit | ea1a3de5fc7a0edc4522abc3cc5af82a47cc66b0 (patch) | |
tree | f47e0487e278b2796348d008a3e60ff8caa8dd3a /epan/dissectors/packet-cfm.c | |
parent | 3664650ead1158175228d59259e2538c609cbef2 (diff) |
Minor cleanup:
- packet-cfm.h not used elsewhere: incorporate into packet-cfm.c;
- Move proto_register and proto_reg_handoff to the end of the file;
- Localize some variables;
- Remove some unneeded initializers;
- Cleanu some whitesace.
svn path=/trunk/; revision=34334
Diffstat (limited to 'epan/dissectors/packet-cfm.c')
-rw-r--r-- | epan/dissectors/packet-cfm.c | 1418 |
1 files changed, 724 insertions, 694 deletions
diff --git a/epan/dissectors/packet-cfm.c b/epan/dissectors/packet-cfm.c index 2085e31780..def1082f62 100644 --- a/epan/dissectors/packet-cfm.c +++ b/epan/dissectors/packet-cfm.c @@ -12,12 +12,12 @@ * 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. @@ -28,7 +28,7 @@ * dissector development. Any updates to these documents may require additional * modifications to this code. */ - + #ifdef HAVE_CONFIG_H # include "config.h" @@ -37,10 +37,42 @@ #include <epan/packet.h> #include <glib.h> #include <epan/etypes.h> -#include "packet-cfm.h" -/* forward reference */ -static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +/** Value declarations for CFM EOAM (IEEE 802.1ag) dissection */ +#define IEEE8021 0x00 +#define CCM 0x01 +#define LBR 0x02 +#define LBM 0x03 +#define LTR 0x04 +#define LTM 0X05 + +#define AIS 0x21 +#define LCK 0x23 +#define TST 0x25 +#define APS 0x27 +#define RAPS 0x28 +#define MCC 0x29 +#define LMM 0x2B +#define LMR 0x2A +#define ODM 0x2D +#define DMM 0x2F +#define DMR 0x2E +#define EXM 0x31 +#define EXR 0x30 +#define VSM 0x33 +#define VSR 0x32 + +#define END_TLV 0x00 +#define SENDER_ID_TLV 0x01 +#define PORT_STAT_TLV 0x02 +#define DATA_TLV 0x03 +#define INTERF_STAT_TLV 0x04 +#define REPLY_ING_TLV 0x05 +#define REPLY_EGR_TLV 0x06 +#define LTM_EGR_ID_TLV 0x07 +#define LTR_EGR_ID_TLV 0x08 +#define ORG_SPEC_TLV 0x1F +#define TEST_TLV 0x20 static int proto_cfm = -1; @@ -320,571 +352,24 @@ static gint ett_cfm_all_tlvs = -1; static gint ett_cfm_tlv = -1; static gint ett_cfm_raps_flags = -1; -/* Register CFM EOAM protocol */ -void proto_register_cfm(void) -{ - static hf_register_info hf[] = { - { &hf_cfm_md_level, - { "CFM MD Level", "cfm.md.level", FT_UINT8, - BASE_DEC, NULL, 0xe0, NULL, HFILL } - }, - { &hf_cfm_version, - { "CFM Version", "cfm.version", FT_UINT8, - BASE_DEC, NULL, 0x1f, NULL, HFILL } - }, - { &hf_cfm_opcode, - { "CFM OpCode", "cfm.opcode", FT_UINT8, - BASE_DEC, VALS(opcodetypenames), 0x0, NULL, HFILL } - }, - - /* CFM CCM*/ - { &hf_cfm_ccm_pdu, - { "CFM CCM PDU", "cfm.ccm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_flags, - { "Flags", "cfm.flags", FT_UINT8, - BASE_HEX, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_flags_RDI, - { "RDI", "cfm.flags.rdi", FT_UINT8, - BASE_DEC, NULL, 0x80, NULL, HFILL } - }, - { &hf_cfm_flags_ccm_Reserved, - { "Reserved", "cfm.flags.ccm.reserved", FT_UINT8, - BASE_DEC, NULL, 0x78, NULL, HFILL } - }, - { &hf_cfm_flags_Interval, - { "Interval Field", "cfm.flags.interval", FT_UINT8, - BASE_DEC, VALS(CCM_IntervalFieldEncoding), 0x07, NULL, HFILL } - }, - { &hf_cfm_first_tlv_offset, - { "First TLV Offset", "cfm.first.tlv.offset", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_ccm_seq_number, - { "Sequence Number", "cfm.ccm.seq.num", FT_UINT32, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_ccm_ma_ep_id, - { "Maintenance Association End Point Identifier", "cfm.ccm.ma.ep.id", - FT_UINT16, BASE_DEC, NULL, 0x1FFF, NULL, HFILL } - }, - { &hf_cfm_ccm_maid, - { "Maintenance Association Identifier (MEG ID)", "cfm.ccm.maid", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_md_name_format, - { "MD Name Format", "cfm.maid.md.name.format", FT_UINT8, - BASE_DEC, VALS(mdnameformattypes), 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_md_name_length, - { "MD Name Length", "cfm.maid.md.name.length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_md_name_string, - { "MD Name (String)", "cfm.maid.md.name", FT_STRING, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_md_name_hex, - { "MD Name", "cfm.maid.md.name", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_md_name_mac, - { "MD Name (MAC)", "cfm.maid.md.name.mac", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_md_name_mac_id, - { "MD Name (MAC)", "cfm.maid.md.name.mac.id", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_ma_name_format, - { "Short MA Name (MEG ID) Format", "cfm.maid.ma.name.format", FT_UINT8, - BASE_DEC, VALS(manameformattypes), 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_ma_name_length, - { "Short MA Name (MEG ID) Length", "cfm.maid.ma.name.length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_ma_name_string, - { "Short MA Name", "cfm.maid.ma.name", FT_STRING, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_ma_name_hex, - { "Short MA Name", "cfm.maid.ma.name", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_maid_padding, - { "Zero-Padding", "cfm.ccm.maid.padding", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_ccm_itu_t_y1731, - { "Defined by ITU-T Y.1731", "cfm.ccm.itu.t.y1731", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_itu_TxFCf, - { "TxFCf", "cfm.itu.txfcf", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_itu_RxFCb, - { "RxFCb", "cfm.itu.rxfcb", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_itu_TxFCb, - { "TxFCb", "cfm.itu.txfcb", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_itu_reserved, - { "Reserved", "cfm.itu.reserved", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM LBM*/ - { &hf_cfm_lbm_pdu, - { "CFM LBM PDU", "cfm.lbm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_lb_transaction_id, - { "Loopback Transaction Identifier", "cfm.lb.transaction.id", FT_UINT32, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - - /* CFM LBR*/ - { &hf_cfm_lbr_pdu, - { "CFM LBR PDU", "cfm.lbr.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM LTM*/ - { &hf_cfm_ltm_pdu, - { "CFM LTM PDU", "cfm.ltm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_flags_UseFDBonly, - { "UseFDBonly", "cfm.flags.usefdbonly", FT_UINT8, - BASE_DEC, NULL, 0x80, NULL, HFILL } - }, - { &hf_cfm_flags_ltm_Reserved, - { "Reserved", "cfm.flags.ltm.reserved", FT_UINT8, - BASE_DEC, NULL, 0x7F, NULL, HFILL } - }, - { &hf_cfm_lt_transaction_id, - { "Linktrace Transaction Identifier", "cfm.lt.transaction.id", FT_UINT32, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_lt_ttl, - { "Linktrace TTL", "cfm.lt.ttl", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_ltm_orig_addr, - { "Linktrace Message: Original Address", "cfm.ltm.orig.addr", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_ltm_targ_addr, - { "Linktrace Message: Target Address", "cfm.ltm.targ.addr", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM LTR*/ - { &hf_cfm_ltr_pdu, - { "CFM LTR PDU", "cfm.ltr.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_flags_FwdYes, - { "FwdYes", "cfm.flags.fwdyes", FT_UINT8, - BASE_DEC, NULL, 0x40, NULL, HFILL } - }, - { &hf_cfm_flags_TerminalMEP, - { "TerminalMEP", "cfm.flags.ltr.terminalmep", FT_UINT8, - BASE_DEC, NULL, 0x20, NULL, HFILL } - }, - { &hf_cfm_flags_ltr_Reserved, - { "Reserved", "cfm.flags.ltr.reserved", FT_UINT8, - BASE_DEC, NULL, 0x1F, NULL, HFILL } - }, - { &hf_cfm_ltr_relay_action, - { "Linktrace Reply Relay Action", "cfm.ltr.relay.action", FT_UINT8, - BASE_DEC, VALS(relayactiontypes), 0x0, NULL, HFILL} - }, - - /* CFM AIS*/ - { &hf_cfm_ais_pdu, - { "CFM AIS PDU", "cfm.ais.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_flags_ais_lck_Reserved, - { "Reserved", "cfm.flags.reserved", FT_UINT8, - BASE_DEC, NULL, 0xF8, NULL, HFILL } - }, - { &hf_cfm_flags_ais_lck_Period, - { "Period", "cfm.flags.period", FT_UINT8, - BASE_DEC, VALS(aislckperiodtypes), 0x07, NULL, HFILL } - }, - - /* CFM LCK */ - { &hf_cfm_lck_pdu, - { "CFM LCK PDU", "cfm.lck.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM TST */ - { &hf_cfm_tst_pdu, - { "CFM TST PDU", "cfm.tst.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_flags_Reserved, - { "Reserved", "cfm.flags.reserved", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_tst_sequence_num, - { "Sequence Number", "cfm.tst.sequence.num", FT_UINT32, - BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - - /* CFM APS */ - { &hf_cfm_aps_pdu, - { "CFM APS PDU", "cfm.aps.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_aps_data, - { "APS data", "cfm.aps.data", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM R-APS */ - { &hf_cfm_raps_pdu, - { "CFM R-APS PDU", "cfm.raps.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_raps_req_st, - { "Request/State", "cfm.raps.req.st", FT_UINT8, - BASE_HEX, VALS(rapsrequeststatevalues), 0xF0, NULL, HFILL } - }, - { &hf_cfm_raps_flags, - { "R-APS Flags", "cfm.raps.flags", FT_UINT8, - BASE_HEX, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_raps_flags_rb, - { "RPL Blocked", "cfm.raps.flags.rb", FT_UINT8, - BASE_HEX, VALS(rapsrplblockedvalues), 0x80, NULL, HFILL } - }, - { &hf_cfm_raps_flags_dnf, - { "Do Not Flush", "cfm.raps.flags.dnf", FT_UINT8, - BASE_HEX, VALS(rapsdnfvalues), 0x40, NULL, HFILL } - }, - { &hf_cfm_raps_node_id, - { "R-APS Node ID", "cfm.raps.node.id", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_raps_reserved, - { "R-APS Reserved", "cfm.raps.reserved", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM MCC */ - { &hf_cfm_mcc_pdu, - { "CFM MCC PDU", "cfm.mcc.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_mcc_data, - { "MCC data", "cfm.mcc.data", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM LMM */ - { &hf_cfm_lmm_pdu, - { "CFM LMM PDU", "cfm.lmm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_lmm_lmr_TxFCf, - { "TxFCf", "cfm.lmm.lmr.txfcf", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_lmm_lmr_RxFCf, - { "RxFCf", "cfm.lmm.lmr.rxfcf", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_lmm_lmr_TxFCb, - { "TxFCb", "cfm.lmm.lmr.txfcb", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - - /* CFM LMR */ - { &hf_cfm_lmr_pdu, - { "CFM LMR PDU", "cfm.lmr.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM 1DM */ - { &hf_cfm_odm_pdu, - { "CFM 1DM PDU", "cfm.odm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_odm_dmm_dmr_TxTimestampf, - { "TxTimestampf", "cfm.odm.dmm.dmr.txtimestampf", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_odm_dmm_dmr_RxTimestampf, - { "RxTimestampf", "cfm.odm.dmm.dmr.rxtimestampf", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM DMM */ - { &hf_cfm_dmm_pdu, - { "CFM DMM PDU", "cfm.dmm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_dmm_dmr_TxTimestampb, - { "TxTimestampb", "cfm.dmm.dmr.txtimestampb", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_dmm_dmr_RxTimestampb, - { "RxTimestampb", "cfm.dmm.dmr.rxtimestampb", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM DMR */ - { &hf_cfm_dmr_pdu, - { "CFM DMR PDU", "cfm.dmr.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM EXM */ - { &hf_cfm_exm_pdu, - { "CFM EXM PDU", "cfm.exm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_exm_exr_data, - { "EXM/EXR data", "cfm.mcc.data", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM EXR */ - { &hf_cfm_exr_pdu, - { "CFM EXR PDU", "cfm.exr.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM VSM */ - { &hf_cfm_vsm_pdu, - { "CFM VSM PDU", "cfm.vsm.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_vsm_vsr_data, - { "VSM/VSR data", "cfm.mcc.data", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* CFM VSR */ - { &hf_cfm_vsr_pdu, - { "CFM VSR PDU", "cfm.vsr.pdu", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /******************************* TLVs ****************************/ - { &hf_cfm_all_tlvs, - { "CFM TLVs", "cfm.all.tlvs", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_cfm_tlv_type, - { "TLV Type", "cfm.tlv.type", FT_UINT8, - BASE_DEC, VALS(tlvtypefieldvalues), 0x0, NULL, HFILL} - }, - { &hf_cfm_tlv_length, - { "TLV Length", "cfm.tlv.length", FT_UINT16, - BASE_DEC, NULL, 0x0, NULL, HFILL} - }, - /* Sender ID TLV */ - { &hf_tlv_chassis_id_length, - { "Chassis ID Length", "cfm.tlv.chassis.id.length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_chassis_id_subtype, - { "Chassis ID Sub-type", "cfm.tlv.chassis.id.subtype", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_chassis_id, - { "Chassis ID", "cfm.tlv.chassis.id", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_ma_domain_length, - { "Management Address Domain Length", "cfm.tlv.ma.domain.length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_ma_domain, - { "Management Address Domain", "cfm.tlv.ma.domain", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_management_addr_length, - { "Management Address Length", "cfm.tlv.management.addr.length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_management_addr, - { "Management Address", "cfm.tlv.management.addr", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL} - }, - - /* Port Status TLV */ - { &hf_tlv_port_status_value, - { "Port Status value", "cfm.tlv.port.status.value", FT_UINT8, - BASE_DEC, VALS(portstatTLVvalues), 0x0, NULL, HFILL} - }, - - /* Data TLV */ - { &hf_tlv_data_value, - { "Data Value", "cfm.tlv.data.value", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL} - }, - - /* Interface status TLV */ - { &hf_tlv_interface_status_value, - { "Interface Status value", "cfm.tlv.port.interface.value", FT_UINT8, - BASE_DEC, VALS(interfacestatTLVvalues), 0x0, NULL, HFILL} - }, - - /* Reply Ingress TLV */ - { &hf_tlv_reply_ingress_action, - { "Ingress Action", "cfm.tlv.reply.ingress.action", FT_UINT8, - BASE_DEC, VALS(replyingressTLVvalues), 0x0, NULL, HFILL} - }, - { &hf_tlv_reply_ingress_mac_address, - { "Ingress MAC address", "cfm.tlv.reply.ingress.mac.address", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_reply_ing_egr_portid_length, - { "Chassis ID Length", "cfm.tlv.chassis.id.length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_reply_ing_egr_portid_subtype, - { "Chassis ID Sub-type", "cfm.tlv.chassis.id.subtype", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL} - }, - { &hf_tlv_reply_ing_egr_portid, - { "Chassis ID", "cfm.tlv.chassis.id", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL} - }, - - /* Reply Egress TLV */ - { &hf_tlv_reply_egress_action, - { "Egress Action", "cfm.tlv.reply.egress.action", FT_UINT8, - BASE_DEC, VALS(replyegressTLVvalues), 0x0, NULL, HFILL} - }, - { &hf_tlv_reply_egress_mac_address, - { "Egress MAC address", "cfm.tlv.reply.egress.mac.address", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* LTM Egress Identifier TLV */ - { &hf_tlv_ltm_egress_id_mac, - { "Egress Identifier - MAC of LT Initiator/Responder", "cfm.tlv.ltm.egress.id.mac", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_ltm_egress_id_unique_identifier, - { "Egress Identifier - Unique Identifier", "cfm.tlv.ltm.egress.id.ui", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* LTR Egress Identifier TLV */ - { &hf_tlv_ltr_egress_last_id_mac, - { "Last Egress Identifier - MAC address", "cfm.tlv.ltr.egress.last.id.mac", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_ltr_egress_last_id_unique_identifier, - { "Last Egress Identifier - Unique Identifier", "cfm.tlv.ltr.egress.last.id.ui", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_ltr_egress_next_id_mac, - { "Next Egress Identifier - MAC address", "cfm.tlv.ltr.egress.next.id.mac", FT_ETHER, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_ltr_egress_next_id_unique_identifier, - { "Next Egress Identifier - Unique Identifier", "cfm.tlv.ltr.egress.next.id.ui", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* Organization-Specific TLV */ - { &hf_tlv_org_spec_oui, - { "OUI", "cfm.tlv.org.spec.oui", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_org_spec_subtype, - { "Sub-Type", "cfm.tlv.org.spec.subtype", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_org_spec_value, - { "Value", "cfm.tlv.org.spec.value", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - - /* Test TLV */ - { &hf_tlv_tst_test_pattern_type, - { "Test Pattern Type", "cfm.tlv.tst.test.pattern.type", FT_UINT8, - BASE_DEC, VALS(testTLVpatterntypes), 0x0, NULL, HFILL} - }, - { &hf_tlv_tst_test_pattern, - { "Test Pattern", "cfm.tlv.tst.test.pattern", FT_NONE, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - { &hf_tlv_tst_CRC32, - { "CRC-32", "cfm.tlv.tst.crc32", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL } - }, - }; - - /* Setup protocol subtree array */ - static gint *ett[] = { - &ett_cfm, - &ett_cfm_flags, - &ett_cfm_ccm_maid, - &ett_cfm_ccm_itu, - &ett_cfm_pdu, - &ett_cfm_all_tlvs, - &ett_cfm_tlv, - &ett_cfm_raps_flags - }; - - proto_cfm = proto_register_protocol ( - "CFM EOAM 802.1ag/ITU Protocol", /* name */ - "CFM", /* short name */ - "cfm" /* abbrev */ - ); - - register_dissector("cfm", dissect_cfm, proto_cfm); - - proto_register_field_array(proto_cfm, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - -} - -/* Register CFM OEAM protocol handler */ -void proto_reg_handoff_cfm(void) -{ - dissector_handle_t cfm_handle; - cfm_handle = create_dissector_handle(dissect_cfm, proto_cfm); - dissector_add("ethertype", ETHERTYPE_CFM, cfm_handle); -} - /* CFM EOAM sub-protocol dissectors: CCM, LBM, LBR, LTM, LTR */ static int dissect_cfm_ccm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - gint maid_offset = 0; - gint itu_offset = 0; - gint padding_length = 0; + gint maid_offset; + gint itu_offset; - guint8 cfm_maid_md_name_format = 0; - guint8 cfm_maid_md_name_length = 0; - guint8 cfm_maid_ma_name_format = 0; - guint8 cfm_maid_ma_name_length = 0; + guint8 cfm_maid_md_name_format; + guint8 cfm_maid_ma_name_format; + guint8 cfm_maid_ma_name_length; - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_item *mi = NULL; - proto_item *wi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; - proto_tree *cfm_ccm_maid_tree = NULL; - proto_tree *cfm_ccm_itu_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_item *mi; + proto_item *wi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; + proto_tree *cfm_ccm_maid_tree; + proto_tree *cfm_ccm_itu_tree; ti = proto_tree_add_item(tree, hf_cfm_ccm_pdu, tvb, offset, -1, FALSE); @@ -912,6 +397,7 @@ static int dissect_cfm_ccm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr cfm_maid_md_name_format = tvb_get_guint8(tvb, maid_offset); maid_offset += 1; if (cfm_maid_md_name_format != 1) { + guint8 cfm_maid_md_name_length; proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_length, tvb, maid_offset, 1, FALSE); cfm_maid_md_name_length = tvb_get_guint8(tvb, maid_offset); @@ -922,17 +408,17 @@ static int dissect_cfm_ccm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr if (cfm_maid_md_name_length != 8) { /* the MD name of type MAC should be 8 octets but if * it isn't we are going to try and process it anyways.*/ - proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_hex, + proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_hex, tvb, maid_offset, cfm_maid_md_name_length, FALSE); } else { - proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_mac, + proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_mac, tvb, maid_offset, 6, FALSE); - proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_mac_id, + proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_mac_id, tvb, maid_offset+6, 2, FALSE); } } else { /* MD name format is regular string or DNS string */ - proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_string, + proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_md_name_string, tvb, maid_offset, cfm_maid_md_name_length, FALSE); } maid_offset += cfm_maid_md_name_length; @@ -945,17 +431,18 @@ static int dissect_cfm_ccm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr cfm_maid_ma_name_length = tvb_get_guint8(tvb, maid_offset); maid_offset += 1; if (cfm_maid_ma_name_format == 2) { - proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_ma_name_string, + proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_ma_name_string, tvb, maid_offset, cfm_maid_ma_name_length, FALSE); } else { - proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_ma_name_hex, + proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_ma_name_hex, tvb, maid_offset, cfm_maid_ma_name_length, FALSE); } maid_offset += cfm_maid_ma_name_length; offset += 48; if (offset > maid_offset) { + gint padding_length; padding_length = offset - maid_offset; - proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_padding, + proto_tree_add_item(cfm_ccm_maid_tree, hf_cfm_maid_padding, tvb, maid_offset, padding_length, FALSE); } @@ -978,8 +465,8 @@ static int dissect_cfm_ccm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_lbm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_tree *cfm_pdu_tree = NULL; + proto_item *ti; + proto_tree *cfm_pdu_tree; ti = proto_tree_add_item(tree, hf_cfm_lbm_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -995,8 +482,8 @@ static int dissect_cfm_lbm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_lbr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_tree *cfm_pdu_tree = NULL; + proto_item *ti; + proto_tree *cfm_pdu_tree; ti = proto_tree_add_item(tree, hf_cfm_lbr_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1012,10 +499,10 @@ static int dissect_cfm_lbr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_ltm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_ltm_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1041,10 +528,10 @@ static int dissect_cfm_ltm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_ltr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_ltr_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1070,10 +557,10 @@ static int dissect_cfm_ltr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_ais(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_ais_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1086,16 +573,16 @@ static int dissect_cfm_ais(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree_add_item(cfm_pdu_tree, hf_cfm_first_tlv_offset, tvb, offset, 1, FALSE); offset += 1; - + return offset; } static int dissect_cfm_lck(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_lck_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1108,16 +595,16 @@ static int dissect_cfm_lck(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree_add_item(cfm_pdu_tree, hf_cfm_first_tlv_offset, tvb, offset, 1, FALSE); offset += 1; - + return offset; } static int dissect_cfm_tst(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_tst_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1132,17 +619,17 @@ static int dissect_cfm_tst(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree_add_item(cfm_pdu_tree, hf_cfm_tst_sequence_num, tvb, offset, 4, FALSE); offset += 4; - + return offset; } static int dissect_cfm_aps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - gint cfm_tlv_offset = 0; - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + gint cfm_tlv_offset; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_aps_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1169,12 +656,12 @@ static int dissect_cfm_aps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_raps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_item *ri = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; - proto_tree *raps_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_item *ri; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; + proto_tree *raps_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_raps_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1201,17 +688,17 @@ static int dissect_cfm_raps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t proto_tree_add_item(cfm_pdu_tree, hf_cfm_raps_reserved, tvb, offset, 24, FALSE); offset += 24; - + return offset; } static int dissect_cfm_mcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - gint cfm_tlv_offset = 0; - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + gint cfm_tlv_offset; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_mcc_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1245,10 +732,10 @@ static int dissect_cfm_mcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_lmm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_lmm_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1273,10 +760,10 @@ static int dissect_cfm_lmm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_lmr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_lmr_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1301,10 +788,10 @@ static int dissect_cfm_lmr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_odm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_odm_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1327,10 +814,10 @@ static int dissect_cfm_odm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_dmm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_dmm_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1357,10 +844,10 @@ static int dissect_cfm_dmm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_dmr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_dmr_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1387,11 +874,11 @@ static int dissect_cfm_dmr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_exm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - gint cfm_tlv_offset = 0; - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + gint cfm_tlv_offset; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_exm_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1425,11 +912,11 @@ static int dissect_cfm_exm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_exr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - gint cfm_tlv_offset = 0; - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + gint cfm_tlv_offset; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_exr_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1463,11 +950,11 @@ static int dissect_cfm_exr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_vsm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - gint cfm_tlv_offset = 0; - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + gint cfm_tlv_offset; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_vsm_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1501,11 +988,11 @@ static int dissect_cfm_vsm(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static int dissect_cfm_vsr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset) { - gint cfm_tlv_offset = 0; - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_pdu_tree = NULL; - proto_tree *cfm_flag_tree = NULL; + gint cfm_tlv_offset; + proto_item *ti; + proto_item *fi; + proto_tree *cfm_pdu_tree; + proto_tree *cfm_flag_tree; ti = proto_tree_add_item(tree, hf_cfm_vsr_pdu, tvb, offset, -1, FALSE); cfm_pdu_tree = proto_item_add_subtree(ti, ett_cfm_pdu); @@ -1542,27 +1029,9 @@ static int dissect_cfm_vsr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { gint offset = 0; - gint cfm_tlv_offset = 0; - gint tlv_header_modifier = 0; - gint tlv_data_offset = 0; - - guint8 cfm_pdu_type = 0; - guint8 cfm_tlv_type = 255; - guint16 cfm_tlv_length = 0; - guint8 tlv_chassis_id_length = 0; - guint8 tlv_ma_domain_length = 0; - guint8 tlv_management_addr_length = 0; - guint8 tlv_reply_ingress_portid_length = 0; - guint8 tlv_reply_egress_portid_length = 0; - guint8 tlv_tst_test_pattern_type = 0; - - proto_item *ti = NULL; - proto_item *fi = NULL; - proto_tree *cfm_tree = NULL; - proto_tree *cfm_all_tlvs_tree = NULL; - proto_tree *cfm_tlv_tree = NULL; - - /* display the CFM protol name */ + guint8 cfm_pdu_type; + + /* display the CFM protol name */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "CFM"); /* Clear out stuff in the info column */ @@ -1577,7 +1046,9 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (tree) { /* we are being asked for details */ - + gint cfm_tlv_offset; + proto_item *ti; + proto_tree *cfm_tree; /* isolate the payload of the packet */ ti = proto_tree_add_item(tree, proto_cfm, tvb, 0, -1, FALSE); @@ -1588,11 +1059,11 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str(cfm_pdu_type, opcodetypenames, "Unknown (0x%02x)")); /* dissecting the common CFM header */ - cfm_tree = proto_item_add_subtree(ti, ett_cfm); + cfm_tree = proto_item_add_subtree(ti, ett_cfm); proto_tree_add_item(cfm_tree, hf_cfm_md_level, tvb, offset, 1, FALSE); - proto_tree_add_item(cfm_tree, hf_cfm_version, tvb, offset, 1, FALSE); + proto_tree_add_item(cfm_tree, hf_cfm_version, tvb, offset, 1, FALSE); offset += 1; - proto_tree_add_item(cfm_tree, hf_cfm_opcode, tvb, offset, 1, FALSE); + proto_tree_add_item(cfm_tree, hf_cfm_opcode, tvb, offset, 1, FALSE); offset += 1; switch(cfm_pdu_type) { @@ -1665,13 +1136,19 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Begin dissecting the TLV's */ /* the TLV offset should be the same as where the pdu left off or we have a problem */ if ((cfm_tlv_offset == offset) && (cfm_tlv_offset > 3)) { + proto_tree *cfm_all_tlvs_tree; + guint8 cfm_tlv_type = 255; ti = proto_tree_add_item(tree, hf_cfm_all_tlvs, tvb, cfm_tlv_offset, -1, FALSE); cfm_all_tlvs_tree = proto_item_add_subtree(ti, ett_cfm_all_tlvs); while (cfm_tlv_type != END_TLV) { + guint16 cfm_tlv_length; + gint tlv_header_modifier; + proto_item *fi; + proto_tree *cfm_tlv_tree; cfm_tlv_type = tvb_get_guint8(tvb, cfm_tlv_offset); - + if (cfm_tlv_type == END_TLV) { tlv_header_modifier = 1; cfm_tlv_length = 0; @@ -1691,7 +1168,11 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(cfm_tlv_tree, hf_cfm_tlv_length, tvb, cfm_tlv_offset, 2, FALSE); cfm_tlv_offset += 2; - if (cfm_tlv_length != 0) { + if (cfm_tlv_length != 0) { + gint tlv_data_offset; + guint8 tlv_chassis_id_length; + guint8 tlv_tst_test_pattern_type; + tlv_data_offset = cfm_tlv_offset; switch(cfm_tlv_type) { @@ -1713,6 +1194,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* If the TLV length is greater than the number of octets used for the * Chassis ID, then we must have a Management Address Domain */ if (cfm_tlv_length > (2 + tlv_chassis_id_length)) { + guint8 tlv_ma_domain_length; proto_tree_add_item(cfm_tlv_tree, hf_tlv_ma_domain_length, tvb, tlv_data_offset, 1, FALSE); tlv_ma_domain_length = tvb_get_guint8(tvb,tlv_data_offset); @@ -1722,11 +1204,12 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb, tlv_data_offset, tlv_ma_domain_length, FALSE); tlv_data_offset += tlv_ma_domain_length; } - + /* If the TLV length is greater than the number of octets used for the * Chassis ID and the Management Address Domain, then we must have a * Management Address */ if (cfm_tlv_length > (2 + tlv_chassis_id_length + 1 + tlv_ma_domain_length)) { + guint8 tlv_management_addr_length; proto_tree_add_item(cfm_tlv_tree, hf_tlv_management_addr_length, tvb, tlv_data_offset, 1, FALSE); tlv_management_addr_length = tvb_get_guint8(tvb,tlv_data_offset); @@ -1737,7 +1220,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tlv_data_offset += tlv_management_addr_length; } } - } + } break; case PORT_STAT_TLV: proto_tree_add_item(cfm_tlv_tree, hf_tlv_port_status_value, @@ -1747,7 +1230,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case DATA_TLV: proto_tree_add_item(cfm_tlv_tree, hf_tlv_data_value, tvb, tlv_data_offset, cfm_tlv_length, FALSE); - tlv_data_offset += cfm_tlv_length; + tlv_data_offset += cfm_tlv_length; break; case INTERF_STAT_TLV: proto_tree_add_item(cfm_tlv_tree, hf_tlv_interface_status_value, @@ -1766,6 +1249,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * an ingress port ID */ if (cfm_tlv_length > 7) { + guint8 tlv_reply_ingress_portid_length; proto_tree_add_item(cfm_tlv_tree, hf_tlv_reply_ing_egr_portid_length, tvb, tlv_data_offset, 1, FALSE); tlv_reply_ingress_portid_length = tvb_get_guint8(tvb,tlv_data_offset); @@ -1779,7 +1263,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb, tlv_data_offset, tlv_reply_ingress_portid_length, FALSE); tlv_data_offset += tlv_reply_ingress_portid_length; } - } + } break; case REPLY_EGR_TLV: proto_tree_add_item(cfm_tlv_tree, hf_tlv_reply_egress_action, @@ -1788,16 +1272,17 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(cfm_tlv_tree, hf_tlv_reply_egress_mac_address, tvb, tlv_data_offset, 6, FALSE); tlv_data_offset += 6; - + /* For the IEEE standard if the TLV length is greater than 7 then we have * an egress port ID */ if (cfm_tlv_length > 7) { + guint8 tlv_reply_egress_portid_length; proto_tree_add_item(cfm_tlv_tree, hf_tlv_reply_ing_egr_portid_length, tvb, tlv_data_offset, 1, FALSE); tlv_reply_egress_portid_length = tvb_get_guint8(tvb,tlv_data_offset); tlv_data_offset += 1; - + if (tlv_reply_egress_portid_length > 0) { proto_tree_add_item(cfm_tlv_tree, hf_tlv_reply_ing_egr_portid_subtype, tvb, tlv_data_offset, 1, FALSE); @@ -1806,7 +1291,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb, tlv_data_offset, tlv_reply_egress_portid_length, FALSE); tlv_data_offset += tlv_reply_egress_portid_length; } - } + } break; case LTM_EGR_ID_TLV: proto_tree_add_item(cfm_tlv_tree, hf_tlv_ltm_egress_id_unique_identifier, @@ -1834,13 +1319,13 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* The TLV length must be long enough to include the OUI * and the subtype. */ - if (cfm_tlv_length > 3) { + if (cfm_tlv_length > 3) { proto_tree_add_item(cfm_tlv_tree, hf_tlv_org_spec_oui, tvb, tlv_data_offset, 3, FALSE); tlv_data_offset += 3; proto_tree_add_item(cfm_tlv_tree, hf_tlv_org_spec_subtype, tvb, tlv_data_offset, 1, FALSE); - tlv_data_offset += 1; + tlv_data_offset += 1; proto_tree_add_item(cfm_tlv_tree, hf_tlv_org_spec_value, tvb, tlv_data_offset, cfm_tlv_length-4, FALSE); tlv_data_offset -= 4; @@ -1851,7 +1336,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* There is a discrepancy in the recommendation ITU-T Y.1731 * where the test pattern type may or may not be included in * the TLV length. Going to assume that it is included in the - * length which corresponds with the typical format for TLV's + * length which corresponds with the typical format for TLV's * until the recommendation is more clear in this regard. */ proto_tree_add_item(cfm_tlv_tree, hf_tlv_tst_test_pattern_type, tvb, tlv_data_offset, 1, FALSE); @@ -1888,3 +1373,548 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } +/* Register CFM EOAM protocol */ +void proto_register_cfm(void) +{ + static hf_register_info hf[] = { + { &hf_cfm_md_level, + { "CFM MD Level", "cfm.md.level", FT_UINT8, + BASE_DEC, NULL, 0xe0, NULL, HFILL } + }, + { &hf_cfm_version, + { "CFM Version", "cfm.version", FT_UINT8, + BASE_DEC, NULL, 0x1f, NULL, HFILL } + }, + { &hf_cfm_opcode, + { "CFM OpCode", "cfm.opcode", FT_UINT8, + BASE_DEC, VALS(opcodetypenames), 0x0, NULL, HFILL } + }, + + /* CFM CCM*/ + { &hf_cfm_ccm_pdu, + { "CFM CCM PDU", "cfm.ccm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_flags, + { "Flags", "cfm.flags", FT_UINT8, + BASE_HEX, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_flags_RDI, + { "RDI", "cfm.flags.rdi", FT_UINT8, + BASE_DEC, NULL, 0x80, NULL, HFILL } + }, + { &hf_cfm_flags_ccm_Reserved, + { "Reserved", "cfm.flags.ccm.reserved", FT_UINT8, + BASE_DEC, NULL, 0x78, NULL, HFILL } + }, + { &hf_cfm_flags_Interval, + { "Interval Field", "cfm.flags.interval", FT_UINT8, + BASE_DEC, VALS(CCM_IntervalFieldEncoding), 0x07, NULL, HFILL } + }, + { &hf_cfm_first_tlv_offset, + { "First TLV Offset", "cfm.first.tlv.offset", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_ccm_seq_number, + { "Sequence Number", "cfm.ccm.seq.num", FT_UINT32, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_ccm_ma_ep_id, + { "Maintenance Association End Point Identifier", "cfm.ccm.ma.ep.id", + FT_UINT16, BASE_DEC, NULL, 0x1FFF, NULL, HFILL } + }, + { &hf_cfm_ccm_maid, + { "Maintenance Association Identifier (MEG ID)", "cfm.ccm.maid", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_md_name_format, + { "MD Name Format", "cfm.maid.md.name.format", FT_UINT8, + BASE_DEC, VALS(mdnameformattypes), 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_md_name_length, + { "MD Name Length", "cfm.maid.md.name.length", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_md_name_string, + { "MD Name (String)", "cfm.maid.md.name", FT_STRING, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_md_name_hex, + { "MD Name", "cfm.maid.md.name", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_md_name_mac, + { "MD Name (MAC)", "cfm.maid.md.name.mac", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_md_name_mac_id, + { "MD Name (MAC)", "cfm.maid.md.name.mac.id", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_ma_name_format, + { "Short MA Name (MEG ID) Format", "cfm.maid.ma.name.format", FT_UINT8, + BASE_DEC, VALS(manameformattypes), 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_ma_name_length, + { "Short MA Name (MEG ID) Length", "cfm.maid.ma.name.length", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_ma_name_string, + { "Short MA Name", "cfm.maid.ma.name", FT_STRING, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_ma_name_hex, + { "Short MA Name", "cfm.maid.ma.name", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_maid_padding, + { "Zero-Padding", "cfm.ccm.maid.padding", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_ccm_itu_t_y1731, + { "Defined by ITU-T Y.1731", "cfm.ccm.itu.t.y1731", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_itu_TxFCf, + { "TxFCf", "cfm.itu.txfcf", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_itu_RxFCb, + { "RxFCb", "cfm.itu.rxfcb", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_itu_TxFCb, + { "TxFCb", "cfm.itu.txfcb", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_itu_reserved, + { "Reserved", "cfm.itu.reserved", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM LBM*/ + { &hf_cfm_lbm_pdu, + { "CFM LBM PDU", "cfm.lbm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_lb_transaction_id, + { "Loopback Transaction Identifier", "cfm.lb.transaction.id", FT_UINT32, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + + /* CFM LBR*/ + { &hf_cfm_lbr_pdu, + { "CFM LBR PDU", "cfm.lbr.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM LTM*/ + { &hf_cfm_ltm_pdu, + { "CFM LTM PDU", "cfm.ltm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_flags_UseFDBonly, + { "UseFDBonly", "cfm.flags.usefdbonly", FT_UINT8, + BASE_DEC, NULL, 0x80, NULL, HFILL } + }, + { &hf_cfm_flags_ltm_Reserved, + { "Reserved", "cfm.flags.ltm.reserved", FT_UINT8, + BASE_DEC, NULL, 0x7F, NULL, HFILL } + }, + { &hf_cfm_lt_transaction_id, + { "Linktrace Transaction Identifier", "cfm.lt.transaction.id", FT_UINT32, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_lt_ttl, + { "Linktrace TTL", "cfm.lt.ttl", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_ltm_orig_addr, + { "Linktrace Message: Original Address", "cfm.ltm.orig.addr", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_ltm_targ_addr, + { "Linktrace Message: Target Address", "cfm.ltm.targ.addr", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM LTR*/ + { &hf_cfm_ltr_pdu, + { "CFM LTR PDU", "cfm.ltr.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_flags_FwdYes, + { "FwdYes", "cfm.flags.fwdyes", FT_UINT8, + BASE_DEC, NULL, 0x40, NULL, HFILL } + }, + { &hf_cfm_flags_TerminalMEP, + { "TerminalMEP", "cfm.flags.ltr.terminalmep", FT_UINT8, + BASE_DEC, NULL, 0x20, NULL, HFILL } + }, + { &hf_cfm_flags_ltr_Reserved, + { "Reserved", "cfm.flags.ltr.reserved", FT_UINT8, + BASE_DEC, NULL, 0x1F, NULL, HFILL } + }, + { &hf_cfm_ltr_relay_action, + { "Linktrace Reply Relay Action", "cfm.ltr.relay.action", FT_UINT8, + BASE_DEC, VALS(relayactiontypes), 0x0, NULL, HFILL} + }, + + /* CFM AIS*/ + { &hf_cfm_ais_pdu, + { "CFM AIS PDU", "cfm.ais.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_flags_ais_lck_Reserved, + { "Reserved", "cfm.flags.reserved", FT_UINT8, + BASE_DEC, NULL, 0xF8, NULL, HFILL } + }, + { &hf_cfm_flags_ais_lck_Period, + { "Period", "cfm.flags.period", FT_UINT8, + BASE_DEC, VALS(aislckperiodtypes), 0x07, NULL, HFILL } + }, + + /* CFM LCK */ + { &hf_cfm_lck_pdu, + { "CFM LCK PDU", "cfm.lck.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM TST */ + { &hf_cfm_tst_pdu, + { "CFM TST PDU", "cfm.tst.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_flags_Reserved, + { "Reserved", "cfm.flags.reserved", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_tst_sequence_num, + { "Sequence Number", "cfm.tst.sequence.num", FT_UINT32, + BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + + /* CFM APS */ + { &hf_cfm_aps_pdu, + { "CFM APS PDU", "cfm.aps.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_aps_data, + { "APS data", "cfm.aps.data", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM R-APS */ + { &hf_cfm_raps_pdu, + { "CFM R-APS PDU", "cfm.raps.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_raps_req_st, + { "Request/State", "cfm.raps.req.st", FT_UINT8, + BASE_HEX, VALS(rapsrequeststatevalues), 0xF0, NULL, HFILL } + }, + { &hf_cfm_raps_flags, + { "R-APS Flags", "cfm.raps.flags", FT_UINT8, + BASE_HEX, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_raps_flags_rb, + { "RPL Blocked", "cfm.raps.flags.rb", FT_UINT8, + BASE_HEX, VALS(rapsrplblockedvalues), 0x80, NULL, HFILL } + }, + { &hf_cfm_raps_flags_dnf, + { "Do Not Flush", "cfm.raps.flags.dnf", FT_UINT8, + BASE_HEX, VALS(rapsdnfvalues), 0x40, NULL, HFILL } + }, + { &hf_cfm_raps_node_id, + { "R-APS Node ID", "cfm.raps.node.id", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_raps_reserved, + { "R-APS Reserved", "cfm.raps.reserved", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM MCC */ + { &hf_cfm_mcc_pdu, + { "CFM MCC PDU", "cfm.mcc.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_mcc_data, + { "MCC data", "cfm.mcc.data", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM LMM */ + { &hf_cfm_lmm_pdu, + { "CFM LMM PDU", "cfm.lmm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_lmm_lmr_TxFCf, + { "TxFCf", "cfm.lmm.lmr.txfcf", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_lmm_lmr_RxFCf, + { "RxFCf", "cfm.lmm.lmr.rxfcf", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_lmm_lmr_TxFCb, + { "TxFCb", "cfm.lmm.lmr.txfcb", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + + /* CFM LMR */ + { &hf_cfm_lmr_pdu, + { "CFM LMR PDU", "cfm.lmr.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM 1DM */ + { &hf_cfm_odm_pdu, + { "CFM 1DM PDU", "cfm.odm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_odm_dmm_dmr_TxTimestampf, + { "TxTimestampf", "cfm.odm.dmm.dmr.txtimestampf", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_odm_dmm_dmr_RxTimestampf, + { "RxTimestampf", "cfm.odm.dmm.dmr.rxtimestampf", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM DMM */ + { &hf_cfm_dmm_pdu, + { "CFM DMM PDU", "cfm.dmm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_dmm_dmr_TxTimestampb, + { "TxTimestampb", "cfm.dmm.dmr.txtimestampb", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_dmm_dmr_RxTimestampb, + { "RxTimestampb", "cfm.dmm.dmr.rxtimestampb", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM DMR */ + { &hf_cfm_dmr_pdu, + { "CFM DMR PDU", "cfm.dmr.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM EXM */ + { &hf_cfm_exm_pdu, + { "CFM EXM PDU", "cfm.exm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_exm_exr_data, + { "EXM/EXR data", "cfm.mcc.data", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM EXR */ + { &hf_cfm_exr_pdu, + { "CFM EXR PDU", "cfm.exr.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM VSM */ + { &hf_cfm_vsm_pdu, + { "CFM VSM PDU", "cfm.vsm.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_vsm_vsr_data, + { "VSM/VSR data", "cfm.mcc.data", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* CFM VSR */ + { &hf_cfm_vsr_pdu, + { "CFM VSR PDU", "cfm.vsr.pdu", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /******************************* TLVs ****************************/ + { &hf_cfm_all_tlvs, + { "CFM TLVs", "cfm.all.tlvs", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_cfm_tlv_type, + { "TLV Type", "cfm.tlv.type", FT_UINT8, + BASE_DEC, VALS(tlvtypefieldvalues), 0x0, NULL, HFILL} + }, + { &hf_cfm_tlv_length, + { "TLV Length", "cfm.tlv.length", FT_UINT16, + BASE_DEC, NULL, 0x0, NULL, HFILL} + }, + /* Sender ID TLV */ + { &hf_tlv_chassis_id_length, + { "Chassis ID Length", "cfm.tlv.chassis.id.length", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_chassis_id_subtype, + { "Chassis ID Sub-type", "cfm.tlv.chassis.id.subtype", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_chassis_id, + { "Chassis ID", "cfm.tlv.chassis.id", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_ma_domain_length, + { "Management Address Domain Length", "cfm.tlv.ma.domain.length", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_ma_domain, + { "Management Address Domain", "cfm.tlv.ma.domain", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_management_addr_length, + { "Management Address Length", "cfm.tlv.management.addr.length", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_management_addr, + { "Management Address", "cfm.tlv.management.addr", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL} + }, + + /* Port Status TLV */ + { &hf_tlv_port_status_value, + { "Port Status value", "cfm.tlv.port.status.value", FT_UINT8, + BASE_DEC, VALS(portstatTLVvalues), 0x0, NULL, HFILL} + }, + + /* Data TLV */ + { &hf_tlv_data_value, + { "Data Value", "cfm.tlv.data.value", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL} + }, + + /* Interface status TLV */ + { &hf_tlv_interface_status_value, + { "Interface Status value", "cfm.tlv.port.interface.value", FT_UINT8, + BASE_DEC, VALS(interfacestatTLVvalues), 0x0, NULL, HFILL} + }, + + /* Reply Ingress TLV */ + { &hf_tlv_reply_ingress_action, + { "Ingress Action", "cfm.tlv.reply.ingress.action", FT_UINT8, + BASE_DEC, VALS(replyingressTLVvalues), 0x0, NULL, HFILL} + }, + { &hf_tlv_reply_ingress_mac_address, + { "Ingress MAC address", "cfm.tlv.reply.ingress.mac.address", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_reply_ing_egr_portid_length, + { "Chassis ID Length", "cfm.tlv.chassis.id.length", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_reply_ing_egr_portid_subtype, + { "Chassis ID Sub-type", "cfm.tlv.chassis.id.subtype", FT_UINT8, + BASE_DEC, NULL, 0x0, NULL, HFILL} + }, + { &hf_tlv_reply_ing_egr_portid, + { "Chassis ID", "cfm.tlv.chassis.id", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL} + }, + + /* Reply Egress TLV */ + { &hf_tlv_reply_egress_action, + { "Egress Action", "cfm.tlv.reply.egress.action", FT_UINT8, + BASE_DEC, VALS(replyegressTLVvalues), 0x0, NULL, HFILL} + }, + { &hf_tlv_reply_egress_mac_address, + { "Egress MAC address", "cfm.tlv.reply.egress.mac.address", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* LTM Egress Identifier TLV */ + { &hf_tlv_ltm_egress_id_mac, + { "Egress Identifier - MAC of LT Initiator/Responder", "cfm.tlv.ltm.egress.id.mac", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_ltm_egress_id_unique_identifier, + { "Egress Identifier - Unique Identifier", "cfm.tlv.ltm.egress.id.ui", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* LTR Egress Identifier TLV */ + { &hf_tlv_ltr_egress_last_id_mac, + { "Last Egress Identifier - MAC address", "cfm.tlv.ltr.egress.last.id.mac", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_ltr_egress_last_id_unique_identifier, + { "Last Egress Identifier - Unique Identifier", "cfm.tlv.ltr.egress.last.id.ui", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_ltr_egress_next_id_mac, + { "Next Egress Identifier - MAC address", "cfm.tlv.ltr.egress.next.id.mac", FT_ETHER, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_ltr_egress_next_id_unique_identifier, + { "Next Egress Identifier - Unique Identifier", "cfm.tlv.ltr.egress.next.id.ui", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* Organization-Specific TLV */ + { &hf_tlv_org_spec_oui, + { "OUI", "cfm.tlv.org.spec.oui", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_org_spec_subtype, + { "Sub-Type", "cfm.tlv.org.spec.subtype", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_org_spec_value, + { "Value", "cfm.tlv.org.spec.value", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + + /* Test TLV */ + { &hf_tlv_tst_test_pattern_type, + { "Test Pattern Type", "cfm.tlv.tst.test.pattern.type", FT_UINT8, + BASE_DEC, VALS(testTLVpatterntypes), 0x0, NULL, HFILL} + }, + { &hf_tlv_tst_test_pattern, + { "Test Pattern", "cfm.tlv.tst.test.pattern", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_tlv_tst_CRC32, + { "CRC-32", "cfm.tlv.tst.crc32", FT_BYTES, + BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + }; + + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_cfm, + &ett_cfm_flags, + &ett_cfm_ccm_maid, + &ett_cfm_ccm_itu, + &ett_cfm_pdu, + &ett_cfm_all_tlvs, + &ett_cfm_tlv, + &ett_cfm_raps_flags + }; + + proto_cfm = proto_register_protocol ( + "CFM EOAM 802.1ag/ITU Protocol", /* name */ + "CFM", /* short name */ + "cfm" /* abbrev */ + ); + + register_dissector("cfm", dissect_cfm, proto_cfm); + + proto_register_field_array(proto_cfm, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + +} + +/* Register CFM OEAM protocol handler */ +void proto_reg_handoff_cfm(void) +{ + dissector_handle_t cfm_handle; + cfm_handle = create_dissector_handle(dissect_cfm, proto_cfm); + dissector_add("ethertype", ETHERTYPE_CFM, cfm_handle); +} + |