Initial fix for bug 974. It does implement RSP header decoding, it lacks RSP trailer...
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 22 Jun 2006 00:07:46 +0000 (00:07 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 22 Jun 2006 00:07:46 +0000 (00:07 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18539 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-asf.c
epan/dissectors/packet-rmcp.c

index ec01becd1e98ddfbb50b21f6d6972e3be1cf888d..be0b8553c60c20bf37138547bbc694b592a735d1 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-# include "config.h"
+#include "config.h"
 #endif
 
 #include <glib.h>
@@ -36,8 +36,8 @@
 
 /*
  * See
- *
  *     http://www.dmtf.org/standards/standard_alert.php
+ *     http://www.dmtf.org/standards/documents/ASF/DSP0136.pdf
  */
 
 #define RMCP_CLASS_ASF 0x06
@@ -59,9 +59,16 @@ static const value_string asf_type_vals[] = {
        { 0x40, "Presence Pong" },
        { 0x41, "Capabilities Response" },
        { 0x42, "System State Response" },
+       { 0x43, "Open Session Response" },
+       { 0x44, "Close Session Response" },
        { 0x80, "Presence Ping" },
        { 0x81, "Capabilities Request" },
        { 0x82, "System State Request" },
+       { 0x83, "Open Session Request" },
+       { 0x84, "Close Session Request" },
+       { 0xC0, "RAKP Message 1" },
+       { 0xC1, "RAKP Message 2" },
+       { 0xC2, "RAKP Message 3" },
        { 0x00, NULL }
 };
 
index 25490c22ccbda944ec44efc6a3cf9350cfdaa371..69bb81a1260c243d3f49bc3f61f6534eac1edaa0 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-# include "config.h"
+#include "config.h"
 #endif
 
 #include <glib.h>
@@ -36,9 +36,8 @@
 
 /*
  * See
- *
  *     http://www.dmtf.org/standards/standard_alert.php
- *
+ *      http://www.dmtf.org/standards/documents/ASF/DSP0136.pdf
  * (the ASF specification includes RMCP)
  */
 
@@ -48,9 +47,19 @@ static int hf_rmcp_sequence = -1;
 static int hf_rmcp_class = -1;
 static int hf_rmcp_type = -1;
 
+static int proto_rsp = -1;
+static int hf_rsp_session_id = -1;
+static int hf_rsp_sequence = -1;
+static int hf_rsp_pad = -1;
+static int hf_rsp_pad_length = -1;
+static int hf_rsp_next_header = -1;
+static int hf_rsp_integrity_data = -1;
+
 static gint ett_rmcp = -1;
 static gint ett_rmcp_typeclass = -1;
 
+static gint ett_rsp = -1;
+
 static dissector_handle_t data_handle;
 static dissector_table_t rmcp_dissector_table;
 
@@ -143,6 +152,35 @@ dissect_rmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        return tvb_length(tvb);
 }
 
+static int
+dissect_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+       proto_tree      *rsp_tree = NULL, *field_tree;
+       proto_item      *ti, *tf;
+       tvbuff_t        *next_tvb;
+       int             offset = 0;
+       
+       if (tree) {
+               ti = proto_tree_add_protocol_format(tree, proto_rsp, tvb, offset, 8,
+                        "RMCP Security-extension Protocol");
+               rsp_tree = proto_item_add_subtree(ti, ett_rsp);
+
+               proto_tree_add_item(rsp_tree, hf_rsp_session_id, tvb, offset, 4, FALSE);
+               offset += 4;
+               proto_tree_add_item(rsp_tree, hf_rsp_sequence, tvb, offset, 4, FALSE);
+               offset += 4;
+       }
+       
+       /* XXX determination of RCMP message length needs to 
+        * be done according to 3.2.3.3.3 of the specification.
+        * This is only valid for session ID equals 0
+        */
+       next_tvb = tvb_new_subset(tvb, 8, -1, -1);
+       dissect_rmcp(next_tvb, pinfo, tree);
+
+       return tvb_length(tvb);
+}
+
 void
 proto_register_rmcp(void)
 {
@@ -164,11 +202,11 @@ proto_register_rmcp(void)
                        "Message Type", "rmcp.type",
                        FT_UINT8, BASE_HEX,
                        VALS(rmcp_type_vals), RMCP_TYPE_MASK,
-                       "RMCP Message Type", HFILL }},
+                       "RMCP Message Type", HFILL }}
        };
        static gint *ett[] = {
                &ett_rmcp,
-               &ett_rmcp_typeclass,
+               &ett_rmcp_typeclass
        };
 
        proto_rmcp = proto_register_protocol(
@@ -181,6 +219,29 @@ proto_register_rmcp(void)
                "rmcp.class", "RMCP Class", FT_UINT8, BASE_HEX);
 }
 
+void
+proto_register_rsp(void)
+{
+       static hf_register_info hf[] = {
+               { &hf_rsp_session_id, {
+                       "Session ID", "rsp.session_id",
+                       FT_UINT32, BASE_HEX, NULL, 0,
+                       "RSP session ID", HFILL }},
+               { &hf_rsp_sequence, {
+                       "Sequence", "rsp.sequence",
+                       FT_UINT32, BASE_HEX, NULL, 0,
+                       "RSP sequence", HFILL }},
+       };
+       static gint *ett[] = {
+               &ett_rsp
+       };
+
+       proto_rsp = proto_register_protocol(
+               "RMCP Security-extensions Protocol", "RSP", "rsp");
+       proto_register_field_array(proto_rsp, hf, array_length(hf));
+       proto_register_subtree_array(ett, array_length(ett));
+}
+
 void
 proto_reg_handoff_rmcp(void)
 {
@@ -190,5 +251,13 @@ proto_reg_handoff_rmcp(void)
 
        rmcp_handle = new_create_dissector_handle(dissect_rmcp, proto_rmcp);
        dissector_add("udp.port", UDP_PORT_RMCP, rmcp_handle);
-       dissector_add("udp.port", UDP_PORT_RMCP_SECURE, rmcp_handle);
+}
+
+void
+proto_reg_handoff_rsp(void)
+{
+       dissector_handle_t rsp_handle;
+
+       rsp_handle = new_create_dissector_handle(dissect_rsp, proto_rsp);
+       dissector_add("udp.port", UDP_PORT_RMCP_SECURE, rsp_handle);
 }