From Anand Narwani: support for Cisco vendor-specific TLVs.

Add RCS IDs to source files.

svn path=/trunk/; revision=6257
This commit is contained in:
Guy Harris 2002-09-10 19:07:40 +00:00
parent 83e4aac7dd
commit 7f3ea787c7
28 changed files with 390 additions and 11 deletions

View File

@ -26,7 +26,7 @@ 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_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-vendor.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.
@ -34,7 +34,7 @@ docsis_la_LDFLAGS = -module -avoid-version
# 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
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-vendor-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
@ -106,6 +106,8 @@ packet-dsdrsp-static.o: packet-dsdrsp.c moduleinfo.h
packet-rngreq-static.o: packet-rngreq.c moduleinfo.h
$(LTCOMPILE) -c -o packet-rngreq-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-rngreq.c
packet-vendor-static.o: packet-vendor.c moduleinfo.h
$(LTCOMPILE) -c -o packet-vendor-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-vendor.c
CLEANFILES = \
docsis \

View File

@ -1,5 +1,5 @@
#
# $Id: Makefile.nmake,v 1.2 2002/07/16 10:11:41 guy Exp $
# $Id: Makefile.nmake,v 1.3 2002/09/10 19:07:37 guy Exp $
#
include ..\..\config.nmake
@ -22,9 +22,9 @@ OBJECTS=packet-docsis.obj packet-bpkmattr.obj \
packet-dsaack.obj packet-dsdreq.obj \
packet-regrsp.obj packet-ucd.obj \
packet-dsareq.obj packet-dsdrsp.obj \
packet-rngreq.obj
packet-rngreq.obj packet-vendor.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
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 packet-vendor.obj ..\plugin_api.obj
link -dll /out:docsis.dll packet-docsis.obj \
packet-bpkmattr.obj packet-dsarsp.obj \
packet-macmgmt.obj packet-rngrsp.obj \
@ -36,7 +36,8 @@ docsis.dll docsis.exp docsis.lib : packet-docsis.obj packet-bpkmattr.obj packet-
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 \
packet-dsdrsp.obj packet-rngreq.obj \
packet-vendor.obj ..\plugin_api.obj \
$(GLIB_DIR)\glib-$(GLIB_VERSION).lib
clean:

View File

@ -2,6 +2,8 @@
* Routines for Baseline Privacy Key Management Attributes dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-bpkmattr.c,v 1.4 2002/09/10 19:07:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Baseline Privacy Key Management Request dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-bpkmreq.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Baseline Privacy Key Management Response dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-bpkmrsp.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,7 +2,7 @@
* Routines for docsis dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-docsis.c,v 1.9 2002/08/30 10:02:10 guy Exp $
* $Id: packet-docsis.c,v 1.10 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -799,6 +799,7 @@ plugin_reg_handoff (void)
proto_reg_handoff_docsis_ucd ();
proto_reg_handoff_docsis_dsareq ();
proto_reg_handoff_docsis_dsdrsp ();
proto_reg_handoff_docsis_vsif ();
}
G_MODULE_EXPORT void
@ -836,6 +837,7 @@ plugin_init (plugin_address_table_t * pat
proto_register_docsis_dsareq ();
proto_register_docsis_dsdrsp ();
proto_register_docsis_rngreq ();
proto_register_docsis_vsif ();
}
}

View File

