From Giles Scott
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>
Fri, 1 Apr 2005 09:48:34 +0000 (09:48 -0000)
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>
Fri, 1 Apr 2005 09:48:34 +0000 (09:48 -0000)
New protocol  ARUBA ADP

svn path=/trunk/; revision=13997

AUTHORS
epan/dissectors/Makefile.common
epan/dissectors/packet-aruba-adp.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index fd135f0473e14229278ba21089bf9c79b66133d3..ffc5c8db5055de3626fb7422f2dfa06463fc6686 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1921,6 +1921,7 @@ Giles Scott             <gscott [AT] arubanetworks.com> {
        Port weak key detection from Airsnort
        Wlan tap
        Retix spanning tree protocol support
+       Aruba ADP protocol support
 }
 
 Vincent Jardin          <vincent.jardin [AT] 6wind.com> {
index 5faec7d43330765dc6c722e9700361c32171ec5e..b443b0c498514aee043c2e2820a8ed8b7a0a0417 100644 (file)
@@ -91,6 +91,7 @@ DISSECTOR_SRC =       \
        packet-app-pkix-cert.c  \
        packet-arcnet.c \
        packet-arp.c    \
+       packet-aruba-adp.c      \
        packet-asap.c   \
        packet-ascend.c \
        packet-asf.c    \
diff --git a/epan/dissectors/packet-aruba-adp.c b/epan/dissectors/packet-aruba-adp.c
new file mode 100644 (file)
index 0000000..721eb67
--- /dev/null
@@ -0,0 +1,160 @@
+/* packet-aruba-adp.c
+ * Routines for Aruba ADP header disassembly
+ *
+ * Giles Scott < gscott <at> arubanetworks dot 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 <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+#include <epan/packet.h>
+#include <epan/addr_resolv.h>
+
+#define UDP_PORT_ADP 8200
+#define ADP_REQUEST 1
+#define ADP_RESPONSE 2
+
+static int proto_aruba_adp = -1;
+static gint ett_aruba_adp  = -1;
+
+static int hf_adp_version  = -1;
+static int hf_adp_type     = -1;
+static int hf_adp_id       = -1;
+static int hf_adp_mac      = -1;
+static int hf_adp_switchip = -1;
+
+static value_string adp_type_val[] =
+{
+  {1, "Request"},
+  {2, "Response"},
+  {0, NULL},
+};
+
+static void
+dissect_aruba_adp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+  proto_tree *ti = NULL;
+  proto_tree *aruba_adp_tree = NULL;
+  guint16 type;
+  const char *src_mac;
+  const char *switchip;
+
+
+  if (check_col(pinfo->cinfo, COL_PROTOCOL))
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "ADP");
+  if (check_col(pinfo->cinfo, COL_INFO))
+    col_clear(pinfo->cinfo, COL_INFO);
+
+
+  if (tree) {
+    ti = proto_tree_add_item(tree, proto_aruba_adp, tvb, 0, 0, FALSE);
+    aruba_adp_tree = proto_item_add_subtree(ti, ett_aruba_adp);
+
+    proto_tree_add_item(aruba_adp_tree, hf_adp_version, tvb, 0, 2, FALSE);
+  }
+  type = tvb_get_ntohs(tvb, 2);
+
+  if (tree) {
+    proto_tree_add_item(aruba_adp_tree, hf_adp_type, tvb, 2, 2, FALSE); 
+
+    proto_tree_add_item(aruba_adp_tree, hf_adp_id, tvb, 4, 2, FALSE);
+  }
+
+  switch(type){
+    case ADP_REQUEST:
+
+      proto_tree_add_item(aruba_adp_tree, hf_adp_mac, tvb, 6, 6, FALSE);
+      src_mac = tvb_get_ptr(tvb, 6, 6);
+
+      if (check_col(pinfo->cinfo, COL_INFO))
+        col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Request Src MAC: %s", ether_to_str(src_mac));
+
+      proto_item_append_text(ti, ", Request Src MAC: %s", ether_to_str(src_mac));
+      break;
+     
+    case ADP_RESPONSE:
+       
+      proto_tree_add_item(aruba_adp_tree, hf_adp_switchip, tvb, 6, 4, FALSE);
+      switchip = tvb_get_ptr(tvb, 6, 4);
+        
+      if (check_col(pinfo->cinfo, COL_INFO))
+        col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Response Switch IP: %s", ip_to_str(switchip));
+     
+      proto_item_append_text(ti, ", Response Switch IP: %s", ip_to_str(switchip)); 
+      break;
+      
+    default:
+        break;
+        
+  }
+}
+
+void
+proto_register_aruba_adp(void)
+{
+  static hf_register_info hf[] = {
+    { &hf_adp_version,
+    { "Version", "adp.version", FT_UINT16, BASE_DEC, NULL,0x0,
+    "ADP version", HFILL}},
+
+    { &hf_adp_type,
+    { "Type", "adp.type", FT_UINT16, BASE_DEC, VALS(adp_type_val), 0x0,
+    "ADP type", HFILL}},
+
+    { &hf_adp_id,
+    { "Transaction ID", "adp.id", FT_UINT16, BASE_DEC, NULL, 0x0,
+    "ADP transaction ID", HFILL}},
+
+    { &hf_adp_mac,
+    { "MAC address", "adp.mac", FT_ETHER, BASE_NONE, NULL, 0x0,
+    "MAC address", HFILL}},
+
+    { &hf_adp_switchip,
+    { "Switch IP", "adp.switch", FT_IPv4, BASE_NONE, NULL, 0x0,
+    "Switch IP address", HFILL}},
+
+    };
+
+  static gint *ett[] = {
+    &ett_aruba_adp,
+  };
+
+  proto_aruba_adp = proto_register_protocol("Aruba - Aruba Discovery Protocol",
+                    "ADP", "adp");
+  proto_register_field_array(proto_aruba_adp, hf, array_length(hf));
+  proto_register_subtree_array(ett, array_length(ett));
+}
+
+
+void
+proto_reg_handoff_aruba_adp(void)
+{
+  dissector_handle_t adp_handle;
+
+  adp_handle = create_dissector_handle(dissect_aruba_adp, proto_aruba_adp);
+  dissector_add("udp.port", UDP_PORT_ADP, adp_handle);
+}
+
+