aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-09-30 04:10:28 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2006-09-30 04:10:28 +0000
commit62290c9cc5b92b1b74d22603043b00697ce5cfc8 (patch)
tree72278e0e9306335561aa7d3ae4cad6b936fa1b9f /epan/dissectors
parentdeef583ae55f7a43d9497e64b0e1ee0a54f4e2fa (diff)
add an extra_data pointer to the itlq structure where specific commandsets/cdbs can hang additional data that are unique to that commandset/cdb
make the scsi osd service action and getsetattributetype use this facility furhter enhancements to scsi osd svn path=/trunk/; revision=19374
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-fc.c1
-rw-r--r--epan/dissectors/packet-fc.h2
-rw-r--r--epan/dissectors/packet-iscsi.c1
-rw-r--r--epan/dissectors/packet-ndmp.c1
-rw-r--r--epan/dissectors/packet-scsi-osd.c121
5 files changed, 120 insertions, 6 deletions
diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c
index 43e60865c4..1922873397 100644
--- a/epan/dissectors/packet-fc.c
+++ b/epan/dissectors/packet-fc.c
@@ -679,6 +679,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
fc_ex->fc_time=pinfo->fd->abs_ts;
fc_ex->flags=0;
fc_ex->alloc_len=0;
+ fc_ex->extra_data=NULL;
se_tree_insert32(fc_conv_data->exchanges, fchdr.oxid, fc_ex);
}
/* populate the exchange struct */
diff --git a/epan/dissectors/packet-fc.h b/epan/dissectors/packet-fc.h
index 6d4be5876c..dbd19f3070 100644
--- a/epan/dissectors/packet-fc.h
+++ b/epan/dissectors/packet-fc.h
@@ -152,11 +152,11 @@ typedef struct _itlq_nexus_t {
guint16 lun; /* initialized to 0xffff == unknown */
guint16 scsi_opcode; /* initialized to 0xffff == unknown */
guint16 flags;
- guint16 svcaction;
guint32 alloc_len; /* we need to track alloc_len between the CDB and
* the DATA pdus for some opcodes.
*/
nstime_t fc_time;
+ void *extra_data; /* extra data that that is task specific */
} itlq_nexus_t;
diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c
index af5a4f93c2..24b5ca6d57 100644
--- a/epan/dissectors/packet-iscsi.c
+++ b/epan/dissectors/packet-iscsi.c
@@ -763,6 +763,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
cdata->itlq.last_exchange_frame=0;
cdata->itlq.flags=0;
cdata->itlq.alloc_len=0;
+ cdata->itlq.extra_data=NULL;
cdata->data_in_frame=0;
cdata->data_out_frame=0;
diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c
index 0e475f909d..4b70864739 100644
--- a/epan/dissectors/packet-ndmp.c
+++ b/epan/dissectors/packet-ndmp.c
@@ -1190,6 +1190,7 @@ dissect_execute_cdb_cdb(tvbuff_t *tvb, int offset, packet_info *pinfo,
ndmp_conv_data->task->itlq->flags=0;
ndmp_conv_data->task->itlq->alloc_len=0;
ndmp_conv_data->task->itlq->fc_time=pinfo->fd->abs_ts;
+ ndmp_conv_data->task->itlq->extra_data=NULL;
}
if(ndmp_conv_data->task->itlq){
dissect_scsi_cdb(cdb_tvb, pinfo, top_tree, devtype, ndmp_conv_data->task->itlq, get_itl_nexus(ndmp_conv_data, pinfo, FALSE));
diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c
index 71fae1e06f..388942a5c4 100644
--- a/epan/dissectors/packet-scsi-osd.c
+++ b/epan/dissectors/packet-scsi-osd.c
@@ -48,11 +48,23 @@ static int hf_scsi_osd_option_dpo = -1;
static int hf_scsi_osd_option_fua = -1;
static int hf_scsi_osd_getsetattrib = -1;
static int hf_scsi_osd_timestamps_control = -1;
+static int hf_scsi_osd_formatted_capacity = -1;
+static int hf_scsi_osd_get_attributes_page = -1;
+static int hf_scsi_osd_get_attributes_allocation_length = -1;
+static int hf_scsi_osd_retreived_attributes_offset = -1;
+static int hf_scsi_osd_set_attributes_page = -1;
+static int hf_scsi_osd_set_attribute_length = -1;
+static int hf_scsi_osd_set_attribute_number = -1;
+static int hf_scsi_osd_set_attributes_offset = -1;
static gint ett_osd_option = -1;
+typedef struct _scsi_osd_extra_data_t {
+ guint16 svcaction;
+ guint8 gsatype;
+} scsi_osd_extra_data_t;
static const true_false_string option_dpo_tfs = {
"DPO is SET",
@@ -97,8 +109,12 @@ static const value_string scsi_osd_getsetattrib_vals[] = {
};
/* OSD2 5.2.2.1 */
static void
-dissect_osd_getsetattrib(tvbuff_t *tvb, int offset, proto_tree *tree)
+dissect_osd_getsetattrib(tvbuff_t *tvb, int offset, proto_tree *tree, scsi_task_data_t *cdata)
{
+ if(cdata && cdata->itlq && cdata->itlq->extra_data){
+ scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
+ extra_data->gsatype=(tvb_get_guint8(tvb, offset)>>4)&0x03;
+ }
proto_tree_add_item(tree, hf_scsi_osd_getsetattrib, tvb, offset, 1, 0);
}
@@ -116,7 +132,55 @@ dissect_osd_timestamps_control(tvbuff_t *tvb, int offset, proto_tree *tree)
}
+static void
+dissect_osd_formatted_capacity(tvbuff_t *tvb, int offset, proto_tree *tree)
+{
+ proto_tree_add_item(tree, hf_scsi_osd_formatted_capacity, tvb, offset, 8, 0);
+}
+
+
+/* do we need to store these in the itlq structure ?*/
+static void
+dissect_osd_attribute_parameters(tvbuff_t *tvb, int offset, proto_tree *tree, scsi_task_data_t *cdata)
+{
+ guint8 gsatype=0;
+
+ if(cdata && cdata->itlq && cdata->itlq->extra_data){
+ scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
+ gsatype=extra_data->gsatype;
+ } else {
+ return;
+ }
+
+ switch(gsatype){
+ case 2: /* 5.2.2.2 attribute page */
+ proto_tree_add_item(tree, hf_scsi_osd_get_attributes_page, tvb, offset, 4, 0);
+ offset+=4;
+ proto_tree_add_item(tree, hf_scsi_osd_get_attributes_allocation_length, tvb, offset, 4, 0);
+ offset+=4;
+ proto_tree_add_item(tree, hf_scsi_osd_retreived_attributes_offset, tvb, offset, 4, 0);
+ offset+=4;
+ proto_tree_add_item(tree, hf_scsi_osd_set_attributes_page, tvb, offset, 4, 0);
+ offset+=4;
+ proto_tree_add_item(tree, hf_scsi_osd_set_attribute_length, tvb, offset, 4, 0);
+ offset+=4;
+ proto_tree_add_item(tree, hf_scsi_osd_set_attribute_number, tvb, offset, 4, 0);
+ offset+=4;
+ proto_tree_add_item(tree, hf_scsi_osd_set_attributes_offset, tvb, offset, 4, 0);
+ offset+=4;
+ break;
+ case 3: /* 5.2.2.3 attribute list */
+/*qqq*/
+ break;
+ }
+}
+/* 4.9.2.2 */
+static void
+dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *tree)
+{
+/*qqq*/
+}
@@ -134,7 +198,7 @@ dissect_osd_format_osd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
offset++;
/* getset attributes byte */
- dissect_osd_getsetattrib(tvb, offset, tree);
+ dissect_osd_getsetattrib(tvb, offset, tree, cdata);
offset++;
/* timestamps control */
@@ -144,6 +208,20 @@ dissect_osd_format_osd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
/* 23 reserved bytes */
offset+=23;
+ /* formatted capacity */
+ dissect_osd_formatted_capacity(tvb, offset, tree);
+ offset+=8;
+
+ /* 8 reserved bytes */
+ offset+=8;
+
+ /* attribute parameters */
+ dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
+ offset+=28;
+
+ /* capability */
+ dissect_osd_capability(tvb, offset, tree);
+ offset+=80;
/*qqq*/
}
@@ -221,7 +299,14 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* We must store the service action for this itlq
* so we can indentify what the data contains
*/
- cdata->itlq->svcaction=svcaction;
+ if((!pinfo->fd->flags.visited) && (!cdata->itlq->extra_data)){
+ scsi_osd_extra_data_t *extra_data;
+
+ extra_data=se_alloc(sizeof(scsi_osd_extra_data_t));
+ extra_data->svcaction=svcaction;
+ extra_data->gsatype=0;
+ cdata->itlq->extra_data=extra_data;
+ }
}
proto_tree_add_item (tree, hf_scsi_osd_svcaction, tvb, offset, 2, 0);
offset+=2;
@@ -241,8 +326,9 @@ dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* If it was not a CDB, try to find the service action and pass it
* off to the service action dissector
*/
- if(cdata && cdata->itlq){
- svcaction=cdata->itlq->svcaction;
+ if(cdata && cdata->itlq && cdata->itlq->extra_data){
+ scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
+ svcaction=extra_data->svcaction;
}
if(check_col(pinfo->cinfo, COL_INFO)){
col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
@@ -570,6 +656,30 @@ proto_register_scsi_osd(void)
{ &hf_scsi_osd_timestamps_control,
{"Timestamps Control", "scsi.osd.timestamps_control", FT_UINT8, BASE_HEX,
VALS(scsi_osd_timestamps_control_vals), 0x0, "", HFILL}},
+ { &hf_scsi_osd_formatted_capacity,
+ {"Formatted Capacity", "scsi.osd.formatted_capacity", FT_UINT64, BASE_DEC,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_get_attributes_page,
+ {"Get Attributes Page", "scsi.osd.get_attributes_page", FT_UINT32, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_get_attributes_allocation_length,
+ {"Get Attributes Allocation Length", "scsi.osd.get_attributes_allocation_length", FT_UINT32, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_retreived_attributes_offset,
+ {"Retreived Attributes Offset", "scsi.osd.retreived_attributes_offset", FT_UINT32, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_set_attributes_page,
+ {"Set Attributes Page", "scsi.osd.set_attributes_page", FT_UINT32, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_set_attribute_length,
+ {"Set Attribute Length", "scsi.osd.set_attribute_length", FT_UINT32, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_set_attribute_number,
+ {"Set Attribute Number", "scsi.osd.set_attribute_number", FT_UINT32, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
+ { &hf_scsi_osd_set_attributes_offset,
+ {"Set Attributes Offset", "scsi.osd.set_attributes_offset", FT_UINT32, BASE_HEX,
+ NULL, 0x0, "", HFILL}},
};
/* Setup protocol subtree array */
@@ -589,3 +699,4 @@ void
proto_reg_handoff_scsi_osd(void)
{
}
+