@ -1,6 +1,6 @@
/* packet-docsis.h
*
* $Id: packet-docsis.h,v 1.3 2002/08/28 20:38:59 jmayer Exp $
* $Id: packet-docsis.h,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -24,7 +24,6 @@
#ifndef __PACKET_DOCSIS_H__
#define __PACKET_DOCSIS_H__
void capture_docsis (const guchar *, 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);
@ -48,6 +47,7 @@ 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_reg_handoff_docsis_vsif (void);
void proto_register_docsis_bpkmattr (void);
void proto_register_docsis_bpkmreq (void);
@ -72,5 +72,6 @@ void proto_register_docsis_tlv (void);
void proto_register_docsis_uccreq (void);
void proto_register_docsis_uccrsp (void);
void proto_register_docsis_ucd (void);
void proto_register_docsis_vsif (void);
#endif

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Addition Acknowledge dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dsaack.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Addition Request dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dsareq.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Addition Response dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dsarsp.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Change Acknowledge dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dscack.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Change Request dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dscreq.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Change Response dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dscrsp.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Delete Request dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dsdreq.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Dynamic Service Delete Response dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-dsdrsp.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for docsis Mac Management Header dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-macmgmt.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for MAP Message dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-map.c,v 1.5 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Registration Acknowledge Message dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-regack.c,v 1.4 2002/09/10 19:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Registration Request dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-regreq.c,v 1.4 2002/09/10 19:07:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Registration Response Message dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-regrsp.c,v 1.4 2002/09/10 19:07:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Ranging Request Message dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-rngreq.c,v 1.4 2002/09/10 19:07:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Ranging Response Message dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-rngrsp.c,v 1.4 2002/09/10 19:07:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines to Dissect Appendix C TLV's
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-tlv.c,v 1.7 2002/09/10 19:07:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
@ -47,6 +49,9 @@
*/
/* Initialize the protocol and registered fields */
static dissector_handle_t docsis_vsif_handle;
static int proto_docsis_tlv = -1;
static int hf_docsis_tlv = -1;
static int hf_docsis_tlv_down_freq = -1;
@ -1782,6 +1787,7 @@ dissect_tlv (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree)
guint16 pos = 0;
guint8 type, length;
guint16 x;
tvbuff_t *vsif_tvb;
total_len = tvb_length_remaining (tvb, 0);
@ -2067,8 +2073,8 @@ dissect_tlv (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree)
tvb, pos, length, FALSE);
break;
case TLV_VENDOR_SPEC:
proto_tree_add_item (tlv_tree, hf_docsis_tlv_vendor_spec,
tvb, pos, length, FALSE);
vsif_tvb = tvb_new_subset (tvb, pos, length, length);
call_dissector (docsis_vsif_handle, vsif_tvb, pinfo, tlv_tree);
break;
case TLV_END:
break;
@ -2846,6 +2852,8 @@ proto_reg_handoff_docsis_tlv (void)
dissector_handle_t docsis_tlv_handle;
docsis_tlv_handle = find_dissector ("docsis_tlv");
docsis_vsif_handle = find_dissector("docsis_vsif");
dissector_add ("docsis", 0xFF, docsis_tlv_handle);
}

View File

@ -2,6 +2,8 @@
* Contains Definitions for Configuration types
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-tlv.h,v 1.3 2002/09/10 19:07:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Upstream Channel Change Request dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-uccreq.c,v 1.4 2002/09/10 19:07:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,8 @@
* Routines for Upstream Channel Change Response dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-uccrsp.c,v 1.4 2002/09/10 19:07:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs

View File

@ -2,6 +2,7 @@
* Routines for UCD Message dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-ucd.c,v 1.4 2002/09/10 19:07:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>

View File

