Add HP Switch Protocol SAP value
[obnox/wireshark/wip.git] / epan / dissectors / packet-hpsw.c
index 1c3ad4df716979ed0129b9dd5e34640cd8fe75be..678437e73e6437206f1fbad557d2675379dd2817 100644 (file)
@@ -4,8 +4,8 @@
  *
  * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
@@ -20,7 +20,7 @@
  *
  * 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -29,7 +29,7 @@
 
 #include <glib.h>
 #include <epan/packet.h>
-#include "etypes.h"
+#include <epan/etypes.h>
 
 #include "packet-hpext.h"
 
@@ -57,6 +57,7 @@ static gint ett_hpsw_tlv = -1;
 #define HPFOO_FIELD_8 0x8
 #define HPFOO_FIELD_9 0x9
 #define HPFOO_FIELD_10 0xa
+#define HPFOO_MAC_ADDR 0xe
 
 static const value_string hpsw_tlv_type_vals[] = {
        { HPFOO_DEVICE_NAME,       "Device Name" },
@@ -67,6 +68,7 @@ static const value_string hpsw_tlv_type_vals[] = {
        { HPFOO_FIELD_8,     "Field 8" },
        { HPFOO_FIELD_9,     "Field 9" },
        { HPFOO_FIELD_10,     "Field 10" },
+       { HPFOO_MAC_ADDR,     "MAC Addr" },
        { 0x00,               NULL }
 };
 
@@ -220,6 +222,17 @@ dissect_hpsw_tlv(tvbuff_t *tvb, int offset, int length,
         }
         break;
 
+    case HPFOO_MAC_ADDR:
+        if (length == 6) {
+            const guint8 *macptr=tvb_get_ptr(tvb,offset,length);
+            proto_item_set_text(ti, "MAC Addr: %s", ether_to_str(macptr));
+            proto_tree_add_text(tree, tvb, offset, length, "MAC Addr: %s", ether_to_str(macptr));
+        } else {
+            proto_item_set_text(ti, "MAC Addr: Bad length %u", length);
+            proto_tree_add_text(tree, tvb, offset, length, "MAC Addr: Bad length %u", length);
+        }
+        break;
+
     default:
         proto_tree_add_text(tree, tvb, offset, length, "Data");
         break;
@@ -244,12 +257,12 @@ proto_register_hpsw(void)
                        VALS(hpsw_tlv_type_vals), 0x0, "", HFILL }},
                { &hf_hpsw_tlvlength,
                { "Length", "hpsw.tlv_len", FT_UINT8, BASE_DEC,
-                       NULL, 0x0, "", HFILL }},
+                       NULL, 0x0, "", HFILL }}
        };
 
        static gint *ett[] = {
                &ett_hpsw,
-               &ett_hpsw_tlv,
+               &ett_hpsw_tlv
        };
 
        proto_hpsw = proto_register_protocol( "HP Switch Protocol", "HPSW", "hpsw");
@@ -266,5 +279,5 @@ proto_reg_handoff_hpsw(void)
 
        hpsw_handle = find_dissector("hpsw");
 
-       dissector_add("hpext.dxsap", 0x0623, hpsw_handle);
+       dissector_add("hpext.dxsap", HPEXT_HPSW, hpsw_handle);
 }