aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-scsi-osd.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-09-29 10:40:51 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-09-29 10:40:51 +0000
commite2a851e18d29b6a10fe85a3206d399eff42917b7 (patch)
tree40e292fe3e84f52c7bb837064a01583658d52572 /epan/dissectors/packet-scsi-osd.c
parentd09cfb2bb8cabfc195ef97e80dd17d1531d8a4ea (diff)
add initial scsi osd dissector but only dissect sdbs that are impoerted from SPC
various changes to the existing scsi dissector to start allowing different commandsets to be implemented in their own dissector files to prevent the scsi dissector to become as huge as the parlay dissector svn path=/trunk/; revision=19360
Diffstat (limited to 'epan/dissectors/packet-scsi-osd.c')
-rw-r--r--epan/dissectors/packet-scsi-osd.c381
1 files changed, 381 insertions, 0 deletions
diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c
new file mode 100644
index 0000000000..385d2e251a
--- /dev/null
+++ b/epan/dissectors/packet-scsi-osd.c
@@ -0,0 +1,381 @@
+/* packet-scsi-osd.c
+ * Ronnie sahlberg 2006
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 2002 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 <glib.h>
+#include <string.h>
+#include <epan/strutil.h>
+#include <epan/packet.h>
+#include <epan/prefs.h>
+#include <epan/emem.h>
+#include <epan/conversation.h>
+#include <epan/tap.h>
+#include "packet-fc.h"
+#include "packet-scsi.h"
+#include "packet-scsi-osd.h"
+
+static int proto_scsi_osd = -1;
+int hf_scsi_osd_opcode = -1;
+static int hf_scsi_osd_control = -1;
+static int hf_scsi_osd_add_cdblen = -1;
+static int hf_scsi_osd_svcaction = -1;
+
+
+
+
+static void
+dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ guint offset, gboolean isreq, gboolean iscdb,
+ guint payload_len _U_, scsi_task_data_t *cdata _U_)
+{
+ guint16 svcaction;
+
+ if(!tree)
+ return;
+
+ /* dissecting the CDB */
+ if (isreq && iscdb) {
+ proto_tree_add_item (tree, hf_scsi_osd_control, tvb, offset, 1, 0);
+ proto_tree_add_item (tree, hf_scsi_osd_add_cdblen, tvb, offset+6, 1, 0);
+ svcaction=tvb_get_ntohs(tvb, offset+7);
+ proto_tree_add_item (tree, hf_scsi_osd_svcaction, tvb, offset+7, 2, 0);
+ }
+}
+
+
+/* OSD Commands */
+const value_string scsi_osd_vals[] = {
+ {SCSI_SPC2_INQUIRY , "Inquiry"},
+ {SCSI_SPC2_LOGSELECT , "Log Select"},
+ {SCSI_SPC2_LOGSENSE , "Log Sense"},
+ {SCSI_SPC2_MODESELECT10 , "Mode Select(10)"},
+ {SCSI_SPC2_MODESENSE10 , "Mode Sense(10)"},
+ {SCSI_SPC2_PERSRESVIN , "Persistent Reserve In"},
+ {SCSI_SPC2_PERSRESVOUT , "Persistent Reserve Out"},
+ {SCSI_SPC2_REPORTLUNS , "Report LUNs"},
+ {SCSI_OSD_OPCODE , "OSD Command" },
+ {0, NULL},
+};
+
+
+
+scsi_cdb_table_t scsi_osd_table[256] = {
+/*OSD 0x00*/{NULL},
+/*OSD 0x01*/{NULL},
+/*OSD 0x02*/{NULL},
+/*OSD 0x03*/{NULL},
+/*OSD 0x04*/{NULL},
+/*OSD 0x05*/{NULL},
+/*OSD 0x06*/{NULL},
+/*OSD 0x07*/{NULL},
+/*OSD 0x08*/{NULL},
+/*OSD 0x09*/{NULL},
+/*OSD 0x0a*/{NULL},
+/*OSD 0x0b*/{NULL},
+/*OSD 0x0c*/{NULL},
+/*OSD 0x0d*/{NULL},
+/*OSD 0x0e*/{NULL},
+/*OSD 0x0f*/{NULL},
+/*OSD 0x10*/{NULL},
+/*OSD 0x11*/{NULL},
+/*OSD 0x12*/{dissect_spc3_inquiry},
+/*OSD 0x13*/{NULL},
+/*OSD 0x14*/{NULL},
+/*OSD 0x15*/{NULL},
+/*OSD 0x16*/{NULL},
+/*OSD 0x17*/{NULL},
+/*OSD 0x18*/{NULL},
+/*OSD 0x19*/{NULL},
+/*OSD 0x1a*/{NULL},
+/*OSD 0x1b*/{NULL},
+/*OSD 0x1c*/{NULL},
+/*OSD 0x1d*/{NULL},
+/*OSD 0x1e*/{NULL},
+/*OSD 0x1f*/{NULL},
+/*OSD 0x20*/{NULL},
+/*OSD 0x21*/{NULL},
+/*OSD 0x22*/{NULL},
+/*OSD 0x23*/{NULL},
+/*OSD 0x24*/{NULL},
+/*OSD 0x25*/{NULL},
+/*OSD 0x26*/{NULL},
+/*OSD 0x27*/{NULL},
+/*OSD 0x28*/{NULL},
+/*OSD 0x29*/{NULL},
+/*OSD 0x2a*/{NULL},
+/*OSD 0x2b*/{NULL},
+/*OSD 0x2c*/{NULL},
+/*OSD 0x2d*/{NULL},
+/*OSD 0x2e*/{NULL},
+/*OSD 0x2f*/{NULL},
+/*OSD 0x30*/{NULL},
+/*OSD 0x31*/{NULL},
+/*OSD 0x32*/{NULL},
+/*OSD 0x33*/{NULL},
+/*OSD 0x34*/{NULL},
+/*OSD 0x35*/{NULL},
+/*OSD 0x36*/{NULL},
+/*OSD 0x37*/{NULL},
+/*OSD 0x38*/{NULL},
+/*OSD 0x39*/{NULL},
+/*OSD 0x3a*/{NULL},
+/*OSD 0x3b*/{NULL},
+/*OSD 0x3c*/{NULL},
+/*OSD 0x3d*/{NULL},
+/*OSD 0x3e*/{NULL},
+/*OSD 0x3f*/{NULL},
+/*OSD 0x40*/{NULL},
+/*OSD 0x41*/{NULL},
+/*OSD 0x42*/{NULL},
+/*OSD 0x43*/{NULL},
+/*OSD 0x44*/{NULL},
+/*OSD 0x45*/{NULL},
+/*OSD 0x46*/{NULL},
+/*OSD 0x47*/{NULL},
+/*OSD 0x48*/{NULL},
+/*OSD 0x49*/{NULL},
+/*OSD 0x4a*/{NULL},
+/*OSD 0x4b*/{NULL},
+/*OSD 0x4c*/{dissect_spc3_logselect},
+/*OSD 0x4d*/{dissect_spc3_logsense},
+/*OSD 0x4e*/{NULL},
+/*OSD 0x4f*/{NULL},
+/*OSD 0x50*/{NULL},
+/*OSD 0x51*/{NULL},
+/*OSD 0x52*/{NULL},
+/*OSD 0x53*/{NULL},
+/*OSD 0x54*/{NULL},
+/*OSD 0x55*/{dissect_spc3_modeselect10},
+/*OSD 0x56*/{NULL},
+/*OSD 0x57*/{NULL},
+/*OSD 0x58*/{NULL},
+/*OSD 0x59*/{NULL},
+/*OSD 0x5a*/{dissect_spc3_modesense10},
+/*OSD 0x5b*/{NULL},
+/*OSD 0x5c*/{NULL},
+/*OSD 0x5d*/{NULL},
+/*OSD 0x5e*/{dissect_spc3_persistentreservein},
+/*OSD 0x5f*/{dissect_spc3_persistentreserveout},
+/*OSD 0x60*/{NULL},
+/*OSD 0x61*/{NULL},
+/*OSD 0x62*/{NULL},
+/*OSD 0x63*/{NULL},
+/*OSD 0x64*/{NULL},
+/*OSD 0x65*/{NULL},
+/*OSD 0x66*/{NULL},
+/*OSD 0x67*/{NULL},
+/*OSD 0x68*/{NULL},
+/*OSD 0x69*/{NULL},
+/*OSD 0x6a*/{NULL},
+/*OSD 0x6b*/{NULL},
+/*OSD 0x6c*/{NULL},
+/*OSD 0x6d*/{NULL},
+/*OSD 0x6e*/{NULL},
+/*OSD 0x6f*/{NULL},
+/*OSD 0x70*/{NULL},
+/*OSD 0x71*/{NULL},
+/*OSD 0x72*/{NULL},
+/*OSD 0x73*/{NULL},
+/*OSD 0x74*/{NULL},
+/*OSD 0x75*/{NULL},
+/*OSD 0x76*/{NULL},
+/*OSD 0x77*/{NULL},
+/*OSD 0x78*/{NULL},
+/*OSD 0x79*/{NULL},
+/*OSD 0x7a*/{NULL},
+/*OSD 0x7b*/{NULL},
+/*OSD 0x7c*/{NULL},
+/*OSD 0x7d*/{NULL},
+/*OSD 0x7e*/{NULL},
+/*OSD 0x7f*/{dissect_osd_opcode},
+/*OSD 0x80*/{NULL},
+/*OSD 0x81*/{NULL},
+/*OSD 0x82*/{NULL},
+/*OSD 0x83*/{NULL},
+/*OSD 0x84*/{NULL},
+/*OSD 0x85*/{NULL},
+/*OSD 0x86*/{NULL},
+/*OSD 0x87*/{NULL},
+/*OSD 0x88*/{NULL},
+/*OSD 0x89*/{NULL},
+/*OSD 0x8a*/{NULL},
+/*OSD 0x8b*/{NULL},
+/*OSD 0x8c*/{NULL},
+/*OSD 0x8d*/{NULL},
+/*OSD 0x8e*/{NULL},
+/*OSD 0x8f*/{NULL},
+/*OSD 0x90*/{NULL},
+/*OSD 0x91*/{NULL},
+/*OSD 0x92*/{NULL},
+/*OSD 0x93*/{NULL},
+/*OSD 0x94*/{NULL},
+/*OSD 0x95*/{NULL},
+/*OSD 0x96*/{NULL},
+/*OSD 0x97*/{NULL},
+/*OSD 0x98*/{NULL},
+/*OSD 0x99*/{NULL},
+/*OSD 0x9a*/{NULL},
+/*OSD 0x9b*/{NULL},
+/*OSD 0x9c*/{NULL},
+/*OSD 0x9d*/{NULL},
+/*OSD 0x9e*/{NULL},
+/*OSD 0x9f*/{NULL},
+/*OSD 0xa0*/{dissect_spc3_reportluns},
+/*OSD 0xa1*/{NULL},
+/*OSD 0xa2*/{NULL},
+/*OSD 0xa3*/{NULL},
+/*OSD 0xa4*/{NULL},
+/*OSD 0xa5*/{NULL},
+/*OSD 0xa6*/{NULL},
+/*OSD 0xa7*/{NULL},
+/*OSD 0xa8*/{NULL},
+/*OSD 0xa9*/{NULL},
+/*OSD 0xaa*/{NULL},
+/*OSD 0xab*/{NULL},
+/*OSD 0xac*/{NULL},
+/*OSD 0xad*/{NULL},
+/*OSD 0xae*/{NULL},
+/*OSD 0xaf*/{NULL},
+/*OSD 0xb0*/{NULL},
+/*OSD 0xb1*/{NULL},
+/*OSD 0xb2*/{NULL},
+/*OSD 0xb3*/{NULL},
+/*OSD 0xb4*/{NULL},
+/*OSD 0xb5*/{NULL},
+/*OSD 0xb6*/{NULL},
+/*OSD 0xb7*/{NULL},
+/*OSD 0xb8*/{NULL},
+/*OSD 0xb9*/{NULL},
+/*OSD 0xba*/{NULL},
+/*OSD 0xbb*/{NULL},
+/*OSD 0xbc*/{NULL},
+/*OSD 0xbd*/{NULL},
+/*OSD 0xbe*/{NULL},
+/*OSD 0xbf*/{NULL},
+/*OSD 0xc0*/{NULL},
+/*OSD 0xc1*/{NULL},
+/*OSD 0xc2*/{NULL},
+/*OSD 0xc3*/{NULL},
+/*OSD 0xc4*/{NULL},
+/*OSD 0xc5*/{NULL},
+/*OSD 0xc6*/{NULL},
+/*OSD 0xc7*/{NULL},
+/*OSD 0xc8*/{NULL},
+/*OSD 0xc9*/{NULL},
+/*OSD 0xca*/{NULL},
+/*OSD 0xcb*/{NULL},
+/*OSD 0xcc*/{NULL},
+/*OSD 0xcd*/{NULL},
+/*OSD 0xce*/{NULL},
+/*OSD 0xcf*/{NULL},
+/*OSD 0xd0*/{NULL},
+/*OSD 0xd1*/{NULL},
+/*OSD 0xd2*/{NULL},
+/*OSD 0xd3*/{NULL},
+/*OSD 0xd4*/{NULL},
+/*OSD 0xd5*/{NULL},
+/*OSD 0xd6*/{NULL},
+/*OSD 0xd7*/{NULL},
+/*OSD 0xd8*/{NULL},
+/*OSD 0xd9*/{NULL},
+/*OSD 0xda*/{NULL},
+/*OSD 0xdb*/{NULL},
+/*OSD 0xdc*/{NULL},
+/*OSD 0xdd*/{NULL},
+/*OSD 0xde*/{NULL},
+/*OSD 0xdf*/{NULL},
+/*OSD 0xe0*/{NULL},
+/*OSD 0xe1*/{NULL},
+/*OSD 0xe2*/{NULL},
+/*OSD 0xe3*/{NULL},
+/*OSD 0xe4*/{NULL},
+/*OSD 0xe5*/{NULL},
+/*OSD 0xe6*/{NULL},
+/*OSD 0xe7*/{NULL},
+/*OSD 0xe8*/{NULL},
+/*OSD 0xe9*/{NULL},
+/*OSD 0xea*/{NULL},
+/*OSD 0xeb*/{NULL},
+/*OSD 0xec*/{NULL},
+/*OSD 0xed*/{NULL},
+/*OSD 0xee*/{NULL},
+/*OSD 0xef*/{NULL},
+/*OSD 0xf0*/{NULL},
+/*OSD 0xf1*/{NULL},
+/*OSD 0xf2*/{NULL},
+/*OSD 0xf3*/{NULL},
+/*OSD 0xf4*/{NULL},
+/*OSD 0xf5*/{NULL},
+/*OSD 0xf6*/{NULL},
+/*OSD 0xf7*/{NULL},
+/*OSD 0xf8*/{NULL},
+/*OSD 0xf9*/{NULL},
+/*OSD 0xfa*/{NULL},
+/*OSD 0xfb*/{NULL},
+/*OSD 0xfc*/{NULL},
+/*OSD 0xfd*/{NULL},
+/*OSD 0xfe*/{NULL},
+/*OSD 0xff*/{NULL}
+};
+
+
+
+
+void
+proto_register_scsi_osd(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_scsi_osd_opcode,
+ {"OSD Opcode", "scsi.osd.opcode", FT_UINT8, BASE_HEX,
+ VALS (scsi_osd_vals), 0x0, "", HFILL}},
+ { &hf_scsi_osd_control,
+ {"Control", "scsi.osd.cdb.control", FT_UINT8, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_add_cdblen,
+ {"Additional CDB Length", "scsi.osd.addcdblen", FT_UINT8, BASE_DEC,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_svcaction,
+ {"Service Action", "scsi.osd.svcaction", FT_UINT16, BASE_HEX, NULL,
+ 0x0, "", HFILL}},
+ };
+
+ /* Setup protocol subtree array */
+ static gint *ett[] = {
+ };
+
+ /* Register the protocol name and description */
+ proto_scsi_osd = proto_register_protocol("SCSI_OSD", "SCSI_OSD", "scsi_osd");
+
+ /* Required function calls to register the header fields and subtrees used */
+ proto_register_field_array(proto_scsi_osd, hf, array_length(hf));
+/*proto_register_subtree_array(ett, array_length(ett));*/
+}
+
+void
+proto_reg_handoff_scsi_osd(void)
+{
+}