From e5e25269c9c11fc05ade2581ad7996439b45a208 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Wed, 1 Feb 2006 05:44:20 +0000 Subject: From Eric Hultin: This patch adds support for dissection of the DCC packet as defined in CableLab's (http://www.cablelabs.com/) DOCSIS Radio Frequency Interface (RFI) specification. The latest version of this specification is currently available at http://www.cablemodem.com/specifications/specifications20.html . Packet formats for DCC are defined in sections 8.3.20 (DCC-REQ), 8.3.21 (DCC-RSP), and 8.3.22 (DCC-ACK) of the RFI specifications (referencing version CM-SP-RFIv2.0-I10-051209). In addition, this patch adds support for the DCD packet as defined in the DOCSIS Set-Top Gateway (DSG) Specification. The latest version of this specification is currently available at http://www.cablemodem.com/specifications/gateway.html . The format of the DCD packet is defined in section 5.3.1 of the DSG specification (referencing version CM-SP-DSG-I06-051209). svn path=/trunk/; revision=17138 --- plugins/docsis/Makefile.am | 2 +- plugins/docsis/Makefile.nmake | 4 +- plugins/docsis/packet-dccack.c | 189 +++++++++ plugins/docsis/packet-dccreq.c | 620 +++++++++++++++++++++++++++++ plugins/docsis/packet-dccrsp.c | 277 +++++++++++++ plugins/docsis/packet-dcd.c | 866 +++++++++++++++++++++++++++++++++++++++++ plugins/docsis/packet-docsis.c | 8 + plugins/docsis/packet-docsis.h | 8 + 8 files changed, 1972 insertions(+), 2 deletions(-) create mode 100644 plugins/docsis/packet-dccack.c create mode 100644 plugins/docsis/packet-dccreq.c create mode 100644 plugins/docsis/packet-dccrsp.c create mode 100644 plugins/docsis/packet-dcd.c (limited to 'plugins/docsis') diff --git a/plugins/docsis/Makefile.am b/plugins/docsis/Makefile.am index ea91755def..26468dfd5d 100644 --- a/plugins/docsis/Makefile.am +++ b/plugins/docsis/Makefile.am @@ -27,7 +27,7 @@ INCLUDES = -I$(top_srcdir) -I$(includedir) plugindir = @plugindir@ plugin_LTLIBRARIES = docsis.la -docsis_la_SOURCES = packet-intrngreq.c packet-type29ucd.c packet-docsis.c packet-bpkmattr.c packet-dsarsp.c packet-macmgmt.c packet-rngrsp.c packet-bpkmreq.c packet-dscack.c packet-map.c packet-tlv.c packet-bpkmrsp.c packet-dscreq.c packet-regack.c packet-uccreq.c packet-dscrsp.c packet-regreq.c packet-uccrsp.c packet-dsaack.c packet-dsdreq.c packet-regrsp.c packet-ucd.c packet-dsareq.c packet-dsdrsp.c packet-rngreq.c packet-vendor.c packet-docsis.h packet-tlv.h moduleinfo.h +docsis_la_SOURCES = packet-intrngreq.c packet-type29ucd.c packet-docsis.c packet-bpkmattr.c packet-dsarsp.c packet-macmgmt.c packet-rngrsp.c packet-bpkmreq.c packet-dscack.c packet-map.c packet-tlv.c packet-bpkmrsp.c packet-dscreq.c packet-regack.c packet-uccreq.c packet-dscrsp.c packet-regreq.c packet-uccrsp.c packet-dsaack.c packet-dsdreq.c packet-regrsp.c packet-ucd.c packet-dsareq.c packet-dsdrsp.c packet-rngreq.c packet-vendor.c packet-docsis.h packet-tlv.h moduleinfo.h packet-dccack.c packet-dccreq.c packet-dccrsp.c packet-dcd.c docsis_la_LDFLAGS = -module -avoid-version docsis_la_LIBADD = @PLUGIN_LIBS@ diff --git a/plugins/docsis/Makefile.nmake b/plugins/docsis/Makefile.nmake index ea8916603a..add44886a2 100644 --- a/plugins/docsis/Makefile.nmake +++ b/plugins/docsis/Makefile.nmake @@ -27,7 +27,9 @@ OBJECTS=packet-intrngreq.obj packet-type29ucd.obj \ packet-dsaack.obj packet-dsdreq.obj \ packet-regrsp.obj packet-ucd.obj \ packet-dsareq.obj packet-dsdrsp.obj \ - packet-rngreq.obj packet-vendor.obj + packet-rngreq.obj packet-vendor.obj \ + packet-dccack.obj packet-dccreq.obj \ + packet-dccrsp.obj packet-dcd.obj docsis.dll docsis.exp docsis.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) link -dll /out:docsis.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ diff --git a/plugins/docsis/packet-dccack.c b/plugins/docsis/packet-dccack.c new file mode 100644 index 0000000000..ad16ce0fde --- /dev/null +++ b/plugins/docsis/packet-dccack.c @@ -0,0 +1,189 @@ +/* packet-dccack.c + * Routines for DCC Acknowledge Message dissection + * Copyright 2004, Darryl Hymel + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 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 "moduleinfo.h" + +#include +#include +#include + +#include + +#include + +#define DCCACK_KEY_SEQ_NUM 31 +#define DCCACK_HMAC_DIGEST 27 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dccack = -1; + +static int hf_docsis_dccack_tran_id = -1; +static int hf_docsis_dccack_key_seq_num = -1; +static int hf_docsis_dccack_hmac_digest = -1; + +/* Initialize the subtree pointers */ +static gint ett_docsis_dccack = -1; + + +/* Code to actually dissect the packets */ +static void +dissect_dccack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint16 pos; + guint8 type, length; + proto_tree *dcc_tree; + proto_item *dcc_item; + guint16 len; + + len = tvb_length_remaining (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO,"DCC-ACK Message: "); + } + + if (tree) + { + dcc_item = + proto_tree_add_protocol_format (tree, proto_docsis_dccack, tvb, 0, + tvb_length_remaining (tvb, 0), + "DCC-ACK Message"); + dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccack); + proto_tree_add_item (dcc_tree, hf_docsis_dccack_tran_id, tvb, 0, 2, FALSE); + + pos = 2; + while (pos < len) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case DCCACK_KEY_SEQ_NUM: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccack_key_seq_num, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCACK_HMAC_DIGEST: + if (length == 20) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccack_hmac_digest, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch(type) */ + pos = pos + length; + } /* while (pos < len) */ + } /* if (tree) */ + +} +/* Register the protocol with Ethereal */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + + +void +proto_register_docsis_dccack (void) +{ +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dccack_tran_id , + { + "Transaction ID ", + "docsis.dccack.tran_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Transaction ID ", + HFILL + } + }, + {&hf_docsis_dccack_key_seq_num , + { + "Auth Key Sequence Number ", + "docsis.dccack.key_seq_num", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Auth Key Sequence Number ", + HFILL + } + }, + {&hf_docsis_dccack_hmac_digest , + { + "HMAC-DigestNumber ", + "docsis.dccack.hmac_digest", + FT_BYTES, BASE_DEC, NULL, 0x0, + "HMAC-DigestNumber ", + HFILL + } + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dccack, + }; + +/* Register the protocol name and description */ + proto_docsis_dccack = + proto_register_protocol ("DOCSIS Downstream Channel Change Acknowledge ", + "DOCSIS DCC-ACK", "docsis_dccack"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dccack, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dccack", dissect_dccack, proto_docsis_dccack); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_docsis_dccack (void) +{ + dissector_handle_t docsis_dccack_handle; + + docsis_dccack_handle = find_dissector ("docsis_dccack"); + dissector_add ("docsis_mgmt", 0x19, docsis_dccack_handle); + +} diff --git a/plugins/docsis/packet-dccreq.c b/plugins/docsis/packet-dccreq.c new file mode 100644 index 0000000000..2b76da30da --- /dev/null +++ b/plugins/docsis/packet-dccreq.c @@ -0,0 +1,620 @@ +/* packet-dccreq.c + * Routines for DCC Request Message dissection + * Copyright 2004, Darryl Hymel + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 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 "moduleinfo.h" + +#include +#include +#include + +#include + +#include + +#define DCCREQ_UP_CHAN_ID 1 +#define DCCREQ_DS_PARAMS 2 +#define DCCREQ_INIT_TECH 3 +#define DCCREQ_UCD_SUB 4 +#define DCCREQ_SAID_SUB 6 +#define DCCREQ_SF_SUB 7 +#define DCCREQ_CMTS_MAC_ADDR 8 +#define DCCREQ_KEY_SEQ_NUM 31 +#define DCCREQ_HMAC_DIGEST 27 + +/* Define Downstrean Parameters subtypes + * These are subtype of DCCREQ_DS_PARAMS (2) + */ + +#define DCCREQ_DS_FREQ 1 +#define DCCREQ_DS_MOD_TYPE 2 +#define DCCREQ_DS_SYM_RATE 3 +#define DCCREQ_DS_INTLV_DEPTH 4 +#define DCCREQ_DS_CHAN_ID 5 +#define DCCREQ_DS_SYNC_SUB 6 + +/* Define Service Flow Substitution subtypes + * These are subtypes of DCCREQ_SF_SUB (7) + */ +#define DCCREQ_SF_SFID 1 +#define DCCREQ_SF_SID 2 +#define DCCREQ_SF_UNSOL_GRANT_TREF 5 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dccreq = -1; + +static int hf_docsis_dccreq_tran_id = -1; +static int hf_docsis_dccreq_up_chan_id = -1; +static int hf_docsis_dccreq_ds_freq = -1; +static int hf_docsis_dccreq_ds_mod_type = -1; +static int hf_docsis_dccreq_ds_sym_rate = -1; +static int hf_docsis_dccreq_ds_intlv_depth_i = -1; +static int hf_docsis_dccreq_ds_intlv_depth_j = -1; +static int hf_docsis_dccreq_ds_chan_id = -1; +static int hf_docsis_dccreq_ds_sync_sub = -1; +static int hf_docsis_dccreq_init_tech = -1; +static int hf_docsis_dccreq_ucd_sub = -1; +static int hf_docsis_dccreq_said_sub_cur = -1; +static int hf_docsis_dccreq_said_sub_new = -1; +static int hf_docsis_dccreq_sf_sfid_cur = -1; +static int hf_docsis_dccreq_sf_sfid_new = -1; +static int hf_docsis_dccreq_sf_sid_cur = -1; +static int hf_docsis_dccreq_sf_sid_new = -1; +static int hf_docsis_dccreq_sf_unsol_grant_tref = -1; +static int hf_docsis_dccreq_cmts_mac_addr = -1; +static int hf_docsis_dccreq_key_seq_num = -1; +static int hf_docsis_dccreq_hmac_digest = -1; + +/* Initialize the subtree pointers */ +static gint ett_docsis_dccreq = -1; +static gint ett_docsis_dccreq_ds_params = -1; +static gint ett_docsis_dccreq_sf_sub = -1; + + +value_string ds_mod_type_vals[] = { + {0 , "64 QAM"}, + {1 , "256 QAM"}, + {0, NULL} +}; + +value_string ds_sym_rate_vals[] = { + {0 , "5.056941 Msym/sec"}, + {1 , "5.360537 Msym/sec"}, + {2 , "6.952 Msym/sec"}, + {0, NULL} +}; +value_string init_tech_vals[] = { + {0 , "Reinitialize MAC"}, + {1 , "Broadcast Init RNG on new chanbefore normal op"}, + {2 , "Unicast RNG on new chan before normal op"}, + {3 , "Either Unicast or broadcast RNG on new chan before normal op"}, + {4 , "Use new chan directly without re-init or RNG"}, + {0, NULL} +}; +/* Code to actually dissect the packets */ +static void +dissect_dccreq_ds_params (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcc_item; + proto_tree *dcc_tree; + int pos; + + pos = start; + dcc_item = proto_tree_add_text ( tree, tvb, start, len, "2 DCC-REQ Downstream Params Encodings (Length = %u)", len); + dcc_tree = proto_item_add_subtree ( dcc_item , ett_docsis_dccreq_ds_params); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCCREQ_DS_FREQ: + if (length == 4) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_freq, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_DS_MOD_TYPE: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_mod_type, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_DS_SYM_RATE: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_sym_rate, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_DS_INTLV_DEPTH: + if (length == 2) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_intlv_depth_i, tvb, + pos, 1, FALSE); + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_intlv_depth_j, tvb, + pos + 1, 1, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_DS_CHAN_ID: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_chan_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_DS_SYNC_SUB: + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_sync_sub, tvb, + pos, length, FALSE); + break; + + } + pos = pos + length; + } +} +static void +dissect_dccreq_sf_sub (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcc_item; + proto_tree *dcc_tree; + int pos; + + pos = start; + dcc_item = proto_tree_add_text ( tree, tvb, start, len, "7 DCC-REQ Service Flow Substitution Encodings (Length = %u)", len); + dcc_tree = proto_item_add_subtree ( dcc_item , ett_docsis_dccreq_sf_sub); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCCREQ_SF_SFID: + if (length == 8) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sfid_cur, tvb, + pos, 4, FALSE); + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sfid_new, tvb, + pos + 4, 4, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_SF_SID: + if (length == 4) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sid_cur, tvb, + pos, 2, FALSE); + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sid_new, tvb, + pos + 2, 2, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_SF_UNSOL_GRANT_TREF: + if (length == 4) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_unsol_grant_tref, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } + pos = pos + length; + } +} +static void +dissect_dccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint16 pos; + guint8 type, length; + proto_tree *dcc_tree; + proto_item *dcc_item; + guint16 len; + + len = tvb_length_remaining (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO,"DCC-REQ Message: "); + } + + if (tree) + { + dcc_item = + proto_tree_add_protocol_format (tree, proto_docsis_dccreq, tvb, 0, + tvb_length_remaining (tvb, 0), + "DCC-REQ Message"); + dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccreq); + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_tran_id, tvb, 0, 2, FALSE); + + pos = 2; + while (pos < len) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCCREQ_UP_CHAN_ID: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_up_chan_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_DS_PARAMS: + dissect_dccreq_ds_params (tvb , dcc_tree , pos , length ); + break; + case DCCREQ_INIT_TECH: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_init_tech, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_UCD_SUB: + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ucd_sub, tvb, + pos, length, FALSE); + break; + case DCCREQ_SAID_SUB: + if (length == 4) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_said_sub_cur, tvb, + pos, 2, FALSE); + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_said_sub_new, tvb, + pos + 2, 2, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_SF_SUB: + dissect_dccreq_sf_sub (tvb , dcc_tree , pos , length ); + break; + case DCCREQ_CMTS_MAC_ADDR: + if (length == 6) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_cmts_mac_addr, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_KEY_SEQ_NUM: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_key_seq_num, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCREQ_HMAC_DIGEST: + if (length == 20) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccreq_hmac_digest, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch(type) */ + pos = pos + length; + } /* while (pos < len) */ + } /* if (tree) */ + +} +/* Register the protocol with Ethereal */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + + +void +proto_register_docsis_dccreq (void) +{ +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dccreq_tran_id , + { + "Transaction ID ", + "docsis.dccreq.tran_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Transaction ID ", + HFILL + } + }, + {&hf_docsis_dccreq_up_chan_id , + { + "Up Channel ID ", + "docsis.dccreq.up_chan_id", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Up Channel ID ", + HFILL + } + }, + {&hf_docsis_dccreq_ds_freq , + { + "Frequency ", + "docsis.dccreq.ds_freq", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Frequency ", + HFILL + } + }, + {&hf_docsis_dccreq_ds_mod_type , + { + "Modulation Type ", + "docsis.dccreq.ds_mod_type", + FT_UINT8, BASE_DEC, VALS (ds_mod_type_vals), 0x0, + "Modulation Type ", + HFILL + } + }, + {&hf_docsis_dccreq_ds_sym_rate , + { + "Symbol Rate", + "docsis.dccreq.ds_sym_rate", + FT_UINT8, BASE_DEC, VALS (ds_sym_rate_vals), 0x0, + "Symbol Rate", + HFILL + } + }, + {&hf_docsis_dccreq_ds_intlv_depth_i , + { + "Interleaver Depth I Value", + "docsis.dccreq.ds_intlv_depth_i", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Interleaver Depth I Value", + HFILL + } + }, + {&hf_docsis_dccreq_ds_intlv_depth_j , + { + "Interleaver Depth J Value", + "docsis.dccreq.ds_intlv_depth_j", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Interleaver Depth J Value", + HFILL + } + }, + {&hf_docsis_dccreq_ds_chan_id , + { + "Downstream Channel ID", + "docsis.dccreq.ds_chan_id", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Downstream Channel ID", + HFILL + } + }, + {&hf_docsis_dccreq_ds_sync_sub , + { + "SYNC Substitution", + "docsis.dccreq.ds_sync_sub", + FT_UINT8, BASE_DEC, NULL, 0x0, + "SYNC Substitution", + HFILL + } + }, + {&hf_docsis_dccreq_init_tech , + { + "Initialization Technique", + "docsis.dccreq.init_tech", + FT_UINT8, BASE_DEC, VALS (init_tech_vals), 0x0, + "Initialization Technique", + HFILL + } + }, + {&hf_docsis_dccreq_ucd_sub , + { + "UCD Substitution ", + "docsis.dccreq.ucd_sub", + FT_BYTES, BASE_HEX, NULL, 0x0, + "UCD Substitution ", + HFILL + } + }, + {&hf_docsis_dccreq_said_sub_cur , + { + "SAID Sub - Current Value", + "docsis.dccreq.said_sub_cur", + FT_UINT16, BASE_DEC, NULL, 0x0, + "SAID Sub - Current Value", + HFILL + } + }, + {&hf_docsis_dccreq_said_sub_new , + { + "SAID Sub - New Value", + "docsis.dccreq.said_sub_new", + FT_UINT16, BASE_DEC, NULL, 0x0, + "SAID Sub - New Value", + HFILL + } + }, + {&hf_docsis_dccreq_sf_sfid_cur , + { + "SF Sub - SFID Current Value", + "docsis.dccreq.sf_sfid_cur", + FT_UINT32, BASE_DEC, NULL, 0x0, + "SF Sub - SFID Current Value", + HFILL + } + }, + {&hf_docsis_dccreq_sf_sfid_new , + { + "SF Sub - SFID New Value", + "docsis.dccreq.sf_sfid_new", + FT_UINT32, BASE_DEC, NULL, 0x0, + "SF Sub - SFID New Value", + HFILL + } + }, + {&hf_docsis_dccreq_sf_sid_cur , + { + "SF Sub - SID Current Value", + "docsis.dccreq.sf_sid_cur", + FT_UINT16, BASE_DEC, NULL, 0x0, + "SF Sub - SID Current Value", + HFILL + } + }, + {&hf_docsis_dccreq_sf_sid_new , + { + "SF Sub - SID New Value", + "docsis.dccreq.sf_sid_new", + FT_UINT16, BASE_DEC, NULL, 0x0, + "SF Sub - SID New Value", + HFILL + } + }, + {&hf_docsis_dccreq_sf_unsol_grant_tref , + { + "SF Sub - Unsolicited Grant Time Reference ", + "docsis.dccreq.sf_unsol_grant_tref", + FT_UINT32, BASE_DEC, NULL, 0x0, + "SF Sub - Unsolicited Grant Time Reference ", + HFILL + } + }, + {&hf_docsis_dccreq_cmts_mac_addr , + { + "CMTS Mac Address ", + "docsis.dccreq.cmts_mac_addr", + FT_ETHER, BASE_DEC, NULL, 0x0, + "CMTS Mac Address ", + HFILL + } + }, + {&hf_docsis_dccreq_key_seq_num , + { + "Auth Key Sequence Number ", + "docsis.dccreq.key_seq_num", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Auth Key Sequence Number ", + HFILL + } + }, + {&hf_docsis_dccreq_hmac_digest , + { + "HMAC-DigestNumber ", + "docsis.dccreq.hmac_digest", + FT_BYTES, BASE_DEC, NULL, 0x0, + "HMAC-DigestNumber ", + HFILL + } + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dccreq, + &ett_docsis_dccreq_sf_sub, + &ett_docsis_dccreq_ds_params, + }; + +/* Register the protocol name and description */ + proto_docsis_dccreq = + proto_register_protocol ("DOCSIS Downstream Channel Change Request ", + "DOCSIS DCC-REQ", "docsis_dccreq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dccreq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dccreq", dissect_dccreq, proto_docsis_dccreq); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_docsis_dccreq (void) +{ + dissector_handle_t docsis_dccreq_handle; + + docsis_dccreq_handle = find_dissector ("docsis_dccreq"); + dissector_add ("docsis_mgmt", 0x17, docsis_dccreq_handle); + +} diff --git a/plugins/docsis/packet-dccrsp.c b/plugins/docsis/packet-dccrsp.c new file mode 100644 index 0000000000..d0c15608be --- /dev/null +++ b/plugins/docsis/packet-dccrsp.c @@ -0,0 +1,277 @@ +/* packet-dccrsp.c + * Routines for DCC Response Message dissection + * Copyright 2004, Darryl Hymel + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 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 "moduleinfo.h" + +#include +#include +#include + +#include + +#include + +#define DCCRSP_CM_JUMP_TIME 1 +#define DCCRSP_KEY_SEQ_NUM 31 +#define DCCRSP_HMAC_DIGEST 27 + +/* Define DCC-RSP CM Jump Time subtypes + * These are subtype of DCCRSP_CM_JUMP_TIME (1) + */ +#define DCCRSP_CM_JUMP_TIME_LENGTH 1 +#define DCCRSP_CM_JUMP_TIME_START 2 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dccrsp = -1; + +static int hf_docsis_dccrsp_tran_id = -1; +static int hf_docsis_dccrsp_conf_code = -1; +static int hf_docsis_dccrsp_cm_jump_time_length = -1; +static int hf_docsis_dccrsp_cm_jump_time_start = -1; +static int hf_docsis_dccrsp_key_seq_num = -1; +static int hf_docsis_dccrsp_hmac_digest = -1; + +/* Initialize the subtree pointers */ +static gint ett_docsis_dccrsp = -1; +static gint ett_docsis_dccrsp_cm_jump_time = -1; + + +/* Code to actually dissect the packets */ +static void +dissect_dccrsp_cm_jump_time (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcc_item; + proto_tree *dcc_tree; + int pos; + + pos = start; + dcc_item = proto_tree_add_text ( tree, tvb, start, len, "2 DCC-RSP CM Time Jump Encodings (Length = %u)", len); + dcc_tree = proto_item_add_subtree ( dcc_item , ett_docsis_dccrsp_cm_jump_time); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCCRSP_CM_JUMP_TIME_LENGTH: + if (length == 4) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_cm_jump_time_length, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCRSP_CM_JUMP_TIME_START: + if (length == 8) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_cm_jump_time_start, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } + pos = pos + length; + } +} +static void +dissect_dccrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint16 pos; + guint8 type, length; + proto_tree *dcc_tree; + proto_item *dcc_item; + guint16 len; + + len = tvb_length_remaining (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO,"DCC-RSP Message: "); + } + + if (tree) + { + dcc_item = + proto_tree_add_protocol_format (tree, proto_docsis_dccrsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "DCC-RSP Message"); + dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccrsp); + proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_tran_id, tvb, 0, 2, FALSE); + proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_conf_code, tvb, 2, 1, FALSE); + + pos = 3; + while (pos < len) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case DCCRSP_CM_JUMP_TIME: + dissect_dccrsp_cm_jump_time (tvb , dcc_tree , pos , length ); + break; + case DCCRSP_KEY_SEQ_NUM: + if (length == 1) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_key_seq_num, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCCRSP_HMAC_DIGEST: + if (length == 20) + { + proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_hmac_digest, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch(type) */ + pos = pos + length; + } /* while (pos < len) */ + } /* if (tree) */ + +} +/* Register the protocol with Ethereal */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + + +void +proto_register_docsis_dccrsp (void) +{ +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dccrsp_tran_id , + { + "Transaction ID ", + "docsis.dccrsp.tran_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Transaction ID ", + HFILL + } + }, + {&hf_docsis_dccrsp_conf_code , + { + "Confirmation Code ", + "docsis.dccrsp.conf_code", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Confirmation Code ", + HFILL + } + }, + {&hf_docsis_dccrsp_cm_jump_time_length , + { + "Jump Time Length ", + "docsis.dccrsp.cm_jump_time_length", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Jump Time Length ", + HFILL + } + }, + {&hf_docsis_dccrsp_cm_jump_time_start , + { + "Jump Time Start ", + "docsis.dccrsp.cm_jump_time_start", + FT_UINT64, BASE_DEC, NULL, 0x0, + "Jump Time Start ", + HFILL + } + }, + {&hf_docsis_dccrsp_key_seq_num , + { + "Auth Key Sequence Number ", + "docsis.dccrsp.key_seq_num", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Auth Key Sequence Number ", + HFILL + } + }, + {&hf_docsis_dccrsp_hmac_digest , + { + "HMAC-DigestNumber ", + "docsis.dccrsp.hmac_digest", + FT_BYTES, BASE_DEC, NULL, 0x0, + "HMAC-DigestNumber ", + HFILL + } + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dccrsp, + &ett_docsis_dccrsp_cm_jump_time, + }; + +/* Register the protocol name and description */ + proto_docsis_dccrsp = + proto_register_protocol ("DOCSIS Downstream Channel Change Response ", + "DOCSIS DCC-RSP", "docsis_dccrsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dccrsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dccrsp", dissect_dccrsp, proto_docsis_dccrsp); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_docsis_dccrsp (void) +{ + dissector_handle_t docsis_dccrsp_handle; + + docsis_dccrsp_handle = find_dissector ("docsis_dccrsp"); + dissector_add ("docsis_mgmt", 0x18, docsis_dccrsp_handle); + +} diff --git a/plugins/docsis/packet-dcd.c b/plugins/docsis/packet-dcd.c new file mode 100644 index 0000000000..5269ee755c --- /dev/null +++ b/plugins/docsis/packet-dcd.c @@ -0,0 +1,866 @@ +/* packet-dcd.c + * Routines for DCD Message dissection + * Copyright 2004, Darryl Hymel + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 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 "moduleinfo.h" + +#include +#include +#include + +#include + +#include + +#define DCD_DOWN_CLASSIFIER 23 +#define DCD_DSG_RULE 50 +#define DCD_DSG_CONFIG 51 + +/* Define Downstrean Classifier subtypes + * These are subtype of DCD_DOWN_CLASSIFIER (23) + */ + +#define DCD_CFR_ID 2 +#define DCD_CFR_RULE_PRI 5 +#define DCD_CFR_IP_CLASSIFIER 9 + +/* Define IP Classifier sub-subtypes + * These are subtypes of DCD_CFR_IP_CLASSIFIER (23.9) + */ +#define DCD_CFR_IP_SOURCE_ADDR 3 +#define DCD_CFR_IP_SOURCE_MASK 4 +#define DCD_CFR_IP_DEST_ADDR 5 +#define DCD_CFR_IP_DEST_MASK 6 +#define DCD_CFR_TCPUDP_SRCPORT_START 7 +#define DCD_CFR_TCPUDP_SRCPORT_END 8 +#define DCD_CFR_TCPUDP_DSTPORT_START 9 +#define DCD_CFR_TCPUDP_DSTPORT_END 10 + +/* Define DSG Rule subtypes + * These are subtype of DCD_DSG_RULE (50) + */ + +#define DCD_RULE_ID 1 +#define DCD_RULE_PRI 2 +#define DCD_RULE_UCID_RNG 3 +#define DCD_RULE_CLIENT_ID 4 +#define DCD_RULE_TUNL_ADDR 5 +#define DCD_RULE_CFR_ID 6 +#define DCD_RULE_VENDOR_SPEC 43 +/* Define DSG Rule Client ID sub-subtypes + * These are subtypes of DCD_RULE_CLIENT_ID (50.4) + */ +#define DCD_CLID_BCAST_ID 1 +#define DCD_CLID_KNOWN_MAC_ADDR 2 +#define DCD_CLID_CA_SYS_ID 3 +#define DCD_CLID_APP_ID 4 + +/* Define DSG Configuration subtypes + * These are subtype of DCD_DSG_CONFIG (51) + */ + +#define DCD_CFG_CHAN_LST 1 +#define DCD_CFG_TDSG1 2 +#define DCD_CFG_TDSG2 3 +#define DCD_CFG_TDSG3 4 +#define DCD_CFG_TDSG4 5 +#define DCD_CFG_VENDOR_SPEC 43 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dcd = -1; + +static int hf_docsis_dcd_config_ch_cnt = -1; +static int hf_docsis_dcd_num_of_frag = -1; +static int hf_docsis_dcd_frag_sequence_num = -1; +static int hf_docsis_dcd_cfr_id = -1; +static int hf_docsis_dcd_cfr_rule_pri = -1; +static int hf_docsis_dcd_cfr_ip_source_addr = -1; +static int hf_docsis_dcd_cfr_ip_source_mask = -1; +static int hf_docsis_dcd_cfr_ip_dest_addr = -1; +static int hf_docsis_dcd_cfr_ip_dest_mask = -1; +static int hf_docsis_dcd_cfr_tcpudp_srcport_start = -1; +static int hf_docsis_dcd_cfr_tcpudp_srcport_end = -1; +static int hf_docsis_dcd_cfr_tcpudp_dstport_start = -1; +static int hf_docsis_dcd_cfr_tcpudp_dstport_end = -1; +static int hf_docsis_dcd_rule_id = -1; +static int hf_docsis_dcd_rule_pri = -1; +static int hf_docsis_dcd_rule_ucid_list = -1; +static int hf_docsis_dcd_clid_known_mac_addr = -1; +static int hf_docsis_dcd_clid_ca_sys_id = -1; +static int hf_docsis_dcd_clid_app_id = -1; +static int hf_docsis_dcd_rule_tunl_addr = -1; +static int hf_docsis_dcd_rule_cfr_id = -1; +static int hf_docsis_dcd_rule_vendor_spec = -1; +static int hf_docsis_dcd_cfg_chan = -1; +static int hf_docsis_dcd_cfg_tdsg1 = -1; +static int hf_docsis_dcd_cfg_tdsg2 = -1; +static int hf_docsis_dcd_cfg_tdsg3 = -1; +static int hf_docsis_dcd_cfg_tdsg4 = -1; +static int hf_docsis_dcd_cfg_vendor_spec = -1; + +/* Initialize the subtree pointers */ +static gint ett_docsis_dcd = -1; +static gint ett_docsis_dcd_cfr = -1; +static gint ett_docsis_dcd_cfr_ip = -1; +static gint ett_docsis_dcd_rule = -1; +static gint ett_docsis_dcd_clid = -1; +static gint ett_docsis_dcd_cfg = -1; + +/* Code to actually dissect the packets */ +static void +dissect_dcd_dsg_cfg (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcd_item; + proto_tree *dcd_tree; + int pos; + + pos = start; + dcd_item = proto_tree_add_text ( tree, tvb, start, len, "51 DCD DSG Config Encodings (Length = %u)", len); + dcd_tree = proto_item_add_subtree ( dcd_item , ett_docsis_dcd_cfg); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCD_CFG_CHAN_LST: + if (length == 4) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_chan, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFG_TDSG1: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg1, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFG_TDSG2: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg2, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFG_TDSG3: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg3, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFG_TDSG4: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg4, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFG_VENDOR_SPEC: + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_vendor_spec, tvb, + pos, length, FALSE); + break; + + } + pos = pos + length; + } +} +static void +dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcd_item; + proto_tree *dcd_tree; + int pos; + + pos = start; + dcd_item = proto_tree_add_text ( tree, tvb, start, len, "23.9 DCD_CFR_IP Encodings (Length = %u)", len); + dcd_tree = proto_item_add_subtree ( dcd_item , ett_docsis_dcd_cfr_ip); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCD_CFR_IP_SOURCE_ADDR: + if (length == 4) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_source_addr, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_IP_SOURCE_MASK: + if (length == 4) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_source_mask, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_IP_DEST_ADDR: + if (length == 4) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_dest_addr, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_IP_DEST_MASK: + if (length == 4) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_dest_mask, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_TCPUDP_SRCPORT_START: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_srcport_start, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_TCPUDP_SRCPORT_END: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_srcport_end, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_TCPUDP_DSTPORT_START: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_dstport_start, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_TCPUDP_DSTPORT_END: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_dstport_end, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } + pos = pos + length; + } +} +static void +dissect_dcd_clid (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcd_item; + proto_tree *dcd_tree; + int pos; + + pos = start; + dcd_item = proto_tree_add_text ( tree, tvb, start, len, "50.4 DCD Rule ClientID Encodings (Length = %u)", len); + dcd_tree = proto_item_add_subtree ( dcd_item , ett_docsis_dcd_clid); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCD_CLID_KNOWN_MAC_ADDR: + if (length == 6) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_known_mac_addr, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CLID_CA_SYS_ID: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_ca_sys_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CLID_APP_ID: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_app_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } + pos = pos + length; + } +} +static void +dissect_dcd_dsg_rule (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcd_item; + proto_tree *dcd_tree; + int pos; + + pos = start; + dcd_item = proto_tree_add_text ( tree, tvb, start, len, "50 DCD DSG Rule Encodings (Length = %u)", len); + dcd_tree = proto_item_add_subtree ( dcd_item , ett_docsis_dcd_rule); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCD_RULE_ID: + if (length == 1) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_RULE_PRI: + if (length == 1) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_pri, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_RULE_UCID_RNG: + proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_ucid_list, tvb, + pos, length, FALSE); + break; + case DCD_RULE_CLIENT_ID: + dissect_dcd_clid (tvb , dcd_tree , pos , length ); + break; + case DCD_RULE_TUNL_ADDR: + if (length == 6) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_tunl_addr, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_RULE_CFR_ID: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_cfr_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_RULE_VENDOR_SPEC: + proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_vendor_spec, tvb, + pos, length, FALSE); + break; + + } + pos = pos + length; + } +} +static void +dissect_dcd_down_classifier (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) +{ + guint8 type, length; + proto_item *dcd_item; + proto_tree *dcd_tree; + int pos; + + pos = start; + dcd_item = proto_tree_add_text ( tree, tvb, start, len, "23 DCD_CFR Encodings (Length = %u)", len); + dcd_tree = proto_item_add_subtree ( dcd_item , ett_docsis_dcd_cfr); + + while ( pos < ( start + len) ) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + + switch (type) + { + case DCD_CFR_ID: + if (length == 2) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_RULE_PRI: + if (length == 1) + { + proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_rule_pri, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case DCD_CFR_IP_CLASSIFIER: + dissect_dcd_down_classifier_ip (tvb , dcd_tree , pos , length ); + break; + + } + pos = pos + length; + } +} +static void +dissect_dcd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint16 pos; + guint8 type, length; + proto_tree *dcd_tree; + proto_item *dcd_item; + guint16 len; + + len = tvb_length_remaining (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO,"DCD Message: "); + } + + if (tree) + { + dcd_item = + proto_tree_add_protocol_format (tree, proto_docsis_dcd, tvb, 0, + tvb_length_remaining (tvb, 0), + "DCD Message"); + dcd_tree = proto_item_add_subtree (dcd_item, ett_docsis_dcd); + proto_tree_add_item (dcd_tree, hf_docsis_dcd_config_ch_cnt, tvb, 0, 1, FALSE); + proto_tree_add_item (dcd_tree, hf_docsis_dcd_num_of_frag, tvb, 1, 1, FALSE); + proto_tree_add_item (dcd_tree, hf_docsis_dcd_frag_sequence_num, tvb, 2, 1, FALSE); + + pos = 3; + while (pos < len) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case DCD_DOWN_CLASSIFIER: + dissect_dcd_down_classifier (tvb , dcd_tree , pos , length ); + break; + case DCD_DSG_RULE: + dissect_dcd_dsg_rule (tvb , dcd_tree , pos , length ); + break; + case DCD_DSG_CONFIG: + dissect_dcd_dsg_cfg (tvb , dcd_tree , pos , length ); + break; + } /* switch(type) */ + pos = pos + length; + } /* while (pos < len) */ + } /* if (tree) */ + +} +/* Register the protocol with Ethereal */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + + +void +proto_register_docsis_dcd (void) +{ +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dcd_config_ch_cnt, + { + "Configuration Change Count", + "docsis.dcd.config_ch_cnt", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Configuration Change Count", + HFILL + } + }, + {&hf_docsis_dcd_num_of_frag, + { + "Number of Fragments", + "docsis.dcd.num_of_frag", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Fragments", + HFILL + } + }, + {&hf_docsis_dcd_frag_sequence_num, + { + "Fragment Sequence Number", + "docsis.dcd.frag_sequence_num", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Fragment Sequence Number", + HFILL + } + }, + {&hf_docsis_dcd_cfr_id, + { + "Downstream Classifier Id", + "docsis.dcd.cfr_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Downstream Classifier Id", + HFILL + } + }, + {&hf_docsis_dcd_cfr_rule_pri, + { + "Downstream Classifier Rule Priority", + "docsis.dcd.cfr_rule_pri", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Downstream Classifier Rule Priority", + HFILL + } + }, + {&hf_docsis_dcd_cfr_ip_source_addr, + { + "Downstream Classifier IP Source Address", + "docsis.dcd.cfr_ip_source_addr", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP Source Address", + HFILL + } + }, + {&hf_docsis_dcd_cfr_ip_source_mask, + { + "Downstream Classifier IP Source Mask", + "docsis.dcd.cfr_ip_source_mask", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP Source Mask", + HFILL + } + }, + {&hf_docsis_dcd_cfr_ip_dest_addr, + { + "Downstream Classifier IP Destination Address", + "docsis.dcd.cfr_ip_dest_addr", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP Destination Address", + HFILL + } + }, + {&hf_docsis_dcd_cfr_ip_dest_mask, + { + "Downstream Classifier IP Destination Mask", + "docsis.dcd.cfr_ip_dest_mask", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP Destination Address", + HFILL + } + }, + {&hf_docsis_dcd_cfr_tcpudp_srcport_start, + { + "Downstream Classifier IP TCP/UDP Source Port Start", + "docsis.dcd.cfr_ip_tcpudp_srcport_start", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP TCP/UDP Source Port Start", + HFILL + } + }, + {&hf_docsis_dcd_cfr_tcpudp_srcport_end, + { + "Downstream Classifier IP TCP/UDP Source Port End", + "docsis.dcd.cfr_ip_tcpudp_srcport_end", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP TCP/UDP Source Port End", + HFILL + } + }, + {&hf_docsis_dcd_cfr_tcpudp_dstport_start, + { + "Downstream Classifier IP TCP/UDP Destination Port Start", + "docsis.dcd.cfr_ip_tcpudp_dstport_start", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP TCP/UDP Destination Port Start", + HFILL + } + }, + {&hf_docsis_dcd_cfr_tcpudp_dstport_end, + { + "Downstream Classifier IP TCP/UDP Destination Port End", + "docsis.dcd.cfr_ip_tcpudp_dstport_end", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Downstream Classifier IP TCP/UDP Destination Port End", + HFILL + } + }, + {&hf_docsis_dcd_rule_id, + { + "DSG Rule Id ", + "docsis.dcd.rule_id", + FT_UINT8, BASE_DEC, NULL, 0x0, + "DSG Rule Id ", + HFILL + } + }, + {&hf_docsis_dcd_rule_pri, + { + "DSG Rule Priority ", + "docsis.dcd.rule_pri", + FT_UINT8, BASE_DEC, NULL, 0x0, + "DSG Rule Priority ", + HFILL + } + }, + {&hf_docsis_dcd_rule_ucid_list, + { + "DSG Rule UCID Range ", + "docsis.dcd.rule_ucid_list", + FT_BYTES, BASE_HEX, NULL, 0x0, + "DSG Rule UCID Range ", + HFILL + } + }, + {&hf_docsis_dcd_clid_known_mac_addr, + { + "DSG Rule Client ID Known MAC Address ", + "docsis.dcd.clid_known_mac_addr", + FT_ETHER, BASE_DEC, NULL, 0x0, + "DSG Rule Client ID Known MAC Address ", + HFILL + } + }, + {&hf_docsis_dcd_clid_ca_sys_id, + { + "DSG Rule Client ID CA System ID ", + "docsis.dcd.clid_ca_sys_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "DSG Rule Client ID CA System ID ", + HFILL + } + }, + {&hf_docsis_dcd_clid_app_id, + { + "DSG Rule Client ID Application ID ", + "docsis.dcd.clid_app_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "DSG Rule Client ID Application ID ", + HFILL + } + }, + {&hf_docsis_dcd_rule_tunl_addr, + { + "DSG Rule Tunnel MAC Address ", + "docsis.dcd.rule_tunl_addr", + FT_ETHER, BASE_DEC, NULL, 0x0, + "DSG Rule Tunnel MAC Address ", + HFILL + } + }, + {&hf_docsis_dcd_rule_cfr_id, + { + "DSG Rule Classifier ID", + "docsis.dcd.rule_cfr_id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "DSG Rule Classifier ID", + HFILL + } + }, + {&hf_docsis_dcd_rule_vendor_spec, + { + "DSG Rule Vendor Specific Parameters", + "docsis.dcd.rule_vendor_spec", + FT_BYTES, BASE_HEX, NULL, 0x0, + "DSG Rule Vendor Specific Parameters", + HFILL + } + }, + {&hf_docsis_dcd_cfg_chan, + { + "DSG Configuration Channel", + "docsis.dcd.cfg_chan", + FT_UINT32, BASE_DEC, NULL, 0x0, + "DSG Configuration Channel", + HFILL + } + }, + {&hf_docsis_dcd_cfg_tdsg1, + { + "DSG Initialization Timeout (Tdsg1) ", + "docsis.dcd.cfg_tdsg1", + FT_UINT16, BASE_DEC, NULL, 0x0, + "DSG Initialization Timeout (Tdsg1) ", + HFILL + } + }, + {&hf_docsis_dcd_cfg_tdsg2, + { + "DSG Operational Timeout (Tdsg2) ", + "docsis.dcd.cfg_tdsg2", + FT_UINT16, BASE_DEC, NULL, 0x0, + "DSG Operational Timeout (Tdsg2) ", + HFILL + } + }, + {&hf_docsis_dcd_cfg_tdsg3, + { + "DSG Two-Way Retry Timer (Tdsg3) ", + "docsis.dcd.cfg_tdsg3", + FT_UINT16, BASE_DEC, NULL, 0x0, + "DSG Two-Way Retry Timer (Tdsg3) ", + HFILL + } + }, + {&hf_docsis_dcd_cfg_tdsg4, + { + "DSG One-Way Retry Timer (Tdsg4) ", + "docsis.dcd.cfg_tdsg4", + FT_UINT16, BASE_DEC, NULL, 0x0, + "DSG One-Way Retry Timer (Tdsg4) ", + HFILL + } + }, + {&hf_docsis_dcd_cfg_vendor_spec, + { + "DSG Configuration Vendor Specific Parameters", + "docsis.dcd.cfg_vendor_spec", + FT_BYTES, BASE_HEX, NULL, 0x0, + "DSG Configuration Vendor Specific Parameters", + HFILL + } + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dcd, + &ett_docsis_dcd_cfr, + &ett_docsis_dcd_cfr_ip, + &ett_docsis_dcd_rule, + &ett_docsis_dcd_clid, + &ett_docsis_dcd_cfg, + }; + +/* Register the protocol name and description */ + proto_docsis_dcd = + proto_register_protocol ("DOCSIS Downstream Channel Descriptor ", + "DOCSIS DCD", "docsis_dcd"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dcd, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dcd", dissect_dcd, proto_docsis_dcd); +} + + +/* If this dissector uses sub-dissector registration add a registration routine. + This format is required because a script is used to find these routines and + create the code that calls these routines. +*/ +void +proto_reg_handoff_docsis_dcd (void) +{ + dissector_handle_t docsis_dcd_handle; + + docsis_dcd_handle = find_dissector ("docsis_dcd"); + dissector_add ("docsis_mgmt", 0x20, docsis_dcd_handle); + +} diff --git a/plugins/docsis/packet-docsis.c b/plugins/docsis/packet-docsis.c index e78e9f8f84..54eb67530c 100644 --- a/plugins/docsis/packet-docsis.c +++ b/plugins/docsis/packet-docsis.c @@ -801,6 +801,10 @@ plugin_register (void) proto_register_docsis_regrsp (); proto_register_docsis_ucd (); proto_register_docsis_type29ucd (); + proto_register_docsis_dcd (); + proto_register_docsis_dccreq (); + proto_register_docsis_dccrsp (); + proto_register_docsis_dccack (); proto_register_docsis_dsareq (); proto_register_docsis_dsdrsp (); proto_register_docsis_rngreq (); @@ -835,6 +839,10 @@ plugin_reg_handoff (void) proto_reg_handoff_docsis_regrsp (); proto_reg_handoff_docsis_ucd (); proto_reg_handoff_docsis_type29ucd (); + proto_reg_handoff_docsis_dcd (); + proto_reg_handoff_docsis_dccreq (); + proto_reg_handoff_docsis_dccrsp (); + proto_reg_handoff_docsis_dccack (); proto_reg_handoff_docsis_dsareq (); proto_reg_handoff_docsis_dsdrsp (); proto_reg_handoff_docsis_vsif (); diff --git a/plugins/docsis/packet-docsis.h b/plugins/docsis/packet-docsis.h index 1e7f595e48..76fe232152 100644 --- a/plugins/docsis/packet-docsis.h +++ b/plugins/docsis/packet-docsis.h @@ -48,6 +48,10 @@ void proto_reg_handoff_docsis_uccreq (void); void proto_reg_handoff_docsis_uccrsp (void); void proto_reg_handoff_docsis_ucd (void); void proto_reg_handoff_docsis_type29ucd (void); +void proto_reg_handoff_docsis_dcd (void); +void proto_reg_handoff_docsis_dccreq (void); +void proto_reg_handoff_docsis_dccrsp (void); +void proto_reg_handoff_docsis_dccack (void); void proto_reg_handoff_docsis_vsif (void); void proto_reg_handoff_docsis_intrngreq (void); @@ -76,6 +80,10 @@ void proto_register_docsis_uccreq (void); void proto_register_docsis_uccrsp (void); void proto_register_docsis_ucd (void); void proto_register_docsis_type29ucd (void); +void proto_register_docsis_dcd (void); +void proto_register_docsis_dccreq (void); +void proto_register_docsis_dccrsp (void); +void proto_register_docsis_dccack (void); void proto_register_docsis_vsif (void); void proto_register_docsis_intrngreq (void); #endif -- cgit v1.2.3