@ -0,0 +1,322 @@
/* packet-vendor.c
* Routines for Vendor Specific Encodings dissection
* Copyright 2002, Anand V. Narwani <anarwani@cisco.com>
*
* $Id: packet-vendor.c,v 1.1 2002/09/10 19:07:40 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.
*/
/* Notes to Adding dissectors for Vendor specific TLV's:
* 1. Create a dissect_<vendorname> function with the following prototype:
* dissect_foovendor(tvbuff_t *tvb, proto_tree *tree, guint8 vsif_len)
* 2. vsif_len will be the *entire* length of the vsif TLV (including the
* Vendor Id TLV, which is 5 bytes long).
* 3. Create a new 'case' statement in dissect_vsif, for your specific Vendor
* id.
* 4. In that 'case' statement you will make the following calls:
* (assume for this example that your vendor id is 0x000054)
* #define VENDOR_FOOVENDOR 0x00054
* case VENDOR_FOOVENDOR:
* proto_item_append_text (it, " (foo vendor)");
* dissect_foovendor (tvb, vsif_tree, vsif_len);
* break;
* 5. Please see dissect_cisco for an example of how to do this.
*/
#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 Vendor ID's here */
#define VENDOR_CISCO 0x00000C
/* Initialize the protocol and registered fields */
static int proto_docsis_vsif = -1;
static int hf_docsis_vsif = -1;
static int hf_docsis_vsif_vendorid = -1;
static int hf_docsis_vsif_vendor_unknown = -1;
static int hf_docsis_vsif_cisco_numphones = -1;
static int hf_docsis_vsif_cisco_ipprec = -1;
static int hf_docsis_vsif_cisco_ipprec_val = -1;
static int hf_docsis_vsif_cisco_ipprec_bw = -1;
static int hf_docsis_vsif_cisco_config_file = -1;
/* Initialize the subtree pointers */
static gint ett_docsis_vsif = -1;
static gint ett_docsis_vsif_ipprec = -1;
static const value_string vendorid_vals[] = {
{VENDOR_CISCO, "Cisco Systems, Inc."},
{0, NULL},
};
/* Forward Declarations for vendor specific dissectors */
static void dissect_cisco (tvbuff_t * tvb, proto_tree * tree,
guint8 vsif_len);
/* Code to actually dissect the packets */
static void
dissect_vsif (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree)
{
proto_item *it;
proto_tree *vsif_tree;
guint8 type;
guint8 length;
guint32 value;
guint16 vsif_len;
/* get the total length of the VSIF TLV */
vsif_len = tvb_length_remaining (tvb, 0);
/* The first TLV in the VSIF encodings must be type 0x08 (Vendor ID) and
* length 3.
*/
type = tvb_get_guint8 (tvb, 0);
if (type != 0x08)
{
THROW (ReportedBoundsError);
}
length = tvb_get_guint8 (tvb, 1);
if (length != 3)
{
THROW (ReportedBoundsError);
}
/* Extract the Value of the Vendor ID */
value = tvb_get_ntoh24 (tvb, 2);
if (tree)
{
it =
proto_tree_add_protocol_format (tree, proto_docsis_vsif, tvb, 0,
tvb_length_remaining (tvb, 0),
"VSIF Encodings");
vsif_tree = proto_item_add_subtree (it, ett_docsis_vsif);
proto_tree_add_item (vsif_tree, hf_docsis_vsif_vendorid, tvb, 2, 3, FALSE);
/* switch on the Vendor ID */
switch (value)
{
case VENDOR_CISCO:
proto_item_append_text (it, " (Cisco)");
dissect_cisco (tvb, vsif_tree, vsif_len);
break;
default:
proto_item_append_text (it, " (Unknown)");
proto_tree_add_item (vsif_tree, hf_docsis_vsif_vendor_unknown, tvb,
0, -1, FALSE);
break;
}
} /* if(tree) */
}
/* Dissector for Cisco Vendor Specific TLV's */
#define NUM_PHONES 0x0a
#define IOS_CONFIG_FILE 0x80
#define IP_PREC 0x0b
#define IP_PREC_VAL 0x01
#define IP_PREC_BW 0x02
static void
dissect_cisco (tvbuff_t * tvb, proto_tree * tree, guint8 vsif_len)
{
/* Start at pos = 5, since tvb includes the Vendor ID field */
guint16 pos = 5;
guint8 type, length;
proto_item *ipprec_it;
proto_tree *ipprec_tree;
guint16 templen;
while (pos < vsif_len)
{
/* Extract the type and length Fields from the TLV */
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case NUM_PHONES:
proto_tree_add_item (tree, hf_docsis_vsif_cisco_numphones, tvb,
pos, length, FALSE);
break;
case IP_PREC:
ipprec_it =
proto_tree_add_text (tree, tvb, pos, length, "IP Precedence");
ipprec_tree =
proto_item_add_subtree (ipprec_it, ett_docsis_vsif_ipprec);
/* Handle Sub-TLVs in IP Precedence */
templen = pos + length;
while (pos < templen)
{
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case IP_PREC_VAL:
if (length != 1)
THROW (ReportedBoundsError);
proto_tree_add_item (ipprec_tree,
hf_docsis_vsif_cisco_ipprec_val, tvb,
pos, length, FALSE);
break;
case IP_PREC_BW:
if (length != 4)
THROW (ReportedBoundsError);
proto_tree_add_item (ipprec_tree,
hf_docsis_vsif_cisco_ipprec_bw, tvb,
pos, length, FALSE);
break;
default:
THROW (ReportedBoundsError);
}
pos += length;
}
break;
case IOS_CONFIG_FILE:
proto_tree_add_item (tree, hf_docsis_vsif_cisco_config_file, tvb,
pos, length, FALSE);
}
pos += length;
}
}
/* 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_vsif (void)
{
/* Setup list of header fields See Section 1.6.1 for details*/
static hf_register_info hf[] = {
{&hf_docsis_vsif,
{"VSIF Encodings", "docsis.vsif",
FT_BYTES, BASE_HEX, NULL, 0x0,
"Vendor Specific Encodings", HFILL}
},
{&hf_docsis_vsif_vendorid,
{"Vendor Id", "docsis.vsif.vendorid",
FT_UINT24, BASE_HEX, VALS(vendorid_vals), 0x0,
"Vendor Identifier", HFILL}
},
{&hf_docsis_vsif_vendor_unknown,
{"VSIF Encodings", "docsis.vsif.unknown",
FT_BYTES, BASE_HEX, NULL, 0x0,
"Unknown Vendor", HFILL}
},
{&hf_docsis_vsif_cisco_numphones,
{"Number of phone lines", "docsis.vsif.cisco.numphones",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Number of phone lines", HFILL}
},
{&hf_docsis_vsif_cisco_ipprec,
{"IP Precedence Encodings", "docsis.vsif.cisco.ipprec",
FT_BYTES, BASE_HEX, NULL, 0x0,
"IP Precedence Encodings", HFILL}
},
{&hf_docsis_vsif_cisco_ipprec_val,
{"IP Precedence Value", "docsis.vsif.cisco.ipprec.value",
FT_UINT8, BASE_DEC, NULL, 0x0,
"IP Precedence Value", HFILL}
},
{&hf_docsis_vsif_cisco_ipprec_bw,
{"IP Precedence Bandwidth", "docsis.vsif.cisco.ipprec.bw",
FT_UINT8, BASE_DEC, NULL, 0x0,
"IP Precedence Bandwidth", HFILL}
},
{&hf_docsis_vsif_cisco_config_file,
{"IOS Config File", "docsis.vsif.cisco.iosfile",
FT_STRING, BASE_DEC, NULL, 0x0,
"IOS Config File", HFILL}
},
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_docsis_vsif,
&ett_docsis_vsif_ipprec,
};
/* Register the protocol name and description */
proto_docsis_vsif =
proto_register_protocol ("DOCSIS Vendor Specific Endodings",
"DOCSIS VSIF", "docsis_vsif");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array (proto_docsis_vsif, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
register_dissector ("docsis_vsif", dissect_vsif, proto_docsis_vsif);
}
/* 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_vsif (void)
{
dissector_handle_t docsis_vsif_handle;
docsis_vsif_handle = find_dissector ("docsis_vsif");
assert (docsis_vsif_handle);
dissector_add ("docsis", 0xFD, docsis_vsif_handle);
}