diff options
49 files changed, 9236 insertions, 51 deletions
@@ -1200,6 +1200,7 @@ Devin Heitmueller <dheitmueller[AT]netilla.com> { editing code without having specified a filter name and string Fix to treat the "send buffer length" in SMB RAP messages as being present in the packet + Dissection of NTLMSSP packets for DCERPC } Chenjiang Hu <chu[AT]chiaro.com> { @@ -1317,8 +1318,12 @@ Liviu Daia <Liviu.Daia[AT]imar.ro> { from the command line } -Devin Heitmueller <dheitmueller[AT]netilla.com> { - Dissection of NTLMSSP packets for DCERPC +Anand V. Narwani <anarwani[AT]cisco.com> { + DOCSIS support, including support for "Ethernet" captures where + the raw frame is a DOCSIS frame rather than an Ethernet + frame (some Cisco cable-modem head-end gear can send out a + trace of all traffic on an Ethernet, but what it sends are + the raw bytes of DOCSIS frames, not Ethernet frames) } Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to diff --git a/Makefile.am b/Makefile.am index 91010d0716..d9beb6f69d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.446 2002/07/11 18:43:35 gerald Exp $ +# $Id: Makefile.am,v 1.447 2002/07/12 22:52:33 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -336,29 +336,77 @@ DISSECTOR_SRC = \ if HAVE_PLUGINS plugin_src = \ - plugins/gryphon/packet-gryphon.c \ - plugins/mgcp/packet-mgcp.c \ + plugins/docsis/packet-bpkmattr.c \ + plugins/docsis/packet-bpkmreq.c \ + plugins/docsis/packet-bpkmrsp.c \ + plugins/docsis/packet-docsis.c \ + plugins/docsis/packet-dsaack.c \ + plugins/docsis/packet-dsareq.c \ + plugins/docsis/packet-dsarsp.c \ + plugins/docsis/packet-dscack.c \ + plugins/docsis/packet-dscreq.c \ + plugins/docsis/packet-dscrsp.c \ + plugins/docsis/packet-dsdreq.c \ + plugins/docsis/packet-dsdrsp.c \ + plugins/docsis/packet-macmgmt.c \ + plugins/docsis/packet-map.c \ + plugins/docsis/packet-regack.c \ + plugins/docsis/packet-regreq.c \ + plugins/docsis/packet-regrsp.c \ + plugins/docsis/packet-rngreq.c \ + plugins/docsis/packet-rngrsp.c \ + plugins/docsis/packet-tlv.c \ + plugins/docsis/packet-uccreq.c \ + plugins/docsis/packet-uccrsp.c \ + plugins/docsis/packet-ucd.c \ plugins/giop/packet-cosnaming.c \ - plugins/giop/packet-coseventcomm.c + plugins/giop/packet-coseventcomm.c \ + plugins/gryphon/packet-gryphon.c \ + plugins/mgcp/packet-mgcp.c + plugin_static_ldadd = \ - plugins/gryphon/packet-gryphon-static.o \ - plugins/mgcp/packet-mgcp-static.o \ - plugins/giop/packet-cosnaming-static.o \ - plugins/giop/packet-coseventcomm-static.o + plugins/docsis/packet-bpkmattr-static.o \ + plugins/docsis/packet-bpkmreq-static.o \ + plugins/docsis/packet-bpkmrsp-static.o \ + plugins/docsis/packet-docsis-static.o \ + plugins/docsis/packet-dsaack-static.o \ + plugins/docsis/packet-dsareq-static.o \ + plugins/docsis/packet-dsarsp-static.o \ + plugins/docsis/packet-dscack-static.o \ + plugins/docsis/packet-dscreq-static.o \ + plugins/docsis/packet-dscrsp-static.o \ + plugins/docsis/packet-dsdreq-static.o \ + plugins/docsis/packet-dsdrsp-static.o \ + plugins/docsis/packet-macmgmt-static.o \ + plugins/docsis/packet-map-static.o \ + plugins/docsis/packet-regack-static.o \ + plugins/docsis/packet-regreq-static.o \ + plugins/docsis/packet-regrsp-static.o \ + plugins/docsis/packet-rngreq-static.o \ + plugins/docsis/packet-rngrsp-static.o \ + plugins/docsis/packet-tlv-static.o \ + plugins/docsis/packet-uccreq-static.o \ + plugins/docsis/packet-uccrsp-static.o \ + plugins/giop/packet-cosnaming-static.o \ + plugins/giop/packet-coseventcomm-static.o \ + plugins/gryphon/packet-gryphon-static.o \ + plugins/mgcp/packet-mgcp-static.o plugin_libs = \ - plugins/gryphon/gryphon.la \ - plugins/mgcp/mgcp.la \ + plugins/docsis/docsis.la \ plugins/giop/cosnaming.la \ - plugins/giop/coseventcomm.la + plugins/giop/coseventcomm.la \ + plugins/gryphon/gryphon.la \ + plugins/mgcp/mgcp.la plugin_ldadd = \ "-dlopen" self \ - "-dlopen" plugins/gryphon/gryphon.la \ - "-dlopen" plugins/mgcp/mgcp.la \ + "-dlopen" plugins/docsis/docsis.la \ "-dlopen" plugins/giop/cosnaming.la \ - "-dlopen" plugins/giop/coseventcomm.la + "-dlopen" plugins/giop/coseventcomm.la \ + "-dlopen" plugins/gryphon/gryphon.la \ + "-dlopen" plugins/mgcp/mgcp.la else plugin_src = diff --git a/configure.in b/configure.in index 408e1ef28c..f5655ecf31 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.169 2002/07/06 20:40:42 guy Exp $ +# $Id: configure.in,v 1.170 2002/07/12 22:52:33 guy Exp $ dnl dnl Process this file with autoconf 2.13 or later to produce a dnl configure script; 2.12 doesn't generate a "configure" script that @@ -693,9 +693,10 @@ AC_OUTPUT( packaging/svr4/checkinstall packaging/svr4/pkginfo plugins/Makefile + plugins/docsis/Makefile + plugins/giop/Makefile plugins/gryphon/Makefile plugins/mgcp/Makefile - plugins/giop/Makefile tools/Makefile tools/lemon/Makefile ,) diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template index aff991dbc2..4490032977 100644 --- a/doc/ethereal.pod.template +++ b/doc/ethereal.pod.template @@ -1460,6 +1460,7 @@ B<http://www.ethereal.com>. Christopher K. St. John <cks[AT]distributopia.com> Nix <nix[AT]esperi.demon.co.uk> Liviu Daia <Liviu.Daia[AT]imar.ro> + Anand V. Narwani <anarwani[AT]cisco.com> Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to give his permission to use his version of snprintf.c. diff --git a/epan/plugins.c b/epan/plugins.c index c53cf4fa92..d5addb1d52 100644 --- a/epan/plugins.c +++ b/epan/plugins.c @@ -1,7 +1,7 @@ /* plugins.c * plugin routines * - * $Id: plugins.c,v 1.54 2002/05/14 10:39:29 guy Exp $ + * $Id: plugins.c,v 1.55 2002/07/12 22:52:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -455,6 +455,9 @@ init_plugins(const char *plugin_dir) patable.p_decode_boolean_bitfield = decode_boolean_bitfield; patable.p_decode_numeric_bitfield = decode_numeric_bitfield; patable.p_decode_enumerated_bitfield = decode_enumerated_bitfield; + patable.p_register_dissector_table = register_dissector_table; + patable.p_except_throw = except_throw; + patable.p_dissector_try_port = dissector_try_port; #endif #ifdef WIN32 diff --git a/packaging/nsis/Makefile.nmake b/packaging/nsis/Makefile.nmake index d851b0cbd4..3d6852ad6e 100644 --- a/packaging/nsis/Makefile.nmake +++ b/packaging/nsis/Makefile.nmake @@ -1,6 +1,5 @@ # -# $Id: Makefile.nmake,v 1.11 2002/03/20 19:45:51 gram Exp $ -# +# $Id: Makefile.nmake,v 1.12 2002/07/12 22:52:38 guy Exp $ # # NSIS is a free packager/installer/uninstaller program for Win32. # It was originally written for the Winamp package, but various @@ -22,8 +21,11 @@ DOC=../../doc/ethereal.html \ ../../README.win32 GPL=GPL.txt -PLUGINS=../../plugins/mgcp/mgcp.dll \ - ../../plugins/gryphon/gryphon.dll +PLUGINS=../../plugins/docsis/docsis.dll \ + ../../plugins/giop/coseventcomm.dll \ + ../../plugins/giop/cosnaming.dll \ + ../../plugins/gryphon/gryphon.dll \ + ../../plugins/mgcp/mgcp.dll DELIVERABLES=$(EXE) $(DLL) $(DOC) $(GPL) $(PLUGINS) diff --git a/packaging/nsis/ethereal.nsi.in b/packaging/nsis/ethereal.nsi.in index 23023f1886..bc29e9f243 100644 --- a/packaging/nsis/ethereal.nsi.in +++ b/packaging/nsis/ethereal.nsi.in @@ -1,7 +1,7 @@ ; ; ethereal.nsi ; -; $Id: ethereal.nsi.in,v 1.15 2002/06/01 22:17:22 guy Exp $ +; $Id: ethereal.nsi.in,v 1.16 2002/07/12 22:52:38 guy Exp $ ; ============================================================================ ; Header configuration @@ -127,10 +127,11 @@ SectionEnd Section "Plugins" ;------------------------------------------- SetOutPath $INSTDIR\plugins\@VERSION@ +File "..\..\plugins\docsis\docsis.dll" +File "..\..\plugins\giop\coseventcomm.dll" +File "..\..\plugins\giop\cosnaming.dll" File "..\..\plugins\gryphon\gryphon.dll" File "..\..\plugins\mgcp\mgcp.dll" -File "..\..\plugins\giop\cosnaming.dll" -File "..\..\plugins\giop\coseventcomm.dll" SectionEnd SectionDivider @@ -167,6 +168,7 @@ Delete "$INSTDIR\*.html" Delete "$INSTDIR\*.dll" Delete "$INSTDIR\plugins\@VERSION@\coseventcomm.dll" Delete "$INSTDIR\plugins\@VERSION@\cosnaming.dll" +Delete "$INSTDIR\plugins\@VERSION@\docsis.dll" Delete "$INSTDIR\plugins\@VERSION@\gryphon.dll" Delete "$INSTDIR\plugins\@VERSION@\mgcp.dll" Delete "$SMPROGRAMS\Ethereal\*.*" diff --git a/packet-frame.c b/packet-frame.c index c8f7ed68ce..40c2d458aa 100644 --- a/packet-frame.c +++ b/packet-frame.c @@ -2,7 +2,7 @@ * * Top-most dissector. Decides dissector based on Wiretap Encapsulation Type. * - * $Id: packet-frame.c,v 1.26 2002/05/04 20:57:18 guy Exp $ + * $Id: packet-frame.c,v 1.27 2002/07/12 22:52:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -52,9 +52,11 @@ static int proto_unreassembled = -1; static gint ett_frame = -1; static dissector_handle_t data_handle; +static dissector_handle_t docsis_handle; /* Preferences */ static gboolean show_file_off = FALSE; +static gboolean force_docsis_encap; static const value_string p2p_dirs[] = { { P2P_DIR_SENT, "Sent" }, @@ -93,6 +95,10 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } + if ((force_docsis_encap) && (docsis_handle)) { + pinfo->fd->lnk_t = WTAP_ENCAP_DOCSIS; + } + /* Put in frame header information. */ if (tree) { @@ -278,10 +284,13 @@ proto_register_frame(void) frame_module = prefs_register_protocol(proto_frame, NULL); prefs_register_bool_preference(frame_module, "show_file_off", "Show File Offset", "Show File Offset", &show_file_off); + prefs_register_bool_preference(frame_module, "force_docsis_encap", + "Treat all frames as DOCSIS frames", "Treat all frames as DOCSIS Frames", &force_docsis_encap); } void proto_reg_handoff_frame(void) { data_handle = find_dissector("data"); + docsis_handle = find_dissector("docsis"); } diff --git a/plugins/Makefile.am b/plugins/Makefile.am index e5c7638ced..138b9d060d 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,13 +1,12 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.10 2002/07/06 20:40:45 guy Exp $ +# $Id: Makefile.am,v 1.11 2002/07/12 22:52:39 guy Exp $ # # Ethereal - Network traffic analyzer -# By Gerald Combs <gerald@zing.org> +# By Gerald Combs <gerald@ethereal.com> # 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 @@ -22,7 +21,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -SUBDIRS = gryphon mgcp giop +SUBDIRS = docsis giop gryphon mgcp plugindir = @plugindir@ diff --git a/plugins/Makefile.nmake b/plugins/Makefile.nmake index cc6042b7fe..b695b6df93 100644 --- a/plugins/Makefile.nmake +++ b/plugins/Makefile.nmake @@ -1,5 +1,5 @@ # -# $Id: Makefile.nmake,v 1.13 2002/02/27 09:42:44 guy Exp $ +# $Id: Makefile.nmake,v 1.14 2002/07/12 22:52:39 guy Exp $ # include ..\config.nmake @@ -13,7 +13,17 @@ CFLAGS=/DHAVE_CONFIG_H /I.. /I../wiretap /I. \ OBJECTS=plugin_api.obj -all: plugin_api.obj gryphon mgcp giop +all: plugin_api.obj docsis giop gryphon mgcp + +docsis:: + cd docsis + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake + cd .. + +giop:: + cd giop + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake + cd .. gryphon:: cd gryphon @@ -21,22 +31,18 @@ gryphon:: cd .. mgcp:: - cd mgcp - $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake - cd .. - -giop:: - cd giop - $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake - cd .. - + cd mgcp + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake + cd .. clean: rm -f plugin_api.obj $(PDB_FILE) - cd gryphon - $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean - cd ../mgcp + cd docsis $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../giop $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean + cd ../gryphon + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean + cd ../mgcp + $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd .. diff --git a/plugins/docsis/.cvsignore b/plugins/docsis/.cvsignore new file mode 100644 index 0000000000..eaf8414111 --- /dev/null +++ b/plugins/docsis/.cvsignore @@ -0,0 +1,63 @@ +.deps +.libs +Makefile +Makefile.in +config.cache +config.h +config.h.in +config.log +config.status +configure +docsis.la +packet-bpkmattr-static.lo +packet-bpkmattr.lo +packet-bpkmreq-static.lo +packet-bpkmreq.lo +packet-bpkmrsp-static.lo +packet-bpkmrsp.lo +packet-docsis-static.lo +packet-docsis.lo +packet-dsaack-static.lo +packet-dsaack.lo +packet-dsareq-static.lo +packet-dsareq.lo +packet-dsarsp-static.lo +packet-dsarsp.lo +packet-dscack-static.lo +packet-dscack.lo +packet-dscreq-static.lo +packet-dscreq.lo +packet-dscrsp-static.lo +packet-dscrsp.lo +packet-dsdreq-static.lo +packet-dsdreq.lo +packet-dsdrsp-static.lo +packet-dsdrsp.lo +packet-macmgmt-static.lo +packet-macmgmt.lo +packet-map-static.lo +packet-map.lo +packet-regack-static.lo +packet-regack.lo +packet-regreq-static.lo +packet-regreq.lo +packet-regrsp-static.lo +packet-regrsp.lo +packet-rngreq-static.lo +packet-rngreq.lo +packet-rngrsp-static.lo +packet-rngrsp.lo +packet-tlv-static.lo +packet-tlv.lo +packet-uccreq-static.lo +packet-uccreq.lo +packet-uccrsp-static.lo +packet-uccrsp.lo +packet-ucd-static.lo +packet-ucd.lo +stamp-h +*.obj +*.dll +*.exp +*.lib +*.pdb diff --git a/plugins/docsis/AUTHORS b/plugins/docsis/AUTHORS new file mode 100644 index 0000000000..eba3156090 --- /dev/null +++ b/plugins/docsis/AUTHORS @@ -0,0 +1,3 @@ +Author : +Anand Narwani <anarwani@cisco.com> + diff --git a/plugins/docsis/ChangeLog b/plugins/docsis/ChangeLog new file mode 100644 index 0000000000..062b94b72d --- /dev/null +++ b/plugins/docsis/ChangeLog @@ -0,0 +1,15 @@ +Overview of changes in Ethereal DOCSIS Plugin 0.0.2 +* Fixed a number of cosmetic things. + +Overview of changes in Ethereal DOCSIS Plugin 0.0.3 +* Added Checks to each TLV Type to validate length. If the length is invalid + an Exception is thrown. +* Cleaned up the code in all dissctors so that they are a little more readable. + +Overview of changes in Ethereal DOCSIS Plugin 0.0.4 +* Added Support for Baseline Privacy Key Management Messages +* Added Concatenation Support + +Overview of changes in Ethereal DOCSIS Plugin 0.0.5 +* Added Support in packet-tlv.c for SNMPv3 Kickstart TLV's +* Added Support in packet-tlv.c for Subscriber Management TLV's diff --git a/plugins/docsis/INSTALL b/plugins/docsis/INSTALL new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/plugins/docsis/INSTALL diff --git a/plugins/docsis/Makefile.am b/plugins/docsis/Makefile.am new file mode 100644 index 0000000000..aa3ffdf934 --- /dev/null +++ b/plugins/docsis/Makefile.am @@ -0,0 +1,116 @@ +# Makefile.am +# Automake file for Ethereal/docsis +# +# Ethereal - Network traffic analyzer +# By Steve Limkemann <stevelim@dgtech.com> +# Copyright 1998 Steve Limkemann +# +# +# 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. +# + +INCLUDES = -I$(top_srcdir) -I$(includedir) + +plugindir = @PLUGIN_DIR@ + +plugin_LTLIBRARIES = docsis.la +docsis_la_SOURCES = 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-docsis.h packet-tlv.h moduleinfo.h +docsis_la_LDFLAGS = -module -avoid-version + +# Libs must be cleared, or else libtool won't create a shared module. +# If your module needs to be linked against any particular libraries, +# add them here. +LIBS = + +docsis_la_DEPENDENCIES = packet-docsis-static.o packet-bpkmattr-static.o packet-dsarsp-static.o packet-macmgmt-static.o packet-rngrsp-static.o packet-bpkmreq-static.o packet-dscack-static.o packet-map-static.o packet-tlv-static.o packet-bpkmrsp-static.o packet-dscreq-static.o packet-regack-static.o packet-uccreq-static.o packet-dscrsp-static.o packet-regreq-static.o packet-uccrsp-static.o packet-dsaack-static.o packet-dsdreq-static.o packet-regrsp-static.o packet-ucd-static.o packet-dsareq-static.o packet-dsdrsp-static.o packet-rngreq-static.o + +packet-docsis-static.o: packet-docsis.c moduleinfo.h + $(LTCOMPILE) -c -o packet-docsis-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-docsis.c + + +packet-bpkmattr-static.o: packet-bpkmattr.c moduleinfo.h + $(LTCOMPILE) -c -o packet-bpkmattr-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-bpkmattr.c + +packet-dsarsp-static.o: packet-dsarsp.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dsarsp-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dsarsp.c + +packet-macmgmt-static.o: packet-macmgmt.c moduleinfo.h + $(LTCOMPILE) -c -o packet-macmgmt-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-macmgmt.c + +packet-rngrsp-static.o: packet-rngrsp.c moduleinfo.h + $(LTCOMPILE) -c -o packet-rngrsp-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-rngrsp.c + +packet-bpkmreq-static.o: packet-bpkmreq.c moduleinfo.h + $(LTCOMPILE) -c -o packet-bpkmreq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-bpkmreq.c + +packet-dscack-static.o: packet-dscack.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dscack-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dscack.c + +packet-map-static.o: packet-map.c moduleinfo.h + $(LTCOMPILE) -c -o packet-map-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-map.c + +packet-tlv-static.o: packet-tlv.c packet-tlv.h moduleinfo.h + $(LTCOMPILE) -c -o packet-tlv-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-tlv.c + +packet-bpkmrsp-static.o: packet-bpkmrsp.c moduleinfo.h + $(LTCOMPILE) -c -o packet-bpkmrsp-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-bpkmrsp.c + +packet-dscreq-static.o: packet-dscreq.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dscreq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dscreq.c + +packet-regack-static.o: packet-regack.c moduleinfo.h + $(LTCOMPILE) -c -o packet-regack-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-regack.c + +packet-uccreq-static.o: packet-uccreq.c moduleinfo.h + $(LTCOMPILE) -c -o packet-uccreq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-uccreq.c + +packet-dscrsp-static.o: packet-dscrsp.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dscrsp-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dscrsp.c + +packet-regreq-static.o: packet-regreq.c moduleinfo.h + $(LTCOMPILE) -c -o packet-regreq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-regreq.c + +packet-uccrsp-static.o: packet-uccrsp.c moduleinfo.h + $(LTCOMPILE) -c -o packet-uccrsp-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-uccrsp.c + +packet-dsaack-static.o: packet-dsaack.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dsaack-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dsaack.c + +packet-dsdreq-static.o: packet-dsdreq.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dsdreq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dsdreq.c + +packet-regrsp-static.o: packet-regrsp.c moduleinfo.h + $(LTCOMPILE) -c -o packet-regrsp-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-regrsp.c + +packet-ucd-static.o: packet-ucd.c moduleinfo.h + $(LTCOMPILE) -c -o packet-ucd-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-ucd.c + +packet-dsareq-static.o: packet-dsareq.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dsareq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dsareq.c + +packet-dsdrsp-static.o: packet-dsdrsp.c moduleinfo.h + $(LTCOMPILE) -c -o packet-dsdrsp-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-dsdrsp.c + +packet-rngreq-static.o: packet-rngreq.c moduleinfo.h + $(LTCOMPILE) -c -o packet-rngreq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-rngreq.c + + +CLEANFILES = \ + docsis \ + *~ + +EXTRA_DIST = \ + Makefile.nmake \ + README diff --git a/plugins/docsis/Makefile.nmake b/plugins/docsis/Makefile.nmake new file mode 100644 index 0000000000..5ddb0ed272 --- /dev/null +++ b/plugins/docsis/Makefile.nmake @@ -0,0 +1,43 @@ +#
+# $Id: Makefile.nmake,v 1.1 2002/07/12 22:52:41 guy Exp $
+#
+
+include ..\..\config.nmake
+
+############### no need to modify below this line #########
+
+CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap \
+ /I$(GLIB_DIR) /I$(GTK_DIR) /I$(GLIB_DIR)/gmodule \
+ /I$(GTK_DIR)\gdk /I$(GTK_DIR)\gdk\win32 \
+ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
+
+OBJECTS=packet-docsis.obj packet-bpkmattr.obj \
+ packet-dsarsp.obj packet-macmgmt.obj \
+ packet-rngrsp.obj packet-bpkmreq.obj \
+ packet-dscack.obj packet-map.obj \
+ packet-tlv.obj packet-bpkmrsp.obj \
+ packet-dscreq.obj packet-regack.obj \
+ packet-uccreq.obj packet-dscrsp.obj \
+ packet-regreq.obj packet-uccrsp.obj \
+ packet-dsaack.obj packet-dsdreq.obj \
+ packet-regrsp.obj packet-ucd.obj \
+ packet-dsareq.obj packet-dsdrsp.obj \
+ packet-rngreq.obj
+
+docsis.dll docsis.exp docsis.lib : packet-docsis.obj packet-bpkmattr.obj packet-dsarsp.obj packet-macmgmt.obj packet-rngrsp.obj packet-bpkmreq.obj packet-dscack.obj packet-map.obj packet-tlv.obj packet-bpkmrsp.obj packet-dscreq.obj packet-regack.obj packet-uccreq.obj packet-dscrsp.obj packet-regreq.obj packet-uccrsp.obj packet-dsaack.obj packet-dsdreq.obj packet-regrsp.obj packet-ucd.obj packet-dsareq.obj packet-dsdrsp.obj packet-rngreq.obj ..\plugin_api.obj
+ link -dll /out:docsis.dll packet-docsis.obj \
+ packet-bpkmattr.obj packet-dsarsp.obj \
+ packet-macmgmt.obj packet-rngrsp.obj \
+ packet-bpkmreq.obj packet-dscack.obj \
+ packet-map.obj packet-tlv.obj \
+ packet-bpkmrsp.obj packet-dscreq.obj \
+ packet-regack.obj packet-uccreq.obj \
+ packet-dscrsp.obj packet-regreq.obj \
+ packet-uccrsp.obj packet-dsaack.obj \
+ packet-dsdreq.obj packet-regrsp.obj \
+ packet-ucd.obj packet-dsareq.obj \
+ packet-dsdrsp.obj packet-rngreq.obj ..\plugin_api.obj \
+ $(GLIB_DIR)\glib-$(GLIB_VERSION).lib
+
+clean:
+ rm -f $(OBJECTS) docsis.dll docsis.exp docsis.lib $(PDB_FILE)
diff --git a/plugins/docsis/NEWS b/plugins/docsis/NEWS new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/plugins/docsis/NEWS diff --git a/plugins/docsis/README b/plugins/docsis/README new file mode 100644 index 0000000000..7247fc1519 --- /dev/null +++ b/plugins/docsis/README @@ -0,0 +1,46 @@ + +Overview: +========= +The dissectors provided by this plugin allow the dissection of DOCSIS 1.1 +Frames. Captures of DOCSIS 1.1 frames can be facilitated using Cisco's +Cable Monitor Features found on Cicso UBR7200 and UBR10000 Series Cable Modem +Termination Systems. + + +Features: +========= ++ Decode the DOCSIS header + Extended Header. For Data PDU's it will + automatically decode as far up the stack that it can. ++ Decode Mac Management Header. The following Mac Messages + are decoded at present: + REG-REQ + REG-RSP + REG-ACK + RNG-REQ + RNG-RSP + UCC-REQ + UCC-RSP + UCD Messages + MAP Messages + DSA-REQ + DSA-RSP + DSA-ACK + DSC-REQ + DSC-RSP + DSC-ACK + DSD-REQ + DSD-RSP + BPKM-REQ + BPKM-RSP + BPKM Attributes ++ Decode All Appendix C TLV's ++ Decode Concatenated Frames via a recursive call to dissect_docsis() + +References: +=========== +DOCSIS 1.1 Specifications can be found at: +http://www.cablemodem.com/specifications.html + +Information on Cisco's Cable Monitor Feature can be found at: +http://www.cisco.com/univercd/cc/td/doc/product/cable/cab_rout/cmtsfg/ufg_cmon.htm + diff --git a/plugins/docsis/moduleinfo.h b/plugins/docsis/moduleinfo.h new file mode 100644 index 0000000000..96f5ceff0f --- /dev/null +++ b/plugins/docsis/moduleinfo.h @@ -0,0 +1,17 @@ +/* Included *after* config.h, in order to re-define these macros */ + +#ifdef PACKAGE +#undef PACKAGE +#endif + +/* Name of package */ +#define PACKAGE "docsis" + + +#ifdef VERSION +#undef VERSION +#endif + +/* Version number of package */ +#define VERSION "0.0.5" + diff --git a/plugins/docsis/packet-bpkmattr.c b/plugins/docsis/packet-bpkmattr.c new file mode 100644 index 0000000000..ae28f57eac --- /dev/null +++ b/plugins/docsis/packet-bpkmattr.c @@ -0,0 +1,610 @@ +/* packet-bpkmattr.c + * Routines for Baseline Privacy Key Management Attributes dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* BPKM Attributes defined in: + * http://www.cablemodem.com/Specs/SP-BPI+-I08-020301.pdf + */ +#define BPKM_RESERVED 0 +#define BPKM_SERIAL_NUM 1 +#define BPKM_MANUFACTURER_ID 2 +#define BPKM_MAC_ADDR 3 +#define BPKM_RSA_PUB_KEY 4 +#define BPKM_CM_ID 5 +#define BPKM_DISPLAY_STR 6 +#define BPKM_AUTH_KEY 7 +#define BPKM_TEK 8 +#define BPKM_KEY_LIFETIME 9 +#define BPKM_KEY_SEQ_NUM 10 +#define BPKM_HMAC_DIGEST 11 +#define BPKM_SAID 12 +#define BPKM_TEK_PARAM 13 +#define BPKM_OBSOLETED 14 +#define BPKM_CBC_IV 15 +#define BPKM_ERROR_CODE 16 +#define BPKM_CA_CERT 17 +#define BPKM_CM_CERT 18 +#define BPKM_SEC_CAPABILITIES 19 +#define BPKM_CRYPTO_SUITE 20 +#define BPKM_CRYPTO_SUITE_LIST 21 +#define BPKM_BPI_VERSION 22 +#define BPKM_SA_DESCRIPTOR 23 +#define BPKM_SA_TYPE 24 +#define BPKM_SA_QUERY 25 +#define BPKM_SA_QUERY_TYPE 26 +#define BPKM_IP_ADDRESS 27 +#define BPKM_DNLD_PARAMS 28 +#define BPKM_VENDOR_DEFINED 127 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_bpkmattr = -1; +static int hf_docsis_bpkmattr = -1; +static int hf_docsis_bpkmattr_serial_num = -1; +static int hf_docsis_bpkmattr_manf_id = -1; +static int hf_docsis_bpkmattr_mac_addr = -1; +static int hf_docsis_bpkmattr_rsa_pub_key = -1; +static int hf_docsis_bpkmattr_cm_id = -1; +static int hf_docsis_bpkmattr_display_str = -1; +static int hf_docsis_bpkmattr_auth_key = -1; +static int hf_docsis_bpkmattr_tek = -1; +static int hf_docsis_bpkmattr_key_life = -1; +static int hf_docsis_bpkmattr_key_seq = -1; +static int hf_docsis_bpkmattr_hmac_digest = -1; +static int hf_docsis_bpkmattr_said = -1; +static int hf_docsis_bpkmattr_tek_params = -1; +static int hf_docsis_bpkmattr_cbc_iv = -1; +static int hf_docsis_bpkmattr_error_code = -1; +static int hf_docsis_bpkmattr_vendor_def = -1; +static int hf_docsis_bpkmattr_ca_cert = -1; +static int hf_docsis_bpkmattr_cm_cert = -1; +static int hf_docsis_bpkmattr_security_cap = -1; +static int hf_docsis_bpkmattr_crypto_suite = -1; +static int hf_docsis_bpkmattr_crypto_suite_list = -1; +static int hf_docsis_bpkmattr_bpi_version = -1; +static int hf_docsis_bpkmattr_sa_descr = -1; +static int hf_docsis_bpkmattr_sa_type = -1; +static int hf_docsis_bpkmattr_sa_query = -1; +static int hf_docsis_bpkmattr_sa_query_type = -1; +static int hf_docsis_bpkmattr_ip_address = -1; +static int hf_docsis_bpkmattr_download_param = -1; + + + +/* Initialize the subtree pointers */ +static gint ett_docsis_bpkmattr = -1; +static gint ett_docsis_bpkmattr_cmid = -1; +static gint ett_docsis_bpkmattr_scap = -1; +static gint ett_docsis_bpkmattr_tekp = -1; +static gint ett_docsis_bpkmattr_sadsc = -1; +static gint ett_docsis_bpkmattr_saqry = -1; +static gint ett_docsis_bpkmattr_dnld = -1; + + +static const value_string error_code_vals[] = { + {0, "no information"}, + {1, "Unauthorized CM"}, + {2, "Unauthorized SAID"}, + {3, "Unsolicited"}, + {4, "Invalid Key Sequence Number"}, + {5, "Key Request authentication failure"}, + {6, "Permanent Authorization Failure"}, + {7, "Not authorized for requested downstream traffic flow"}, + {8, "Downstream traffic flow not mapped to BPI+ SAID"}, + {9, "Time of day not acquired"}, + {0, NULL}, +}; + +static const value_string data_encr_algo_vals[] = { + {0, "Reserved"}, + {1, "CBC Mode, 56 Bit DES"}, + {2, "CBC Mode, 40 Bit DES"}, + {0, NULL}, +}; + +static const value_string data_auth_algo_vals[] = { + {0, "No Data Authentication"}, + {0, NULL}, +}; + +static const value_string crypto_suite_attr_vals[] = { + {0x0100, "CBC Mode, 56 Bit DES & no Data Authentication"}, + {0x0200, "CBC Mode, 40 Bit DES & no Data Authentication"}, + {0, NULL}, +}; + +static const value_string bpi_ver_vals[] = { + {0, "Reserved"}, + {1, "BPI+"}, + {0, NULL}, +}; + +/* Code to actually dissect the packets */ + +/* The dissect_attrs() function does the actual work to dissect the + * attributes. It's called recursively, to dissect embedded attributes + */ +static void +dissect_attrs (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint8 type; + guint16 length; + guint16 pos = 0; + guint16 total_len; + proto_item *cmid_it, *tekp_it, *scap_it; + proto_item *saqry_it, *dnld_it, *sadsc_it; + proto_tree *cmid_tree, *tekp_tree, *scap_tree; + proto_tree *saqry_tree, *dnld_tree, *sadsc_tree; + tvbuff_t *cmid_tvb, *tekp_tvb, *scap_tvb; + tvbuff_t *saqry_tvb, *dnld_tvb, *sadsc_tvb; + + total_len = tvb_length_remaining (tvb, 0); + while (pos < total_len) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_ntohs (tvb, pos); + pos += 2; + switch (type) + { + case BPKM_RESERVED: + break; + case BPKM_SERIAL_NUM: + proto_tree_add_item (tree, hf_docsis_bpkmattr_serial_num, tvb, pos, + length, FALSE); + break; + case BPKM_MANUFACTURER_ID: + if (length == 3) + proto_tree_add_item (tree, hf_docsis_bpkmattr_manf_id, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_MAC_ADDR: + if (length == 6) + proto_tree_add_item (tree, hf_docsis_bpkmattr_mac_addr, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_RSA_PUB_KEY: + proto_tree_add_item (tree, hf_docsis_bpkmattr_rsa_pub_key, tvb, pos, + length, FALSE); + break; + case BPKM_CM_ID: + cmid_it = + proto_tree_add_text (tree, tvb, pos, length, + "5 CM Identification"); + cmid_tree = + proto_item_add_subtree (cmid_it, ett_docsis_bpkmattr_cmid); + cmid_tvb = tvb_new_subset (tvb, pos, length, length); + dissect_attrs (cmid_tvb, pinfo, cmid_tree); + break; + case BPKM_DISPLAY_STR: + proto_tree_add_item (tree, hf_docsis_bpkmattr_display_str, tvb, pos, + length, FALSE); + break; + case BPKM_AUTH_KEY: + if ((length == 96) || (length == 128)) + proto_tree_add_item (tree, hf_docsis_bpkmattr_auth_key, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_TEK: + if (length == 8) + proto_tree_add_item (tree, hf_docsis_bpkmattr_tek, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_KEY_LIFETIME: + if (length == 4) + proto_tree_add_item (tree, hf_docsis_bpkmattr_key_life, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_KEY_SEQ_NUM: + if (length == 1) + proto_tree_add_item (tree, hf_docsis_bpkmattr_key_seq, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_HMAC_DIGEST: + if (length == 20) + proto_tree_add_item (tree, hf_docsis_bpkmattr_hmac_digest, tvb, + pos, length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_SAID: + if (length == 2) + proto_tree_add_item (tree, hf_docsis_bpkmattr_said, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_TEK_PARAM: + tekp_it = + proto_tree_add_text (tree, tvb, pos, length, "13 TEK Parameters"); + tekp_tree = + proto_item_add_subtree (tekp_it, ett_docsis_bpkmattr_tekp); + tekp_tvb = tvb_new_subset (tvb, pos, length, length); + dissect_attrs (tekp_tvb, pinfo, tekp_tree); + break; + case BPKM_OBSOLETED: + break; + case BPKM_CBC_IV: + if (length == 8) + proto_tree_add_item (tree, hf_docsis_bpkmattr_cbc_iv, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_ERROR_CODE: + if (length == 1) + proto_tree_add_item (tree, hf_docsis_bpkmattr_error_code, tvb, + pos, length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_CA_CERT: + proto_tree_add_item (tree, hf_docsis_bpkmattr_ca_cert, tvb, pos, + length, FALSE); + break; + case BPKM_CM_CERT: + proto_tree_add_item (tree, hf_docsis_bpkmattr_cm_cert, tvb, pos, + length, FALSE); + break; + case BPKM_SEC_CAPABILITIES: + scap_it = + proto_tree_add_text (tree, tvb, pos, length, + "19 Security Capabilities"); + scap_tree = + proto_item_add_subtree (scap_it, ett_docsis_bpkmattr_scap); + scap_tvb = tvb_new_subset (tvb, pos, length, length); + dissect_attrs (scap_tvb, pinfo, scap_tree); + break; + case BPKM_CRYPTO_SUITE: + if (length == 2) + proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite, tvb, + pos, length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_CRYPTO_SUITE_LIST: + proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite_list, + tvb, pos, length, FALSE); + break; + case BPKM_BPI_VERSION: + if (length == 1) + proto_tree_add_item (tree, hf_docsis_bpkmattr_bpi_version, tvb, + pos, length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_SA_DESCRIPTOR: + sadsc_it = + proto_tree_add_text (tree, tvb, pos, length, "23 SA Descriptor"); + sadsc_tree = + proto_item_add_subtree (sadsc_it, ett_docsis_bpkmattr_sadsc); + sadsc_tvb = tvb_new_subset (tvb, pos, length, length); + dissect_attrs (sadsc_tvb, pinfo, sadsc_tree); + break; + case BPKM_SA_TYPE: + if (length == 1) + proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_type, tvb, pos, + length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_SA_QUERY: + saqry_it = + proto_tree_add_text (tree, tvb, pos, length, "25 SA Query"); + saqry_tree = + proto_item_add_subtree (saqry_it, ett_docsis_bpkmattr_saqry); + saqry_tvb = tvb_new_subset (tvb, pos, length, length); + dissect_attrs (saqry_tvb, pinfo, saqry_tree); + break; + case BPKM_SA_QUERY_TYPE: + if (length == 1) + proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_query_type, tvb, + pos, length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_IP_ADDRESS: + if (length == 4) + proto_tree_add_item (tree, hf_docsis_bpkmattr_ip_address, tvb, + pos, length, FALSE); + else + THROW (ReportedBoundsError); + break; + case BPKM_VENDOR_DEFINED: + proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos, + length, FALSE); + case BPKM_DNLD_PARAMS: + dnld_it = + proto_tree_add_text (tree, tvb, pos, length, + "28 Download Parameters"); + dnld_tree = + proto_item_add_subtree (dnld_it, ett_docsis_bpkmattr_dnld); + dnld_tvb = tvb_new_subset (tvb, pos, length, length); + dissect_attrs (dnld_tvb, pinfo, dnld_tree); + break; + default: + proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos, + length, FALSE); + break; + } + pos += length; /* switch */ + } /* while */ +} + +static void +dissect_bpkmattr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *bpkmattr_tree; + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_bpkmattr, tvb, 0, + tvb_length_remaining (tvb, 0), + "BPKM Attributes"); + bpkmattr_tree = proto_item_add_subtree (it, ett_docsis_bpkmattr); + dissect_attrs (tvb, pinfo, bpkmattr_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_bpkmattr (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_bpkmattr, + {"BPKM Attributes", "docsis.bpkmattr", + FT_BYTES, BASE_HEX, NULL, 0x0, + "BPKM Attributes", HFILL} + }, + {&hf_docsis_bpkmattr_serial_num, + {"1 Serial Number", "docsis.bpkmattr.serialnum", + FT_STRING, BASE_DEC, NULL, 0x0, + "Serial Number", HFILL} + }, + {&hf_docsis_bpkmattr_manf_id, + {"2 Manufacturer Id", "docsis.bpkmattr.manfid", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Manufacturer Id", HFILL} + }, + {&hf_docsis_bpkmattr_mac_addr, + {"3 Mac Address", "docsis.bpkmattr.macaddr", + FT_ETHER, BASE_HEX, NULL, 0x0, + "Mac Address", HFILL} + }, + {&hf_docsis_bpkmattr_rsa_pub_key, + {"4 RSA Public Key", "docsis.bpkmattr.rsa_pub_key", + FT_BYTES, BASE_HEX, NULL, 0x0, + "RSA Public Key", HFILL} + }, + {&hf_docsis_bpkmattr_cm_id, + {"5 CM Identification", "docsis.bpkmattr.cmid", + FT_BYTES, BASE_HEX, NULL, 0x0, + "CM Identification", HFILL} + }, + {&hf_docsis_bpkmattr_display_str, + {"6 Display String", "docsis.bpkmattr.dispstr", + FT_STRING, BASE_DEC, NULL, 0x0, + "Display String", HFILL} + }, + {&hf_docsis_bpkmattr_auth_key, + {"7 Auth Key", "docsis.bpkmattr.auth_key", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Auth Key", HFILL} + }, + {&hf_docsis_bpkmattr_tek, + {"8 Traffic Encryption Key", "docsis.bpkmattr.tek", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Traffic Encryption Key", HFILL} + }, + {&hf_docsis_bpkmattr_key_life, + {"9 Key Lifetime (s)", "docsis.bpkmattr.keylife", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Key Lifetime (s)", HFILL} + }, + {&hf_docsis_bpkmattr_key_seq, + {"10 Key Sequence Number", "docsis.bpkmattr.keyseq", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Key Sequence Number", HFILL} + }, + {&hf_docsis_bpkmattr_hmac_digest, + {"11 HMAC Digest", "docsis.bpkmattr.hmacdigest", + FT_BYTES, BASE_HEX, NULL, 0x0, + "HMAC Digest", HFILL} + }, + {&hf_docsis_bpkmattr_said, + {"12 SAID", "docsis.bpkmattr.said", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Security Association ID", HFILL} + }, + {&hf_docsis_bpkmattr_tek_params, + {"13 TEK Parameters", "docsis.bpkmattr.tekparams", + FT_BYTES, BASE_HEX, NULL, 0x0, + "TEK Parameters", HFILL} + }, + {&hf_docsis_bpkmattr_cbc_iv, + {"14 CBC IV", "docsis.bpkmattr.cbciv", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Cypher Block Chaining", HFILL} + }, + {&hf_docsis_bpkmattr_error_code, + {"16 Error Code", "docsis.bpkmattr.errcode", + FT_UINT8, BASE_DEC, VALS (error_code_vals), 0x0, + "Error Code", HFILL} + }, + {&hf_docsis_bpkmattr_vendor_def, + {"127 Vendor Defined", "docsis.bpkmattr.vendordef", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Vendor Defined", HFILL} + }, + {&hf_docsis_bpkmattr_ca_cert, + {"17 CA Certificate", "docsis.bpkmattr.cacert", + FT_BYTES, BASE_HEX, NULL, 0x0, + "CA Certificate", HFILL} + }, + {&hf_docsis_bpkmattr_cm_cert, + {"18 CM Certificate", "docsis.bpkmattr.cmcert", + FT_BYTES, BASE_HEX, NULL, 0x0, + "CM Certificate", HFILL} + }, + {&hf_docsis_bpkmattr_security_cap, + {"19 Security Capabilities", "docsis.bpkmattr.seccap", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Security Capabilities", HFILL} + }, + {&hf_docsis_bpkmattr_crypto_suite, + {"20 Cryptographic Suite", "docsis.bpkmattr.cryptosuite", + FT_UINT16, BASE_HEX, NULL, 0x0, + "Cryptographic Suite", HFILL} + }, + {&hf_docsis_bpkmattr_crypto_suite_list, + {"21 Cryptographic Suite List", "docsis.bpkmattr.crypto_suite_lst", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Cryptographic Suite", HFILL} + }, + {&hf_docsis_bpkmattr_bpi_version, + {"22 BPI Version", "docsis.bpkmattr.bpiver", + FT_UINT8, BASE_DEC, VALS (bpi_ver_vals), 0x0, + "BPKM Attributes", HFILL} + }, + {&hf_docsis_bpkmattr_sa_descr, + {"23 SA Descriptor", "docsis.bpkmattr.sadescr", + FT_BYTES, BASE_HEX, NULL, 0x0, + "SA Descriptor", HFILL} + }, + {&hf_docsis_bpkmattr_sa_type, + {"24 SA Type", "docsis.bpkmattr.satype", + FT_UINT8, BASE_DEC, NULL, 0x0, + "SA Type", HFILL} + }, + {&hf_docsis_bpkmattr_sa_query, + {"25 SA Query", "docsis.bpkmattr.saquery", + FT_BYTES, BASE_HEX, NULL, 0x0, + "SA Query", HFILL} + }, + {&hf_docsis_bpkmattr_sa_query_type, + {"26 SA Query Type", "docsis.bpkmattr.saquery_type", + FT_UINT8, BASE_HEX, NULL, 0x0, + "SA Query Type", HFILL} + }, + {&hf_docsis_bpkmattr_ip_address, + {"27 IP Address", "docsis.bpkmattr.ipaddr", + FT_IPv4, BASE_DEC, NULL, 0x0, + "IP Address", HFILL} + }, + {&hf_docsis_bpkmattr_download_param, + {"28 Download Parameters", "docsis.bpkmattr.dnld_params", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Download Parameters", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_bpkmattr, + &ett_docsis_bpkmattr_cmid, + &ett_docsis_bpkmattr_scap, + &ett_docsis_bpkmattr_tekp, + &ett_docsis_bpkmattr_sadsc, + &ett_docsis_bpkmattr_saqry, + &ett_docsis_bpkmattr_dnld + }; + +/* Register the protocol name and description */ + proto_docsis_bpkmattr = + proto_register_protocol + ("DOCSIS Baseline Privacy Key Management Attributes", "DOCSIS BPKM-ATTR", + "docsis_bpkmattr"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_bpkmattr, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_bpkmattr", dissect_bpkmattr, + proto_docsis_bpkmattr); +} + + +/* 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_bpkmattr (void) +{ + dissector_handle_t docsis_bpkmattr_handle; + + docsis_bpkmattr_handle = find_dissector ("docsis_bpkmattr"); + dissector_add ("docsis", 0xFE, docsis_bpkmattr_handle); + +} diff --git a/plugins/docsis/packet-bpkmreq.c b/plugins/docsis/packet-bpkmreq.c new file mode 100644 index 0000000000..b7db149705 --- /dev/null +++ b/plugins/docsis/packet-bpkmreq.c @@ -0,0 +1,199 @@ +/* packet-bpkmreq.c + * Routines for Baseline Privacy Key Management Request dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_bpkmreq = -1; +static int hf_docsis_bpkmreq = -1; +static int hf_docsis_bpkmreq_code = -1; +static int hf_docsis_bpkmreq_length = -1; +static int hf_docsis_bpkmreq_ident = -1; + +static const value_string code_field_vals[] = { + {0, "Reserved"}, + {1, "Reserved"}, + {2, "Reserved"}, + {3, "Reserved"}, + {4, "Auth Request"}, + {5, "Auth Reply"}, + {6, "Auth Reject"}, + {7, "Key Request"}, + {8, "Key Reply"}, + {9, "Key Reject"}, + {10, "Auth Invalid"}, + {11, "TEK Invalid"}, + {12, "Authent Info"}, + {13, "Map Request"}, + {14, "Map Reply"}, + {15, "Map Reject"}, + {0, NULL}, +}; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_bpkmreq = -1; + +static dissector_handle_t attrs_handle; + +/* Code to actually dissect the packets */ +static void +dissect_bpkmreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *bpkmreq_tree; + guint8 code; + guint16 attrs_len; + tvbuff_t *attrs_tvb; + + code = tvb_get_guint8 (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Request (%s)", + val_to_str (code, code_field_vals, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_bpkmreq, tvb, 0, + tvb_length_remaining (tvb, 0), + "BPKM Request Message"); + bpkmreq_tree = proto_item_add_subtree (it, ett_docsis_bpkmreq); + proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_code, tvb, 0, 1, + FALSE); + proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_ident, tvb, 1, 1, + FALSE); + proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_length, tvb, 2, 2, + FALSE); + } + + /* Code to Call subdissector */ + attrs_len = tvb_length_remaining (tvb, 4); + attrs_tvb = tvb_new_subset (tvb, 4, attrs_len, attrs_len); + call_dissector (attrs_handle, attrs_tvb, pinfo, 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_bpkmreq (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_bpkmreq, + {"BPKM Request Message", "docsis.bpkmreq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "BPKM Request Message", HFILL} + }, + {&hf_docsis_bpkmreq_code, + {"BPKM Code", "docsis.bpkmreq.code", + FT_UINT8, BASE_DEC, VALS (code_field_vals), 0x0, + "BPKM Request Message", HFILL} + }, + {&hf_docsis_bpkmreq_ident, + {"BPKM Identifier", "docsis.bpkmreq.ident", + FT_UINT8, BASE_DEC, NULL, 0x0, + "BPKM Identifier", HFILL} + }, + {&hf_docsis_bpkmreq_length, + {"BPKM Length", "docsis.bpkmreq.length", + FT_UINT16, BASE_DEC, NULL, 0x0, + "BPKM Length", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_bpkmreq, + }; + +/* Register the protocol name and description */ + proto_docsis_bpkmreq = + proto_register_protocol ("DOCSIS Baseline Privacy Key Management Request", + "DOCSIS BPKM-REQ", "docsis_bpkmreq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_bpkmreq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_bpkmreq", dissect_bpkmreq, + proto_docsis_bpkmreq); +} + + +/* 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_bpkmreq (void) +{ + dissector_handle_t docsis_bpkmreq_handle; + + docsis_bpkmreq_handle = find_dissector ("docsis_bpkmreq"); + attrs_handle = find_dissector ("docsis_bpkmattr"); + dissector_add ("docsis_mgmt", 0x0C, docsis_bpkmreq_handle); + +} diff --git a/plugins/docsis/packet-bpkmrsp.c b/plugins/docsis/packet-bpkmrsp.c new file mode 100644 index 0000000000..3c0c1bba48 --- /dev/null +++ b/plugins/docsis/packet-bpkmrsp.c @@ -0,0 +1,201 @@ +/* packet-bpkmrsp.c + * Routines for Baseline Privacy Key Management Response dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_bpkmrsp = -1; +static int hf_docsis_bpkmrsp = -1; +static int hf_docsis_bpkmrsp_code = -1; +static int hf_docsis_bpkmrsp_length = -1; +static int hf_docsis_bpkmrsp_ident = -1; + +static const value_string code_field_vals[] = { + {0, "Reserved"}, + {1, "Reserved"}, + {2, "Reserved"}, + {3, "Reserved"}, + {4, "Auth Response"}, + {5, "Auth Reply"}, + {6, "Auth Reject"}, + {7, "Key Response"}, + {8, "Key Reply"}, + {9, "Key Reject"}, + {10, "Auth Invalid"}, + {11, "TEK Invalid"}, + {12, "Authent Info"}, + {13, "Map Response"}, + {14, "Map Reply"}, + {15, "Map Reject"}, + {0, NULL}, +}; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_bpkmrsp = -1; + +static dissector_handle_t attrs_handle; + +/* Code to actually dissect the packets */ +static void +dissect_bpkmrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *bpkmrsp_tree; + guint8 code; + guint16 attrs_len; + tvbuff_t *attrs_tvb; + + + code = tvb_get_guint8 (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Response (%s)", + val_to_str (code, code_field_vals, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_bpkmrsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "BPKM Response Message"); + bpkmrsp_tree = proto_item_add_subtree (it, ett_docsis_bpkmrsp); + proto_tree_add_item (bpkmrsp_tree, hf_docsis_bpkmrsp_code, tvb, 0, 1, + FALSE); + proto_tree_add_item (bpkmrsp_tree, hf_docsis_bpkmrsp_ident, tvb, 1, 1, + FALSE); + proto_tree_add_item (bpkmrsp_tree, hf_docsis_bpkmrsp_length, tvb, 2, 2, + FALSE); + } + + /* Code to Call subdissector */ + attrs_len = tvb_length_remaining (tvb, 4); + attrs_tvb = tvb_new_subset (tvb, 4, attrs_len, attrs_len); + call_dissector (attrs_handle, attrs_tvb, pinfo, 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_bpkmrsp (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_bpkmrsp, + {"BPKM Response Message", "docsis.bpkmrsp", + FT_BYTES, BASE_HEX, NULL, 0x0, + "BPKM Response Message", HFILL} + }, + {&hf_docsis_bpkmrsp_code, + {"BPKM Code", "docsis.bpkmrsp.code", + FT_UINT8, BASE_DEC, VALS (code_field_vals), 0x0, + "BPKM Response Message", HFILL} + }, + {&hf_docsis_bpkmrsp_ident, + {"BPKM Identifier", "docsis.bpkmrsp.ident", + FT_UINT8, BASE_DEC, NULL, 0x0, + "BPKM Identifier", HFILL} + }, + {&hf_docsis_bpkmrsp_length, + {"BPKM Length", "docsis.bpkmrsp.length", + FT_UINT16, BASE_DEC, NULL, 0x0, + "BPKM Length", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_bpkmrsp, + }; + +/* Register the protocol name and description */ + proto_docsis_bpkmrsp = + proto_register_protocol + ("DOCSIS Baseline Privacy Key Management Response", "DOCSIS BPKM-RSP", + "docsis_bpkmrsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_bpkmrsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_bpkmrsp", dissect_bpkmrsp, + proto_docsis_bpkmrsp); +} + + +/* 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_bpkmrsp (void) +{ + dissector_handle_t docsis_bpkmrsp_handle; + + docsis_bpkmrsp_handle = find_dissector ("docsis_bpkmrsp"); + attrs_handle = find_dissector ("docsis_bpkmattr"); + dissector_add ("docsis_mgmt", 0x0D, docsis_bpkmrsp_handle); + +} diff --git a/plugins/docsis/packet-docsis.c b/plugins/docsis/packet-docsis.c new file mode 100644 index 0000000000..eccf96ddf1 --- /dev/null +++ b/plugins/docsis/packet-docsis.c @@ -0,0 +1,750 @@ +/* packet-docsis.c + * Routines for docsis dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * $Id: packet-docsis.c,v 1.1 2002/07/12 22:52:41 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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. + */ + + +/* This code is based on the DOCSIS 1.1 specification available at: + * http://www.cablemodem.com/specifications.html + * + * DOCSIS Captures can be facilitated using the Cable Monitor Feature + * available on Cisco Cable Modem Termination Systems : + * http://www.cisco.com/univercd/cc/td/doc/product/cable/cab_rout/cmtsfg/ufg_cmon.htm + * + * This dissector depends on the presence of a DOCSIS enapsulation type. + * There is no simple way to distinguish DOCSIS Frames from Ethernet frames, + * since the frames are copied from the RF interface on the CMTS to + * a Fast Ethernet interface; Thus a preference was needed to enable + * the DOCSIS encapsulation type. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + + +#ifndef __ETHEREAL_STATIC__ +G_MODULE_EXPORT const gchar version[] = VERSION; +#endif + + +#include "packet-docsis.h" + +#define FCTYPE_PACKET 0x00 +#define FCTYPE_ATMPDU 0x01 +#define FCTYPE_RESRVD 0x02 +#define FCTYPE_MACSPC 0x03 + +#define EH_NULL_CONFIG 0 +#define EH_REQUEST 1 +#define EH_ACK_REQ 2 +#define EH_BP_UP 3 +#define EH_BP_DOWN 4 +#define EH_SFLOW_HDR_DOWN 5 +#define EH_SFLOW_HDR_UP 6 +#define EH_RESERVED_7 7 +#define EH_RESERVED_8 8 +#define EH_RESERVED_9 9 +#define EH_RESERVED_10 10 +#define EH_RESERVED_11 11 +#define EH_RESERVED_12 12 +#define EH_RESERVED_13 13 +#define EH_RESERVED_14 14 +#define EH_EXTENDED 15 + +/* Initialize the protocol and registered fields */ +static int proto_docsis = -1; +static int hf_docsis_fctype = -1; +static int hf_docsis_machdr_fcparm = -1; +static int hf_docsis_fcparm = -1; +static int hf_docsis_ehdron = -1; +static int hf_docsis_concat_cnt = -1; +static int hf_docsis_macparm = -1; +static int hf_docsis_ehdrlen = -1; +static int hf_docsis_lensid = -1; +static int hf_docsis_eh_type = -1; +static int hf_docsis_eh_len = -1; +static int hf_docsis_eh_val = -1; +static int hf_docsis_sid = -1; +static int hf_docsis_mini_slots = -1; +static int hf_docsis_hcs = -1; +static int hf_docsis_bpi_en = -1; +static int hf_docsis_toggle_bit = -1; +static int hf_docsis_key_seq = -1; +static int hf_docsis_ehdr_ver = -1; +static int hf_docsis_said = -1; +static int hf_docsis_reserved = -1; + +static dissector_handle_t docsis_handle; +static dissector_handle_t eth_handle; +static dissector_handle_t data_handle; +static dissector_handle_t docsis_mgmt_handle; +static dissector_table_t docsis_dissector_table; + +/* Initialize the subtree pointers */ +static gint ett_docsis = -1; +static gint ett_ehdr = -1; + +static const value_string fctype_vals[] = { + {FCTYPE_PACKET, "Packet PDU"}, + {FCTYPE_ATMPDU, "ATM PDU"}, + {FCTYPE_RESRVD, "Reserved"}, + {FCTYPE_MACSPC, "MAC Specific"}, + {0, NULL} +}; + +static const value_string eh_type_vals[] = { + {0, "NULL Configuration Parameter"}, + {EH_REQUEST, "Request"}, + {EH_ACK_REQ, "Acknowledgement Requested"}, + {EH_BP_UP, "Upstream Privacy Element"}, + {EH_BP_DOWN, "Downstream Privacy Element"}, + {EH_SFLOW_HDR_UP, "Service Flow EH; PHS Header Upstream"}, + {EH_SFLOW_HDR_DOWN, "Service Flow EH; PHS Header Downstream"}, + {EH_RESERVED_7, "Reserved"}, + {EH_RESERVED_8, "Reserved"}, + {EH_RESERVED_9, "Reserved"}, + {EH_RESERVED_10, "Reserved"}, + {EH_RESERVED_10, "Reserved"}, + {EH_RESERVED_11, "Reserved"}, + {EH_RESERVED_12, "Reserved"}, + {EH_RESERVED_13, "Reserved"}, + {EH_RESERVED_14, "Reserved"}, + {EH_EXTENDED, "Extended"}, + {0, NULL} +}; + +static const value_string fcparm_vals[] = { + {0x0, "Timing Header"}, + {0x1, "Mac Management Message"}, + {0x2, "Request Frame"}, + {0x3, "Fragmentation Header"}, + {0x1C, "Concatenation Header"}, + {0, NULL} +}; +static const value_string ehdron_vals[] = { + {0x00, "Extended Header Absent"}, + {0x01, "Extended Header Present"}, + {0, NULL} +}; + +static const true_false_string ena_dis_tfs = { + "Enabled", + "Disabled" +}; + +static const value_string ena_dis_vals[] = { + {0, "Disabled"}, + {1, "Enabled"}, + {0, NULL} +}; + +static const value_string odd_even_vals[] = { + {1, "Odd Key"}, + {0, "Even Key"}, + {0, NULL} +}; +/* Code to actually dissect the packets */ +/* Code to Dissect the extended header */ +static void +dissect_ehdr (tvbuff_t * tvb, proto_tree * tree) +{ + proto_tree *ehdr_tree; + proto_item *it; + guint8 ehdrlen; + guint8 pos; + guint8 type; + guint8 len; + guint8 mini_slots; + guint16 sid; + + ehdrlen = tvb_get_guint8 (tvb, 1); + pos = 4; + + it = proto_tree_add_text (tree, tvb, pos, ehdrlen, "Extended Header"); + ehdr_tree = proto_item_add_subtree (it, ett_ehdr); + while (pos < (ehdrlen + 4)) + { + proto_tree_add_item (ehdr_tree, hf_docsis_eh_type, tvb, pos, 1, FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_eh_len, tvb, pos, 1, FALSE); + type = (tvb_get_guint8 (tvb, pos) & 0xF0); + len = (tvb_get_guint8 (tvb, pos) & 0x0F); + switch ((type >> 4) & 0x0F) + { + case EH_REQUEST: + if (len == 3) + { + mini_slots = tvb_get_guint8 (tvb, pos + 1); + sid = tvb_get_ntohs (tvb, pos + 2); + proto_tree_add_uint (ehdr_tree, hf_docsis_mini_slots, tvb, + pos + 1, 1, mini_slots); + proto_tree_add_uint (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2, + sid); + } + else + { + THROW (ReportedBoundsError); + } + break; + case EH_ACK_REQ: + if (len == 2) + { + sid = tvb_get_ntohs (tvb, pos + 1); + proto_tree_add_uint (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2, + sid); + } + else + { + THROW (ReportedBoundsError); + } + case EH_BP_UP: + proto_tree_add_item (ehdr_tree, hf_docsis_key_seq, tvb, pos + 1, 1, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_ver, tvb, pos + 1, 1, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_bpi_en, tvb, pos + 2, 1, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_toggle_bit, tvb, pos + 2, + 1, FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_mini_slots, tvb, pos + 4, + 1, FALSE); + break; + case EH_BP_DOWN: + proto_tree_add_item (ehdr_tree, hf_docsis_key_seq, tvb, pos + 1, 1, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_ver, tvb, pos + 1, 1, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_bpi_en, tvb, pos + 2, 1, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_toggle_bit, tvb, pos + 2, + 1, FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_said, tvb, pos + 2, 2, + FALSE); + proto_tree_add_item (ehdr_tree, hf_docsis_reserved, tvb, pos + 4, 1, + FALSE); + break; + default: + if (len > 0) + proto_tree_add_item (ehdr_tree, hf_docsis_eh_val, tvb, pos + 1, + len, FALSE); + } + pos += len + 1; + } + + return; +} + + +static void +dissect_docsis (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint8 fc; + guint8 fctype; + guint8 fcparm; + guint8 ehdron; + guint8 mac_parm; + guint8 hdrlen; + guint16 len_sid; + tvbuff_t *next_tvb, *mgt_tvb; + guint16 pdulen, captured_length, framelen; +/* Set up structures needed to add the protocol subtree and manage it */ + proto_item *ti; + proto_tree *docsis_tree; +/* concatlen and concatpos are declared static to allow for recursive calls to + * the dissect_docsis routine when dissecting Concatenated frames + */ + static guint16 concatlen; + static guint16 concatpos; + +/* Extract important fields */ + fc = tvb_get_guint8 (tvb, 0); /* Frame Control Byte */ + fctype = (fc >> 6) & 0x03; /* Frame Control Type: 2 MSB Bits */ + fcparm = (fc >> 1) & 0x1F; /* Frame Control Parameter: Next 5 Bits */ + ehdron = (fc & 0x01); /* Extended Header Bit: LSB */ + + mac_parm = tvb_get_guint8 (tvb, 1); /* Mac Parm */ + len_sid = tvb_get_ntohs (tvb, 2); /* Length Or SID */ + +/* set Header length based on presence of Extended header */ + if (ehdron == 0x00) + hdrlen = 6; + else + hdrlen = 6 + mac_parm; + +/* Captured PDU Length is based on the length of the header */ + captured_length = tvb_length_remaining (tvb, hdrlen); + +/* If this is a Request Frame, then pdulen is 0 and framelen is 6 */ + if ((fctype == FCTYPE_MACSPC) && fcparm == 0x02) + { + pdulen = 0; + framelen = 6; + } + else + { + framelen = 6 + len_sid; + pdulen = len_sid - ((guint16) (mac_parm & 0xFF)); + } + +/* if this is a concatenated frame setup the length of the concatenated + * frame and set the position to the first byte of the first frame */ + if ((fctype == FCTYPE_MACSPC) && (fcparm == 0x1c)) + { + concatlen = len_sid; + concatpos = 6; + } + +/* Make entries in Protocol column and Info column on summary display */ + if (check_col (pinfo->cinfo, COL_PROTOCOL)) + col_set_str (pinfo->cinfo, COL_PROTOCOL, "DOCSIS"); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + switch (fctype) + { + case FCTYPE_PACKET: + col_set_str (pinfo->cinfo, COL_INFO, "Packet PDU"); + break; + case FCTYPE_ATMPDU: + col_set_str (pinfo->cinfo, COL_INFO, "ATM PDU"); + break; + case FCTYPE_RESRVD: + col_set_str (pinfo->cinfo, COL_INFO, "Reserved PDU"); + break; + case FCTYPE_MACSPC: + if (fcparm == 0x02) + col_add_fstr (pinfo->cinfo, COL_INFO, + "Request Frame SID = %u Mini Slots = %u", mac_parm, + len_sid); + else if (fcparm == 0x03) + col_set_str (pinfo->cinfo, COL_INFO, "Mac Specific"); + else + col_set_str (pinfo->cinfo, COL_INFO, "Fragmented Frame"); + break; + } /* switch */ + } /* if */ + +/* In the interest of speed, if "tree" is NULL, don't do any work not + necessary to generate protocol tree items. */ + if (tree) + { + ti = proto_tree_add_protocol_format (tree, proto_docsis, tvb, 0, + hdrlen, "DOCSIS"); + docsis_tree = proto_item_add_subtree (ti, ett_docsis); + +/* add an item to the subtree, see section 1.6 for more information */ + proto_tree_add_item (docsis_tree, hf_docsis_fctype, tvb, 0, 1, FALSE); + switch (fctype) + { + case FCTYPE_PACKET: + case FCTYPE_ATMPDU: + case FCTYPE_RESRVD: + proto_tree_add_item (docsis_tree, hf_docsis_fcparm, tvb, 0, 1, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_ehdron, tvb, 0, 1, + FALSE); + if (ehdron == 0x01) + { + proto_tree_add_item (docsis_tree, hf_docsis_ehdrlen, tvb, 1, 1, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2, + FALSE); + dissect_ehdr (tvb, docsis_tree); + proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, + 4 + mac_parm, 2, FALSE); + } + else + { + proto_tree_add_item (docsis_tree, hf_docsis_macparm, tvb, 1, 1, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2, + FALSE); + } + break; + case FCTYPE_MACSPC: + proto_tree_add_item (docsis_tree, hf_docsis_machdr_fcparm, tvb, 0, + 1, FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_ehdron, tvb, 0, 1, + FALSE); + /* Decode for a Request Frame. No extended header */ + if (fcparm == 0x02) + { + proto_tree_add_uint (docsis_tree, hf_docsis_mini_slots, tvb, 1, + 1, mac_parm); + proto_tree_add_uint (docsis_tree, hf_docsis_sid, tvb, 2, 2, + len_sid); + proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2, + FALSE); + break; + } + /* Decode for a Concatenated Header. No Extended Header */ + if (fcparm == 0x1c) + { + proto_item_append_text (ti, " (Concatenated Header)"); + proto_tree_add_item (docsis_tree, hf_docsis_concat_cnt, tvb, 1, + 1, FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2, + FALSE); + break; + } + /* If Extended header is present then decode it */ + if (ehdron == 0x01) + { + proto_tree_add_item (docsis_tree, hf_docsis_ehdrlen, tvb, 1, 1, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2, + FALSE); + dissect_ehdr (tvb, docsis_tree); + proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, + 4 + mac_parm, 2, FALSE); + break; + } + /* default case for all other Mac Frame Types */ + proto_tree_add_item (docsis_tree, hf_docsis_macparm, tvb, 1, 1, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2, + FALSE); + proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2, FALSE); + break; + } + } + +/* If this protocol has a sub-dissector call it here, see section 1.8 */ + if ((fctype == FCTYPE_PACKET) && (len_sid > mac_parm)) + { + next_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen); + call_dissector (eth_handle, next_tvb, pinfo, tree); + if (concatlen > 0) + { + concatlen = concatlen - framelen; + concatpos += framelen; + } + } + if (fctype == FCTYPE_MACSPC) + { + switch (fcparm) + { + case 0x00: + case 0x01: + mgt_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen); + call_dissector (docsis_mgmt_handle, mgt_tvb, pinfo, tree); + if (concatlen > 0) + { + concatlen = concatlen - framelen; + concatpos += framelen; + } + break; + case 0x02: + /* Don't do anything for a Request Frame */ + break; + case 0x03: + /* For Fragmentation Frames simply dissect using the data + * dissector as we don't handle them yet + */ + mgt_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen); + call_dissector (data_handle, mgt_tvb, pinfo, tree); + if (concatlen > 0) + { + concatlen = concatlen - framelen; + concatpos += framelen; + } + break; + case 0x1c: + /* call the docsis dissector on the same frame + * to dissect DOCSIS frames within the concatenated + * frame. concatpos and concatlen are declared + * static and are decremented and incremented + * respectively when the inner + * docsis frames are dissected. */ + while (concatlen > 0) + { + next_tvb = tvb_new_subset (tvb, concatpos, -1, concatlen); + call_dissector (docsis_handle, next_tvb, pinfo, tree); + } + concatlen = 0; + concatpos = 0; + if (check_col (pinfo->cinfo, COL_INFO)) + col_set_str (pinfo->cinfo, COL_INFO, "Concatenated Frame"); + break; + } + } +} + + +/* 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 (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_fctype, + {"FCType", "docsis.fctype", + FT_UINT8, BASE_BIN, VALS (fctype_vals), 0xC0, + "Frame Control Type", HFILL} + }, + {&hf_docsis_fcparm, + {"FCParm", "docsis.fcparm", + FT_UINT8, BASE_BIN, NULL, 0x3E, + "Parameter Field", HFILL} + }, + {&hf_docsis_machdr_fcparm, + {"FCParm", "docsis.fcparm", + FT_UINT8, BASE_BIN, VALS (fcparm_vals), 0x3E, + "Parameter Field", HFILL} + }, + {&hf_docsis_ehdron, + {"EHDRON", "docsis.ehdron", + FT_UINT8, BASE_BIN, VALS (ehdron_vals), 0x01, + "Extended Header Presence", HFILL} + }, + {&hf_docsis_macparm, + {"MacParm", "docsis.macparm", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Mac Parameter Field", HFILL} + }, + {&hf_docsis_concat_cnt, + {"Number of Concatenated Frames", "docsis.macparm", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Concatenated Frames", HFILL} + }, + {&hf_docsis_ehdrlen, + {"Extended Header Length (bytes)", "docsis.macparm", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Mac Parameter Field", HFILL} + }, + {&hf_docsis_lensid, + {"Length after HCS (bytes)", "docsis.lensid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Length or SID", HFILL} + }, + {&hf_docsis_eh_type, + {"Type", "docsis.ehdr.type", + FT_UINT8, BASE_DEC, VALS (eh_type_vals), 0xF0, + "TLV Type", HFILL} + }, + {&hf_docsis_eh_len, + {"Length", "docsis.ehdr.len", + FT_UINT8, BASE_DEC, NULL, 0x0F, + "TLV Len", HFILL} + }, + {&hf_docsis_eh_val, + {"Value", "docsis.ehdr.value", + FT_BYTES, BASE_HEX, NULL, 0x0, + "TLV Value", HFILL} + }, + {&hf_docsis_sid, + {"SID", "docsis.ehdr.sid", + FT_UINT16, BASE_DEC, NULL, 0x3FFF, + "Service Identifier", HFILL} + }, + {&hf_docsis_said, + {"SAID", "docsis.ehdr.said", + FT_UINT16, BASE_DEC, NULL, 0x3FFF, + "Security Association Identifier", HFILL} + }, + {&hf_docsis_reserved, + {"Reserved", "docsis.ehdr.rsvd", + FT_UINT8, BASE_HEX, NULL, 0x3FFF, + "Reserved Byte", HFILL} + }, + {&hf_docsis_mini_slots, + {"MiniSlots", "docsis.ehdr.minislots", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Mini Slots Requested", HFILL} + }, + {&hf_docsis_key_seq, + {"Key Sequence", "docsis.ehdr.keyseq", + FT_UINT8, BASE_DEC, NULL, 0xF0, + "Key Sequence", HFILL} + }, + {&hf_docsis_ehdr_ver, + {"Version", "docsis.ehdr.", + FT_UINT8, BASE_DEC, NULL, 0x0F, + "Version", HFILL} + }, + {&hf_docsis_hcs, + {"Header check sequence", "docsis.hcs", + FT_UINT16, BASE_HEX, NULL, 0x0, + "Header check sequence", HFILL}, + }, + {&hf_docsis_bpi_en, + {"Encryption", "docsis.bpi_en", + FT_UINT8, BASE_HEX, VALS (ena_dis_vals), 0x80, + "BPI Enable", HFILL}, + }, + {&hf_docsis_toggle_bit, + {"Toggle", "docsis.toggle_bit", + FT_UINT8, BASE_HEX, VALS (odd_even_vals), 0x40, + "Toggle", HFILL}, + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis, + &ett_ehdr, + }; + + docsis_dissector_table = register_dissector_table ("docsis", + "DOCSIS Encapsulation Type", + FT_UINT8, BASE_DEC); + +/* Register the protocol name and description */ + proto_docsis = proto_register_protocol ("DOCSIS 1.1", "DOCSIS", "docsis"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis", dissect_docsis, proto_docsis); +} + + +/* 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 (void) +{ + + + docsis_handle = find_dissector ("docsis"); + data_handle = find_dissector ("data"); + dissector_add ("wtap_encap", WTAP_ENCAP_DOCSIS, docsis_handle); + + docsis_mgmt_handle = find_dissector ("docsis_mgmt"); + eth_handle = find_dissector ("eth"); +} + +/* Start the functions we need for the plugin stuff */ + +#ifndef __ETHEREAL_STATIC__ + +G_MODULE_EXPORT void +plugin_reg_handoff (void) +{ + proto_reg_handoff_docsis (); + proto_reg_handoff_docsis_bpkmattr (); + proto_reg_handoff_docsis_dsarsp (); + proto_reg_handoff_docsis_mgmt (); + proto_reg_handoff_docsis_rngreq (); + proto_reg_handoff_docsis_rngrsp (); + proto_reg_handoff_docsis_bpkmreq (); + proto_reg_handoff_docsis_dscack (); + proto_reg_handoff_docsis_map (); + proto_reg_handoff_docsis_tlv (); + proto_reg_handoff_docsis_bpkmrsp (); + proto_reg_handoff_docsis_dscreq (); + proto_reg_handoff_docsis_regack (); + proto_reg_handoff_docsis_uccreq (); + proto_reg_handoff_docsis_dscrsp (); + proto_reg_handoff_docsis_regreq (); + proto_reg_handoff_docsis_uccrsp (); + proto_reg_handoff_docsis_dsaack (); + proto_reg_handoff_docsis_dsdreq (); + proto_reg_handoff_docsis_regrsp (); + proto_reg_handoff_docsis_ucd (); + proto_reg_handoff_docsis_dsareq (); + proto_reg_handoff_docsis_dsdrsp (); +} + +G_MODULE_EXPORT void +plugin_init (plugin_address_table_t * pat +#ifndef PLUGINS_NEED_ADDRESS_TABLE + _U_ +#endif + ) +{ + /* initialise the table of pointers needed in Win32 DLLs */ + plugin_address_table_init (pat); + /* register the new protocol, protocol fields, and subtrees */ + if (proto_docsis == -1) + { /* execute protocol initialization only once */ + proto_register_docsis (); + proto_register_docsis_bpkmattr (); + proto_register_docsis_dsarsp (); + proto_register_docsis_mgmt (); + proto_register_docsis_rngrsp (); + proto_register_docsis_bpkmreq (); + proto_register_docsis_dscack (); + proto_register_docsis_map (); + proto_register_docsis_tlv (); + proto_register_docsis_bpkmrsp (); + proto_register_docsis_dscreq (); + proto_register_docsis_regack (); + proto_register_docsis_uccreq (); + proto_register_docsis_dscrsp (); + proto_register_docsis_regreq (); + proto_register_docsis_uccrsp (); + proto_register_docsis_dsaack (); + proto_register_docsis_dsdreq (); + proto_register_docsis_regrsp (); + proto_register_docsis_ucd (); + proto_register_docsis_dsareq (); + proto_register_docsis_dsdrsp (); + proto_register_docsis_rngreq (); + + } +} + +#endif diff --git a/plugins/docsis/packet-docsis.h b/plugins/docsis/packet-docsis.h new file mode 100644 index 0000000000..c7b27a2cf3 --- /dev/null +++ b/plugins/docsis/packet-docsis.h @@ -0,0 +1,76 @@ +/* packet-docsis.h + * + * $Id: packet-docsis.h,v 1.1 2002/07/12 22:52:41 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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. + */ + +#ifndef __PACKET_DOCSIS_H__ +#define __PACKET_DOCSIS_H__ + +void capture_docsis (const u_char *, int, int, packet_counts *); +void proto_reg_handoff_docsis_bpkmattr (void); +void proto_reg_handoff_docsis_bpkmreq (void); +void proto_reg_handoff_docsis_bpkmrsp (void); +void proto_reg_handoff_docsis (void); +void proto_reg_handoff_docsis_dsaack (void); +void proto_reg_handoff_docsis_dsareq (void); +void proto_reg_handoff_docsis_dsarsp (void); +void proto_reg_handoff_docsis_dscack (void); +void proto_reg_handoff_docsis_dscreq (void); +void proto_reg_handoff_docsis_dscrsp (void); +void proto_reg_handoff_docsis_dsdreq (void); +void proto_reg_handoff_docsis_dsdrsp (void); +void proto_reg_handoff_docsis_mgmt (void); +void proto_reg_handoff_docsis_map (void); +void proto_reg_handoff_docsis_regack (void); +void proto_reg_handoff_docsis_regreq (void); +void proto_reg_handoff_docsis_regrsp (void); +void proto_reg_handoff_docsis_rngreq (void); +void proto_reg_handoff_docsis_rngrsp (void); +void proto_reg_handoff_docsis_tlv (void); +void proto_reg_handoff_docsis_uccreq (void); +void proto_reg_handoff_docsis_uccrsp (void); +void proto_reg_handoff_docsis_ucd (void); + +void proto_register_docsis_bpkmattr (void); +void proto_register_docsis_bpkmreq (void); +void proto_register_docsis_bpkmrsp (void); +void proto_register_docsis (void); +void proto_register_docsis_dsaack (void); +void proto_register_docsis_dsareq (void); +void proto_register_docsis_dsarsp (void); +void proto_register_docsis_dscack (void); +void proto_register_docsis_dscreq (void); +void proto_register_docsis_dscrsp (void); +void proto_register_docsis_dsdreq (void); +void proto_register_docsis_dsdrsp (void); +void proto_register_docsis_mgmt (void); +void proto_register_docsis_map (void); +void proto_register_docsis_regack (void); +void proto_register_docsis_regreq (void); +void proto_register_docsis_regrsp (void); +void proto_register_docsis_rngreq (void); +void proto_register_docsis_rngrsp (void); +void proto_register_docsis_tlv (void); +void proto_register_docsis_uccreq (void); +void proto_register_docsis_uccrsp (void); +void proto_register_docsis_ucd (void); + +#endif diff --git a/plugins/docsis/packet-dsaack.c b/plugins/docsis/packet-dsaack.c new file mode 100644 index 0000000000..21c5691628 --- /dev/null +++ b/plugins/docsis/packet-dsaack.c @@ -0,0 +1,171 @@ +/* packet-dsaack.c + * Routines for Dynamic Service Addition Acknowledge dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dsaack = -1; +static int hf_docsis_dsaack = -1; +static int hf_docsis_dsaack_tranid = -1; +static int hf_docsis_dsaack_response = -1; +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_dsaack = -1; + +extern value_string docsis_conf_code[]; + +/* Code to actually dissect the packets */ +static void +dissect_dsaack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dsaack_tree; + guint16 transid; + guint16 tlv_data_len; + guint8 response; + tvbuff_t *next_tvb; + + transid = tvb_get_ntohs (tvb, 0); + response = tvb_get_guint8 (tvb, 2); + tlv_data_len = tvb_length_remaining (tvb, 3); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Add Ack ID = %u (%s)", transid, + val_to_str (response, docsis_conf_code, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dsaack, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSA Acknowledge"); + dsaack_tree = proto_item_add_subtree (it, ett_docsis_dsaack); + proto_tree_add_item (dsaack_tree, hf_docsis_dsaack_tranid, tvb, 0, 2, + FALSE); + proto_tree_add_item (dsaack_tree, hf_docsis_dsaack_response, tvb, 2, 1, + FALSE); + + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 3, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsaack_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_dsaack (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dsaack, + {"Dynamic Service Add Ack", "docsis.dsaack", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Add Request", HFILL} + }, + {&hf_docsis_dsaack_tranid, + {"Transaction Id", "docsis.dsaack.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_dsaack_response, + {"Confirmation Code", "docsis.dsaack.confcode", + FT_UINT8, BASE_DEC, VALS (docsis_conf_code), 0x0, + "Confirmation Code", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dsaack, + }; + +/* Register the protocol name and description */ + proto_docsis_dsaack = + proto_register_protocol ("DOCSIS Dynamic Service Addition Acknowledge", + "DOCSIS DSA-ACK", "docsis_dsaack"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dsaack, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dsaack", dissect_dsaack, proto_docsis_dsaack); +} + + +/* 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_dsaack (void) +{ + dissector_handle_t docsis_dsaack_handle; + + docsis_dsaack_handle = find_dissector ("docsis_dsaack"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x11, docsis_dsaack_handle); + +} diff --git a/plugins/docsis/packet-dsareq.c b/plugins/docsis/packet-dsareq.c new file mode 100644 index 0000000000..21cae0c406 --- /dev/null +++ b/plugins/docsis/packet-dsareq.c @@ -0,0 +1,159 @@ +/* packet-dsareq.c + * Routines for Dynamic Service Addition Request dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dsareq = -1; +static int hf_docsis_dsareq = -1; +static int hf_docsis_dsareq_tranid = -1; +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_dsareq = -1; + +/* Code to actually dissect the packets */ +static void +dissect_dsareq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dsareq_tree; + guint16 tlv_data_len; + guint16 transid; + tvbuff_t *next_tvb; + + transid = tvb_get_ntohs (tvb, 0); + tlv_data_len = tvb_length_remaining (tvb, 2); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Addition Request Tran-id = %u", transid); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dsareq, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSA Request"); + dsareq_tree = proto_item_add_subtree (it, ett_docsis_dsareq); + proto_tree_add_item (dsareq_tree, hf_docsis_dsareq_tranid, tvb, 0, 2, + FALSE); + + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 2, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsareq_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_dsareq (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dsareq, + {"Dynamic Service Addition Request", "docsis.dsareq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Addition Request", HFILL} + }, + {&hf_docsis_dsareq_tranid, + {"Transaction Id", "docsis.dsareq.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Transaction Id", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dsareq, + }; + +/* Register the protocol name and description */ + proto_docsis_dsareq = + proto_register_protocol ("DOCSIS Dynamic Service Addition Request", + "DOCSIS DSA-REQ", "docsis_dsareq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dsareq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dsareq", dissect_dsareq, proto_docsis_dsareq); +} + + +/* 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_dsareq (void) +{ + dissector_handle_t docsis_dsareq_handle; + + docsis_dsareq_handle = find_dissector ("docsis_dsareq"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x0F, docsis_dsareq_handle); + +} diff --git a/plugins/docsis/packet-dsarsp.c b/plugins/docsis/packet-dsarsp.c new file mode 100644 index 0000000000..18f6f77c08 --- /dev/null +++ b/plugins/docsis/packet-dsarsp.c @@ -0,0 +1,174 @@ +/* packet-dsarsp.c + * Routines for Dynamic Service Addition Response dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dsarsp = -1; +static int hf_docsis_dsarsp = -1; +static int hf_docsis_dsarsp_tranid = -1; +static int hf_docsis_dsarsp_response = -1; +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_dsarsp = -1; + +extern value_string docsis_conf_code[]; + +/* Code to actually dissect the packets */ +static void +dissect_dsarsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dsarsp_tree; + guint16 transid; + guint16 tlv_data_len; + guint8 response; + tvbuff_t *next_tvb; + + transid = tvb_get_ntohs (tvb, 0); + response = tvb_get_guint8 (tvb, 2); + tlv_data_len = tvb_length_remaining (tvb, 3); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Add Response ID = %u (%s)", transid, + val_to_str (response, docsis_conf_code, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dsarsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSA Response"); + dsarsp_tree = proto_item_add_subtree (it, ett_docsis_dsarsp); + proto_tree_add_item (dsarsp_tree, hf_docsis_dsarsp_tranid, tvb, 0, 2, + FALSE); + proto_tree_add_item (dsarsp_tree, hf_docsis_dsarsp_response, tvb, 2, 1, + FALSE); + + /* Call dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 3, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsarsp_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_dsarsp (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dsarsp, + {"Dynamic Service Add Request", "docsis.dsarsp", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Add Request", HFILL} + }, + {&hf_docsis_dsarsp_tranid, + {"Transaction Id", "docsis.dsarsp.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_dsarsp_response, + {"Confirmation Code", "docsis.dsarsp.confcode", + FT_UINT8, BASE_DEC, VALS (docsis_conf_code), 0x0, + "Confirmation Code", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dsarsp, + }; + +/* Register the protocol name and description */ + proto_docsis_dsarsp = + proto_register_protocol ("DOCSIS Dynamic Service Addition Response", + "DOCSIS DSA-RSP", "docsis_dsarsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dsarsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dsarsp", dissect_dsarsp, proto_docsis_dsarsp); +} + + +/* 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_dsarsp (void) +{ + dissector_handle_t docsis_dsarsp_handle; + + docsis_dsarsp_handle = find_dissector ("docsis_dsarsp"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x10, docsis_dsarsp_handle); + +} diff --git a/plugins/docsis/packet-dscack.c b/plugins/docsis/packet-dscack.c new file mode 100644 index 0000000000..de78704afd --- /dev/null +++ b/plugins/docsis/packet-dscack.c @@ -0,0 +1,173 @@ +/* packet-dscack.c + * Routines for Dynamic Service Change Acknowledge dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dscack = -1; +static int hf_docsis_dscack = -1; +static int hf_docsis_dscack_tranid = -1; +static int hf_docsis_dscack_response = -1; +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_dscack = -1; + +extern value_string docsis_conf_code[]; + +/* Code to actually dissect the packets */ +static void +dissect_dscack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dscack_tree; + guint16 transid; + guint16 tlv_data_len; + guint8 response; + tvbuff_t *next_tvb; + + transid = tvb_get_ntohs (tvb, 0); + response = tvb_get_guint8 (tvb, 2); + tlv_data_len = tvb_length_remaining (tvb, 3); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Change Ack ID = %u (%s)", transid, + val_to_str (response, docsis_conf_code, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dscack, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSC Acknowledge"); + dscack_tree = proto_item_add_subtree (it, ett_docsis_dscack); + proto_tree_add_item (dscack_tree, hf_docsis_dscack_tranid, tvb, 0, 2, + FALSE); + proto_tree_add_item (dscack_tree, hf_docsis_dscack_response, tvb, 2, 1, + FALSE); + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 3, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscack_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_dscack (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dscack, + {"Dynamic Service Change Ack", "docsis.dscack", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Add Request", HFILL} + }, + {&hf_docsis_dscack_tranid, + {"Transaction Id", "docsis.dscack.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_dscack_response, + {"Confirmation Code", "docsis.dscack.confcode", + FT_UINT8, BASE_DEC, VALS (docsis_conf_code), 0x0, + "Confirmation Code", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dscack, + }; + +/* Register the protocol name and description */ + proto_docsis_dscack = + proto_register_protocol ("DOCSIS Dynamic Service Change Acknowledgement", + "DOCSIS DSC-ACK", "docsis_dscack"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dscack, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dscack", dissect_dscack, proto_docsis_dscack); +} + + +/* 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_dscack (void) +{ + dissector_handle_t docsis_dscack_handle; + + docsis_dscack_handle = find_dissector ("docsis_dscack"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x14, docsis_dscack_handle); + +} diff --git a/plugins/docsis/packet-dscreq.c b/plugins/docsis/packet-dscreq.c new file mode 100644 index 0000000000..466e532ed7 --- /dev/null +++ b/plugins/docsis/packet-dscreq.c @@ -0,0 +1,160 @@ +/* packet-dscreq.c + * Routines for Dynamic Service Change Request dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dscreq = -1; +static int hf_docsis_dscreq = -1; +static int hf_docsis_dscreq_tranid = -1; +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_dscreq = -1; + +/* Code to actually dissect the packets */ +static void +dissect_dscreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dscreq_tree; + guint16 tlv_data_len; + guint16 transid; + tvbuff_t *next_tvb; + + + transid = tvb_get_ntohs (tvb, 0); + tlv_data_len = tvb_length_remaining (tvb, 2); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Change Request Tran-id = %u", transid); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dscreq, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSC Request"); + dscreq_tree = proto_item_add_subtree (it, ett_docsis_dscreq); + proto_tree_add_item (dscreq_tree, hf_docsis_dscreq_tranid, tvb, 0, 2, + FALSE); + + /* Call dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 2, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscreq_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_dscreq (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dscreq, + {"Dynamic Service Change Request", "docsis.dscreq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Addition Request", HFILL} + }, + {&hf_docsis_dscreq_tranid, + {"Transaction Id", "docsis.dscreq.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Transaction Id", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dscreq, + }; + +/* Register the protocol name and description */ + proto_docsis_dscreq = + proto_register_protocol ("DOCSIS Dynamic Service Change Request", + "DOCSIS DSC-REQ", "docsis_dscreq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dscreq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dscreq", dissect_dscreq, proto_docsis_dscreq); +} + + +/* 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_dscreq (void) +{ + dissector_handle_t docsis_dscreq_handle; + + docsis_dscreq_handle = find_dissector ("docsis_dscreq"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x12, docsis_dscreq_handle); + +} diff --git a/plugins/docsis/packet-dscrsp.c b/plugins/docsis/packet-dscrsp.c new file mode 100644 index 0000000000..9fee394e97 --- /dev/null +++ b/plugins/docsis/packet-dscrsp.c @@ -0,0 +1,172 @@ +/* packet-dscrsp.c + * Routines for Dynamic Service Change Response dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dscrsp = -1; +static int hf_docsis_dscrsp = -1; +static int hf_docsis_dscrsp_tranid = -1; +static int hf_docsis_dscrsp_response = -1; +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_dscrsp = -1; + +extern value_string docsis_conf_code[]; + +/* Code to actually dissect the packets */ +static void +dissect_dscrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dscrsp_tree; + guint16 transid; + guint16 tlv_data_len; + guint8 response; + tvbuff_t *next_tvb; + + + transid = tvb_get_ntohs (tvb, 0); + response = tvb_get_guint8 (tvb, 2); + tlv_data_len = tvb_length_remaining (tvb, 3); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Change Response ID = %u (%s)", transid, + val_to_str (response, docsis_conf_code, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dscrsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSC Response"); + dscrsp_tree = proto_item_add_subtree (it, ett_docsis_dscrsp); + proto_tree_add_item (dscrsp_tree, hf_docsis_dscrsp_tranid, tvb, 0, 2, + FALSE); + proto_tree_add_item (dscrsp_tree, hf_docsis_dscrsp_response, tvb, 2, 1, + FALSE); + + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 3, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscrsp_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_dscrsp (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dscrsp, + {"Dynamic Service Change Request", "docsis.dscrsp", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Add Request", HFILL} + }, + {&hf_docsis_dscrsp_tranid, + {"Transaction Id", "docsis.dscrsp.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_dscrsp_response, + {"Confirmation Code", "docsis.dscrsp.confcode", + FT_UINT8, BASE_DEC, VALS (docsis_conf_code), 0x0, + "Confirmation Code", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dscrsp, + }; + +/* Register the protocol name and description */ + proto_docsis_dscrsp = + proto_register_protocol ("DOCSIS Dynamic Service Change Response", + "DOCSIS DSC-RSP", "docsis_dscrsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dscrsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dscrsp", dissect_dscrsp, proto_docsis_dscrsp); +} + + +/* 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_dscrsp (void) +{ + dissector_handle_t docsis_dscrsp_handle; + + docsis_dscrsp_handle = find_dissector ("docsis_dscrsp"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x13, docsis_dscrsp_handle); + +} diff --git a/plugins/docsis/packet-dsdreq.c b/plugins/docsis/packet-dsdreq.c new file mode 100644 index 0000000000..5598d9c4f9 --- /dev/null +++ b/plugins/docsis/packet-dsdreq.c @@ -0,0 +1,174 @@ +/* packet-dsdreq.c + * Routines for Dynamic Service Delete Request dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dsdreq = -1; +static int hf_docsis_dsdreq = -1; +static int hf_docsis_dsdreq_tranid = -1; +static int hf_docsis_dsdreq_rsvd = -1; +static int hf_docsis_dsdreq_sfid = -1; + +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_dsdreq = -1; + +/* Code to actually dissect the packets */ +static void +dissect_dsdreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dsdreq_tree; + guint16 tlv_data_len; + guint16 transid; + tvbuff_t *next_tvb; + + transid = tvb_get_ntohs (tvb, 0); + tlv_data_len = tvb_length_remaining (tvb, 8); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Delete Request Tran-id = %u", transid); + } + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dsdreq, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSD Request"); + dsdreq_tree = proto_item_add_subtree (it, ett_docsis_dsdreq); + proto_tree_add_item (dsdreq_tree, hf_docsis_dsdreq_tranid, tvb, 0, 2, + FALSE); + proto_tree_add_item (dsdreq_tree, hf_docsis_dsdreq_rsvd, tvb, 2, 2, + FALSE); + proto_tree_add_item (dsdreq_tree, hf_docsis_dsdreq_sfid, tvb, 4, 4, + FALSE); + + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 8, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsdreq_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_dsdreq (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dsdreq, + {"Dynamic Service Delete Request", "docsis.dsdreq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Delete Request", HFILL} + }, + {&hf_docsis_dsdreq_tranid, + {"Transaction Id", "docsis.dsdreq.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Transaction Id", HFILL} + }, + {&hf_docsis_dsdreq_rsvd, + {"Reserved", "docsis.dsdreq.rsvd", + FT_UINT16, BASE_HEX, NULL, 0x0, + "Reserved", HFILL} + }, + {&hf_docsis_dsdreq_sfid, + {"Service Flow ID", "docsis.dsdreq.sfid", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Service Flow Id", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dsdreq, + }; + +/* Register the protocol name and description */ + proto_docsis_dsdreq = + proto_register_protocol ("DOCSIS Dynamic Service Delete Request", + "DOCSIS DSD-REQ", "docsis_dsdreq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dsdreq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dsdreq", dissect_dsdreq, proto_docsis_dsdreq); +} + + +/* 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_dsdreq (void) +{ + dissector_handle_t docsis_dsdreq_handle; + + docsis_dsdreq_handle = find_dissector ("docsis_dsdreq"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x15, docsis_dsdreq_handle); + +} diff --git a/plugins/docsis/packet-dsdrsp.c b/plugins/docsis/packet-dsdrsp.c new file mode 100644 index 0000000000..bf3dfab474 --- /dev/null +++ b/plugins/docsis/packet-dsdrsp.c @@ -0,0 +1,170 @@ +/* packet-dsdrsp.c + * Routines for Dynamic Service Delete Response dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_dsdrsp = -1; +static int hf_docsis_dsdrsp = -1; +static int hf_docsis_dsdrsp_tranid = -1; +static int hf_docsis_dsdrsp_confcode = -1; +static int hf_docsis_dsdrsp_rsvd = -1; + +extern value_string docsis_conf_code[]; + +/* Initialize the subtree pointers */ +static gint ett_docsis_dsdrsp = -1; + +/* Code to actually dissect the packets */ +static void +dissect_dsdrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *dsdrsp_tree; + guint16 tranid; + guint8 confcode; + + tranid = tvb_get_ntohs (tvb, 0); + confcode = tvb_get_guint8 (tvb, 2); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Dynamic Service Delete Response Tran id = %u (%s)", + tranid, val_to_str (confcode, docsis_conf_code, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_dsdrsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "DSD Response"); + dsdrsp_tree = proto_item_add_subtree (it, ett_docsis_dsdrsp); + proto_tree_add_item (dsdrsp_tree, hf_docsis_dsdrsp_tranid, tvb, 0, 2, + FALSE); + proto_tree_add_item (dsdrsp_tree, hf_docsis_dsdrsp_confcode, tvb, 2, 1, + FALSE); + proto_tree_add_item (dsdrsp_tree, hf_docsis_dsdrsp_rsvd, tvb, 3, 1, + FALSE); + } + +} + + + + +/* 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_dsdrsp (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_dsdrsp, + {"Dynamic Service Delete Response", "docsis.dsdrsp", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Dynamic Service Delete Response", HFILL} + }, + {&hf_docsis_dsdrsp_tranid, + {"Transaction Id", "docsis.dsdrsp.tranid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Transaction Id", HFILL} + }, + {&hf_docsis_dsdrsp_confcode, + {"Confirmation Code", "docsis.dsdrsp.confcode", + FT_UINT8, BASE_DEC, VALS (docsis_conf_code), 0x0, + "Confirmation Code", HFILL} + }, + {&hf_docsis_dsdrsp_rsvd, + {"Reserved", "docsis.dsdrsp.rsvd", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Reserved", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_dsdrsp, + }; + +/* Register the protocol name and description */ + proto_docsis_dsdrsp = + proto_register_protocol ("DOCSIS Dynamic Service Delete Response", + "DOCSIS DSD-RSP", "docsis_dsdrsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_dsdrsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_dsdrsp", dissect_dsdrsp, proto_docsis_dsdrsp); +} + + +/* 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_dsdrsp (void) +{ + dissector_handle_t docsis_dsdrsp_handle; + + docsis_dsdrsp_handle = find_dissector ("docsis_dsdrsp"); + dissector_add ("docsis_mgmt", 0x16, docsis_dsdrsp_handle); + +} diff --git a/plugins/docsis/packet-macmgmt.c b/plugins/docsis/packet-macmgmt.c new file mode 100644 index 0000000000..c978b7a9ae --- /dev/null +++ b/plugins/docsis/packet-macmgmt.c @@ -0,0 +1,306 @@ +/* packet-macmgmt.c + * Routines for docsis Mac Management Header dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <glib.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +#define MGT_SYNC 1 +#define MGT_UCD 2 +#define MGT_MAP 3 +#define MGT_RNG_REQ 4 +#define MGT_RNG_RSP 5 +#define MGT_REG_REQ 6 +#define MGT_REG_RSP 7 +#define MGT_UCC_REQ 8 +#define MGT_UCC_RSP 9 +#define MGT_TRI_TCD 10 +#define MGT_TRI_TSI 11 +#define MGT_BPKM_REQ 12 +#define MGT_BPKM_RSP 13 +#define MGT_REG_ACK 14 +#define MGT_DSA_REQ 15 +#define MGT_DSA_RSP 16 +#define MGT_DSA_ACK 17 +#define MGT_DSC_REQ 18 +#define MGT_DSC_RSP 19 +#define MGT_DSC_ACK 20 +#define MGT_DSD_REQ 21 +#define MGT_DSD_RSP 22 +#define MGT_DCC_REQ 23 +#define MGT_DCC_RSP 24 +#define MGT_DCC_ACK 25 +#define MGT_DCI_REQ 26 +#define MGT_DCI_RSP 27 +#define MGT_UP_DIS 28 + + +/* Initialize the protocol and registered fields */ +static int proto_docsis_mgmt = -1; +static int hf_docsis_mgt_hdr = -1; +static int hf_docsis_mgt_dst_addr = -1; +static int hf_docsis_mgt_src_addr = -1; +static int hf_docsis_mgt_msg_len = -1; +static int hf_docsis_mgt_dsap = -1; +static int hf_docsis_mgt_ssap = -1; +static int hf_docsis_mgt_control = -1; +static int hf_docsis_mgt_version = -1; +static int hf_docsis_mgt_type = -1; +static int hf_docsis_mgt_rsvd = -1; + +static dissector_table_t docsis_mgmt_dissector_table; +static dissector_handle_t data_handle; + +/* Initialize the subtree pointers */ +static gint ett_docsis_mgmt = -1; +static gint ett_mgmt_pay = -1; + + +static const value_string mgmt_type_vals[] = { + {MGT_SYNC, "Timing Synchronisation"}, + {MGT_UCD, "Upstream Channel Descriptor"}, + {MGT_MAP, "Upstream Bandwidth Allocation"}, + {MGT_RNG_REQ, "Ranging Request"}, + {MGT_RNG_RSP, "Ranging Response"}, + {MGT_REG_REQ, "Registration Request"}, + {MGT_REG_RSP, "Registration Response"}, + {MGT_UCC_REQ, "Upstream Channel Change Request"}, + {MGT_UCC_RSP, "Upstream Channel Change Response"}, + {MGT_TRI_TCD, "Telephony Channel Descriptor"}, + {MGT_TRI_TSI, "Termination System Information"}, + {MGT_BPKM_REQ, "Privacy Key Management Request"}, + {MGT_BPKM_RSP, "Privacy Key Management Response"}, + {MGT_REG_ACK, "Registration Acknowledge"}, + {MGT_DSA_REQ, "Dynamic Service Addition Request"}, + {MGT_DSA_RSP, "Dynamic Service Addition Response"}, + {MGT_DSA_ACK, "Dynamic Service Addition Acknowledge"}, + {MGT_DSC_REQ, "Dynamic Service Change Request"}, + {MGT_DSC_RSP, "Dynamic Service Change Response"}, + {MGT_DSC_ACK, "Dynamic Service Change Acknowledge"}, + {MGT_DSD_REQ, "Dynamic Service Delete Request"}, + {MGT_DSD_RSP, "Dynamic Service Delete Response"}, + {MGT_DCC_REQ, "Dynamic Channel Change Request"}, + {MGT_DCC_RSP, "Dynamic Channel Change Response"}, + {MGT_DCC_ACK, "Dynamic Channel Change Acknowledge"}, + {MGT_DCI_REQ, "Device Class Identification Request"}, + {MGT_DCI_RSP, "Device Class Identification Response"}, + {MGT_UP_DIS, "Upstream Channel Disable"}, + {0, NULL} +}; + +/* Code to actually dissect the packets */ +static void +dissect_macmgmt (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + const guint8 *src, *dst; + guint16 msg_len; + proto_item *mgt_hdr_it; + proto_tree *mgt_hdr_tree; + tvbuff_t *payload_tvb; + guint8 type; + if (check_col (pinfo->cinfo, COL_PROTOCOL)) + col_set_str (pinfo->cinfo, COL_PROTOCOL, "DOCSIS MGMT"); + + if (check_col (pinfo->cinfo, COL_INFO)) + col_clear (pinfo->cinfo, COL_INFO); + + + src = tvb_get_ptr (tvb, 6, 6); + dst = tvb_get_ptr (tvb, 0, 6); + SET_ADDRESS (&pinfo->dl_src, AT_ETHER, 6, src); + SET_ADDRESS (&pinfo->src, AT_ETHER, 6, src); + SET_ADDRESS (&pinfo->dl_dst, AT_ETHER, 6, dst); + SET_ADDRESS (&pinfo->dst, AT_ETHER, 6, dst); + + if (tree) + { + mgt_hdr_it = + proto_tree_add_protocol_format (tree, proto_docsis_mgmt, tvb, 0, 20, + "Mac Management"); + mgt_hdr_tree = proto_item_add_subtree (mgt_hdr_it, ett_docsis_mgmt); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dst_addr, tvb, 0, 6, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_src_addr, tvb, 6, 6, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_msg_len, tvb, 12, 2, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dsap, tvb, 14, 1, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_ssap, tvb, 15, 1, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_control, tvb, 16, 1, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_version, tvb, 17, 1, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_type, tvb, 18, 1, + FALSE); + proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_rsvd, tvb, 19, 1, + FALSE); + + } + /* Code to Call subdissector */ + /* sub-dissectors are based on the type field */ + type = tvb_get_guint8 (tvb, 18); + msg_len = tvb_get_ntohs (tvb, 12); + payload_tvb = tvb_new_subset (tvb, 20, msg_len - 6, msg_len - 6); + + if (dissector_try_port + (docsis_mgmt_dissector_table, type, payload_tvb, pinfo, tree)) + return; + else + call_dissector (data_handle, payload_tvb, pinfo, 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_mgmt (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_mgt_hdr, + {"Mac Management Header", "docsis.mgmt", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Mac Management Header", HFILL} + }, + {&hf_docsis_mgt_dst_addr, + {"Destination Address", "docsis.mgmt.dst", + FT_ETHER, BASE_HEX, NULL, 0x0, + "Destination Address", HFILL} + }, + {&hf_docsis_mgt_src_addr, + {"Source Address", "docsis.mgmt.src", + FT_ETHER, BASE_HEX, NULL, 0x0, + "Source Address", HFILL} + }, + {&hf_docsis_mgt_msg_len, + {"Message Length - DSAP to End (Bytes)", "docsis.mgmt.msglen", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Message Length", HFILL} + }, + {&hf_docsis_mgt_dsap, + {"DSAP [0x00]", "docsis.mgmt.dsap", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Destination SAP", HFILL} + }, + {&hf_docsis_mgt_ssap, + {"SSAP [0x00]", "docsis.mgmt.ssap", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Source SAP", HFILL} + }, + {&hf_docsis_mgt_control, + {"Control [0x03]", "docsis.mgmt.control", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Control", HFILL} + }, + {&hf_docsis_mgt_version, + {"Version", "docsis.mgmt.version", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Version", HFILL} + }, + {&hf_docsis_mgt_type, + {"Type", "docsis.mgmt.type", + FT_UINT8, BASE_DEC, VALS (mgmt_type_vals), 0x0, + "Type", HFILL} + }, + {&hf_docsis_mgt_rsvd, + {"Reserved [0x00]", "docsis.mgmt.rsvd", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Reserved", HFILL} + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_mgmt, + &ett_mgmt_pay, + }; + + docsis_mgmt_dissector_table = register_dissector_table ("docsis_mgmt", + "DOCSIS Mac Management", + FT_UINT8, BASE_DEC); + + +/* Register the protocol name and description */ + proto_docsis_mgmt = proto_register_protocol ("DOCSIS Mac Management", + "DOCSIS MAC MGMT", + "docsis_mgmt"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_mgmt, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_mgmt", dissect_macmgmt, proto_docsis_mgmt); +} + + +/* 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_mgmt (void) +{ + dissector_handle_t docsis_mgmt_handle; + + docsis_mgmt_handle = find_dissector ("docsis_mgmt"); + data_handle = find_dissector ("data"); + + dissector_add ("docsis", 0x03, docsis_mgmt_handle); +} diff --git a/plugins/docsis/packet-map.c b/plugins/docsis/packet-map.c new file mode 100644 index 0000000000..c167ebebd0 --- /dev/null +++ b/plugins/docsis/packet-map.c @@ -0,0 +1,311 @@ +/* packet-map.c + * Routines for MAP Message dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +#define IUC_REQUEST 1 +#define IUC_REQ_DATA 2 +#define IUC_INIT_MAINT 3 +#define IUC_STATION_MAINT 4 +#define IUC_SHORT_DATA_GRANT 5 +#define IUC_LONG_DATA_GRANT 6 +#define IUC_NULL_IE 7 +#define IUC_DATA_ACK 8 +#define IUC_RESERVED9 9 +#define IUC_RESERVED10 10 +#define IUC_RESERVED11 11 +#define IUC_RESERVED12 12 +#define IUC_RESERVED13 13 +#define IUC_RESERVED14 14 +#define IUC_EXPANSION 15 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_map = -1; +static int hf_docsis_map_upstream_chid = -1; +static int hf_docsis_map_ucd_count = -1; +static int hf_docsis_map_numie = -1; +static int hf_docsis_map = -1; +static int hf_docsis_map_alloc_start = -1; +static int hf_docsis_map_ack_time = -1; +static int hf_docsis_map_rng_start = -1; +static int hf_docsis_map_rng_end = -1; +static int hf_docsis_map_data_start = -1; +static int hf_docsis_map_data_end = -1; +static int hf_docsis_map_ie = -1; +static int hf_docsis_map_rsvd = -1; + +static int hf_docsis_map_sid = -1; +static int hf_docsis_map_iuc = -1; +static int hf_docsis_map_offset = -1; + +/* Initialize the subtree pointers */ +static gint ett_docsis_map = -1; + +/* Defined in packet-ucd.c */ +extern value_string iuc_vals[]; + +/* Code to actually dissect the packets */ +static void +dissect_map (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint8 i, numie; + guint16 pos; + guint16 sid; + guint8 iuc; + guint16 offset; + guint32 ie, temp, mask; + proto_item *it; + proto_tree *map_tree; + guint8 upchid, ucd_count; + + + numie = tvb_get_guint8 (tvb, 2); + upchid = tvb_get_guint8 (tvb, 0); + ucd_count = tvb_get_guint8 (tvb, 1); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + if (upchid > 0) + col_add_fstr (pinfo->cinfo, COL_INFO, + "Map Message: Channel ID = %u (U%u), UCD Count = %u, # IE's = %u", + upchid, upchid - 1, ucd_count, numie); + else + col_add_fstr (pinfo->cinfo, COL_INFO, + "Map Message: Channel ID = %u (Telephony Return), UCD Count = %u, # IE's = %u", + upchid, ucd_count, numie); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_map, tvb, 0, + tvb_length_remaining (tvb, 0), + "MAP Message"); + map_tree = proto_item_add_subtree (it, ett_docsis_map); + + proto_tree_add_item (map_tree, hf_docsis_map_upstream_chid, tvb, 0, 1, + FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_ucd_count, tvb, 1, 1, + FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_numie, tvb, 2, 1, FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_rsvd, tvb, 3, 1, FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_alloc_start, tvb, 4, 4, + FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_ack_time, tvb, 8, 4, + FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_rng_start, tvb, 12, 1, + FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_rng_end, tvb, 13, 1, + FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_data_start, tvb, 14, 1, + FALSE); + proto_tree_add_item (map_tree, hf_docsis_map_data_end, tvb, 15, 1, + FALSE); + + pos = 16; + for (i = 0; i < numie; i++) + { + ie = tvb_get_ntohl (tvb, pos); + mask = 0xFFFC0000; + temp = (ie & mask); + temp = temp >> 18; + sid = (guint16) (temp & 0x3FFF); + mask = 0x3C000; + temp = (ie & mask); + temp = temp >> 14; + iuc = (guint8) (temp & 0x0F); + mask = 0x3FFF; + offset = (guint16) (ie & mask); + proto_tree_add_item_hidden(map_tree, hf_docsis_map_sid, tvb, pos, 4, FALSE); + proto_tree_add_item_hidden(map_tree, hf_docsis_map_iuc, tvb, pos, 4, FALSE); + proto_tree_add_item_hidden(map_tree, hf_docsis_map_offset, tvb, pos, 4, FALSE); + if (sid == 0x3FFF) + proto_tree_add_uint_format (map_tree, hf_docsis_map_ie, tvb, pos, 4, + ie, "SID = 0x%x (All CM's), IUC = %s, Offset = %u", + sid, val_to_str (iuc, iuc_vals, "%s"), + offset); + else + proto_tree_add_uint_format (map_tree, hf_docsis_map_ie, tvb, pos, 4, + ie, "SID = %u, IUC = %s, Offset = %u", + sid, val_to_str (iuc, iuc_vals, "%s"), + offset); + pos = pos + 4; + } /* for... */ + } /* 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_map (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_map, + {"Map Message", "docsis.map", + FT_BYTES, BASE_HEX, NULL, 0x0, + "MAP Message", HFILL} + }, + {&hf_docsis_map_ucd_count, + {"UCD Count", "docsis.map.ucdcount", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Map UCD Count", HFILL} + }, + {&hf_docsis_map_upstream_chid, + {"Upstream Channel ID", "docsis.map.upchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel ID", HFILL} + }, + {&hf_docsis_map_numie, + {"Number of IE's", "docsis.map.numie", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Information Elements", HFILL} + }, + {&hf_docsis_map_alloc_start, + {"Alloc Start Time (minislots)", "docsis.map.allocstart", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Alloc Start Time (minislots)", HFILL} + }, + {&hf_docsis_map_ack_time, + {"ACK Time (minislots)", "docsis.map.acktime", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Ack Time (minislots)", HFILL} + }, + {&hf_docsis_map_rng_start, + {"Ranging Backoff Start", "docsis.map.rng_start", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Ranging Backoff Start", HFILL} + }, + {&hf_docsis_map_rng_end, + {"Ranging Backoff End", "docsis.map.rng_end", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Ranging Backoff End", HFILL} + }, + {&hf_docsis_map_data_start, + {"Data Backoff Start", "docsis.map.data_start", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Data Backoff Start", HFILL} + }, + {&hf_docsis_map_data_end, + {"Data Backoff End", "docsis.map.data_end", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Data Backoff End", HFILL} + }, + {&hf_docsis_map_ie, + {"Information Element", "docsis.map.ie", + FT_UINT32, BASE_HEX, NULL, 0x0, + "Information Element", HFILL} + }, + {&hf_docsis_map_rsvd, + {"Reserved [0x00]", "docsis.map.rsvd", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Reserved Byte", HFILL} + }, + {&hf_docsis_map_sid, + {"Service Identifier", "docsis.map.sid", + FT_UINT32, BASE_DEC, NULL, 0xFFFC0000, + "Service Identifier", HFILL} + }, + {&hf_docsis_map_iuc, + {"Interval Usage Code", "docsis.map.iuc", + FT_UINT32, BASE_DEC, VALS(iuc_vals), 0x0003c000, + "Interval Usage Code", HFILL} + }, + {&hf_docsis_map_offset, + {"Offset", "docsis.map.offset", + FT_UINT32, BASE_DEC, NULL, 0x00003fff, + "Offset", HFILL} + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_map, + }; + +/* Register the protocol name and description */ + proto_docsis_map = + proto_register_protocol ("DOCSIS Upstream Bandwidth Allocation", + "DOCSIS MAP", "docsis_map"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_map, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_map", dissect_map, proto_docsis_map); +} + + +/* 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_map (void) +{ + dissector_handle_t docsis_map_handle; + + docsis_map_handle = find_dissector ("docsis_map"); + dissector_add ("docsis_mgmt", 0x03, docsis_map_handle); + +} diff --git a/plugins/docsis/packet-regack.c b/plugins/docsis/packet-regack.c new file mode 100644 index 0000000000..90eac4cd54 --- /dev/null +++ b/plugins/docsis/packet-regack.c @@ -0,0 +1,171 @@ +/* packet-regack.c + * Routines for Registration Acknowledge Message dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_regack = -1; +static int hf_docsis_regack = -1; +static int hf_docsis_regack_sid = -1; +static int hf_docsis_regack_response = -1; +static dissector_handle_t docsis_tlv_handle; + +/* Defined in packet-tlv.c */ +extern value_string docsis_conf_code[]; + +/* Initialize the subtree pointers */ +static gint ett_docsis_regack = -1; + +/* Code to actually dissect the packets */ +static void +dissect_regack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *regack_tree; + guint16 sid; + guint16 tlv_data_len; + guint8 response; + tvbuff_t *next_tvb; + + sid = tvb_get_ntohs (tvb, 0); + response = tvb_get_guint8 (tvb, 2); + tlv_data_len = tvb_length_remaining (tvb, 3); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Registration Acknowledge SID = %u (%s)", sid, + val_to_str (response, docsis_conf_code, "%s")); + } + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_regack, tvb, 0, + tvb_length_remaining (tvb, 0), + "Registration Acknowledge"); + regack_tree = proto_item_add_subtree (it, ett_docsis_regack); + proto_tree_add_item (regack_tree, hf_docsis_regack_sid, tvb, 0, 2, + FALSE); + proto_tree_add_item (regack_tree, hf_docsis_regack_response, tvb, 2, 1, + FALSE); + + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 3, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regack_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_regack (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_regack, + {"Registration Request", "docsis.regack", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Registration Request", HFILL} + }, + {&hf_docsis_regack_sid, + {"Service Identifier", "docsis.regack.sid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_regack_response, + {"Response Code", "docsis.regack.respnse", + FT_UINT8, BASE_DEC, VALS (docsis_conf_code), 0x0, + "Response Code", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_regack, + }; + +/* Register the protocol name and description */ + proto_docsis_regack = + proto_register_protocol ("DOCSIS Registration Acknowledge", + "DOCSIS REG-ACK", "docsis_regack"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_regack, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_regack", dissect_regack, proto_docsis_regack); +} + + +/* 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_regack (void) +{ + dissector_handle_t docsis_regack_handle; + + docsis_regack_handle = find_dissector ("docsis_regack"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x0e, docsis_regack_handle); + +} diff --git a/plugins/docsis/packet-regreq.c b/plugins/docsis/packet-regreq.c new file mode 100644 index 0000000000..7cdd546946 --- /dev/null +++ b/plugins/docsis/packet-regreq.c @@ -0,0 +1,162 @@ +/* packet-regreq.c + * Routines for Registration Request dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_regreq = -1; +static int hf_docsis_regreq = -1; +static int hf_docsis_regreq_sid = -1; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_regreq = -1; + +static dissector_handle_t docsis_tlv_handle; + +/* Code to actually dissect the packets */ +static void +dissect_regreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *regreq_tree; + guint16 sid; + guint16 tlv_data_len; + tvbuff_t *next_tvb; + + sid = tvb_get_ntohs (tvb, 0); + tlv_data_len = tvb_length_remaining (tvb, 2); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, "Registration Request SID = %u", + sid); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_regreq, tvb, 0, + tvb_length_remaining (tvb, 0), + "Registration Request"); + regreq_tree = proto_item_add_subtree (it, ett_docsis_regreq); + proto_tree_add_item (regreq_tree, hf_docsis_regreq_sid, tvb, 0, 2, + FALSE); + /* Call Dissector for Appendix C TlV's */ + next_tvb = tvb_new_subset (tvb, 2, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreq_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_regreq (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_regreq, + {"Registration Request", "docsis.regreq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Registration Request", HFILL} + }, + {&hf_docsis_regreq_sid, + {"Service Identifier", "docsis.regreq.sid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_regreq, + }; + +/* Register the protocol name and description */ + proto_docsis_regreq = + proto_register_protocol ("DOCSIS Registration Requests", "DOCSIS REG-REQ", + "docsis_regreq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_regreq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_regreq", dissect_regreq, proto_docsis_regreq); +} + + +/* 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_regreq (void) +{ + dissector_handle_t docsis_regreq_handle; + + docsis_regreq_handle = find_dissector ("docsis_regreq"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + + dissector_add ("docsis_mgmt", 0x06, docsis_regreq_handle); + +} diff --git a/plugins/docsis/packet-regrsp.c b/plugins/docsis/packet-regrsp.c new file mode 100644 index 0000000000..851304c305 --- /dev/null +++ b/plugins/docsis/packet-regrsp.c @@ -0,0 +1,169 @@ +/* packet-regrsp.c + * Routines for Registration Response Message dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_regrsp = -1; +static int hf_docsis_regrsp = -1; +static int hf_docsis_regrsp_sid = -1; +static int hf_docsis_regrsp_response = -1; +static dissector_handle_t docsis_tlv_handle; + +/* Defined in packet-tlv.c */ +extern value_string docsis_conf_code[]; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_regrsp = -1; + +/* Code to actually dissect the packets */ +static void +dissect_regrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *regrsp_tree; + guint16 sid; + guint16 tlv_data_len; + guint8 response; + tvbuff_t *next_tvb; + + sid = tvb_get_ntohs (tvb, 0); + response = tvb_get_guint8 (tvb, 2); + tlv_data_len = tvb_length_remaining (tvb, 3); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Registration Response SID = %u (%s)", sid, + val_to_str (response, docsis_conf_code, "%s")); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_regrsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "Registration Response"); + regrsp_tree = proto_item_add_subtree (it, ett_docsis_regrsp); + proto_tree_add_item (regrsp_tree, hf_docsis_regrsp_sid, tvb, 0, 2, + FALSE); + proto_tree_add_item (regrsp_tree, hf_docsis_regrsp_response, tvb, 2, 1, + FALSE); + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 3, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrsp_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_regrsp (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_regrsp, + {"Registration Request", "docsis.regrsp", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Registration Request", HFILL} + }, + {&hf_docsis_regrsp_sid, + {"Service Identifier", "docsis.regrsp.sid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_regrsp_response, + {"Response Code", "docsis.regrsp.respnse", + FT_UINT8, BASE_DEC, VALS (docsis_conf_code), 0x0, + "Response Code", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_regrsp, + }; + +/* Register the protocol name and description */ + proto_docsis_regrsp = + proto_register_protocol ("DOCSIS Registration Requests", "DOCSIS REG-RSP", + "docsis_regrsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_regrsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_regrsp", dissect_regrsp, proto_docsis_regrsp); +} + + +/* 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_regrsp (void) +{ + dissector_handle_t docsis_regrsp_handle; + + docsis_regrsp_handle = find_dissector ("docsis_regrsp"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x07, docsis_regrsp_handle); + +} diff --git a/plugins/docsis/packet-rngreq.c b/plugins/docsis/packet-rngreq.c new file mode 100644 index 0000000000..540d5fa6f6 --- /dev/null +++ b/plugins/docsis/packet-rngreq.c @@ -0,0 +1,173 @@ +/* packet-rngreq.c + * Routines for Ranging Request Message dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + + +/* Initialize the protocol and registered fields */ +static int proto_docsis_rngreq = -1; +static int hf_docsis_rngreq = -1; +static int hf_docsis_rngreq_down_chid = -1; +static int hf_docsis_rngreq_sid = -1; +static int hf_docsis_rngreq_pend_compl = -1; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_rngreq = -1; + +/* Code to actually dissect the packets */ +static void +dissect_rngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + proto_item *it; + proto_tree *rngreq_tree; + guint16 sid; + + sid = tvb_get_ntohs (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + if (sid > 0) + col_add_fstr (pinfo->cinfo, COL_INFO, "Ranging Request: SID = %u", + sid); + else + col_add_str (pinfo->cinfo, COL_INFO, + "Initial Ranging Request SID = 0"); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_rngreq, tvb, 0, + tvb_length_remaining (tvb, 0), + "Ranging Request"); + rngreq_tree = proto_item_add_subtree (it, ett_docsis_rngreq); + proto_tree_add_item (rngreq_tree, hf_docsis_rngreq_sid, tvb, 0, 2, + FALSE); + proto_tree_add_item (rngreq_tree, hf_docsis_rngreq_down_chid, tvb, 2, 1, + FALSE); + proto_tree_add_item (rngreq_tree, hf_docsis_rngreq_pend_compl, tvb, 3, + 1, FALSE); + } + + +} + + + + +/* 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_rngreq (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_rngreq, + {"RNG-REQ Message", "docsis.rngreq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Ranging Request Message", HFILL} + }, + {&hf_docsis_rngreq_sid, + {"Service Identifier", "docsis.rngreq.sid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_rngreq_down_chid, + {"Downstream Channel ID", "docsis.rngreq.downchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Downstream Channel ID", HFILL} + }, + {&hf_docsis_rngreq_pend_compl, + {"Pending Till Complete (hundreths of a sec)", "docsis.rngreq.upchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel ID", HFILL} + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_rngreq, + }; + +/* Register the protocol name and description */ + proto_docsis_rngreq = proto_register_protocol ("DOCSIS MAP Messages", + "DOCSIS RNG-REQ", + "docsis_rngreq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_rngreq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_rngreq", dissect_rngreq, proto_docsis_rngreq); +} + + +/* 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_rngreq (void) +{ + dissector_handle_t docsis_rngreq_handle; + + docsis_rngreq_handle = find_dissector ("docsis_rngreq"); + dissector_add ("docsis_mgmt", 0x04, docsis_rngreq_handle); + +} diff --git a/plugins/docsis/packet-rngrsp.c b/plugins/docsis/packet-rngrsp.c new file mode 100644 index 0000000000..e21b7f21af --- /dev/null +++ b/plugins/docsis/packet-rngrsp.c @@ -0,0 +1,364 @@ +/* packet-rngrsp.c + * Routines for Ranging Response Message dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +#define RNGRSP_TIMING 1 +#define RNGRSP_PWR_LEVEL_ADJ 2 +#define RNGRSP_OFFSET_FREQ_ADJ 3 +#define RNGRSP_TRANSMIT_EQ_ADJ 4 +#define RNGRSP_RANGING_STATUS 5 +#define RNGRSP_DOWN_FREQ_OVER 6 +#define RNGRSP_UP_CHID_OVER 7 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_rngrsp = -1; +static int hf_docsis_rngrsp = -1; +static int hf_docsis_rngrsp_upstream_chid = -1; +static int hf_docsis_rngrsp_sid = -1; +static int hf_docsis_rngrsp_timing_adj = -1; +static int hf_docsis_rngrsp_power_adj = -1; +static int hf_docsis_rngrsp_freq_adj = -1; +static int hf_docsis_rngrsp_xmit_eq_adj = -1; +static int hf_docsis_rngrsp_ranging_status = -1; +static int hf_docsis_rngrsp_down_freq_over = -1; +static int hf_docsis_rngrsp_upstream_ch_over = -1; + +static const value_string rng_stat_vals[] = { + {1, "Continue"}, + {2, "Abort"}, + {3, "Success"}, + {0, NULL} +}; + +/* Initialize the subtree pointers */ +static gint ett_docsis_rngrsp = -1; + +/* These Routines convert the specified type to a signed integer + * using a Two's Compliment Format */ + +gint8 +byte_to_signed (guint8 i) +{ + gint16 val; + if (i & 0x80) + { + val = ((~i) + 1); + val = -val; + } + else + { + val = i; + } + return (val); +} + +gint16 +short_to_signed (guint16 i) +{ + gint16 val; + + if (i & 0x8000) + { + val = (gint16) ((~i) + 1); + val = -val; + } + else + { + val = (gint16) i; + } + + return (val); +} + +gint32 +long_to_signed (guint32 i) +{ + gint32 val; + + if (i & 0x80000000) + { + val = (gint32) ((~i) + 1); + val = -val; + } + else + { + val = (gint16) i; + } + + return (val); + +} + +/* Code to actually dissect the packets */ +static void +dissect_rngrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + proto_item *it; + proto_tree *rngrsp_tree; + guint8 tlvtype, tlvlen; + guint16 pos, length; + guint8 upchid; + guint16 sid; + gint8 pwr; + gint32 tim; + + sid = tvb_get_ntohs (tvb, 0); + upchid = tvb_get_guint8 (tvb, 2); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + if (upchid > 0) + col_add_fstr (pinfo->cinfo, COL_INFO, + "Ranging Response: SID = %u, Upstream Channel = %u (U%u)", + sid, upchid, upchid - 1); + else + col_add_fstr (pinfo->cinfo, COL_INFO, + "Ranging Response: SID = %u, Telephony Return", sid); + + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_rngrsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "Ranging Response"); + rngrsp_tree = proto_item_add_subtree (it, ett_docsis_rngrsp); + proto_tree_add_item (rngrsp_tree, hf_docsis_rngrsp_sid, tvb, 0, 2, + FALSE); + proto_tree_add_item (rngrsp_tree, hf_docsis_rngrsp_upstream_chid, tvb, + 2, 1, FALSE); + + length = tvb_length_remaining (tvb, 0); + pos = 3; + while (pos < length) + { + tlvtype = tvb_get_guint8 (tvb, pos++); + tlvlen = tvb_get_guint8 (tvb, pos++); + switch (tlvtype) + { + case RNGRSP_TIMING: + if (tlvlen == 4) + { + tim = long_to_signed (tvb_get_ntohl (tvb, pos)); + proto_tree_add_int (rngrsp_tree, + hf_docsis_rngrsp_timing_adj, tvb, pos, + tlvlen, tim); + } + else + { + THROW (ReportedBoundsError); + } + break; + case RNGRSP_PWR_LEVEL_ADJ: + if (tlvlen == 1) + { + pwr = byte_to_signed (tvb_get_guint8 (tvb, pos)); + proto_tree_add_int (rngrsp_tree, hf_docsis_rngrsp_power_adj, + tvb, pos, tlvlen, pwr); + } + else + { + THROW (ReportedBoundsError); + } + break; + case RNGRSP_OFFSET_FREQ_ADJ: + if (tlvlen == 2) + { + proto_tree_add_item (rngrsp_tree, hf_docsis_rngrsp_freq_adj, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case RNGRSP_TRANSMIT_EQ_ADJ: + proto_tree_add_item (rngrsp_tree, hf_docsis_rngrsp_xmit_eq_adj, + tvb, pos, tlvlen, FALSE); + break; + case RNGRSP_RANGING_STATUS: + if (tlvlen == 1) + proto_tree_add_item (rngrsp_tree, + hf_docsis_rngrsp_ranging_status, tvb, + pos, tlvlen, FALSE); + else + { + THROW (ReportedBoundsError); + } + break; + case RNGRSP_DOWN_FREQ_OVER: + if (tlvlen == 4) + proto_tree_add_item (rngrsp_tree, + hf_docsis_rngrsp_down_freq_over, tvb, + pos, tlvlen, FALSE); + else + { + THROW (ReportedBoundsError); + } + break; + case RNGRSP_UP_CHID_OVER: + if (tlvlen == 1) + proto_tree_add_item (rngrsp_tree, + hf_docsis_rngrsp_upstream_ch_over, tvb, + pos, tlvlen, FALSE); + else + { + THROW (ReportedBoundsError); + } + break; + + } /* switch(tlvtype) */ + pos = pos + tlvlen; + } /* while (pos < length) */ + } /* 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_rngrsp (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_rngrsp, + {"RNG-RSP Message", "docsis.rngrsp", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Ranging Response Message", HFILL} + }, + {&hf_docsis_rngrsp_sid, + {"Service Identifier", "docsis.rngrsp.sid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_rngrsp_upstream_chid, + {"Upstream Channel ID", "docsis.rngrsp.upchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel ID", HFILL} + }, + {&hf_docsis_rngrsp_timing_adj, + {"Timing Adjust (6.25us/64)", "docsis.rngrsp.timingadj", + FT_INT32, BASE_DEC, NULL, 0x0, + "Timing Adjust", HFILL} + }, + {&hf_docsis_rngrsp_power_adj, + {"Power Level Adjust (0.25dB units)", "docsis.rngrsp.poweradj", + FT_INT8, BASE_DEC, NULL, 0x0, + "Power Level Adjust", HFILL} + }, + {&hf_docsis_rngrsp_freq_adj, + {"Offset Freq Adjust (Hz)", "docsis.rngrsp.freqadj", + FT_INT16, BASE_DEC, NULL, 0x0, + "Frequency Adjust", HFILL} + }, + {&hf_docsis_rngrsp_xmit_eq_adj, + {"Transmit Equalisation Adjust", "docsis.rngrsp.xmit_eq_adj", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Timing Equalisation Adjust", HFILL} + }, + {&hf_docsis_rngrsp_ranging_status, + {"Ranging Status", "docsis.rngrsp.rng_stat", + FT_UINT8, BASE_DEC, VALS (rng_stat_vals), 0x0, + "Ranging Status", HFILL} + }, + {&hf_docsis_rngrsp_down_freq_over, + {"Downstream Frequency Override (Hz)", "docsis.rngrsp.freq_over", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Downstream Frequency Override", HFILL} + }, + {&hf_docsis_rngrsp_upstream_ch_over, + {"Upstream Channel ID Override", "docsis.rngrsp.chid_override", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel ID Override", HFILL} + }, + + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_rngrsp, + }; + +/* Register the protocol name and description */ + proto_docsis_rngrsp = proto_register_protocol ("DOCSIS Ranging Response", + "DOCSIS RNG-RSP", + "docsis_rngrsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_rngrsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_rngrsp", dissect_rngrsp, proto_docsis_rngrsp); +} + + +/* 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_rngrsp (void) +{ + dissector_handle_t docsis_rngrsp_handle; + + docsis_rngrsp_handle = find_dissector ("docsis_rngrsp"); + dissector_add ("docsis_mgmt", 0x05, docsis_rngrsp_handle); + +} diff --git a/plugins/docsis/packet-tlv.c b/plugins/docsis/packet-tlv.c new file mode 100644 index 0000000000..1d2e10d64f --- /dev/null +++ b/plugins/docsis/packet-tlv.c @@ -0,0 +1,2867 @@ +/* packet-tlv.c + * Routines to Dissect Appendix C TLV's + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> +#include "packet-tlv.h" + +/* This module will dissect the Appendix C TLV's. Please see: + * http://www.cablemodem.com/specifications.html + * + * The main dissector is dissect_tlv. This routine will dissect + * top level TLV's and call sub-dissectors for the sub-TLV's. + */ + +/* Initialize the protocol and registered fields */ +static int proto_docsis_tlv = -1; +static int hf_docsis_tlv = -1; +static int hf_docsis_tlv_down_freq = -1; +static int hf_docsis_tlv_upstream_chid = -1; +static int hf_docsis_tlv_net_access = -1; +static int hf_docsis_tlv_cos = -1; +static int hf_docsis_tlv_mcap = -1; +static int hf_docsis_tlv_privacy_enable = -1; +static int hf_docsis_tlv_max_cpe = -1; +static int hf_docsis_tlv_max_classifiers = -1; +static int hf_docsis_tlv_snmp_access = -1; +static int hf_docsis_tlv_snmp_obj = -1; +static int hf_docsis_tlv_svc_unavail = -1; +static int hf_docsis_tlv_svc_unavail_classid = -1; +static int hf_docsis_tlv_svc_unavail_type = -1; +static int hf_docsis_tlv_svc_unavail_code = -1; +static int hf_docsis_tlv_bpi = -1; +static int hf_docsis_tlv_phs = -1; +static int hf_docsis_tlv_hmac_digest = -1; +static int hf_docsis_tlv_tftp_server_timestamp = -1; +static int hf_docsis_tlv_tftp_prov_modem_address = -1; +static int hf_docsis_tlv_upclsfr = -1; +static int hf_docsis_tlv_downclsfr = -1; +static int hf_docsis_tlv_upsflow = -1; +static int hf_docsis_tlv_downsflow = -1; +static int hf_docsis_tlv_vendor_spec = -1; +static int hf_docsis_tlv_cm_mic = -1; +static int hf_docsis_tlv_cmts_mic = -1; +static int hf_docsis_tlv_auth_block = -1; +static int hf_docsis_tlv_key_seq_num = -1; +static int hf_docsis_tlv_snmpv3_kick = -1; +static int hf_docsis_tlv_snmpv3_kick_name = -1; +static int hf_docsis_tlv_snmpv3_kick_publicnum = -1; +static int hf_docsis_tlv_mfgr_cvc = -1; +static int hf_docsis_tlv_cosign_cvc = -1; +static int hf_docsis_tlv_vendor_id = -1; +static int hf_docsis_tlv_sw_file = -1; +static int hf_docsis_tlv_sw_upg_srvr = -1; +static int hf_docsis_tlv_cpe_ethernet = -1; +static int hf_docsis_tlv_modem_addr = -1; +static int hf_docsis_tlv_rng_tech = -1; +static int hf_docsis_tlv_subs_mgmt_ctrl = -1; +static int hf_docsis_tlv_subs_mgmt_ip_table = -1; +static int hf_docsis_tlv_subs_mgmt_ip_entry = -1; +static int hf_docsis_tlv_subs_mgmt_filter_grps = -1; + +static int hf_docsis_tlv_cos_id = -1; +static int hf_docsis_tlv_cos_sid = -1; +static int hf_docsis_tlv_cos_max_down = -1; +static int hf_docsis_tlv_cos_max_up = -1; +static int hf_docsis_tlv_cos_up_chnl_pri = -1; +static int hf_docsis_tlv_cos_min_grntd_up = -1; +static int hf_docsis_tlv_cos_max_up_burst = -1; +static int hf_docsis_tlv_cos_privacy_enable = -1; + +static int hf_docsis_tlv_mcap_concat = -1; +static int hf_docsis_tlv_mcap_docs_ver = -1; +static int hf_docsis_tlv_mcap_frag = -1; +static int hf_docsis_tlv_mcap_phs = -1; +static int hf_docsis_tlv_mcap_igmp = -1; +static int hf_docsis_tlv_mcap_down_said = -1; +static int hf_docsis_tlv_mcap_up_sid = -1; +static int hf_docsis_tlv_mcap_privacy = -1; +static int hf_docsis_tlv_mcap_8021P_filter = -1; +static int hf_docsis_tlv_mcap_8021Q_filter = -1; +static int hf_docsis_tlv_mcap_xmit_eq_taps_per_sym = -1; +static int hf_docsis_tlv_mcap_xmit_eq_taps = -1; +static int hf_docsis_tlv_mcap_dcc = -1; + +static int hf_docsis_tlv_clsfr_ref = -1; +static int hf_docsis_tlv_clsfr_id = -1; +static int hf_docsis_tlv_clsfr_sflow_ref = -1; +static int hf_docsis_tlv_clsfr_sflow_id = -1; +static int hf_docsis_tlv_clsfr_rule_pri = -1; +static int hf_docsis_tlv_clsfr_act_state = -1; +static int hf_docsis_tlv_clsfr_dsc_act = -1; +static int hf_docsis_tlv_clsfr_err = -1; +static int hf_docsis_tlv_ipclsfr = -1; +static int hf_docsis_tlv_ethclsfr = -1; +static int hf_docsis_tlv_dot1qclsfr = -1; + +static int hf_docsis_tlv_clsfr_vendor_spc = -1; + +static int hf_docsis_tlv_clsfr_err_param = -1; +static int hf_docsis_tlv_clsfr_err_code = -1; +static int hf_docsis_tlv_clsfr_err_msg = -1; + +static int hf_docsis_tlv_ipclsfr_tosmask = -1; +static int hf_docsis_tlv_ipclsfr_ipproto = -1; +static int hf_docsis_tlv_ipclsfr_src = -1; +static int hf_docsis_tlv_ipclsfr_dst = -1; +static int hf_docsis_tlv_ipclsfr_srcmask = -1; +static int hf_docsis_tlv_ipclsfr_dstmask = -1; +static int hf_docsis_tlv_ipclsfr_sport_start = -1; +static int hf_docsis_tlv_ipclsfr_sport_end = -1; +static int hf_docsis_tlv_ipclsfr_dport_start = -1; +static int hf_docsis_tlv_ipclsfr_dport_end = -1; + +static int hf_docsis_tlv_ethclsfr_dmac = -1; +static int hf_docsis_tlv_ethclsfr_smac = -1; +static int hf_docsis_tlv_ethclsfr_ethertype = -1; + +static int hf_docsis_tlv_dot1qclsfr_user_pri = -1; +static int hf_docsis_tlv_dot1qclsfr_vlanid = -1; +static int hf_docsis_tlv_dot1qclsfr_vendorspec = -1; + +static int hf_docsis_tlv_sflow_ref = -1; +static int hf_docsis_tlv_sflow_id = -1; +static int hf_docsis_tlv_sflow_sid = -1; +static int hf_docsis_tlv_sflow_classname = -1; +static int hf_docsis_tlv_sflow_qos_param = -1; +static int hf_docsis_tlv_sflow_err = -1; +static int hf_docsis_tlv_sflow_traf_pri = -1; +static int hf_docsis_tlv_sflow_max_sus = -1; +static int hf_docsis_tlv_sflow_max_burst = -1; +static int hf_docsis_tlv_sflow_min_traf = -1; +static int hf_docsis_tlv_sflow_ass_min_pkt_size = -1; +static int hf_docsis_tlv_sflow_timeout_active = -1; +static int hf_docsis_tlv_sflow_timeout_admitted = -1; +static int hf_docsis_tlv_sflow_vendor_spec = -1; +static int hf_docsis_tlv_sflow_max_concat_burst = -1; +static int hf_docsis_tlv_sflow_sched_type = -1; +static int hf_docsis_tlv_sflow_reqxmit_pol = -1; +static int hf_docsis_tlv_sflow_nominal_polling = -1; +static int hf_docsis_tlv_sflow_tolerated_jitter = -1; +static int hf_docsis_tlv_sflow_ugs_size = -1; +static int hf_docsis_tlv_sflow_nom_grant_intvl = -1; +static int hf_docsis_tlv_sflow_tol_grant_jitter = -1; +static int hf_docsis_tlv_sflow_grants_per_intvl = -1; +static int hf_docsis_tlv_sflow_ip_tos_overwrite = -1; +static int hf_docsis_tlv_sflow_ugs_timeref = -1; +static int hf_docsis_tlv_sflow_max_down_latency = -1; + +static int hf_docsis_tlv_sflow_err_param = -1; +static int hf_docsis_tlv_sflow_err_code = -1; +static int hf_docsis_tlv_sflow_err_msg = -1; + +static int hf_docsis_tlv_phs_class_ref = -1; +static int hf_docsis_tlv_phs_class_id = -1; +static int hf_docsis_tlv_phs_sflow_ref = -1; +static int hf_docsis_tlv_phs_sflow_id = -1; +static int hf_docsis_tlv_phs_dsc_action = -1; +static int hf_docsis_tlv_phs_err = -1; +static int hf_docsis_tlv_phs_phsf = -1; +static int hf_docsis_tlv_phs_phsm = -1; +static int hf_docsis_tlv_phs_phsv = -1; +static int hf_docsis_tlv_phs_phsi = -1; +static int hf_docsis_tlv_phs_phss = -1; +static int hf_docsis_tlv_phs_vendorspec = -1; + +static int hf_docsis_tlv_phs_err_param = -1; +static int hf_docsis_tlv_phs_err_code = -1; +static int hf_docsis_tlv_phs_err_msg = -1; + +/* Initialize the subtree pointers */ +static gint ett_docsis_tlv = -1; +static gint ett_docsis_tlv_cos = -1; +static gint ett_docsis_tlv_mcap = -1; +static gint ett_docsis_tlv_clsfr = -1; +static gint ett_docsis_tlv_clsfr_ip = -1; +static gint ett_docsis_tlv_clsfr_eth = -1; +static gint ett_docsis_tlv_clsfr_err = -1; +static gint ett_docsis_tlv_phs = -1; +static gint ett_docsis_tlv_phs_err = -1; +static gint ett_docsis_tlv_clsfr_dot1q = -1; +static gint ett_docsis_tlv_reqxmitpol = -1; +static gint ett_docsis_tlv_sflow_err = -1; +static gint ett_docsis_tlv_svc_unavail = -1; +static gint ett_docsis_tlv_snmpv3_kick = -1; + +static const true_false_string on_off_tfs = { + "On", + "Off" +}; + +static const value_string on_off_vals[] = { + {0, "Off"}, + {1, "On"}, + {0, NULL}, +}; + +static const true_false_string ena_dis_tfs = { + "Enable", + "Disable" +}; + +static const value_string docs_ver_vals[] = { + {0, "v1.0"}, + {1, "v1.1"}, + {0, NULL}, +}; + +static const true_false_string activation_tfs = { + "Active", + "Inactive" +}; + +static const value_string dsc_act_vals[] = { + {0, "DSC Add Classifier"}, + {1, "DSC Replace Classifier"}, + {2, "DSC Delete Classifier"}, + {0, NULL}, +}; + +static const value_string qos_param_vals[] = { + {0x01, "Apply to provisioned set only"}, + {0x02, "Perform admission control add apply to addmitted set"}, + {0x03, "Apply to provisioned and admitted set; Perform admission control"}, + {0x04, "Perform admission control if needed and apply to active set"}, + {0x05, + "Apply to provisioned and active sets; Admission control on admitted set in separate service flow, and activate service flow"}, + {0x06, + "Perform admission control and activate; Apply to admitted and active sets"}, + {0x07, + "Apply to Provisioned, Active and Admitted Sets; Admission Control and Activate Service Flow"}, + {0, NULL}, +}; + +static const value_string sched_type_vals[] = { + {0, "Reserved"}, + {1, "Undefined (CMTS Dependent)"}, + {2, "Best Effort Service"}, + {3, "Non-Real-Time Polling Service"}, + {4, "Real-Time Polling Service"}, + {5, "Unsolicited Grant Service w/Activity Detection"}, + {6, "Unsolicited Grant Service"}, + {0, NULL}, +}; + +static const value_string action_vals[] = { + {0, "Add PHS Rule"}, + {1, "Set PHS Rule"}, + {2, "Delete PHS Rule"}, + {3, "Delete all PHS Rules"}, + {0, NULL}, +}; + +static const true_false_string verify_tfs = { + "Don't Verify", + "Verify" +}; + +static const value_string rng_tech_vals[] = { + {0, "Perform initial maintenance on new channel"}, + {1, "Perform only station maintenance on new channel"}, + {2, + "Perform either initial maintenance or station maintenance on new channel"}, + {3, + "Use the new channel directly without performing initial or station maintenance"}, + {0, NULL}, +}; + + +const value_string docsis_conf_code[] = { + {0, "okay/success"}, + {1, "Reject: Other/Auth failure (1.0)"}, + {2, "Reject: Unrecognized configuration setting/COS failure (1.0)"}, + {3, "Reject: Temporary/Reject resource"}, + {4, "Reject: Permanent/Reject rdmin"}, + {5, "Reject: Not owner"}, + {6, "Reject: Service flow not found"}, + {7, "Reject: Service flow exists"}, + {8, "Reject: Required parameter not present"}, + {9, "Reject: Header suppression"}, + {10, "Reject: Unknown transaction id"}, + {11, "Reject: Authentication failure"}, + {12, "Reject: Add aborted"}, + {13, "Reject: Multiple errors"}, + {14, "Reject: Classifier not found"}, + {15, "Reject: Classifier exists"}, + {16, "Reject: PHS rule not found"}, + {17, "Reject: PHS rule exists"}, + {18, "Reject: Duplicate reference ID or index in message"}, + {19, "Reject: Multiple upstream service flows"}, + {20, "Reject: Multiple downstream service flows"}, + {21, "Reject: Classifier for another service flow "}, + {22, "Reject: PHS for another service flow "}, + {23, "Reject: Parameter invalid for context"}, + {24, "Reject: Authorization failure"}, + {25, "Reject: Temporary DCC"}, + {180, "Depart"}, + {181, "Arrive"}, + {182, "Reject: Already There"}, + {200, "Reject: Major Service Flow Error"}, + {201, "Reject: Major Classifier Error"}, + {202, "Reject: Major PHS Rule Error"}, + {203, "Reject: Multiple Major Errors"}, + {204, "Reject: Message Syntax Error"}, + {205, "Reject: Primary Service Flow Error"}, + {206, "Reject: Message Too Big"}, + {207, "Reject: Invalid Modem Capabilities"}, + {0, NULL} +}; + + + +/* Code to actually dissect the packets */ +static void +dissect_phs_err (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *err_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "5 Service Flow Error Encodings (Length = %u)", len); + err_tree = proto_item_add_subtree (it, ett_docsis_tlv_sflow_err); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case PHS_ERR_PARAM: + if (length == 1) + { + proto_tree_add_item (err_tree, hf_docsis_tlv_phs_err_param, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_ERR_CODE: + if (length == 1) + { + proto_tree_add_item (err_tree, hf_docsis_tlv_phs_err_code, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_ERR_MSG: + proto_tree_add_item (err_tree, hf_docsis_tlv_phs_err_msg, tvb, pos, + length, FALSE); + break; + } /* switch */ + pos = pos + length; + + } /* while */ +} + +static void +dissect_phs (tvbuff_t * tvb, proto_tree * tree, guint16 start, guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *phs_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "26 PHS Encodings (Length = %u)", len); + phs_tree = proto_item_add_subtree (it, ett_docsis_tlv_phs); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case PHS_CLSFR_REF: + if (length == 1) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_class_ref, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_CLSFR_ID: + if (length == 2) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_class_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_SFLOW_REF: + if (length == 2) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_sflow_ref, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_SFLOW_ID: + if (length == 4) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_sflow_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_DSC_ACTION: + if (length == 1) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_dsc_action, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_ERRORS: + dissect_phs_err (tvb, phs_tree, pos, length); + case PHS_FIELD: + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_phsf, tvb, pos, + length, FALSE); + break; + case PHS_INDEX: + if (length == 1) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_phsi, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_MASK: + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_phsm, tvb, pos, + length, FALSE); + break; + case PHS_SUP_SIZE: + if (length == 1) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_phss, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_VERIFICATION: + if (length == 1) + { + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_phsf, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case PHS_VENDOR_SPEC: + proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_vendorspec, tvb, + pos, length, FALSE); + break; + } /* switch */ + pos = pos + length; + + } /* while */ +} + + +static void +dissect_reqxmit_policy (tvbuff_t * tvb, proto_tree * tree, guint16 start) +{ + guint32 value; + proto_item *it; + proto_tree *pol_tree; + + value = tvb_get_ntohl (tvb, start); + it = + proto_tree_add_item (tree, hf_docsis_tlv_sflow_reqxmit_pol, tvb, start, 4, + FALSE); + pol_tree = proto_item_add_subtree (it, ett_docsis_tlv_reqxmitpol); + + if (value & 0x100) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT use \"all CMs\" broadcast request opportunities"); + if (value & 0x80) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT use priority multicast request opportunities"); + if (value & 0x40) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT use Request/Data opportunities for requests"); + if (value & 0x20) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT use Request/Data opportunities for data"); + if (value & 0x10) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT use piggy back requests with data"); + if (value & 0x08) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT concatenate data"); + if (value & 0x04) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT fragment data"); + if (value & 0x02) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST NOT suppress payload headers"); + if (value & 0x01) + proto_tree_add_text (pol_tree, tvb, start, 4, + "Service flow MUST drop packets that do not fit in the UGS size"); +} + +static void +dissect_sflow_err (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *err_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "5 Service Flow Error Encodings (Length = %u)", len); + err_tree = proto_item_add_subtree (it, ett_docsis_tlv_sflow_err); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case SFW_ERR_PARAM: + if (length == 1) + { + proto_tree_add_item (err_tree, hf_docsis_tlv_sflow_err_param, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_ERR_CODE: + if (length == 1) + { + proto_tree_add_item (err_tree, hf_docsis_tlv_sflow_err_code, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_ERR_MSG: + proto_tree_add_item (err_tree, hf_docsis_tlv_sflow_err_msg, tvb, + pos, length, FALSE); + break; + } /* switch */ + pos = pos + length; + + } /* while */ +} + +static void +dissect_downstream_sflow (tvbuff_t * tvb, proto_tree * sflow_tree, + guint16 start, guint16 len) +{ + guint8 type, length; + guint16 pos = start; + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case SFW_MAX_DOWN_LAT: + if (length == 4) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_max_down_latency, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + + } + break; + } /* switch */ + pos = pos + length; + + } /* while */ +} + +static void +dissect_upstream_sflow (tvbuff_t * tvb, proto_tree * sflow_tree, + guint16 start, guint16 len) +{ + guint8 type, length; + guint16 pos = start; + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case SFW_MAX_CONCAT_BURST: + if (length == 2) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_max_concat_burst, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + + } + break; + case SFW_SCHEDULING_TYPE: + if (length == 1) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_sched_type, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_REQ_XMIT_POL: + dissect_reqxmit_policy (tvb, sflow_tree, pos); + break; + case SFW_NOM_POLL_INT: + if (length == 4) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_nominal_polling, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_POLL_JTTR_TOL: + if (length == 4) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_tolerated_jitter, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_UG_SIZE: + if (length == 2) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_ugs_size, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_NOM_GRNT_INTV: + if (length == 4) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_nom_grant_intvl, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_GRNT_JTTR_TOL: + if (length == 4) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_tol_grant_jitter, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_GRNTS_PER_INTV: + if (length == 1) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_grants_per_intvl, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_IP_TOS_OVERWRITE: + if (length == 2) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_ip_tos_overwrite, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_UG_TIME_REF: + if (length == 4) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_ugs_timeref, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + + } /* switch */ + pos = pos + length; + + } /* while */ +} + +static void +dissect_sflow (tvbuff_t * tvb, proto_tree * tree, guint16 start, guint16 len, + guint8 direction) +{ + guint8 type, length; + proto_item *it; + proto_tree *sflow_tree; + guint16 pos = start; + if (direction == 24) + it = + proto_tree_add_text (tree, tvb, start, len, + "24 Upstream Service Flow (Length = %u)", len); + else if (direction == 25) + it = + proto_tree_add_text (tree, tvb, start, len, + "25 Downstream Service Flow (Length = %u)", len); + else + return; + sflow_tree = proto_item_add_subtree (it, ett_docsis_tlv_clsfr); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case SFW_REF: + if (length == 2) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_ref, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_ID: + if (length == 4) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_SID: + if (length == 2) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_sid, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_SERVICE_CLASS_NAME: + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_classname, tvb, + pos, length, FALSE); + break; + case SFW_ERRORS: + dissect_sflow_err (tvb, sflow_tree, pos, length); + break; + case SFW_QOS_SET_TYPE: + if (length == 1) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_qos_param, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_TRAF_PRI: + if (length == 1) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_traf_pri, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_MAX_SUSTAINED: + if (length == 4) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_max_sus, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_MAX_BURST: + if (length == 4) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_max_burst, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_MIN_RSVD_TRAF: + if (length == 4) + { + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_min_traf, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_MIN_RSVD_PACKETSIZE: + if (length == 2) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_ass_min_pkt_size, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_ACTIVE_QOS_TIMEOUT: + if (length == 2) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_timeout_active, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_ADMITT_QOS_TIMEOUT: + if (length == 2) + { + proto_tree_add_item (sflow_tree, + hf_docsis_tlv_sflow_timeout_admitted, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case SFW_VENDOR_SPEC: + proto_tree_add_item (sflow_tree, hf_docsis_tlv_sflow_vendor_spec, + tvb, pos, length, FALSE); + break; + default: + if (direction == 24) + dissect_upstream_sflow (tvb, sflow_tree, pos - 2, length); + else + dissect_downstream_sflow (tvb, sflow_tree, pos - 2, length); + break; + + } /* switch (type) */ + pos = pos + length; + } /* while(pos < start + len) */ + +} + +static void +dissect_dot1q_clsfr (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *dot1qclsfr_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "11 801.1P/Q Classifiers (Length = %u)", len); + dot1qclsfr_tree = proto_item_add_subtree (it, ett_docsis_tlv_cos); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case CFR_D1Q_USER_PRI: + if (length == 2) + { + proto_tree_add_item (dot1qclsfr_tree, + hf_docsis_tlv_dot1qclsfr_user_pri, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_D1Q_VLAN_ID: + if (length == 2) + { + proto_tree_add_item (dot1qclsfr_tree, + hf_docsis_tlv_dot1qclsfr_vlanid, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_D1Q_VENDOR_SPEC: + proto_tree_add_item (dot1qclsfr_tree, + hf_docsis_tlv_dot1qclsfr_vendorspec, tvb, pos, + length, FALSE); + break; + } /* switch */ + pos = pos + length; + + } /* while */ +} + +static void +dissect_eth_clsfr (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *ethclsfr_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "10 Ethernet Classifiers (Length = %u)", len); + ethclsfr_tree = proto_item_add_subtree (it, ett_docsis_tlv_clsfr_eth); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case CFR_ETH_DST_MAC: + if (length == 6) + { + proto_tree_add_item (ethclsfr_tree, hf_docsis_tlv_ethclsfr_dmac, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_ETH_SRC_MAC: + if (length == 6) + { + proto_tree_add_item (ethclsfr_tree, hf_docsis_tlv_ethclsfr_smac, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_ETH_DSAP: + if (length == 3) + { + proto_tree_add_item (ethclsfr_tree, + hf_docsis_tlv_ethclsfr_ethertype, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch */ + pos = pos + length; + + } /* while */ + + + +} + +static void +dissect_clsfr_err (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *err_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "8 Classifier Error Encodings (Length = %u)", len); + err_tree = proto_item_add_subtree (it, ett_docsis_tlv_clsfr_err); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case CFR_ERR_PARAM: + if (len == 1) + proto_tree_add_item (err_tree, hf_docsis_tlv_clsfr_err_param, tvb, + pos, length, FALSE); + else if (len == 2) + { + proto_tree_add_item (err_tree, hf_docsis_tlv_clsfr_err_param, + tvb, pos, 1, FALSE); + proto_tree_add_item (err_tree, hf_docsis_tlv_clsfr_err_param, + tvb, pos + 1, 1, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_ERR_CODE: + if (length == 1) + { + proto_tree_add_item (err_tree, hf_docsis_tlv_clsfr_err_code, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_ERR_MSG: + proto_tree_add_item (err_tree, hf_docsis_tlv_clsfr_err_msg, tvb, + pos, length, FALSE); + break; + } /* switch */ + pos = pos + length; + + } /* while */ + + + +} + +static void +dissect_ip_classifier (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *ipclsfr_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "9 IP Classifier (Length = %u)", len); + ipclsfr_tree = proto_item_add_subtree (it, ett_docsis_tlv_clsfr_ip); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case CFR_IP_TOS_RANGE_MASK: + if (length == 3) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_tosmask, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_PROTO: + if (length == 2) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_ipproto, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_SOURCE_ADDR: + if (length == 4) + { + proto_tree_add_item (ipclsfr_tree, hf_docsis_tlv_ipclsfr_src, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_SOURCE_MASK: + if (length == 4) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_srcmask, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_DEST_ADDR: + if (length == 4) + { + proto_tree_add_item (ipclsfr_tree, hf_docsis_tlv_ipclsfr_dst, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_DEST_MASK: + if (length == 4) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_dstmask, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_SRCPORT_START: + if (length == 2) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_sport_start, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_SRCPORT_END: + if (length == 2) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_sport_end, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_DSTPORT_START: + if (length == 2) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_dport_start, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_IP_DSTPORT_END: + if (length == 2) + { + proto_tree_add_item (ipclsfr_tree, + hf_docsis_tlv_ipclsfr_dport_end, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch */ + pos = pos + length; + + } /* while */ + +} +static void +dissect_classifiers (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len, guint8 direction) +{ + guint8 type, length; + proto_item *it; + proto_tree *clsfr_tree; + guint16 pos = start; + if (direction == 22) + it = + proto_tree_add_text (tree, tvb, start, len, + "22 Upstream Packet Classifier (Length = %u)", + len); + else if (direction == 23) + it = + proto_tree_add_text (tree, tvb, start, len, + "23 Downstream Packet Classifier (Length = %u)", + len); + else + return; + clsfr_tree = proto_item_add_subtree (it, ett_docsis_tlv_clsfr); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case CFR_REF: + if (length == 1) + { + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_ref, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_ID: + if (length == 2) + { + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_SFLOW_REF: + if (length == 2) + { + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_sflow_ref, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_SFLOW_ID: + if (length == 4) + { + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_sflow_id, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_RULE_PRI: + if (length == 1) + { + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_rule_pri, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_ACT_STATE: + if (length == 1) + { + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_act_state, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_DSA_ACTION: + if (length == 1) + { + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_dsc_act, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CFR_ERROR: + dissect_clsfr_err (tvb, clsfr_tree, pos, length); + break; + case CFR_IP_CLASSIFIER: + dissect_ip_classifier (tvb, clsfr_tree, pos, length); + break; + case CFR_ETH_CLASSIFIER: + dissect_eth_clsfr (tvb, clsfr_tree, pos, length); + break; + case CFR_8021Q_CLASSIFIER: + dissect_dot1q_clsfr (tvb, clsfr_tree, pos, length); + break; + case CFR_VENDOR_SPEC: + proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_vendor_spc, + tvb, pos, length, FALSE); + break; + } /* switch */ + pos = pos + length; + + } /* while */ + + + +} + +static void +dissect_doc10cos (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *doc10cos_tree; + guint16 pos = start; + it = + proto_tree_add_text (tree, tvb, start, len, + "1 Docsis 1.0 Class of Service (Length = %u)", len); + doc10cos_tree = proto_item_add_subtree (it, ett_docsis_tlv_cos); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case 1: + if (length == 1) + { + proto_tree_add_item (doc10cos_tree, hf_docsis_tlv_cos_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case 2: + if (length == 2) + { + proto_tree_add_item (doc10cos_tree, hf_docsis_tlv_cos_sid, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch */ + pos = pos + length; + + } /* while */ +} + +static void +dissect_modemcap (tvbuff_t * tvb, proto_tree * tree, guint16 start, + guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *mcap_tree; + guint16 pos = start; + + it = + proto_tree_add_text (tree, tvb, start, len, + "5 Modem Capabilities Type (Length = %u)", len); + + mcap_tree = proto_item_add_subtree (it, ett_docsis_tlv_mcap); + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case CAP_CONCAT: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_concat, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_DOCSIS_VER: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_docs_ver, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_FRAG: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_frag, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_PHS: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_phs, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_IGMP: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_igmp, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_PRIVACY: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_privacy, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_DOWN_SAID: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_down_said, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_UP_SID: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_up_sid, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_OPT_FILT: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_8021P_filter, + tvb, pos, length, FALSE); + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_8021Q_filter, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_XMIT_EQPERSYM: + if (length == 1) + { + proto_tree_add_item (mcap_tree, + hf_docsis_tlv_mcap_xmit_eq_taps_per_sym, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_NUM_XMIT_EQ_TAPS: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_xmit_eq_taps, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case CAP_DCC: + if (length == 1) + { + proto_tree_add_item (mcap_tree, hf_docsis_tlv_mcap_dcc, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch (type) */ + pos = pos + length; + } /* while (pos < pos+len) */ + +} + +static void +dissect_cos (tvbuff_t * tvb, proto_tree * tree, guint16 start, guint16 len) +{ + guint8 type, length; + proto_item *it; + proto_tree *cos_tree; + guint16 pos = start; + + it = + proto_tree_add_text (tree, tvb, start, len, + "4 Class of Service Type (Length = %u)", len); + cos_tree = proto_item_add_subtree (it, ett_docsis_tlv_cos); + + while (pos < (start + len)) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case COS_CLASSID: + if (length == 1) + { + proto_tree_add_item (cos_tree, hf_docsis_tlv_cos_id, tvb, pos, + length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case COS_MAX_DOWN: + if (length == 4) + { + proto_tree_add_item (cos_tree, hf_docsis_tlv_cos_max_down, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case COS_MAX_UP: + if (length == 4) + { + proto_tree_add_item (cos_tree, hf_docsis_tlv_cos_max_up, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case COS_UP_CH_PRIO: + if (length == 1) + { + proto_tree_add_item (cos_tree, hf_docsis_tlv_cos_up_chnl_pri, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case COS_MIN_UP_RATE: + if (length == 4) + { + proto_tree_add_item (cos_tree, hf_docsis_tlv_cos_min_grntd_up, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case COS_MAX_UP_BURST: + if (length == 2) + { + proto_tree_add_item (cos_tree, hf_docsis_tlv_cos_max_up_burst, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case COS_BP_ENABLE: + if (length == 1) + { + proto_tree_add_item (cos_tree, hf_docsis_tlv_cos_privacy_enable, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + + } + break; + } /* switch (type) */ + pos = pos + length; + } /* while (pos < pos+len) */ + +} + +static void +dissect_svc_unavail(tvbuff_t * tvb, proto_tree * tree, guint16 pos, guint16 length) { + + proto_item *svc_unavail_it; + proto_tree *svc_unavail_tree; + svc_unavail_it = proto_tree_add_item (tree, + hf_docsis_tlv_svc_unavail, + tvb, pos, length, FALSE); + svc_unavail_tree = proto_item_add_subtree(svc_unavail_it, ett_docsis_tlv_svc_unavail ); + proto_tree_add_item (svc_unavail_tree, + hf_docsis_tlv_svc_unavail_classid, tvb, + pos, 1, FALSE); + proto_tree_add_item (svc_unavail_tree, + hf_docsis_tlv_svc_unavail_type, tvb, + pos+1, 1, FALSE); + proto_tree_add_item (svc_unavail_tree, + hf_docsis_tlv_svc_unavail_code, tvb, + pos+2, 1, FALSE); + +} + +static void +dissect_snmpv3_kickstart(tvbuff_t * tvb, proto_tree *tree, guint16 start, guint16 len) { + proto_item *snmpv3_it; + proto_tree *snmpv3_tree; + guint8 type, length; + guint16 pos = start; + + snmpv3_it = proto_tree_add_item (tree, + hf_docsis_tlv_snmpv3_kick, + tvb, start, len, FALSE); + snmpv3_tree = proto_item_add_subtree(snmpv3_it, ett_docsis_tlv_snmpv3_kick); + + while (pos < (start + len)) { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) { + case SNMPV3_SEC_NAME: + proto_tree_add_item (snmpv3_tree, + hf_docsis_tlv_snmpv3_kick_name, tvb, + pos, length, FALSE); + break; + case SNMPV3_MGR_PUB_NUM: + proto_tree_add_item (snmpv3_tree, + hf_docsis_tlv_snmpv3_kick_publicnum, tvb, + pos, length, FALSE); + break; + } /* switch */ + pos += length; + } /* while */ +} + +static void +dissect_tlv (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *tlv_tree; + guint16 total_len; + guint16 pos = 0; + guint8 type, length; + guint16 x; + + total_len = tvb_length_remaining (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + col_clear (pinfo->cinfo, COL_INFO); + + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_tlv, tvb, 0, + tvb_length_remaining (tvb, 0), + "TLV Data"); + tlv_tree = proto_item_add_subtree (it, ett_docsis_tlv); + while (pos < total_len) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case TLV_DOWN_FREQ: + /* This is ugly. There are multiple type 1 TLV's that may appear + * in the TLV data, the problem is that they are dependent on + * message type. */ + if (length == 4) + proto_tree_add_item (tlv_tree, hf_docsis_tlv_down_freq, tvb, + pos, length, FALSE); + else if (length == 1) + proto_tree_add_item (tlv_tree, hf_docsis_tlv_rng_tech, tvb, + pos, length, FALSE); + else + dissect_doc10cos (tvb, tlv_tree, pos, length); + break; + case TLV_CHNL_ID: + if (length == 1) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_upstream_chid, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_NET_ACCESS: + if (length == 1) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_net_access, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_COS: + dissect_cos (tvb, tlv_tree, pos, length); + break; + case TLV_MODEM_CAP: + dissect_modemcap (tvb, tlv_tree, pos, length); + break; + case TLV_CM_MIC: + if (length == 16) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_cm_mic, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_CMTS_MIC: + if (length == 16) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_cmts_mic, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_VENDOR_ID: + if (length == 3) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_vendor_id, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_SW_UPG_FILE: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_sw_file, tvb, pos, + length, FALSE); + break; + case TLV_SNMP_WRITE_CTRL: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_snmp_access, tvb, + pos, length, FALSE); + break; + case TLV_SNMP_OBJECT: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_snmp_obj, tvb, + pos, length, FALSE); + break; + case TLV_MODEM_IP: + if (length == 4) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_modem_addr, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_SVC_UNAVAIL: + if (length == 3) + { + dissect_svc_unavail(tvb, tlv_tree, pos, length); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_ETHERNET_MAC: + if (length == 6) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_cpe_ethernet, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_TEL_SETTINGS: + break; + case TLV_BPI_CONFIG: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_bpi, tvb, + pos, length, FALSE); + break; + case TLV_MAX_CPES: + if (length == 1) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_max_cpe, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_TFTP_TIME: + if (length == 4) + { + proto_tree_add_item (tlv_tree, + hf_docsis_tlv_tftp_server_timestamp, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_TFTP_MODEM_ADDRESS: + if (length == 4) + { + proto_tree_add_item (tlv_tree, + hf_docsis_tlv_tftp_prov_modem_address, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_SW_UPG_SRVR: + if (length == 4) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_sw_upg_srvr, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_UPSTREAM_CLASSIFIER: + case TLV_DOWN_CLASSIFIER: + dissect_classifiers (tvb, tlv_tree, pos, length, type); + break; + case TLV_UPSTREAM_SERVICE_FLOW: + case TLV_DOWN_SERVICE_FLOW: + dissect_sflow (tvb, tlv_tree, pos, length, type); + break; + case TLV_PHS: + dissect_phs (tvb, tlv_tree, pos, length); + break; + case TLV_HMAC_DIGEST: + if (length == 20) + { + proto_tree_add_item (tlv_tree, + hf_docsis_tlv_hmac_digest, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_MAX_CLASSIFIERS: + if (length == 2) + { + proto_tree_add_item (tlv_tree, + hf_docsis_tlv_max_classifiers, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_PRIVACY_ENABLE: + if (length == 1) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_privacy_enable, + tvb, pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_AUTH_BLOCK: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_auth_block, + tvb, pos, length, FALSE); + break; + case TLV_KEY_SEQ_NUM: + if (length == 1) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_key_seq_num, tvb, + pos, length, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_MFGR_CVC: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_mfgr_cvc, + tvb, pos, length, FALSE); + break; + case TLV_COSIGN_CVC: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_cosign_cvc, + tvb, pos, length, FALSE); + break; + case TLV_SNMPV3_KICKSTART: + dissect_snmpv3_kickstart(tvb, tlv_tree, pos, length); + break; + case TLV_SUBS_MGMT_CTRL: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_subs_mgmt_ctrl, + tvb, pos, length, FALSE); + break; + case TLV_SUBS_MGMT_CPE: + if ((length % 4) == 0) + { + proto_tree_add_item (tlv_tree, hf_docsis_tlv_subs_mgmt_ip_table, + tvb, pos, length, FALSE); + for (x = 0; x < length; x+=4) + { + proto_tree_add_item (tlv_tree, + hf_docsis_tlv_subs_mgmt_ip_entry, + tvb, pos + x, 4, FALSE); + } + } + else + { + THROW (ReportedBoundsError); + } + break; + case TLV_SUBS_MGMT_FLTR: + proto_tree_add_item (tlv_tree, + hf_docsis_tlv_subs_mgmt_filter_grps, + tvb, pos, length, FALSE); + break; + case TLV_VENDOR_SPEC: + proto_tree_add_item (tlv_tree, hf_docsis_tlv_vendor_spec, + tvb, pos, length, FALSE); + break; + case TLV_END: + break; + } /* switch(type) */ + + pos = pos + length; + } /* while (pos < total_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_tlv (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_tlv, + {"TLV Data", "docsis.tlv", + FT_BYTES, BASE_HEX, NULL, 0x0, + "TLV Data", HFILL} + }, + {&hf_docsis_tlv_down_freq, + {"1 Downstream Frequency", "docsis.tlv.downfreq", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Downstream Frequency", HFILL} + }, + {&hf_docsis_tlv_upstream_chid, + {"2 Upstream Channel ID", "docsis.tlv.upchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_tlv_net_access, + {"3 Network Access", "docsis.tlv.netaccess", + FT_BOOLEAN, BASE_DEC, TFS (&on_off_tfs), 0x0, + "Network Access TLV", HFILL} + }, + {&hf_docsis_tlv_cos, + {"4 COS Encodings", "docsis.tlv.cos", + FT_BYTES, BASE_HEX, NULL, 0x0, + "4 COS Encodings", HFILL} + }, + {&hf_docsis_tlv_cos_id, + {".1 Class ID", "docsis.tlv.cos.id", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Class ID", HFILL} + }, + {&hf_docsis_tlv_cos_sid, + {".2 Service ID", "docsis.cos.sid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service ID", HFILL} + }, + {&hf_docsis_tlv_cos_max_down, + {".2 Max Downstream Rate (bps)", "docsis.tlv.cos.maxdown", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Max Downstream Rate", HFILL} + }, + {&hf_docsis_tlv_cos_max_up, + {".3 Max Upstream Rate (bps)", "docsis.tlv.cos.maxup", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Max Upstream Rate", HFILL} + }, + {&hf_docsis_tlv_cos_up_chnl_pri, + {".4 Upstream Channel Priority", "docsis.tlv.cos.upchnlpri", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel Priority", HFILL} + }, + {&hf_docsis_tlv_cos_min_grntd_up, + {".5 Guaranteed Upstream Rate", "docsis.tlv.cos.mingrntdup", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Guaranteed Minimum Upstream Data Rate", HFILL} + }, + {&hf_docsis_tlv_cos_max_up_burst, + {".6 Maximum Upstream Burst", "docsis.tlv.cos.maxupburst", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Maximum Upstream Burst", HFILL} + }, + {&hf_docsis_tlv_cos_privacy_enable, + {".7 COS Privacy Enable", "docsis.tlv.cos.privacy_enable", + FT_BOOLEAN, BASE_DEC, TFS (&ena_dis_tfs), 0x0, + "Class of Service Privacy Enable", HFILL} + }, + {&hf_docsis_tlv_mcap, + {"5 Modem Capabilities", "docsis.tlv.mcap", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Modem Capabilities", HFILL} + }, + {&hf_docsis_tlv_mcap_concat, + {".1 Concatenation Support", "docsis.tlv.mcap.concat", + FT_BOOLEAN, BASE_DEC, TFS (&on_off_tfs), 0x0, + "Concatenation Support", HFILL} + }, + {&hf_docsis_tlv_mcap_docs_ver, + {".2 Docsis Version", "docsis.tlv.map.docsver", + FT_UINT8, BASE_DEC, VALS (docs_ver_vals), 0x0, + "DOCSIS Version", HFILL} + }, + {&hf_docsis_tlv_mcap_frag, + {".3 Fragmentation Support", "docsis.tlv.mcap.frag", + FT_BOOLEAN, BASE_DEC, TFS (&on_off_tfs), 0x0, + "Fragmentation Support", HFILL} + }, + {&hf_docsis_tlv_mcap_phs, + {".4 PHS Support", "docsis.tlv.mcap.phs", + FT_BOOLEAN, BASE_DEC, TFS (&on_off_tfs), 0x0, + "PHS Support", HFILL} + }, + {&hf_docsis_tlv_mcap_igmp, + {".5 IGMP Support", "docsis.tlv.mcap.igmp", + FT_BOOLEAN, BASE_DEC, TFS (&on_off_tfs), 0x0, + "IGMP Support", HFILL} + }, + {&hf_docsis_tlv_mcap_privacy, + {".6 Privacy Support", "docsis.tlv.mcap.privacy", + FT_BOOLEAN, BASE_DEC, TFS (&on_off_tfs), 0x0, + "Privacy Support", HFILL} + }, + {&hf_docsis_tlv_mcap_down_said, + {".7 # Downstream SAIDs Supported", "docsis.tlv.mcap.downsaid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Downstream Said Support", HFILL} + }, + {&hf_docsis_tlv_mcap_up_sid, + {".8 # Upstream SAIDs Supported", "docsis.tlv.mcap.upsid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream SID Support", HFILL} + }, + {&hf_docsis_tlv_mcap_8021P_filter, + {".9 802.1P Filtering Support", "docsis.tlv.mcap.dot1pfiltering", + FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x80, + "802.1P Filtering Support", HFILL} + }, + {&hf_docsis_tlv_mcap_8021Q_filter, + {".9 802.1Q Filtering Support", "docsis.tlv.mcap.dot1qfilt", + FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x40, + "802.1Q Filtering Support", HFILL} + }, + {&hf_docsis_tlv_mcap_xmit_eq_taps_per_sym, + {".10 Xmit Equalizer Taps/Sym", "docsis.tlv.mcap.tapspersym", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Transmit Equalizer Taps per Symbol", HFILL} + }, + {&hf_docsis_tlv_mcap_xmit_eq_taps, + {".11 # Xmit Equalizer Taps", "docsis.tlv.mcap.numtaps", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number of Transmit Equalizer Taps", HFILL} + }, + {&hf_docsis_tlv_mcap_dcc, + {".12 DCC Support", "docsis.tlv.mcap.dcc", + FT_BOOLEAN, BASE_DEC, TFS (&on_off_tfs), 0x0, + "DCC Support", HFILL} + }, + {&hf_docsis_tlv_cm_mic, + {"6 CM MIC", "docsis.tlv.cmmic", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Cable Modem Message Integrity Check", HFILL} + }, + {&hf_docsis_tlv_cmts_mic, + {"7 CMTS MIC", "docsis.tlv.cmtsmic", + FT_BYTES, BASE_HEX, NULL, 0x0, + "CMTS Message Integrity Check", HFILL} + }, + {&hf_docsis_tlv_vendor_id, + {"8 Vendor ID", "docsis.tlv.vendorid", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Vendor Identifier", HFILL} + }, + {&hf_docsis_tlv_sw_file, + {"9 Software Upgrade File", "docsis.tlv.sw_upg_file", + FT_STRINGZ, BASE_DEC, NULL, 0x0, + "Software Upgrade File", HFILL} + }, + {&hf_docsis_tlv_snmp_access, + {"10 SNMP Write Access", "docsis.tlv.snmp_access", + FT_BYTES, BASE_HEX, NULL, 0x0, + "SNMP Write Access", HFILL} + }, + {&hf_docsis_tlv_snmp_obj, + {"11 SNMP Object", "docsis.tlv.snmp_obj", + FT_BYTES, BASE_HEX, NULL, 0x0, + "SNMP Object", HFILL} + }, + {&hf_docsis_tlv_modem_addr, + {"12 Modem IP Address", "docsis.tlv.modemaddr", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Modem IP Address", HFILL} + }, + {&hf_docsis_tlv_svc_unavail, + {"13 Service Not Available Response", "docsis.tlv.svcunavail", + FT_BYTES, BASE_DEC, NULL, 0x0, + "Service Not Available Response", HFILL} + }, + {&hf_docsis_tlv_svc_unavail_classid, + {"Service Not Available: (Class ID)", "docsis.tlv.svcunavail.classid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Service Not Available (Class ID)", HFILL} + }, + {&hf_docsis_tlv_svc_unavail_type, + {"Service Not Available (Type)", "docsis.tlv.svcunavail.type", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Service Not Available (Type)", HFILL} + }, + {&hf_docsis_tlv_svc_unavail_code, + {"Service Not Available (Code)", "docsis.tlv.svcunavail.code", + FT_UINT8, BASE_DEC, VALS(docsis_conf_code), 0x0, + "Service Not Available (Code)", HFILL} + }, + {&hf_docsis_tlv_cpe_ethernet, + {"14 CPE Ethernet Addr", "docsis.tlv.cpe_ether", + FT_ETHER, BASE_DEC, NULL, 0x0, + "CPE Ethernet Addr", HFILL} + }, + {&hf_docsis_tlv_bpi, + {"17 Baseline Privacy Encoding", "docsis.tlv.bpi", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Baseline Privacy Encoding", HFILL} + }, + {&hf_docsis_tlv_max_cpe, + {"18 Max # of CPE's", "docsis.tlv.maxcpe", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Max Number of CPE's", HFILL} + }, + {&hf_docsis_tlv_tftp_server_timestamp, + {"19 TFTP Server Timestamp", "docsis.tlv.tftp_time", + FT_UINT32, BASE_DEC, NULL, 0x0, + "TFTP Server TimeStamp", HFILL} + }, + {&hf_docsis_tlv_tftp_prov_modem_address, + {"20 TFTP Server Provisioned Modem Addr", "docsis.tlv.tftpmodemaddr", + FT_IPv4, BASE_DEC, NULL, 0x0, + "TFTP Server Provisioned Modem Addr", HFILL} + }, + {&hf_docsis_tlv_sw_upg_srvr, + {"21 Software Upgrade Server", "docsis.tlv.sw_upg_srvr", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Software Upgrade Server", HFILL} + }, + {&hf_docsis_tlv_upclsfr, + {"22 Upstream Classifier", "docsis.tlv.upclsfr", + FT_BYTES, BASE_HEX, NULL, 0x0, + "22 Upstream Classifier", HFILL} + }, + {&hf_docsis_tlv_downclsfr, + {"23 Downstream Classifier", "docsis.tlv.downclsfr", + FT_BYTES, BASE_HEX, NULL, 0x0, + "23 Downstream Classifier", HFILL} + }, + {&hf_docsis_tlv_clsfr_ref, + {".1 Classifier Ref", "docsis.tlv.clsfr.ref", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Classifier Reference", HFILL} + }, + {&hf_docsis_tlv_clsfr_id, + {".2 Classifier ID", "docsis.tlv.clsfr.id", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Classifier ID", HFILL} + }, + {&hf_docsis_tlv_clsfr_sflow_ref, + {".3 Service Flow Ref", "docsis.tlv.clsfr.sflowref", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Flow Reference", HFILL} + }, + {&hf_docsis_tlv_clsfr_sflow_id, + {".4 Service Flow ID", "docsis.tlv.clsfr.sflowid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Flow ID", HFILL} + }, + {&hf_docsis_tlv_clsfr_rule_pri, + {".5 Rule Priority", "docsis.tlv.clsfr.rulepri", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Rule Priority", HFILL} + }, + {&hf_docsis_tlv_clsfr_act_state, + {".6 Activation State", "docsis.tlv.clsfr.actstate", + FT_BOOLEAN, BASE_DEC, TFS (&activation_tfs), 0x0, + "Classifier Activation State", HFILL} + }, + {&hf_docsis_tlv_clsfr_dsc_act, + {".7 DSC Action", "docsis.tlv.clsfr.dscact", + FT_UINT8, BASE_DEC, VALS (dsc_act_vals), 0x0, + "Dynamic Service Change Action", HFILL} + }, + {&hf_docsis_tlv_clsfr_err, + {".8 Error Encodings", "docsis.tlv.clsfr.err", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Error Encodings", HFILL} + }, + {&hf_docsis_tlv_clsfr_err_param, + {"..1 Param Subtype", "docsis.tlv.clsfr.err.param", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Parameter Subtype", HFILL} + }, + {&hf_docsis_tlv_clsfr_err_code, + {"..2 Error Code", "docsis.tlv.clsfr.err.code", + FT_UINT8, BASE_DEC, NULL, 0x0, + "TCP/UDP Destination Port End", HFILL} + }, + {&hf_docsis_tlv_clsfr_err_msg, + {"..3 Error Message", "docsis.tlv.clsfr.err.msg", + FT_STRINGZ, BASE_DEC, NULL, 0x0, + "Error Message", HFILL} + }, + {&hf_docsis_tlv_ipclsfr, + {".9 IP Classifier Encodings", "docsis.tlv.clsfr.ip", + FT_BYTES, BASE_HEX, NULL, 0x0, + "IP Classifier Encodings", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_tosmask, + {"..1 Type Of Service Mask", "docsis.tlv.clsfr.ip.tosmask", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Type Of Service Mask", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_ipproto, + {"..2 IP Protocol", "docsis.tlv.clsfr.ip.ipproto", + FT_UINT16, BASE_DEC, NULL, 0x0, + "IP Protocol", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_src, + {"..3 Source Address", "docsis.tlv.clsfr.ip.src", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Source Address", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_dst, + {"..4 Destination Address", "docsis.tlv.clsfr.ip.dst", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Destination Address", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_srcmask, + {"..5 Source Mask", "docsis.tlv.clsfr.ip.smask", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Source Mask", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_dstmask, + {"..6 Destination Mask", "docsis.tlv.clsfr.ip.dmask", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Destination Mask", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_sport_start, + {"..7 Source Port Start", "docsis.tlv.clsfr.ip.sportstart", + FT_UINT16, BASE_DEC, NULL, 0x0, + "TCP/UDP Source Port Start", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_sport_end, + {"..8 Source Port End", "docsis.tlv.clsfr.ip.sportend", + FT_UINT16, BASE_DEC, NULL, 0x0, + "TCP/UDP Source Port End", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_dport_start, + {"..9 Dest Port Start", "docsis.tlv.clsfr.ip.dportstart", + FT_UINT16, BASE_DEC, NULL, 0x0, + "TCP/UDP Destination Port Start", HFILL} + }, + {&hf_docsis_tlv_ipclsfr_dport_end, + {"..10 Dest Port End", "docsis.tlv.clsfr.ip.dportend", + FT_UINT16, BASE_DEC, NULL, 0x0, + "TCP/UDP Destination Port End", HFILL} + }, + {&hf_docsis_tlv_ethclsfr, + {".10 Ethernet Classifier Encodings", "docsis.tlv.clsfr.eth", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Ethernet Classifier Encodings", HFILL} + }, + {&hf_docsis_tlv_ethclsfr_dmac, + {"..1 Dest Mac Address", "docsis.tlv.clsfr.eth.dmac", + FT_ETHER, BASE_DEC, NULL, 0x0, + "Destination Mac Address", HFILL} + }, + {&hf_docsis_tlv_ethclsfr_smac, + {"..2 Source Mac Address", "docsis.tlv.clsfr.eth.smac", + FT_ETHER, BASE_DEC, NULL, 0x0, + "Source Mac Address", HFILL} + }, + {&hf_docsis_tlv_ethclsfr_ethertype, + {"..3 Ethertype", "docsis.tlv.clsfr.eth.ethertype", + FT_UINT24, BASE_HEX, NULL, 0x0, + "Ethertype", HFILL} + }, + {&hf_docsis_tlv_dot1qclsfr, + {".11 802.1Q Classifier Encodings", "docsis.tlv.clsfr.dot1q", + FT_BYTES, BASE_HEX, NULL, 0x0, + "802.1Q Classifier Encodings", HFILL} + }, + {&hf_docsis_tlv_dot1qclsfr_user_pri, + {"..1 User Priority", "docsis.tlv.clsfr.dot1q.userpri", + FT_UINT16, BASE_HEX, NULL, 0x0, + "User Priority", HFILL} + }, + {&hf_docsis_tlv_dot1qclsfr_vlanid, + {"..2 VLAN id", "docsis.tlv.clsfr.dot1q.ethertype", + FT_UINT16, BASE_DEC, NULL, 0x0, + "VLAN Id", HFILL} + }, + {&hf_docsis_tlv_dot1qclsfr_vendorspec, + {"..43 Vendor Specific Encodings", "docsis.tlv.clsfr.dot1q.vendorspec", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Vendor Specific Encodings", HFILL} + }, + {&hf_docsis_tlv_clsfr_vendor_spc, + {".43 Vendor Specific Encodings", "docsis.tlv.clsfr.vendor", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Vendor Specific Encodings", HFILL} + }, + {&hf_docsis_tlv_upsflow, + {"24 Upstream Service Flow", "docsis.tlv.upsflow", + FT_BYTES, BASE_HEX, NULL, 0x0, + "24 Upstream Service Flow", HFILL} + }, + {&hf_docsis_tlv_downsflow, + {"25 Downstream Service Flow", "docsis.tlv.downsflow", + FT_BYTES, BASE_HEX, NULL, 0x0, + "25 Downstream Service Flow", HFILL} + }, + {&hf_docsis_tlv_sflow_ref, + {".1 Service Flow Ref", "docsis.tlv.sflow.ref", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Flow Reference", HFILL} + }, + {&hf_docsis_tlv_sflow_id, + {".2 Service Flow Id", "docsis.tlv.sflow.id", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Service Flow Id", HFILL} + }, + {&hf_docsis_tlv_sflow_sid, + {".3 Service Identifier", "docsis.tlv.sflow.sid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Identifier", HFILL} + }, + {&hf_docsis_tlv_sflow_classname, + {".4 Service Class Name", "docsis.tlv.sflow.cname", + FT_STRINGZ, BASE_HEX, NULL, 0x0, + "Service Class Name", HFILL} + }, + {&hf_docsis_tlv_sflow_err, + {".5 Error Encodings", "docsis.tlv.sflow.err", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Error Encodings", HFILL} + }, + {&hf_docsis_tlv_sflow_err_param, + {"..1 Param Subtype", "docsis.tlv.sflow.err.param", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Parameter Subtype", HFILL} + }, + {&hf_docsis_tlv_sflow_err_code, + {"..2 Error Code", "docsis.tlv.sflow.err.code", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Error Code", HFILL} + }, + {&hf_docsis_tlv_sflow_err_msg, + {"..3 Error Message", "docsis.tlv.sflow.err.msg", + FT_STRINGZ, BASE_DEC, NULL, 0x0, + "Error Message", HFILL} + }, + {&hf_docsis_tlv_sflow_qos_param, + {".6 QOS Parameter Set", "docsis.tlv.sflow.qos", + FT_UINT8, BASE_BIN, VALS (qos_param_vals), 0x0, + "QOS Parameter Set", HFILL} + }, + {&hf_docsis_tlv_sflow_traf_pri, + {".7 Traffic Priority", "docsis.tlv.sflow.trafpri", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Traffic Priority", HFILL} + }, + {&hf_docsis_tlv_sflow_max_sus, + {".8 Maximum Sustained Traffic Rate (bps)", + "docsis.tlv.sflow.maxtrafrate", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Maximum Sustained Traffic Rate (bps)", HFILL} + }, + {&hf_docsis_tlv_sflow_max_burst, + {".9 Maximum Burst (bps)", "docsis.tlv.sflow.maxburst", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Maximum Burst (bps)", HFILL} + }, + {&hf_docsis_tlv_sflow_min_traf, + {".10 Minimum Traffic Rate (bps)", "docsis.tlv.sflow.mintrafrate", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Minimum Traffic Rate (bps)", HFILL} + }, + {&hf_docsis_tlv_sflow_ass_min_pkt_size, + {".11 Assumed Min Reserved Packet Size", + "docsis.tlv.sflow.assumed_min_pkt_size", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Assumed Minimum Reserved Packet Size", HFILL} + }, + {&hf_docsis_tlv_sflow_timeout_active, + {".12 Timeout for Active Params (secs)", "docsis.tlv.sflow.act_timeout", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Timeout for Active Params (secs)", HFILL} + }, + {&hf_docsis_tlv_sflow_timeout_admitted, + {".13 Timeout for Admitted Params (secs)", + "docsis.tlv.sflow.adm_timeout", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Timeout for Admitted Params (secs)", HFILL} + }, + {&hf_docsis_tlv_sflow_max_down_latency, + {".14 Maximum Downstream Latency (usec)", + "docsis.tlv.sflow.max_down_lat", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Maximum Downstream Latency (usec)", HFILL} + }, + {&hf_docsis_tlv_sflow_max_concat_burst, + {".14 Max Concat Burst", "docsis.tlv.sflow.maxconcat", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Max Concatenated Burst", HFILL} + }, + {&hf_docsis_tlv_sflow_sched_type, + {".15 Scheduling Type", "docsis.tlv.sflow.schedtype", + FT_UINT32, BASE_HEX, VALS (sched_type_vals), 0x0, + "Scheduling Type", HFILL} + }, + {&hf_docsis_tlv_sflow_reqxmit_pol, + {".16 Request/Transmission Policy", "docsis.tlv.sflow.reqxmitpol", + FT_UINT32, BASE_HEX, NULL, 0x0, + "Request/Transmission Policy", HFILL} + }, + {&hf_docsis_tlv_sflow_nominal_polling, + {".17 Nominal Polling Interval(usec)", + "docsis.tlv.sflow.nominal_polling", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Nominal Polling Interval(usec)", HFILL} + }, + {&hf_docsis_tlv_sflow_tolerated_jitter, + {".18 Tolerated Poll Jitter (usec)", "docsis.tlv.sflow.toler_jitter", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Tolerated Poll Jitter (usec)", HFILL} + }, + {&hf_docsis_tlv_sflow_ugs_size, + {".19 Unsolicited Grant Size (bytes)", "docsis.tlv.sflow.ugs_size", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Unsolicited Grant Size (bytes)", HFILL} + }, + {&hf_docsis_tlv_sflow_nom_grant_intvl, + {".20 Nominal Grant Interval (usec)", "docsis.tlv.sflow.nom_grant_intvl", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Nominal Grant Interval (usec)", HFILL} + }, + {&hf_docsis_tlv_sflow_tol_grant_jitter, + {".21 Tolerated Grant Jitter (usec)", + "docsis.tlv.sflow.tol_grant_jitter", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Tolerated Grant Jitter (usec)", HFILL} + }, + {&hf_docsis_tlv_sflow_grants_per_intvl, + {".22 Grants Per Interval", "docsis.tlv.sflow.grnts_per_intvl", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Grants Per Interval", HFILL} + }, + {&hf_docsis_tlv_sflow_ip_tos_overwrite, + {".23 IP TOS Overwrite", "docsis.tlv.sflow.iptos_overwrite", + FT_UINT16, BASE_HEX, NULL, 0x0, + "IP TOS Overwrite", HFILL} + }, + {&hf_docsis_tlv_sflow_ugs_timeref, + {".24 UGS Time Reference", "docsis.tlv.sflow.ugs_timeref", + FT_UINT32, BASE_DEC, NULL, 0x0, + "UGS Time Reference", HFILL} + }, + {&hf_docsis_tlv_sflow_vendor_spec, + {".43 Vendor Specific Encodings", "docsis.tlv.sflow.vendorspec", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Vendor Specific Encodings", HFILL} + }, + {&hf_docsis_tlv_phs, + {"26 PHS Rules", "docsis.tlv.phs", + FT_BYTES, BASE_HEX, NULL, 0x0, + "PHS Rules", HFILL} + }, + {&hf_docsis_tlv_phs_class_ref, + {".1 Classifier Reference", "docsis.tlv.phs.classref", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Classifier Reference", HFILL} + }, + {&hf_docsis_tlv_phs_class_id, + {".2 Classifier Id", "docsis.tlv.phs.classid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Classifier Id", HFILL} + }, + {&hf_docsis_tlv_phs_sflow_ref, + {".3 Service flow reference", "docsis.tlv.phs.sflowref", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Flow Reference", HFILL} + }, + {&hf_docsis_tlv_phs_sflow_id, + {".4 Service flow Id", "docsis.tlv.phs.sflowid", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Service Flow Id", HFILL} + }, + {&hf_docsis_tlv_phs_dsc_action, + {".5 DSC Action", "docsis.tlv.phs.dscaction", + FT_UINT8, BASE_DEC, VALS (action_vals), 0x0, + "Dynamic Service Change Action", HFILL} + }, + {&hf_docsis_tlv_phs_err, + {".6 Error Encodings", "docsis.tlv.phs.err", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Error Encodings", HFILL} + }, + {&hf_docsis_tlv_phs_err_param, + {"..1 Param Subtype", "docsis.tlv.phs.err.param", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Parameter Subtype", HFILL} + }, + {&hf_docsis_tlv_phs_err_code, + {"..2 Error Code", "docsis.tlv.phs.err.code", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Error Code", HFILL} + }, + {&hf_docsis_tlv_phs_err_msg, + {"..3 Error Message", "docsis.tlv.phs.err.msg", + FT_STRINGZ, BASE_DEC, NULL, 0x0, + "Error Message", HFILL} + }, + {&hf_docsis_tlv_phs_phsf, + {".7 PHS Field", "docsis.tlv.phs.phsf", + FT_BYTES, BASE_HEX, NULL, 0x0, + "PHS Field", HFILL} + }, + {&hf_docsis_tlv_phs_phsi, + {".8 PHS Index", "docsis.tlv.phs.phsi", + FT_UINT8, BASE_DEC, NULL, 0x0, + "PHS Index", HFILL} + }, + {&hf_docsis_tlv_phs_phsm, + {".9 PHS Mask", "docsis.tlv.phs.phsm", + FT_BYTES, BASE_HEX, NULL, 0x0, + "PHS Mask", HFILL} + }, + {&hf_docsis_tlv_phs_phss, + {".10 PHS Size", "docsis.tlv.phs.phss", + FT_UINT8, BASE_DEC, NULL, 0x0, + "PHS Size", HFILL} + }, + {&hf_docsis_tlv_phs_phsv, + {".11 PHS Verify", "docsis.tlv.phs.phsv", + FT_BOOLEAN, BASE_DEC, VALS (&verify_tfs), 0x0, + "PHS Verify", HFILL} + }, + {&hf_docsis_tlv_phs_vendorspec, + {".43 PHS Vendor Specific", "docsis.tlv.phs.vendorspec", + FT_BYTES, BASE_HEX, NULL, 0x0, + "PHS Vendor Specific", HFILL} + }, + {&hf_docsis_tlv_hmac_digest, + {"27 HMAC Digest", "docsis.tlv.hmac_digest", + FT_BYTES, BASE_HEX, NULL, 0x0, + "HMAC Digest", HFILL} + }, + {&hf_docsis_tlv_max_classifiers, + {"28 Max # of Classifiers", "docsis.tlv.maxclass", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Max # of Classifiers", HFILL} + }, + {&hf_docsis_tlv_privacy_enable, + {"29 Privacy Enable", "docsis.tlv.bpi_en", + FT_BOOLEAN, BASE_DEC, TFS (&ena_dis_tfs), 0x0, + "Privacy Enable", HFILL} + }, + {&hf_docsis_tlv_auth_block, + {"30 Auth Block", "docsis.tlv.auth_block", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Auth Block", HFILL} + }, + {&hf_docsis_tlv_key_seq_num, + {"31 Key Sequence Number", "docsis.tlv.key_seq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Key Sequence Number", HFILL} + }, + {&hf_docsis_tlv_mfgr_cvc, + {"32 Manufacturer CVC", "docsis.tlv.mfgr_cvc", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Manufacturer CVC", HFILL} + }, + {&hf_docsis_tlv_cosign_cvc, + {"33 Co-Signer CVC", "docsis.tlv.cosign_cvc", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Co-Signer CVC", HFILL} + }, + {&hf_docsis_tlv_snmpv3_kick, + {"34 SNMPv3 Kickstart Value", "docsis.tlv.snmpv3", + FT_BYTES, BASE_HEX, NULL, 0x0, + "SNMPv3 Kickstart Value", HFILL} + }, + {&hf_docsis_tlv_snmpv3_kick_name, + {".1 SNMPv3 Kickstart Security Name", "docsis.tlv.snmpv3.secname", + FT_STRING, BASE_DEC, NULL, 0x0, + "SNMPv3 Kickstart Security Name", HFILL} + }, + {&hf_docsis_tlv_snmpv3_kick_publicnum, + {".2 SNMPv3 Kickstart Manager Public Number", "docsis.tlv.snmpv3.publicnum", + FT_BYTES, BASE_HEX, NULL, 0x0, + "SNMPv3 Kickstart Value Manager Public Number", HFILL} + }, + {&hf_docsis_tlv_subs_mgmt_ctrl, + {"35 Subscriber Management Control", "docsis.tlv.subsmgmtctrl", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Subscriber Management Control", HFILL} + }, + {&hf_docsis_tlv_subs_mgmt_ip_table, + {"36 Subscriber Management CPE IP Table", "docsis.tlv.subsiptable", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Subscriber Management CPE IP Table", HFILL} + }, + {&hf_docsis_tlv_subs_mgmt_ip_entry, + {"Subscriber Management CPE IP Entry", "docsis.tlv.subsipentry", + FT_IPv4, BASE_DEC, NULL, 0x0, + "Subscriber Management CPE IP Entry", HFILL} + }, + {&hf_docsis_tlv_subs_mgmt_filter_grps, + {"37 Subscriber Management Filter Groups", "docsis.tlv.subsfltrgrps", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Subscriber Management Filter Groups", HFILL} + }, + {&hf_docsis_tlv_vendor_spec, + {"43 Vendor Specific Encodings", "docsis.tlv.vendorspec", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Vendor Specific Encodings", HFILL} + }, + {&hf_docsis_tlv_rng_tech, + {"Ranging Technique", "docsis.tlv.rng_tech", + FT_UINT8, BASE_DEC, VALS (rng_tech_vals), 0x0, + "Ranging Technique", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_tlv, + &ett_docsis_tlv_cos, + &ett_docsis_tlv_mcap, + &ett_docsis_tlv_clsfr, + &ett_docsis_tlv_clsfr_ip, + &ett_docsis_tlv_clsfr_eth, + &ett_docsis_tlv_clsfr_err, + &ett_docsis_tlv_clsfr_dot1q, + &ett_docsis_tlv_reqxmitpol, + &ett_docsis_tlv_sflow_err, + &ett_docsis_tlv_phs, + &ett_docsis_tlv_phs_err, + &ett_docsis_tlv_svc_unavail, + &ett_docsis_tlv_snmpv3_kick, + }; + +/* Register the protocol name and description */ + proto_docsis_tlv = proto_register_protocol ("DOCSIS Appendix C TLV's", + "DOCSIS TLVs", "docsis_tlv"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_tlv, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_tlv", dissect_tlv, proto_docsis_tlv); +} + + +/* 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_tlv (void) +{ + dissector_handle_t docsis_tlv_handle; + + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis", 0xFF, docsis_tlv_handle); + +} diff --git a/plugins/docsis/packet-tlv.h b/plugins/docsis/packet-tlv.h new file mode 100644 index 0000000000..5c0dee9432 --- /dev/null +++ b/plugins/docsis/packet-tlv.h @@ -0,0 +1,227 @@ +/* packet-tlv.h + * Contains Definitions for Configuration types + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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. + */ + + +/* Define Top Level TLV Types + * Please see http://www.cablemodem.com/Specs/SP-RFIv1.1-I08-020301.pdf + * Appendix C. + */ +#ifndef __PACKET_TLV_H__ +#define __PACKET_TLV_H__ +#define TLV_DOWN_FREQ 1 +#define TLV_CHNL_ID 2 +#define TLV_NET_ACCESS 3 +#define TLV_COS 4 +#define TLV_MODEM_CAP 5 +#define TLV_CM_MIC 6 +#define TLV_CMTS_MIC 7 +#define TLV_VENDOR_ID 8 +#define TLV_SW_UPG_FILE 9 +#define TLV_SNMP_WRITE_CTRL 10 +#define TLV_SNMP_OBJECT 11 +#define TLV_MODEM_IP 12 +#define TLV_SVC_UNAVAIL 13 +#define TLV_ETHERNET_MAC 14 +#define TLV_TEL_SETTINGS 15 +#define TLV_BPI_CONFIG 17 +#define TLV_MAX_CPES 18 +#define TLV_TFTP_TIME 19 +#define TLV_TFTP_MODEM_ADDRESS 20 +#define TLV_SW_UPG_SRVR 21 +#define TLV_UPSTREAM_CLASSIFIER 22 +#define TLV_DOWN_CLASSIFIER 23 +#define TLV_UPSTREAM_SERVICE_FLOW 24 +#define TLV_DOWN_SERVICE_FLOW 25 +#define TLV_PHS 26 +#define TLV_HMAC_DIGEST 27 +#define TLV_MAX_CLASSIFIERS 28 +#define TLV_PRIVACY_ENABLE 29 +#define TLV_AUTH_BLOCK 30 +#define TLV_KEY_SEQ_NUM 31 +#define TLV_MFGR_CVC 32 +#define TLV_COSIGN_CVC 33 +#define TLV_SNMPV3_KICKSTART 34 +#define TLV_SUBS_MGMT_CTRL 35 +#define TLV_SUBS_MGMT_CPE 36 +#define TLV_SUBS_MGMT_FLTR 37 +#define TLV_VENDOR_SPEC 43 +#define TLV_END 255 + +/* Define DOCSIS 1.0 Class Of Service Configuration Types + * These are subtypes of TLV_COS (4) + */ +#define COS_CLASSID 1 +#define COS_MAX_DOWN 2 +#define COS_MAX_UP 3 +#define COS_UP_CH_PRIO 4 +#define COS_MIN_UP_RATE 5 +#define COS_MAX_UP_BURST 6 +#define COS_BP_ENABLE 7 + +/* Define SNMPV3 KickStart subtypes + * These are subtypes of TLV_SNMPV3_KICKSTART (34) + */ +#define SNMPV3_SEC_NAME 1 +#define SNMPV3_MGR_PUB_NUM 2 + +/* Define Modem Capabilities Subtypes + * These are subtypes of TLV_MODEM_CAP (5) + */ +#define CAP_CONCAT 1 +#define CAP_DOCSIS_VER 2 +#define CAP_FRAG 3 +#define CAP_PHS 4 +#define CAP_IGMP 5 +#define CAP_PRIVACY 6 +#define CAP_DOWN_SAID 7 +#define CAP_UP_SID 8 +#define CAP_OPT_FILT 9 +#define CAP_XMIT_EQPERSYM 10 +#define CAP_NUM_XMIT_EQ_TAPS 11 +#define CAP_DCC 12 + +/* Define Classifier subtypes + * These are subtypes of either: + * TLV_UPSTREAM_CLASSIFIER (22) + * TLV_DOWN_CLASSIFIER (23) + */ +#define CFR_REF 1 +#define CFR_ID 2 +#define CFR_SFLOW_REF 3 +#define CFR_SFLOW_ID 4 +#define CFR_RULE_PRI 5 +#define CFR_ACT_STATE 6 +#define CFR_DSA_ACTION 7 +#define CFR_ERROR 8 +#define CFR_IP_CLASSIFIER 9 +#define CFR_ETH_CLASSIFIER 10 +#define CFR_8021Q_CLASSIFIER 11 +#define CFR_VENDOR_SPEC 43 + +/* Define Classifier Error sub-subtypes + * These are subtypes of CFR_ERROR ([22/23].8) + */ +#define CFR_ERR_PARAM 1 +#define CFR_ERR_CODE 2 +#define CFR_ERR_MSG 3 + +/* Define IP Classifier sub-subtypes + * These are subtypes of CFR_IP_CLASSIFIER ([22/23].9) + */ +#define CFR_IP_TOS_RANGE_MASK 1 +#define CFR_IP_PROTO 2 +#define CFR_IP_SOURCE_ADDR 3 +#define CFR_IP_SOURCE_MASK 4 +#define CFR_IP_DEST_ADDR 5 +#define CFR_IP_DEST_MASK 6 +#define CFR_IP_SRCPORT_START 7 +#define CFR_IP_SRCPORT_END 8 +#define CFR_IP_DSTPORT_START 9 +#define CFR_IP_DSTPORT_END 10 + +/* Define Ethertype Classifier sub-subtypes + * These are subtypes of CFR_ETH_CLASSIFIER ([22/23].10) + */ +#define CFR_ETH_DST_MAC 1 +#define CFR_ETH_SRC_MAC 2 +#define CFR_ETH_DSAP 3 + +/* Define 802.1P/Q Classifier sub-subtypes + * These are subtypes of CFR_8021Q_CLASSIFIER ([22/23].11) + */ +#define CFR_D1Q_USER_PRI 1 +#define CFR_D1Q_VLAN_ID 2 +#define CFR_D1Q_VENDOR_SPEC 43 + +/* Define Upstream/Downstream Service flow subtypes + * These are subtypes of: + * TLV_UPSTREAM_SERVICE_FLOW (24) + * TLV_DOWN_SERVICE_FLOW (25) + */ +#define SFW_REF 1 +#define SFW_ID 2 +#define SFW_SID 3 +#define SFW_SERVICE_CLASS_NAME 4 +#define SFW_ERRORS 5 +#define SFW_QOS_SET_TYPE 6 +#define SFW_TRAF_PRI 7 +#define SFW_MAX_SUSTAINED 8 +#define SFW_MAX_BURST 9 +#define SFW_MIN_RSVD_TRAF 10 +#define SFW_MIN_RSVD_PACKETSIZE 11 +#define SFW_ACTIVE_QOS_TIMEOUT 12 +#define SFW_ADMITT_QOS_TIMEOUT 13 +#define SFW_VENDOR_SPEC 43 +/* The following types only apply to + * TLV_UPSTREAM_SERVICE_FLOW (24) + */ +#define SFW_MAX_CONCAT_BURST 14 +#define SFW_SCHEDULING_TYPE 15 +#define SFW_REQ_XMIT_POL 16 +#define SFW_NOM_POLL_INT 17 +#define SFW_POLL_JTTR_TOL 18 +#define SFW_UG_SIZE 19 +#define SFW_NOM_GRNT_INTV 20 +#define SFW_GRNT_JTTR_TOL 21 +#define SFW_GRNTS_PER_INTV 22 +#define SFW_IP_TOS_OVERWRITE 23 +#define SFW_UG_TIME_REF 24 + +/* The following types only apply to + * TLV_DOWN_SERVICE_FLOW (25) + */ +#define SFW_MAX_DOWN_LAT 14 + +/* Define Service Flow Error sub-subtypes + * These are subtypes of + * SFW_ERRORS ([24/25].5) + */ +#define SFW_ERR_PARAM 1 +#define SFW_ERR_CODE 2 +#define SFW_ERR_MSG 3 + + +/* Define Payload Header Supression subtypes + * These are subtypes of TLV_PHS (26) + */ +#define PHS_CLSFR_REF 1 +#define PHS_CLSFR_ID 2 +#define PHS_SFLOW_REF 3 +#define PHS_SFLOW_ID 4 +#define PHS_DSC_ACTION 5 +#define PHS_ERRORS 6 +#define PHS_FIELD 7 +#define PHS_INDEX 8 +#define PHS_MASK 9 +#define PHS_SUP_SIZE 10 +#define PHS_VERIFICATION 11 +#define PHS_VENDOR_SPEC 43 + +/* Define PHS Error sub-subtypes + * These are subtypes of PHS_ERRORS (26.6) + */ +#define PHS_ERR_PARAM 1 +#define PHS_ERR_CODE 2 +#define PHS_ERR_MSG 3 + +#endif diff --git a/plugins/docsis/packet-uccreq.c b/plugins/docsis/packet-uccreq.c new file mode 100644 index 0000000000..d6ba08a075 --- /dev/null +++ b/plugins/docsis/packet-uccreq.c @@ -0,0 +1,161 @@ +/* packet-uccreq.c + * Routines for Upstream Channel Change Request dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#include "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_uccreq = -1; +static int hf_docsis_uccreq = -1; +static int hf_docsis_uccreq_upchid = -1; +static dissector_handle_t docsis_tlv_handle; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_uccreq = -1; + +/* Code to actually dissect the packets */ +static void +dissect_uccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *uccreq_tree; + guint16 tlv_data_len; + guint8 chid; + tvbuff_t *next_tvb; + + chid = tvb_get_guint8 (tvb, 0); + tlv_data_len = tvb_length_remaining (tvb, 1); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Upstream Channel Change request Channel ID = %u (U%u)", + chid, (chid > 0 ? chid - 1 : chid)); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_uccreq, tvb, 0, + tvb_length_remaining (tvb, 0), + "UCC Request"); + uccreq_tree = proto_item_add_subtree (it, ett_docsis_uccreq); + proto_tree_add_item (uccreq_tree, hf_docsis_uccreq_upchid, tvb, 0, 1, + FALSE); + + /* call dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset (tvb, 1, tlv_data_len, tlv_data_len); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, uccreq_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_uccreq (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_uccreq, + {"Upstream Channel Change Request", "docsis.uccreq", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Upstream Channel Change Request", HFILL} + }, + {&hf_docsis_uccreq_upchid, + {"Upstream Channel Id", "docsis.uccreq.upchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel Id", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_uccreq, + }; + +/* Register the protocol name and description */ + proto_docsis_uccreq = + proto_register_protocol ("DOCSIS Upstream Channel Change Request", + "DOCSIS UCC-REQ", "docsis_uccreq"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_uccreq, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_uccreq", dissect_uccreq, proto_docsis_uccreq); +} + + +/* 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_uccreq (void) +{ + dissector_handle_t docsis_uccreq_handle; + + docsis_uccreq_handle = find_dissector ("docsis_uccreq"); + docsis_tlv_handle = find_dissector ("docsis_tlv"); + dissector_add ("docsis_mgmt", 0x08, docsis_uccreq_handle); + +} diff --git a/plugins/docsis/packet-uccrsp.c b/plugins/docsis/packet-uccrsp.c new file mode 100644 index 0000000000..448e18cdb3 --- /dev/null +++ b/plugins/docsis/packet-uccrsp.c @@ -0,0 +1,151 @@ +/* packet-uccrsp.c + * Routines for Upstream Channel Change Response dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +/* Initialize the protocol and registered fields */ +static int proto_docsis_uccrsp = -1; +static int hf_docsis_uccrsp = -1; +static int hf_docsis_uccrsp_upchid = -1; + + +/* Initialize the subtree pointers */ +static gint ett_docsis_uccrsp = -1; + +/* Code to actually dissect the packets */ +static void +dissect_uccrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + proto_item *it; + proto_tree *uccrsp_tree; + guint8 chid; + + chid = tvb_get_guint8 (tvb, 0); + + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + col_add_fstr (pinfo->cinfo, COL_INFO, + "Upstream Channel Change response Channel ID = %u (U%u)", + chid, (chid > 0 ? chid - 1 : chid)); + } + + if (tree) + { + it = + proto_tree_add_protocol_format (tree, proto_docsis_uccrsp, tvb, 0, + tvb_length_remaining (tvb, 0), + "UCC Response"); + uccrsp_tree = proto_item_add_subtree (it, ett_docsis_uccrsp); + proto_tree_add_item (uccrsp_tree, hf_docsis_uccrsp_upchid, tvb, 0, 1, + FALSE); + } + +} + + + + +/* 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_uccrsp (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_uccrsp, + {"Upstream Channel Change Request", "docsis.uccrsp", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Upstream Channel Change Request", HFILL} + }, + {&hf_docsis_uccrsp_upchid, + {"Upstream Channel Id", "docsis.uccrsp.upchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel Id", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_uccrsp, + }; + +/* Register the protocol name and description */ + proto_docsis_uccrsp = + proto_register_protocol ("DOCSIS Upstream Channel Change Response", + "DOCSIS UCC-RSP", "docsis_uccrsp"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_uccrsp, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_uccrsp", dissect_uccrsp, proto_docsis_uccrsp); +} + + +/* 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_uccrsp (void) +{ + dissector_handle_t docsis_uccrsp_handle; + + docsis_uccrsp_handle = find_dissector ("docsis_uccrsp"); + dissector_add ("docsis_mgmt", 0x09, docsis_uccrsp_handle); + +} diff --git a/plugins/docsis/packet-ucd.c b/plugins/docsis/packet-ucd.c new file mode 100644 index 0000000000..8a85aed6c2 --- /dev/null +++ b/plugins/docsis/packet-ucd.c @@ -0,0 +1,541 @@ +/* packet-ucd.c + * Routines for UCD Message dissection + * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> + * + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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 "plugins/plugin_api.h" +#include "plugins/plugin_api_defs.h" +#include "moduleinfo.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + +#include <gmodule.h> + +#ifdef NEED_SNPRINTF_H +# include "snprintf.h" +#endif + +#include <epan/packet.h> + +#define UCD_SYMBOL_RATE 1 +#define UCD_FREQUENCY 2 +#define UCD_PREAMBLE 3 +#define UCD_BURST_DESCR 4 + +#define UCD_MODULATION 1 +#define UCD_DIFF_ENCODING 2 +#define UCD_PREAMBLE_LEN 3 +#define UCD_PREAMBLE_VAL_OFF 4 +#define UCD_FEC 5 +#define UCD_FEC_CODEWORD 6 +#define UCD_SCRAMBLER_SEED 7 +#define UCD_MAX_BURST 8 +#define UCD_GUARD_TIME 9 +#define UCD_LAST_CW_LEN 10 +#define UCD_SCRAMBLER_ONOFF 11 + +#define IUC_REQUEST 1 +#define IUC_REQ_DATA 2 +#define IUC_INIT_MAINT 3 +#define IUC_STATION_MAINT 4 +#define IUC_SHORT_DATA_GRANT 5 +#define IUC_LONG_DATA_GRANT 6 +#define IUC_NULL_IE 7 +#define IUC_DATA_ACK 8 +#define IUC_RESERVED9 9 +#define IUC_RESERVED10 10 +#define IUC_RESERVED11 11 +#define IUC_RESERVED12 12 +#define IUC_RESERVED13 13 +#define IUC_RESERVED14 14 +#define IUC_EXPANSION 15 + +/* Initialize the protocol and registered fields */ +static int proto_docsis_ucd = -1; + +static int hf_docsis_ucd_upstream_chid = -1; +static int hf_docsis_ucd_config_ch_cnt = -1; +static int hf_docsis_ucd_mini_slot_size = -1; +static int hf_docsis_ucd_down_chid = -1; +static int hf_docsis_ucd_symbol_rate = -1; +static int hf_docsis_ucd_frequency = -1; +static int hf_docsis_ucd_preamble_pat = -1; +static int hf_docsis_ucd_iuc = -1; + +static int hf_docsis_burst_mod_type = -1; +static int hf_docsis_burst_diff_encoding = -1; +static int hf_docsis_burst_preamble_len = -1; +static int hf_docsis_burst_preamble_val_off = -1; +static int hf_docsis_burst_fec = -1; +static int hf_docsis_burst_fec_codeword = -1; +static int hf_docsis_burst_scrambler_seed = -1; +static int hf_docsis_burst_max_burst = -1; +static int hf_docsis_burst_guard_time = -1; +static int hf_docsis_burst_last_cw_len = -1; +static int hf_docsis_burst_scrambler_onoff = -1; + +/* Initialize the subtree pointers */ +static gint ett_docsis_ucd = -1; +static gint ett_burst_descr = -1; + +static const value_string channel_tlv_vals[] = { + {UCD_SYMBOL_RATE, "Symbol Rate"}, + {UCD_FREQUENCY, "Frequency"}, + {UCD_PREAMBLE, "Preamble Pattern"}, + {UCD_BURST_DESCR, "Burst Descriptor"}, + {0, NULL} +}; + +static const value_string on_off_vals[] = { + {1, "On"}, + {2, "Off"}, + {0, NULL} +}; + +static const value_string mod_vals[] = { + {1, "QPSK"}, + {2, "QAM16"}, + {0, NULL} +}; + +value_string iuc_vals[] = { + {IUC_REQUEST, "Request"}, + {IUC_REQ_DATA, "REQ/Data"}, + {IUC_INIT_MAINT, "Initial Maintenance"}, + {IUC_STATION_MAINT, "Station Maintenance"}, + {IUC_SHORT_DATA_GRANT, "Short Data Grant"}, + {IUC_LONG_DATA_GRANT, "Long Data Grant"}, + {IUC_NULL_IE, "NULL IE"}, + {IUC_DATA_ACK, "Data Ack"}, + {IUC_RESERVED9, "Reserved"}, + {IUC_RESERVED10, "Reserved"}, + {IUC_RESERVED11, "Reserved"}, + {IUC_RESERVED12, "Reserved"}, + {IUC_RESERVED13, "Reserved"}, + {IUC_RESERVED14, "Reserved"}, + {IUC_EXPANSION, "Expanded IUC"}, + {0, NULL} +}; + +static const value_string last_cw_len_vals[] = { + {1, "Fixed"}, + {2, "Shortened"}, + {0, NULL} +}; +/* Code to actually dissect the packets */ +static void +dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + guint16 pos, endtlvpos; + guint8 type, length; + guint8 tlvlen, tlvtype; + proto_tree *burst_descr_tree; + proto_item *it; + proto_tree *ucd_tree; + proto_item *ucd_item; + guint16 len; + guint8 upchid, symrate; + + len = tvb_length_remaining (tvb, 0); + upchid = tvb_get_guint8 (tvb, 0); + + /* if the upstream Channel ID is 0 then this is for Telephony Return) */ + if (check_col (pinfo->cinfo, COL_INFO)) + { + col_clear (pinfo->cinfo, COL_INFO); + if (upchid > 0) + col_add_fstr (pinfo->cinfo, COL_INFO, + "UCD Message: Channel ID = %u (U%u)", upchid, + upchid - 1); + else + col_add_fstr (pinfo->cinfo, COL_INFO, + "UCD Message: Channel ID = %u (Telephony Return)", + upchid); + } + + if (tree) + { + ucd_item = + proto_tree_add_protocol_format (tree, proto_docsis_ucd, tvb, 0, + tvb_length_remaining (tvb, 0), + "UCD Message"); + ucd_tree = proto_item_add_subtree (ucd_item, ett_docsis_ucd); + proto_tree_add_item (ucd_tree, hf_docsis_ucd_upstream_chid, tvb, 0, 1, + FALSE); + proto_tree_add_item (ucd_tree, hf_docsis_ucd_config_ch_cnt, tvb, 1, 1, + FALSE); + proto_tree_add_item (ucd_tree, hf_docsis_ucd_mini_slot_size, tvb, 2, 1, + FALSE); + proto_tree_add_item (ucd_tree, hf_docsis_ucd_down_chid, tvb, 3, 1, + FALSE); + + pos = 4; + while (pos < len) + { + type = tvb_get_guint8 (tvb, pos++); + length = tvb_get_guint8 (tvb, pos++); + switch (type) + { + case UCD_SYMBOL_RATE: + if (length == 1) + { + symrate = tvb_get_guint8 (tvb, pos); + proto_tree_add_uint (ucd_tree, hf_docsis_ucd_symbol_rate, + tvb, pos, length, symrate * 160); + } + else + { + THROW (ReportedBoundsError); + } + pos = pos + length; + break; + case UCD_FREQUENCY: + if (length == 4) + { + proto_tree_add_item (ucd_tree, hf_docsis_ucd_frequency, tvb, + pos, length, FALSE); + pos = pos + length; + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_PREAMBLE: + proto_tree_add_item (ucd_tree, hf_docsis_ucd_preamble_pat, tvb, + pos, length, FALSE); + pos = pos + length; + break; + case UCD_BURST_DESCR: + it = + proto_tree_add_text (ucd_tree, tvb, pos, length, + "4 Burst Descriptor (Length = %u)", + length); + burst_descr_tree = proto_item_add_subtree (it, ett_burst_descr); + proto_tree_add_item (burst_descr_tree, hf_docsis_ucd_iuc, tvb, + pos++, 1, FALSE); + endtlvpos = pos + length - 1; + while (pos < endtlvpos) + { + tlvtype = tvb_get_guint8 (tvb, pos++); + tlvlen = tvb_get_guint8 (tvb, pos++); + switch (tlvtype) + { + case UCD_MODULATION: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_mod_type, tvb, + pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_DIFF_ENCODING: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_diff_encoding, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_PREAMBLE_LEN: + if (tlvlen == 2) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_preamble_len, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_PREAMBLE_VAL_OFF: + if (tlvlen == 2) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_preamble_val_off, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_FEC: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_fec, tvb, pos, + tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_FEC_CODEWORD: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_fec_codeword, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_SCRAMBLER_SEED: + if (tlvlen == 2) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_scrambler_seed, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_MAX_BURST: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_max_burst, tvb, + pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_GUARD_TIME: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_guard_time, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_LAST_CW_LEN: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_last_cw_len, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + case UCD_SCRAMBLER_ONOFF: + if (tlvlen == 1) + { + proto_tree_add_item (burst_descr_tree, + hf_docsis_burst_scrambler_onoff, + tvb, pos, tlvlen, FALSE); + } + else + { + THROW (ReportedBoundsError); + } + break; + } /* switch(tlvtype) */ + pos = pos + tlvlen; + } /* while (pos < endtlvpos) */ + break; + } /* switch(type) */ + } /* 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_ucd (void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + {&hf_docsis_ucd_upstream_chid, + {"Upstream Channel ID", "docsis.ucd.upchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Upstream Channel ID", HFILL} + }, + {&hf_docsis_ucd_config_ch_cnt, + {"Config Change Count", "docsis.ucd.confcngcnt", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Configuration Change Count", HFILL} + }, + {&hf_docsis_ucd_mini_slot_size, + {"Mini Slot Size (6.25us TimeTicks)", "docsis.ucd.mslotsize", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Mini Slot Size (6.25us TimeTicks)", HFILL} + }, + {&hf_docsis_ucd_down_chid, + {"Downstream Channel ID", "docsis.ucd.downchid", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Management Message", HFILL} + }, + {&hf_docsis_ucd_symbol_rate, + {"1 Symbol Rate (ksym/sec)", "docsis.ucd.symrate", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Symbol Rate", HFILL} + }, + {&hf_docsis_ucd_frequency, + {"2 Frequency (Hz)", "docsis.ucd.freq", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Upstream Center Frequency", HFILL} + }, + {&hf_docsis_ucd_preamble_pat, + {"3 Preamble Pattern", "docsis.ucd.preamble", + FT_BYTES, BASE_HEX, NULL, 0x0, + "Preamble Superstring", HFILL} + }, + {&hf_docsis_ucd_iuc, + {"Interval Usage Code", "docsis.ucd.iuc", + FT_UINT8, BASE_DEC, VALS (iuc_vals), 0x0, + "Interval Usage Code", HFILL} + }, + {&hf_docsis_burst_mod_type, + {"1 Modulation Type", "docsis.ucd.burst.modtype", + FT_UINT8, BASE_DEC, VALS (mod_vals), 0x0, + "Modulation Type", HFILL} + }, + {&hf_docsis_burst_diff_encoding, + {"2 Differential Encoding", "docsis.ucd.burst.diffenc", + FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0, + "Differential Encoding", HFILL} + }, + {&hf_docsis_burst_preamble_len, + {"3 Preamble Length (Bits)", "docsis.ucd.burst.preamble_len", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Preamble Length (Bits)", HFILL} + }, + {&hf_docsis_burst_preamble_val_off, + {"4 Preamble Offset (Bits)", "docsis.ucd.burst.preamble_off", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Preamble Offset (Bits)", HFILL} + }, + {&hf_docsis_burst_fec, + {"5 FEC (T)", "docsis.ucd.burst.fec", + FT_UINT8, BASE_DEC, NULL, 0x0, + "FEC (T) Codeword Parity Bits = 2^T", HFILL} + }, + {&hf_docsis_burst_fec_codeword, + {"6 FEC Codeword Info bytes (k)", "docsis.ucd.burst.fec_codeword", + FT_UINT8, BASE_DEC, NULL, 0x0, + "FEC Codeword Info Bytes (k)", HFILL} + }, + {&hf_docsis_burst_scrambler_seed, + {"7 Scrambler Seed", "docsis.ucd.burst.scrambler_seed", + FT_UINT16, BASE_HEX, NULL, 0x0, + "Burst Descriptor", HFILL} + }, + {&hf_docsis_burst_max_burst, + {"8 Max Burst Size (Minislots)", "docsis.ucd.burst.maxburst", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Max Burst Size (Minislots)", HFILL} + }, + {&hf_docsis_burst_guard_time, + {"9 Guard Time Size (Symbol Times)", "docsis.ucd.burst.guardtime", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Guard Time Size", HFILL} + }, + {&hf_docsis_burst_last_cw_len, + {"10 Last Codeword Length", "docsis.ucd.burst.last_cw_len", + FT_UINT8, BASE_DEC, VALS (last_cw_len_vals), 0x0, + "Last Codeword Length", HFILL} + }, + {&hf_docsis_burst_scrambler_onoff, + {"11 Scrambler On/Off", "docsis.ucd.burst.scrambleronoff", + FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0, + "Scrambler On/Off", HFILL} + }, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_docsis_ucd, + &ett_burst_descr, + }; + +/* Register the protocol name and description */ + proto_docsis_ucd = + proto_register_protocol ("DOCSIS Upstream Channel Descriptor", + "DOCSIS UCD", "docsis_ucd"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array (proto_docsis_ucd, hf, array_length (hf)); + proto_register_subtree_array (ett, array_length (ett)); + + register_dissector ("docsis_ucd", dissect_ucd, proto_docsis_ucd); +} + + +/* 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_ucd (void) +{ + dissector_handle_t docsis_ucd_handle; + + docsis_ucd_handle = find_dissector ("docsis_ucd"); + dissector_add ("docsis_mgmt", 0x02, docsis_ucd_handle); + +} diff --git a/plugins/plugin_api.c b/plugins/plugin_api.c index 43a6ca1004..25aaf8c368 100644 --- a/plugins/plugin_api.c +++ b/plugins/plugin_api.c @@ -1,7 +1,7 @@ /* plugin_api.c * Routines for Ethereal plugins. * - * $Id: plugin_api.c,v 1.39 2002/05/05 00:34:12 guy Exp $ + * $Id: plugin_api.c,v 1.40 2002/07/12 22:52:39 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -172,4 +172,7 @@ plugin_address_table_init(plugin_address_table_t *pat) p_decode_boolean_bitfield = pat->p_decode_boolean_bitfield; p_decode_numeric_bitfield = pat->p_decode_numeric_bitfield; p_decode_enumerated_bitfield = pat->p_decode_enumerated_bitfield; + p_register_dissector_table = pat->p_register_dissector_table; + p_except_throw = pat->p_except_throw; + p_dissector_try_port = pat->p_dissector_try_port; } diff --git a/plugins/plugin_api.h b/plugins/plugin_api.h index 0e2a0093c3..531dfae1b0 100644 --- a/plugins/plugin_api.h +++ b/plugins/plugin_api.h @@ -1,7 +1,7 @@ /* plugin_api.h * Routines for Ethereal plugins. * - * $Id: plugin_api.h,v 1.40 2002/05/05 00:34:12 guy Exp $ + * $Id: plugin_api.h,v 1.41 2002/07/12 22:52:39 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -202,6 +202,9 @@ #define decode_boolean_bitfield (*p_decode_boolean_bitfield) #define decode_numeric_bitfield (*p_decode_numeric_bitfield) #define decode_enumerated_bitfield (*p_decode_enumerated_bitfield) +#define register_dissector_table (*p_register_dissector_table) +#define except_throw (*p_except_throw) +#define dissector_try_port (*p_dissector_try_port) #endif diff --git a/plugins/plugin_api_decls.h b/plugins/plugin_api_decls.h index 82850f6c6b..1a79e2ada8 100644 --- a/plugins/plugin_api_decls.h +++ b/plugins/plugin_api_decls.h @@ -2,7 +2,7 @@ * Declarations of a list of "p_" names; included in various places * to declare them as variables or as function members. * - * $Id: plugin_api_decls.h,v 1.2 2002/05/05 00:34:12 guy Exp $ + * $Id: plugin_api_decls.h,v 1.3 2002/07/12 22:52:39 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -211,3 +211,6 @@ addr_set_actual_length p_set_actual_length; addr_decode_boolean_bitfield p_decode_boolean_bitfield; addr_decode_numeric_bitfield p_decode_numeric_bitfield; addr_decode_enumerated_bitfield p_decode_enumerated_bitfield; +addr_register_dissector_table p_register_dissector_table; +addr_except_throw p_except_throw; +addr_dissector_try_port p_dissector_try_port; diff --git a/plugins/plugin_table.h b/plugins/plugin_table.h index a9f262f88f..f47ec6597b 100644 --- a/plugins/plugin_table.h +++ b/plugins/plugin_table.h @@ -1,7 +1,7 @@ /* plugin_table.h * Table of exported addresses for Ethereal plugins. * - * $Id: plugin_table.h,v 1.49 2002/05/16 02:43:53 gerald Exp $ + * $Id: plugin_table.h,v 1.50 2002/07/12 22:52:39 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -236,6 +236,10 @@ typedef const char *(*addr_decode_numeric_bitfield)(guint32, guint32, int, typedef const char *(*addr_decode_enumerated_bitfield)(guint32, guint32, int, const value_string *, const char *); +typedef dissector_table_t (*addr_register_dissector_table)(const char *, char *, ftenum_t ,int ); +typedef void (*addr_except_throw)(long, long, const char *); +typedef gboolean (*addr_dissector_try_port)(dissector_table_t, guint32, tvbuff_t *, packet_info *, proto_tree *); + typedef struct { #include "plugin_api_decls.h" diff --git a/wiretap/wtap.h b/wiretap/wtap.h index aee32cefc1..e961d68164 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1,6 +1,6 @@ /* wtap.h * - * $Id: wtap.h,v 1.115 2002/06/23 10:32:36 guy Exp $ + * $Id: wtap.h,v 1.116 2002/07/12 22:52:43 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -106,9 +106,10 @@ #define WTAP_ENCAP_PRISM_HEADER 25 #define WTAP_ENCAP_PFLOG 26 #define WTAP_ENCAP_HHDLC 27 +#define WTAP_ENCAP_DOCSIS 28 /* last WTAP_ENCAP_ value + 1 */ -#define WTAP_NUM_ENCAP_TYPES 28 +#define WTAP_NUM_ENCAP_TYPES 29 /* File types that can be read by wiretap. We support writing some many of these file types, too, so we |