start splitting the monolitic scsi dissector up into commandset dissectors
[obnox/wireshark/wip.git] / epan / dissectors / packet-scsi-osd.c
1 /* packet-scsi-osd.c
2  * Ronnie sahlberg 2006
3  * Joe Breher 2006
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 2002 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include <glib.h>
31 #include <string.h>
32 #include <epan/strutil.h>
33 #include <epan/packet.h>
34 #include <epan/prefs.h>
35 #include <epan/emem.h>
36 #include <epan/conversation.h>
37 #include <epan/tap.h>
38 #include "packet-scsi.h"
39 #include "packet-fc.h"
40 #include "packet-scsi-osd.h"
41
42
43 static int proto_scsi_osd               = -1;
44 int hf_scsi_osd_opcode                  = -1;
45 static int hf_scsi_osd_add_cdblen       = -1;
46 static int hf_scsi_osd_svcaction        = -1;
47 static int hf_scsi_osd_option           = -1;
48 static int hf_scsi_osd_option_dpo       = -1;
49 static int hf_scsi_osd_option_fua       = -1;
50 static int hf_scsi_osd_getsetattrib     = -1;
51 static int hf_scsi_osd_timestamps_control       = -1;
52 static int hf_scsi_osd_formatted_capacity       = -1;
53 static int hf_scsi_osd_get_attributes_page      = -1;
54 static int hf_scsi_osd_get_attributes_allocation_length = -1;
55 static int hf_scsi_osd_get_attributes_list_length= -1;
56 static int hf_scsi_osd_get_attributes_list_offset= -1;
57 static int hf_scsi_osd_retreived_attributes_offset = -1;
58 static int hf_scsi_osd_set_attributes_page      = -1;
59 static int hf_scsi_osd_set_attribute_length     = -1;
60 static int hf_scsi_osd_set_attribute_number     = -1;
61 static int hf_scsi_osd_set_attributes_offset    = -1;
62 static int hf_scsi_osd_set_attributes_list_length= -1;
63 static int hf_scsi_osd_set_attributes_list_offset= -1;
64 static int hf_scsi_osd_capability_format        = -1;
65 static int hf_scsi_osd_key_version      = -1;
66 static int hf_scsi_osd_icva             = -1;
67 static int hf_scsi_osd_security_method  = -1;
68 static int hf_scsi_osd_capability_expiration_time= -1;
69 static int hf_scsi_osd_audit= -1;
70 static int hf_scsi_osd_capability_discriminator = -1;
71 static int hf_scsi_osd_object_created_time= -1;
72 static int hf_scsi_osd_object_type      = -1;
73 static int hf_scsi_osd_permissions      = -1;
74 static int hf_scsi_osd_permissions_read = -1;
75 static int hf_scsi_osd_permissions_write        = -1;
76 static int hf_scsi_osd_permissions_get_attr     = -1;
77 static int hf_scsi_osd_permissions_set_attr     = -1;
78 static int hf_scsi_osd_permissions_create       = -1;
79 static int hf_scsi_osd_permissions_remove       = -1;
80 static int hf_scsi_osd_permissions_obj_mgmt     = -1;
81 static int hf_scsi_osd_permissions_append       = -1;
82 static int hf_scsi_osd_permissions_dev_mgmt     = -1;
83 static int hf_scsi_osd_permissions_global       = -1;
84 static int hf_scsi_osd_permissions_pol_sec      = -1;
85 static int hf_scsi_osd_object_descriptor_type   = -1;
86 static int hf_scsi_osd_object_descriptor= -1;
87 static int hf_scsi_osd_ricv             = -1;
88 static int hf_scsi_osd_request_nonce    = -1;
89 static int hf_scsi_osd_diicvo           = -1;
90 static int hf_scsi_osd_doicvo           = -1;
91 static int hf_scsi_osd_requested_partition_id   = -1;
92 static int hf_scsi_osd_sortorder        = -1;
93 static int hf_scsi_osd_partition_id     = -1;
94 static int hf_scsi_osd_list_identifier  = -1;
95 static int hf_scsi_osd_allocation_length= -1;
96 static int hf_scsi_osd_length= -1;
97 static int hf_scsi_osd_starting_byte_address    = -1;
98 static int hf_scsi_osd_initial_object_id= -1;
99 static int hf_scsi_osd_additional_length= -1;
100 static int hf_scsi_osd_continuation_object_id= -1;
101 static int hf_scsi_osd_list_flags_lstchg= -1;
102 static int hf_scsi_osd_list_flags_root= -1;
103 static int hf_scsi_osd_user_object_id= -1;
104 static int hf_scsi_osd_requested_user_object_id = -1;
105 static int hf_scsi_osd_number_of_user_objects   = -1;
106 static int hf_scsi_osd_key_to_set               = -1;
107 static int hf_scsi_osd_set_key_version          = -1;
108 static int hf_scsi_osd_key_identifier           = -1;
109 static int hf_scsi_osd_seed                     = -1;
110 static int hf_scsi_osd_collection_fcr           = -1;
111 static int hf_scsi_osd_collection_object_id     = -1;
112 static int hf_scsi_osd_requested_collection_object_id   = -1;
113 static int hf_scsi_osd_partition_created_in     = -1;
114 static int hf_scsi_osd_partition_removed_in     = -1;
115 static int hf_scsi_osd_flush_scope              = -1;
116 static int hf_scsi_osd_flush_collection_scope   = -1;
117 static int hf_scsi_osd_flush_partition_scope    = -1;
118 static int hf_scsi_osd_flush_osd_scope          = -1;
119
120 static gint ett_osd_option              = -1;
121 static gint ett_osd_partition           = -1;
122 static gint ett_osd_attribute_parameters= -1;
123 static gint ett_osd_capability          = -1;
124 static gint ett_osd_permission_bitmask  = -1;
125 static gint ett_osd_security_parameters = -1;
126
127
128
129 /* There will be one such structure create for each conversation ontop of which
130  * there is an OSD session
131  */
132 typedef struct _scsi_osd_conv_info_t {
133         emem_tree_t *luns;
134 } scsi_osd_conv_info_t;
135
136 /* there will be one such structure created for each lun for each conversation
137  * that is handled by the OSD dissector
138  */
139 typedef struct _scsi_osd_lun_info_t {
140         emem_tree_t *partitions;
141 } scsi_osd_lun_info_t;
142
143 typedef void (*scsi_osd_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
144                 proto_tree *tree, guint offset,
145                 gboolean isreq, gboolean iscdb,
146                 guint32 payload_len, scsi_task_data_t *cdata,
147                 scsi_osd_conv_info_t *conv_info,
148                 scsi_osd_lun_info_t *lun_info
149                 );
150
151 /* One such structure is created per conversation/lun/partition to
152  * keep track of when partitions are created/used/destroyed
153  */
154 typedef struct _partition_info_t {
155         int created_in;
156         int removed_in;
157 } partition_info_t;
158
159
160 /* This is a set of extra data specific to OSD that we need to attach to every
161  * task.
162  */
163 typedef struct _scsi_osd_extra_data_t {
164         guint16 svcaction;
165         guint8  gsatype;
166         union {
167                 struct {        /* gsatype: attribute list */
168                         guint32 get_list_length;
169                         guint32 get_list_offset;
170                         guint32 get_list_allocation_length;
171                         guint32 retreived_list_offset;
172                         guint32 set_list_length;
173                         guint32 set_list_offset;
174                 };
175         };
176 } scsi_osd_extra_data_t;
177
178 static const true_false_string option_dpo_tfs = {
179         "DPO is SET",
180         "Dpo is NOT set"
181 };
182 static const true_false_string option_fua_tfs = {
183         "FUA is SET",
184         "Fua is NOT set"
185 };
186
187 /* OSD2 5.2.4 */
188 static void
189 dissect_osd_option(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
190 {
191         proto_tree *tree=NULL;
192         proto_item *it=NULL;
193         guint8 option;
194
195         option=tvb_get_guint8(tvb, offset);
196
197         if(parent_tree){
198                 it=proto_tree_add_item(parent_tree, hf_scsi_osd_option, tvb, offset, 1, 0);
199                 tree = proto_item_add_subtree(it, ett_osd_option);
200         }
201
202         proto_tree_add_item(tree, hf_scsi_osd_option_dpo, tvb, offset, 1, 0);
203         if(option&0x10){
204                 proto_item_append_text(tree, " DPO");
205         }
206
207         proto_tree_add_item(tree, hf_scsi_osd_option_fua, tvb, offset, 1, 0);
208         if(option&0x08){
209                 proto_item_append_text(tree, " FUA");
210         }
211 }
212
213
214 static const value_string scsi_osd_getsetattrib_vals[] = {
215     {2,         "Get an attributes page and set an attribute value"},
216     {3,         "Get and set attributes using a list"},
217     {0, NULL},
218 };
219 /* OSD2 5.2.2.1 */
220 static void
221 dissect_osd_getsetattrib(tvbuff_t *tvb, int offset, proto_tree *tree, scsi_task_data_t *cdata)
222 {
223         if(cdata && cdata->itlq && cdata->itlq->extra_data){
224                 scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
225                 extra_data->gsatype=(tvb_get_guint8(tvb, offset)>>4)&0x03;
226         }
227         proto_tree_add_item(tree, hf_scsi_osd_getsetattrib, tvb, offset, 1, 0);
228 }
229
230
231 static const value_string scsi_osd_timestamps_control_vals[] = {
232     {0x00,      "Timestamps shall be updated"},
233     {0x7f,      "Timestamps shall not be updated"},
234     {0, NULL},
235 };
236 /* OSD2 5.2.8 */
237 static void
238 dissect_osd_timestamps_control(tvbuff_t *tvb, int offset, proto_tree *tree)
239 {
240         proto_tree_add_item(tree, hf_scsi_osd_timestamps_control, tvb, offset, 1, 0);
241 }
242
243
244 static void
245 dissect_osd_formatted_capacity(tvbuff_t *tvb, int offset, proto_tree *tree)
246 {
247         proto_tree_add_item(tree, hf_scsi_osd_formatted_capacity, tvb, offset, 8, 0);
248 }
249
250
251 static void
252 dissect_osd_attribute_parameters(tvbuff_t *tvb, int offset, proto_tree *parent_tree, scsi_task_data_t *cdata)
253 {
254         guint8 gsatype=0;
255         proto_item *item=NULL;
256         proto_tree *tree=NULL;
257         scsi_osd_extra_data_t *extra_data=NULL;
258
259         if(parent_tree){
260                 item = proto_tree_add_text(parent_tree, tvb, offset, 28,
261                     "Attribute Parameters");
262                 tree = proto_item_add_subtree(item, ett_osd_attribute_parameters);
263         }
264                 
265         if(cdata && cdata->itlq && cdata->itlq->extra_data){
266                 extra_data=cdata->itlq->extra_data;
267                 gsatype=extra_data->gsatype;
268         } else {
269                 return;
270         }
271
272         switch(gsatype){
273         case 2: /* 5.2.2.2  attribute page */
274                 proto_tree_add_item(tree, hf_scsi_osd_get_attributes_page, tvb, offset, 4, 0);
275                 offset+=4;
276                 proto_tree_add_item(tree, hf_scsi_osd_get_attributes_allocation_length, tvb, offset, 4, 0);
277                 offset+=4;
278                 proto_tree_add_item(tree, hf_scsi_osd_retreived_attributes_offset, tvb, offset, 4, 0);
279                 offset+=4;
280                 proto_tree_add_item(tree, hf_scsi_osd_set_attributes_page, tvb, offset, 4, 0);
281                 offset+=4;
282                 proto_tree_add_item(tree, hf_scsi_osd_set_attribute_number, tvb, offset, 4, 0);
283                 offset+=4;
284                 proto_tree_add_item(tree, hf_scsi_osd_set_attribute_length, tvb, offset, 4, 0);
285                 offset+=4;
286                 proto_tree_add_item(tree, hf_scsi_osd_set_attributes_offset, tvb, offset, 4, 0);
287                 offset+=4;
288                 break;
289         case 3: /* 5.2.2.3  attribute list */
290                 proto_tree_add_item(tree, hf_scsi_osd_get_attributes_list_length, tvb, offset, 4, 0);
291                 extra_data->get_list_length=tvb_get_ntohl(tvb, offset);
292                 offset+=4;
293
294                 proto_tree_add_item(tree, hf_scsi_osd_get_attributes_list_offset, tvb, offset, 4, 0);
295                 extra_data->get_list_offset=tvb_get_ntohl(tvb, offset);
296                 offset+=4;
297
298                 proto_tree_add_item(tree, hf_scsi_osd_get_attributes_allocation_length, tvb, offset, 4, 0);
299                 extra_data->get_list_allocation_length=tvb_get_ntohl(tvb, offset);
300                 offset+=4;
301
302                 proto_tree_add_item(tree, hf_scsi_osd_retreived_attributes_offset, tvb, offset, 4, 0);
303                 extra_data->retreived_list_offset=tvb_get_ntohl(tvb, offset);
304                 offset+=4;
305
306                 proto_tree_add_item(tree, hf_scsi_osd_set_attributes_list_length, tvb, offset, 4, 0);
307                 extra_data->set_list_length=tvb_get_ntohl(tvb, offset);
308                 offset+=4;
309
310                 proto_tree_add_item(tree, hf_scsi_osd_set_attributes_list_offset, tvb, offset, 4, 0);
311                 extra_data->set_list_offset=tvb_get_ntohl(tvb, offset);
312                 offset+=4;
313
314                 /* 4 reserved bytes */
315                 offset+=4;
316
317                 break;
318         }
319 }
320
321
322 static void
323 dissect_osd_attribute_data_out(tvbuff_t *tvb, int offset _U_, proto_tree *tree, scsi_task_data_t *cdata)
324 {
325         guint8 gsatype=0;
326         scsi_osd_extra_data_t *extra_data=NULL;
327
328         if(cdata && cdata->itlq && cdata->itlq->extra_data){
329                 extra_data=cdata->itlq->extra_data;
330                 gsatype=extra_data->gsatype;
331         } else {
332                 return;
333         }
334
335         switch(gsatype){
336         case 2: /* 5.2.2.2  attribute page */
337 /*qqq*/
338                 break;
339         case 3: /* 5.2.2.3  attribute list */
340                 if(extra_data->get_list_length){
341                         proto_tree_add_text(tree, tvb, extra_data->get_list_offset, extra_data->get_list_length, "Get Attributes Data");
342                 }
343                 if(extra_data->set_list_length){
344                         proto_tree_add_text(tree, tvb, extra_data->set_list_offset, extra_data->set_list_length, "Set Attributes Data");
345                 }
346                 break;
347         }
348 }
349
350
351 static void
352 dissect_osd_attribute_data_in(tvbuff_t *tvb, int offset _U_, proto_tree *tree, scsi_task_data_t *cdata)
353 {
354         guint8 gsatype=0;
355         scsi_osd_extra_data_t *extra_data=NULL;
356
357         if(cdata && cdata->itlq && cdata->itlq->extra_data){
358                 extra_data=cdata->itlq->extra_data;
359                 gsatype=extra_data->gsatype;
360         } else {
361                 return;
362         }
363
364         switch(gsatype){
365         case 2: /* 5.2.2.2  attribute page */
366 /*qqq*/
367                 break;
368         case 3: /* 5.2.2.3  attribute list */
369                 if(extra_data->get_list_allocation_length){
370                         proto_tree_add_text(tree, tvb, extra_data->retreived_list_offset, extra_data->get_list_allocation_length, "Get Attributes Data");
371                 }
372                 break;
373         }
374 }
375
376
377 static const value_string scsi_osd_capability_format_vals[] = {
378     {0x00,      "No Capability"},
379     {0x01,      "SCSI OSD Capabilities"},
380     {0, NULL},
381 };
382 static const value_string scsi_osd_object_type_vals[] = {
383     {0x01,      "ROOT"},
384     {0x02,      "PARTITION"},
385     {0x40,      "COLLECTION"},
386     {0x80,      "USER"},
387     {0, NULL},
388 };
389 static const value_string scsi_osd_object_descriptor_type_vals[] = {
390     {0, "NONE: the object descriptor field shall be ignored"},
391     {1, "U/C: a single collection or user object"},
392     {2, "PAR: a single partition, including partition zero"},
393     {0, NULL},
394 };
395
396 static const true_false_string permissions_read_tfs = {
397         "READ is SET",
398         "Read is NOT set"
399 };
400 static const true_false_string permissions_write_tfs = {
401         "WRITE is SET",
402         "Write is NOT set"
403 };
404 static const true_false_string permissions_get_attr_tfs = {
405         "GET_ATTR is SET",
406         "Get_attr is NOT set"
407 };
408 static const true_false_string permissions_set_attr_tfs = {
409         "SET_ATTR is SET",
410         "Set_attr is NOT set"
411 };
412 static const true_false_string permissions_create_tfs = {
413         "CREATE is SET",
414         "Create is NOT set"
415 };
416 static const true_false_string permissions_remove_tfs = {
417         "REMOVE is SET",
418         "Remove is NOT set"
419 };
420 static const true_false_string permissions_obj_mgmt_tfs = {
421         "OBJ_MGMT is SET",
422         "Obj_mgmt is NOT set"
423 };
424 static const true_false_string permissions_append_tfs = {
425         "APPEND is SET",
426         "Append is NOT set"
427 };
428 static const true_false_string permissions_dev_mgmt_tfs = {
429         "DEV_MGMT is SET",
430         "Dev_mgmt is NOT set"
431 };
432 static const true_false_string permissions_global_tfs = {
433         "GLOBAL is SET",
434         "Global is NOT set"
435 };
436 static const true_false_string permissions_pol_sec_tfs = {
437         "POL/SEC is SET",
438         "Pol/sec is NOT set"
439 };
440 /* OSD 4.9.2.2.1 */
441 static void
442 dissect_osd_permissions(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
443 {
444         proto_tree *tree=NULL;
445         proto_item *it=NULL;
446         guint16 permissions;
447
448         permissions=tvb_get_ntohs(tvb, offset); 
449
450         if(parent_tree){
451                 it=proto_tree_add_item(parent_tree, hf_scsi_osd_permissions, tvb, offset, 2, 0);
452                 tree = proto_item_add_subtree(it, ett_osd_permission_bitmask);
453         }
454
455         proto_tree_add_item(tree, hf_scsi_osd_permissions_read, tvb, offset, 2, 0);
456         if(permissions&0x8000){
457                 proto_item_append_text(tree, " READ");
458         }
459         proto_tree_add_item(tree, hf_scsi_osd_permissions_write, tvb, offset, 2, 0);
460         if(permissions&0x4000){
461                 proto_item_append_text(tree, " WRITE");
462         }
463         proto_tree_add_item(tree, hf_scsi_osd_permissions_get_attr, tvb, offset, 2, 0);
464         if(permissions&0x2000){
465                 proto_item_append_text(tree, " GET_ATTR");
466         }
467         proto_tree_add_item(tree, hf_scsi_osd_permissions_set_attr, tvb, offset, 2, 0);
468         if(permissions&0x1000){
469                 proto_item_append_text(tree, " SET_ATTR");
470         }
471         proto_tree_add_item(tree, hf_scsi_osd_permissions_create, tvb, offset, 2, 0);
472         if(permissions&0x0800){
473                 proto_item_append_text(tree, " CREATE");
474         }
475         proto_tree_add_item(tree, hf_scsi_osd_permissions_remove, tvb, offset, 2, 0);
476         if(permissions&0x0400){
477                 proto_item_append_text(tree, " REMOVE");
478         }
479         proto_tree_add_item(tree, hf_scsi_osd_permissions_obj_mgmt, tvb, offset, 2, 0);
480         if(permissions&0x0200){
481                 proto_item_append_text(tree, " OBJ_MGMT");
482         }
483         proto_tree_add_item(tree, hf_scsi_osd_permissions_append, tvb, offset, 2, 0);
484         if(permissions&0x0100){
485                 proto_item_append_text(tree, " APPEND");
486         }
487         proto_tree_add_item(tree, hf_scsi_osd_permissions_dev_mgmt, tvb, offset, 2, 0);
488         if(permissions&0x0080){
489                 proto_item_append_text(tree, " DEV_MGMT");
490         }
491         proto_tree_add_item(tree, hf_scsi_osd_permissions_global, tvb, offset, 2, 0);
492         if(permissions&0x0040){
493                 proto_item_append_text(tree, " GLOBAL");
494         }
495         proto_tree_add_item(tree, hf_scsi_osd_permissions_pol_sec, tvb, offset, 2, 0);
496         if(permissions&0x0020){
497                 proto_item_append_text(tree, " POL/SEC");
498         }
499 }
500
501 /* 4.9.2.2 */
502 static void
503 dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
504 {
505         proto_item *item=NULL;
506         proto_tree *tree=NULL;
507
508         if(parent_tree){
509                 item = proto_tree_add_text(parent_tree, tvb, offset, 80,
510                     "Capability");
511                 tree = proto_item_add_subtree(item, ett_osd_capability);
512         }
513                 
514         /* capability format */
515         proto_tree_add_item(tree, hf_scsi_osd_capability_format, tvb, offset, 1, 0);
516         offset++;
517
518         /* key version and icva */
519         proto_tree_add_item(tree, hf_scsi_osd_key_version, tvb, offset, 1, 0);
520         proto_tree_add_item(tree, hf_scsi_osd_icva, tvb, offset, 1, 0);
521         offset++;
522
523         /* security method */
524         proto_tree_add_item(tree, hf_scsi_osd_security_method, tvb, offset, 1, 0);
525         offset++;
526
527         /* a reserved byte */
528         offset++;
529
530         /* capability expiration time */
531         proto_tree_add_item(tree, hf_scsi_osd_capability_expiration_time, tvb, offset, 6, 0);
532         offset+=6;
533
534         /* audit */
535         proto_tree_add_item(tree, hf_scsi_osd_audit, tvb, offset, 20, 0);
536         offset+=20;
537
538         /* capability discriminator */
539         proto_tree_add_item(tree, hf_scsi_osd_capability_discriminator, tvb, offset, 12, 0);
540         offset+=12;
541
542         /* object created time */
543         proto_tree_add_item(tree, hf_scsi_osd_object_created_time, tvb, offset, 6, 0);
544         offset+=6;
545
546         /* object type */
547         proto_tree_add_item(tree, hf_scsi_osd_object_type, tvb, offset, 1, 0);
548         offset++;
549
550         /* permission bitmask */
551         dissect_osd_permissions(tvb, offset, tree);
552         offset+=5;
553
554         /* a reserved byte */
555         offset++;
556
557         /* object descriptor type */
558         proto_tree_add_item(tree, hf_scsi_osd_object_descriptor_type, tvb, offset, 1, 0);
559         offset++;
560
561         /* object descriptor */
562         proto_tree_add_item(tree, hf_scsi_osd_object_descriptor, tvb, offset, 24, 0);
563         offset+=24;
564 }
565
566
567
568 /* 5.2.6 */
569 static void
570 dissect_osd_security_parameters(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
571 {
572         proto_item *item=NULL;
573         proto_tree *tree=NULL;
574
575         if(parent_tree){
576                 item = proto_tree_add_text(parent_tree, tvb, offset, 40,
577                     "Security Parameters");
578                 tree = proto_item_add_subtree(item, ett_osd_security_parameters);
579         }
580                 
581         /* request integrity check value */
582         proto_tree_add_item(tree, hf_scsi_osd_ricv, tvb, offset, 20, 0);
583         offset+=20;
584
585         /* request nonce */
586         proto_tree_add_item(tree, hf_scsi_osd_request_nonce, tvb, offset, 12, 0);
587         offset+=12;
588
589         /* data in integrity check value offset */
590         proto_tree_add_item(tree, hf_scsi_osd_diicvo, tvb, offset, 4, 0);
591         offset+=4;
592
593         /* data out integrity check value offset */
594         proto_tree_add_item(tree, hf_scsi_osd_doicvo, tvb, offset, 4, 0);
595         offset+=4;
596 }
597
598 static void
599 dissect_osd_format_osd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
600                         guint offset, gboolean isreq, gboolean iscdb,
601                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
602                         scsi_osd_conv_info_t *conv_info _U_,
603                         scsi_osd_lun_info_t *lun_info _U_)
604 {
605         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
606         if(isreq && iscdb){
607                 /* options byte */
608                 dissect_osd_option(tvb, offset, tree);
609                 offset++;
610
611                 /* getset attributes byte */
612                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
613                 offset++;
614
615                 /* timestamps control */
616                 dissect_osd_timestamps_control(tvb, offset, tree);
617                 offset++;
618
619                 /* 23 reserved bytes */
620                 offset+=23;
621
622                 /* formatted capacity */
623                 dissect_osd_formatted_capacity(tvb, offset, tree);
624                 offset+=8;
625
626                 /* 8 reserved bytes */
627                 offset+=8;
628
629                 /* attribute parameters */
630                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
631                 offset+=28;
632
633                 /* capability */
634                 dissect_osd_capability(tvb, offset, tree);
635                 offset+=80;
636
637                 /* security parameters */
638                 dissect_osd_security_parameters(tvb, offset, tree);
639                 offset+=40;
640         }
641
642         /* dissecting the DATA OUT */
643         if(isreq && !iscdb){
644                 /* attribute data out */
645                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
646
647                 /* no data out for format osd */
648         }
649
650         /* dissecting the DATA IN */
651         if(!isreq && !iscdb){
652                 /* attribute data in */
653                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
654
655                 /* no data in for format osd */
656         }
657         
658 }
659
660
661 static void
662 dissect_osd_partition_id(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree, int hf_index, scsi_osd_lun_info_t *lun_info, gboolean is_created, gboolean is_removed)
663 {
664         proto_item *item=NULL;
665         guint64 partition_id;
666
667         /* partition id */
668         item=proto_tree_add_item(tree, hf_index, tvb, offset, 8, 0);
669         partition_id=tvb_get_ntoh64(tvb, offset);
670         if(!partition_id){
671                 proto_item_append_text(item, " (ROOT partition)");
672         } else {
673                 partition_info_t *part_info;
674                 emem_tree_key_t pikey[2];
675                 proto_tree *partition_tree=NULL;
676
677                 pikey[0].length=2;
678                 pikey[0].key=(guint32 *)&partition_id;
679                 pikey[1].length=0;
680                 part_info=se_tree_lookup32_array(lun_info->partitions, &pikey[0]);
681                 if(!part_info){
682                         part_info=se_alloc(sizeof(partition_info_t));
683                         part_info->created_in=0;
684                         part_info->removed_in=0;
685
686                         pikey[0].length=2;
687                         pikey[0].key=(guint32 *)&partition_id;
688                         pikey[1].length=0;
689                         se_tree_insert32_array(lun_info->partitions, &pikey[0], part_info);
690                 }
691                 if(is_created){
692                         part_info->created_in=pinfo->fd->num;
693                 }
694                 if(is_removed){
695                         part_info->removed_in=pinfo->fd->num;
696                 }
697                 if(item){
698                         partition_tree=proto_item_add_subtree(item, ett_osd_partition);
699                 }
700                 if(part_info->created_in){
701                         proto_item *tmp_item;
702                         tmp_item=proto_tree_add_uint(partition_tree, hf_scsi_osd_partition_created_in, tvb, 0, 0, part_info->created_in);
703                         PROTO_ITEM_SET_GENERATED(tmp_item);
704                 }
705                 if(part_info->removed_in){
706                         proto_item *tmp_item;
707                         tmp_item=proto_tree_add_uint(partition_tree, hf_scsi_osd_partition_removed_in, tvb, 0, 0, part_info->removed_in);
708                         PROTO_ITEM_SET_GENERATED(tmp_item);
709                 }
710         }
711         offset+=8;
712 }
713
714
715
716 static void
717 dissect_osd_create_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
718                         guint offset, gboolean isreq, gboolean iscdb,
719                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
720                         scsi_osd_conv_info_t *conv_info _U_,
721                         scsi_osd_lun_info_t *lun_info)
722 {
723         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
724         if(isreq && iscdb){
725                 /* options byte */
726                 dissect_osd_option(tvb, offset, tree);
727                 offset++;
728
729                 /* getset attributes byte */
730                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
731                 offset++;
732
733                 /* timestamps control */
734                 dissect_osd_timestamps_control(tvb, offset, tree);
735                 offset++;
736
737                 /* 3 reserved bytes */
738                 offset+=3;
739
740                 /* requested partiton id */
741                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_requested_partition_id, lun_info, TRUE, FALSE);
742                 offset+=8;
743
744                 /* 28 reserved bytes */
745                 offset+=28;
746
747                 /* attribute parameters */
748                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
749                 offset+=28;
750
751                 /* capability */
752                 dissect_osd_capability(tvb, offset, tree);
753                 offset+=80;
754
755                 /* security parameters */
756                 dissect_osd_security_parameters(tvb, offset, tree);
757                 offset+=40;
758         }
759
760         /* dissecting the DATA OUT */
761         if(isreq && !iscdb){
762                 /* attribute data out */
763                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
764
765                 /* no data out for create partition */
766         }
767
768         /* dissecting the DATA IN */
769         if(!isreq && !iscdb){
770                 /* attribute data in */
771                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
772
773                 /* no data in for create partition */
774         }
775         
776 }
777
778 static const value_string scsi_osd_sort_order_vals[] = {
779     {0x00,      "Ascending numeric value"},
780     {0, NULL},
781 };
782 static void
783 dissect_osd_sortorder(tvbuff_t *tvb, int offset, proto_tree *tree)
784 {
785         /* sort order */
786         proto_tree_add_item(tree, hf_scsi_osd_sortorder, tvb, offset, 1, 0);
787         offset++;
788 }
789
790 static void
791 dissect_osd_list_identifier(tvbuff_t *tvb, int offset, proto_tree *tree)
792 {
793         /* list identifier */
794         proto_tree_add_item(tree, hf_scsi_osd_list_identifier, tvb, offset, 4, 0);
795         offset+=4;
796 }
797
798 static void
799 dissect_osd_allocation_length(tvbuff_t *tvb, int offset, proto_tree *tree)
800 {
801         /* allocation length */
802         proto_tree_add_item(tree, hf_scsi_osd_allocation_length, tvb, offset, 8, 0);
803         offset+=8;
804 }
805
806 static void
807 dissect_osd_initial_object_id(tvbuff_t *tvb, int offset, proto_tree *tree)
808 {
809         /* initial object id */
810         proto_tree_add_item(tree, hf_scsi_osd_initial_object_id, tvb, offset, 8, 0);
811         offset+=8;
812 }
813
814 static void
815 dissect_osd_additional_length(tvbuff_t *tvb, int offset, proto_tree *tree)
816 {
817         /* additional length */
818         proto_tree_add_item(tree, hf_scsi_osd_additional_length, tvb, offset, 8, 0);
819         offset+=8;
820 }
821
822
823 static void
824 dissect_osd_continuation_object_id(tvbuff_t *tvb, int offset, proto_tree *tree)
825 {
826         /* continuation object id */
827         proto_tree_add_item(tree, hf_scsi_osd_continuation_object_id, tvb, offset, 8, 0);
828         offset+=8;
829 }
830
831 static const true_false_string list_lstchg_tfs = {
832         "List has CHANGED since the first List command",
833         "List has NOT changed since first command"
834 };
835 static const true_false_string list_root_tfs = {
836         "Objects are from root and are PARTITION IDs",
837         "Objects are from a partition and are USER OBJECTs"
838 };
839
840 static void
841 dissect_osd_user_object_id(tvbuff_t *tvb, int offset, proto_tree *tree)
842 {
843         /* user object id */
844         proto_tree_add_item(tree, hf_scsi_osd_user_object_id, tvb, offset, 8, 0);
845         offset+=8;
846 }
847
848 static void
849 dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
850                         guint offset, gboolean isreq, gboolean iscdb,
851                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
852                         scsi_osd_conv_info_t *conv_info _U_,
853                         scsi_osd_lun_info_t *lun_info)
854 {
855         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
856         if(isreq && iscdb){
857                 /* options byte */
858                 dissect_osd_option(tvb, offset, tree);
859                 offset++;
860
861                 /* getset attributes byte / sort order */
862                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
863                 dissect_osd_sortorder(tvb, offset, tree);
864                 offset++;
865
866                 /* timestamps control */
867                 dissect_osd_timestamps_control(tvb, offset, tree);
868                 offset++;
869
870                 /* 3 reserved bytes */
871                 offset+=3;
872
873                 /* partiton id */
874                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
875                 offset+=8;
876
877                 /* 8 reserved bytes */
878                 offset+=8;
879
880                 /* list identifier */
881                 dissect_osd_list_identifier(tvb, offset, tree);
882                 offset+=4;
883
884                 /* allocation length */
885                 dissect_osd_allocation_length(tvb, offset, tree);
886                 offset+=8;
887
888                 /* initial object id */
889                 dissect_osd_initial_object_id(tvb, offset, tree);
890                 offset+=8;
891
892                 /* attribute parameters */
893                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
894                 offset+=28;
895
896                 /* capability */
897                 dissect_osd_capability(tvb, offset, tree);
898                 offset+=80;
899
900                 /* security parameters */
901                 dissect_osd_security_parameters(tvb, offset, tree);
902                 offset+=40;
903         }
904
905         /* dissecting the DATA OUT */
906         if(isreq && !iscdb){
907                 /* attribute data out */
908                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
909
910                 /* no data out for LIST */
911         }
912
913         /* dissecting the DATA IN */
914         if(!isreq && !iscdb){
915                 guint64 additional_length;
916                 gboolean is_root;
917
918                 /* attribute data in */
919                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
920
921                 /* dissection of the LIST DATA-IN */
922                 /* additional length */
923                 additional_length=tvb_get_ntoh64(tvb, offset);
924                 dissect_osd_additional_length(tvb, offset, tree);
925                 offset+=8;
926
927                 /* continuation object id */
928                 dissect_osd_continuation_object_id(tvb, offset, tree);
929                 offset+=8;
930
931                 /* list identifier */
932                 dissect_osd_list_identifier(tvb, offset, tree);
933                 offset+=4;
934
935                 /* 3 reserved bytes */
936                 offset+=3;
937
938                 /* LSTCHG and ROOT flags */
939                 proto_tree_add_item(tree, hf_scsi_osd_list_flags_lstchg, tvb, offset, 1, 0);
940                 proto_tree_add_item(tree, hf_scsi_osd_list_flags_root, tvb, offset, 1, 0);
941                 is_root=tvb_get_guint8(tvb, offset)&0x01;
942                 offset++;
943
944
945                 /* list of user object ids or partition ids */
946                 while(additional_length > (offset-8)){
947                         if(is_root){
948                                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
949                         } else {
950                                 dissect_osd_user_object_id(tvb, offset, tree);
951                         }
952                         offset+=8;
953                 }
954         }
955         
956 }
957
958 static void
959 dissect_osd_requested_user_object_id(tvbuff_t *tvb, int offset, proto_tree *tree)
960 {
961         /* request user object id */
962         proto_tree_add_item(tree, hf_scsi_osd_requested_user_object_id, tvb, offset, 8, 0);
963         offset+=8;
964 }
965
966 static void
967 dissect_osd_number_of_user_objects(tvbuff_t *tvb, int offset, proto_tree *tree)
968 {
969         /* number_of_user_objects */
970         proto_tree_add_item(tree, hf_scsi_osd_number_of_user_objects, tvb, offset, 2, 0);
971         offset+=2;
972 }
973
974 static void
975 dissect_osd_create(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
976                         guint offset, gboolean isreq, gboolean iscdb,
977                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
978                         scsi_osd_conv_info_t *conv_info _U_,
979                         scsi_osd_lun_info_t *lun_info)
980 {
981         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
982         if(isreq && iscdb){
983                 /* options byte */
984                 dissect_osd_option(tvb, offset, tree);
985                 offset++;
986
987                 /* getset attributes byte */
988                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
989                 offset++;
990
991                 /* timestamps control */
992                 dissect_osd_timestamps_control(tvb, offset, tree);
993                 offset++;
994
995                 /* 3 reserved bytes */
996                 offset+=3;
997
998                 /* partiton id */
999                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1000                 offset+=8;
1001
1002                 /* requested user_object id */
1003                 dissect_osd_requested_user_object_id(tvb, offset, tree);
1004                 offset+=8;
1005
1006                 /* 4 reserved bytes */
1007                 offset+=4;
1008
1009                 /* number of user objects */
1010                 dissect_osd_number_of_user_objects(tvb, offset, tree);
1011                 offset+=2;
1012
1013                 /* 14 reserved bytes */
1014                 offset+=14;
1015
1016                 /* attribute parameters */
1017                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1018                 offset+=28;
1019
1020                 /* capability */
1021                 dissect_osd_capability(tvb, offset, tree);
1022                 offset+=80;
1023
1024                 /* security parameters */
1025                 dissect_osd_security_parameters(tvb, offset, tree);
1026                 offset+=40;
1027         }
1028
1029         /* dissecting the DATA OUT */
1030         if(isreq && !iscdb){
1031                 /* attribute data out */
1032                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1033
1034                 /* no data out for create */
1035         }
1036
1037         /* dissecting the DATA IN */
1038         if(!isreq && !iscdb){
1039                 /* attribute data in */
1040                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1041
1042                 /* no data in for create */
1043         }
1044         
1045 }
1046
1047
1048 static void
1049 dissect_osd_remove_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1050                         guint offset, gboolean isreq, gboolean iscdb,
1051                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1052                         scsi_osd_conv_info_t *conv_info _U_,
1053                         scsi_osd_lun_info_t *lun_info)
1054 {
1055         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1056         if(isreq && iscdb){
1057                 /* options byte */
1058                 dissect_osd_option(tvb, offset, tree);
1059                 offset++;
1060
1061                 /* getset attributes byte */
1062                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1063                 offset++;
1064
1065                 /* timestamps control */
1066                 dissect_osd_timestamps_control(tvb, offset, tree);
1067                 offset++;
1068
1069                 /* 3 reserved bytes */
1070                 offset+=3;
1071
1072                 /* partiton id */
1073                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, TRUE);
1074                 offset+=8;
1075
1076                 /* 28 reserved bytes */
1077                 offset+=28;
1078
1079                 /* attribute parameters */
1080                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1081                 offset+=28;
1082
1083                 /* capability */
1084                 dissect_osd_capability(tvb, offset, tree);
1085                 offset+=80;
1086
1087                 /* security parameters */
1088                 dissect_osd_security_parameters(tvb, offset, tree);
1089                 offset+=40;
1090         }
1091
1092         /* dissecting the DATA OUT */
1093         if(isreq && !iscdb){
1094                 /* attribute data out */
1095                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1096
1097                 /* no data out for remove partition */
1098         }
1099
1100         /* dissecting the DATA IN */
1101         if(!isreq && !iscdb){
1102                 /* attribute data in */
1103                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1104
1105                 /* no data in for remove partition */
1106         }
1107         
1108 }
1109
1110 static const value_string key_to_set_vals[] = {
1111     {1, "Root"},
1112     {2, "Partition"},
1113     {3, "Working"},
1114     {0, NULL},
1115 };
1116 static void
1117 dissect_osd_key_to_set(tvbuff_t *tvb, int offset, proto_tree *tree)
1118 {
1119         proto_tree_add_item(tree, hf_scsi_osd_key_to_set, tvb, offset, 1, 0);
1120 }
1121
1122 static void
1123 dissect_osd_set_key_version(tvbuff_t *tvb, int offset, proto_tree *tree)
1124 {
1125         proto_tree_add_item(tree, hf_scsi_osd_set_key_version, tvb, offset, 1, 0);
1126 }
1127
1128 static void
1129 dissect_osd_key_identifier(tvbuff_t *tvb, int offset, proto_tree *tree)
1130 {
1131         proto_tree_add_item(tree, hf_scsi_osd_key_identifier, tvb, offset, 7, 0);
1132 }
1133
1134 static void
1135 dissect_osd_seed(tvbuff_t *tvb, int offset, proto_tree *tree)
1136 {
1137         proto_tree_add_item(tree, hf_scsi_osd_seed, tvb, offset, 20, 0);
1138 }
1139
1140 static void
1141 dissect_osd_set_key(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1142                         guint offset, gboolean isreq, gboolean iscdb,
1143                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1144                         scsi_osd_conv_info_t *conv_info _U_,
1145                         scsi_osd_lun_info_t *lun_info)
1146 {
1147         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1148         if(isreq && iscdb){
1149                 /* a reserved byte */
1150                 offset++;
1151
1152                 /* getset attributes byte and key to set*/
1153                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1154                 dissect_osd_key_to_set(tvb, offset, tree);
1155                 offset++;
1156
1157                 /* timestamps control */
1158                 dissect_osd_timestamps_control(tvb, offset, tree);
1159                 offset++;
1160
1161                 /* 3 reserved bytes */
1162                 offset+=3;
1163
1164                 /* partiton id */
1165                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1166                 offset+=8;
1167
1168                 /* key version */
1169                 dissect_osd_set_key_version(tvb, offset, tree);
1170                 offset++;
1171
1172                 /* key identifier */
1173                 dissect_osd_key_identifier(tvb, offset, tree);
1174                 offset+=7;
1175
1176                 /* seed */
1177                 dissect_osd_seed(tvb, offset, tree);
1178                 offset+=20;
1179
1180                 /* attribute parameters */
1181                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1182                 offset+=28;
1183
1184                 /* capability */
1185                 dissect_osd_capability(tvb, offset, tree);
1186                 offset+=80;
1187
1188                 /* security parameters */
1189                 dissect_osd_security_parameters(tvb, offset, tree);
1190                 offset+=40;
1191         }
1192
1193         /* dissecting the DATA OUT */
1194         if(isreq && !iscdb){
1195                 /* attribute data out */
1196                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1197
1198                 /* no data out for set key */
1199         }
1200
1201         /* dissecting the DATA IN */
1202         if(!isreq && !iscdb){
1203                 /* attribute data in */
1204                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1205
1206                 /* no data in for set key */
1207         }
1208         
1209 }
1210
1211 static void
1212 dissect_osd_remove(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1213                         guint offset, gboolean isreq, gboolean iscdb,
1214                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1215                         scsi_osd_conv_info_t *conv_info _U_,
1216                         scsi_osd_lun_info_t *lun_info)
1217 {
1218         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1219         if(isreq && iscdb){
1220                 /* options byte */
1221                 dissect_osd_option(tvb, offset, tree);
1222                 offset++;
1223
1224                 /* getset attributes byte */
1225                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1226                 offset++;
1227
1228                 /* timestamps control */
1229                 dissect_osd_timestamps_control(tvb, offset, tree);
1230                 offset++;
1231
1232                 /* 3 reserved bytes */
1233                 offset+=3;
1234
1235                 /* partiton id */
1236                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1237                 offset+=8;
1238
1239                 /* user object id */
1240                 dissect_osd_user_object_id(tvb, offset, tree);
1241                 offset+=8;
1242
1243                 /* 20 reserved bytes */
1244                 offset+=20;
1245
1246                 /* attribute parameters */
1247                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1248                 offset+=28;
1249
1250                 /* capability */
1251                 dissect_osd_capability(tvb, offset, tree);
1252                 offset+=80;
1253
1254                 /* security parameters */
1255                 dissect_osd_security_parameters(tvb, offset, tree);
1256                 offset+=40;
1257         }
1258
1259         /* dissecting the DATA OUT */
1260         if(isreq && !iscdb){
1261                 /* attribute data out */
1262                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1263
1264                 /* no data out for remove */
1265         }
1266
1267         /* dissecting the DATA IN */
1268         if(!isreq && !iscdb){
1269                 /* attribute data in */
1270                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1271
1272                 /* no data in for remove */
1273         }
1274         
1275 }
1276
1277 static const true_false_string collection_fcr_tfs = {
1278         "FCR is SET",
1279         "Fcr is NOR set"
1280 };
1281 static void
1282 dissect_osd_collection_fcr(tvbuff_t *tvb, int offset, proto_tree *tree)
1283 {
1284         proto_tree_add_item(tree, hf_scsi_osd_collection_fcr, tvb, offset, 1, 0);
1285 }
1286
1287 static void
1288 dissect_osd_collection_object_id(tvbuff_t *tvb, int offset, proto_tree *tree)
1289 {
1290         /* collection object id */
1291         proto_tree_add_item(tree, hf_scsi_osd_collection_object_id, tvb, offset, 8, 0);
1292         offset+=8;
1293 }
1294
1295
1296 static void
1297 dissect_osd_remove_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1298                         guint offset, gboolean isreq, gboolean iscdb,
1299                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1300                         scsi_osd_conv_info_t *conv_info _U_,
1301                         scsi_osd_lun_info_t *lun_info)
1302 {
1303         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1304         if(isreq && iscdb){
1305                 /* options byte */
1306                 dissect_osd_option(tvb, offset, tree);
1307                 offset++;
1308
1309                 /* getset attributes byte */
1310                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1311                 dissect_osd_collection_fcr(tvb, offset, tree);
1312                 offset++;
1313
1314                 /* timestamps control */
1315                 dissect_osd_timestamps_control(tvb, offset, tree);
1316                 offset++;
1317
1318                 /* 3 reserved bytes */
1319                 offset+=3;
1320
1321                 /* partiton id */
1322                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1323                 offset+=8;
1324
1325                 /* collection object id */
1326                 dissect_osd_collection_object_id(tvb, offset, tree);
1327                 offset+=8;
1328
1329                 /* 20 reserved bytes */
1330                 offset+=20;
1331
1332                 /* attribute parameters */
1333                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1334                 offset+=28;
1335
1336                 /* capability */
1337                 dissect_osd_capability(tvb, offset, tree);
1338                 offset+=80;
1339
1340                 /* security parameters */
1341                 dissect_osd_security_parameters(tvb, offset, tree);
1342                 offset+=40;
1343         }
1344
1345         /* dissecting the DATA OUT */
1346         if(isreq && !iscdb){
1347                 /* attribute data out */
1348                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1349
1350                 /* no data out for remove collection */
1351         }
1352
1353         /* dissecting the DATA IN */
1354         if(!isreq && !iscdb){
1355                 /* attribute data in */
1356                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1357
1358                 /* no data in for remove collection */
1359         }
1360         
1361 }
1362
1363
1364 static void
1365 dissect_osd_length(tvbuff_t *tvb, int offset, proto_tree *tree)
1366 {
1367         /* length */
1368         proto_tree_add_item(tree, hf_scsi_osd_length, tvb, offset, 8, 0);
1369         offset+=8;
1370 }
1371
1372 static void
1373 dissect_osd_starting_byte_address(tvbuff_t *tvb, int offset, proto_tree *tree)
1374 {
1375         /* starting_byte_address */
1376         proto_tree_add_item(tree, hf_scsi_osd_starting_byte_address, tvb, offset, 8, 0);
1377         offset+=8;
1378 }
1379
1380
1381 static void
1382 dissect_osd_write(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1383                         guint offset, gboolean isreq, gboolean iscdb,
1384                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1385                         scsi_osd_conv_info_t *conv_info _U_,
1386                         scsi_osd_lun_info_t *lun_info)
1387 {
1388         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1389         if(isreq && iscdb){
1390                 /* options byte */
1391                 dissect_osd_option(tvb, offset, tree);
1392                 offset++;
1393
1394                 /* getset attributes byte / sort order */
1395                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1396                 offset++;
1397
1398                 /* timestamps control */
1399                 dissect_osd_timestamps_control(tvb, offset, tree);
1400                 offset++;
1401
1402                 /* 3 reserved bytes */
1403                 offset+=3;
1404
1405                 /* partiton id */
1406                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1407                 offset+=8;
1408
1409                 /* user object id */
1410                 dissect_osd_user_object_id(tvb, offset, tree);
1411                 offset+=8;
1412
1413                 /* 4 reserved bytes */
1414                 offset+=4;
1415
1416                 /* length */
1417                 dissect_osd_length(tvb, offset, tree);
1418                 offset+=8;
1419
1420                 /* starting byte address */
1421                 dissect_osd_starting_byte_address(tvb, offset, tree);
1422                 offset+=8;
1423
1424                 /* attribute parameters */
1425                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1426                 offset+=28;
1427
1428                 /* capability */
1429                 dissect_osd_capability(tvb, offset, tree);
1430                 offset+=80;
1431
1432                 /* security parameters */
1433                 dissect_osd_security_parameters(tvb, offset, tree);
1434                 offset+=40;
1435         }
1436
1437         /* dissecting the DATA OUT */
1438         if(isreq && !iscdb){
1439                 /* attribute data out */
1440                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1441
1442                 /* xxx should dissect the data ? */
1443         }
1444
1445         /* dissecting the DATA IN */
1446         if(!isreq && !iscdb){
1447                 /* attribute data in */
1448                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1449
1450                 /* no data in for WRITE */
1451         }
1452         
1453 }
1454
1455
1456 static void
1457 dissect_osd_requested_collection_object_id(tvbuff_t *tvb, int offset, proto_tree *tree)
1458 {
1459         /* requested collection object id */
1460         proto_tree_add_item(tree, hf_scsi_osd_requested_collection_object_id, tvb, offset, 8, 0);
1461         offset+=8;
1462 }
1463
1464
1465 static void
1466 dissect_osd_create_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1467                         guint offset, gboolean isreq, gboolean iscdb,
1468                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1469                         scsi_osd_conv_info_t *conv_info _U_,
1470                         scsi_osd_lun_info_t *lun_info)
1471 {
1472         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1473         if(isreq && iscdb){
1474                 /* options byte */
1475                 dissect_osd_option(tvb, offset, tree);
1476                 offset++;
1477
1478                 /* getset attributes byte */
1479                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1480                 dissect_osd_collection_fcr(tvb, offset, tree);
1481                 offset++;
1482
1483                 /* timestamps control */
1484                 dissect_osd_timestamps_control(tvb, offset, tree);
1485                 offset++;
1486
1487                 /* 3 reserved bytes */
1488                 offset+=3;
1489
1490                 /* partiton id */
1491                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1492                 offset+=8;
1493
1494                 /* requested collection object id */
1495                 dissect_osd_requested_collection_object_id(tvb, offset, tree);
1496                 offset+=8;
1497
1498                 /* 20 reserved bytes */
1499                 offset+=20;
1500
1501                 /* attribute parameters */
1502                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1503                 offset+=28;
1504
1505                 /* capability */
1506                 dissect_osd_capability(tvb, offset, tree);
1507                 offset+=80;
1508
1509                 /* security parameters */
1510                 dissect_osd_security_parameters(tvb, offset, tree);
1511                 offset+=40;
1512         }
1513
1514         /* dissecting the DATA OUT */
1515         if(isreq && !iscdb){
1516                 /* attribute data out */
1517                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1518
1519                 /* no data out for create collection */
1520         }
1521
1522         /* dissecting the DATA IN */
1523         if(!isreq && !iscdb){
1524                 /* attribute data in */
1525                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1526
1527                 /* no data in for create collection */
1528         }
1529         
1530 }
1531
1532
1533 static const value_string flush_scope_vals[] = {
1534         {0,     "User object data and attributes"},
1535         {1,     "User object attributes only"},
1536         {0, NULL}
1537 };
1538
1539 static void
1540 dissect_osd_flush_scope(tvbuff_t *tvb, int offset, proto_tree *tree)
1541 {
1542         /* flush scope */
1543         proto_tree_add_item(tree, hf_scsi_osd_flush_scope, tvb, offset, 1, 0);
1544         offset++;
1545 }
1546
1547 static void
1548 dissect_osd_flush(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1549                         guint offset, gboolean isreq, gboolean iscdb,
1550                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1551                         scsi_osd_conv_info_t *conv_info _U_,
1552                         scsi_osd_lun_info_t *lun_info)
1553 {
1554         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1555         if(isreq && iscdb){
1556                 /* options byte */
1557                 dissect_osd_flush_scope(tvb, offset, tree);
1558                 offset++;
1559
1560                 /* getset attributes byte */
1561                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1562                 offset++;
1563
1564                 /* timestamps control */
1565                 dissect_osd_timestamps_control(tvb, offset, tree);
1566                 offset++;
1567
1568                 /* 3 reserved bytes */
1569                 offset+=3;
1570
1571                 /* partiton id */
1572                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1573                 offset+=8;
1574
1575                 /* user object id */
1576                 dissect_osd_user_object_id(tvb, offset, tree);
1577                 offset+=8;
1578
1579                 /* 20 reserved bytes */
1580                 offset+=20;
1581
1582                 /* attribute parameters */
1583                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1584                 offset+=28;
1585
1586                 /* capability */
1587                 dissect_osd_capability(tvb, offset, tree);
1588                 offset+=80;
1589
1590                 /* security parameters */
1591                 dissect_osd_security_parameters(tvb, offset, tree);
1592                 offset+=40;
1593         }
1594
1595         /* dissecting the DATA OUT */
1596         if(isreq && !iscdb){
1597                 /* attribute data out */
1598                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1599
1600                 /* no data out for flush */
1601         }
1602
1603         /* dissecting the DATA IN */
1604         if(!isreq && !iscdb){
1605                 /* attribute data in */
1606                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1607
1608                 /* no data in for flush */
1609         }
1610         
1611 }
1612
1613
1614 static const value_string flush_collection_scope_vals[] = {
1615         {0,     "List of user objects contained in the collection"},
1616         {1,     "Collection attributes only"},
1617         {2,     "List of user objects and collection attributes"},
1618         {0, NULL}
1619 };
1620
1621 static void
1622 dissect_osd_flush_collection_scope(tvbuff_t *tvb, int offset, proto_tree *tree)
1623 {
1624         /* flush collection scope */
1625         proto_tree_add_item(tree, hf_scsi_osd_flush_collection_scope, tvb, offset, 1, 0);
1626         offset++;
1627 }
1628
1629 static void
1630 dissect_osd_flush_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1631                         guint offset, gboolean isreq, gboolean iscdb,
1632                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1633                         scsi_osd_conv_info_t *conv_info _U_,
1634                         scsi_osd_lun_info_t *lun_info)
1635 {
1636         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1637         if(isreq && iscdb){
1638                 /* options byte */
1639                 dissect_osd_flush_collection_scope(tvb, offset, tree);
1640                 offset++;
1641
1642                 /* getset attributes byte */
1643                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1644                 dissect_osd_collection_fcr(tvb, offset, tree);
1645                 offset++;
1646
1647                 /* timestamps control */
1648                 dissect_osd_timestamps_control(tvb, offset, tree);
1649                 offset++;
1650
1651                 /* 3 reserved bytes */
1652                 offset+=3;
1653
1654                 /* partiton id */
1655                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1656                 offset+=8;
1657
1658                 /* collection object id */
1659                 dissect_osd_collection_object_id(tvb, offset, tree);
1660                 offset+=8;
1661
1662                 /* 20 reserved bytes */
1663                 offset+=20;
1664
1665                 /* attribute parameters */
1666                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1667                 offset+=28;
1668
1669                 /* capability */
1670                 dissect_osd_capability(tvb, offset, tree);
1671                 offset+=80;
1672
1673                 /* security parameters */
1674                 dissect_osd_security_parameters(tvb, offset, tree);
1675                 offset+=40;
1676         }
1677
1678         /* dissecting the DATA OUT */
1679         if(isreq && !iscdb){
1680                 /* attribute data out */
1681                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1682
1683                 /* no data out for flush collection */
1684         }
1685
1686         /* dissecting the DATA IN */
1687         if(!isreq && !iscdb){
1688                 /* attribute data in */
1689                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1690
1691                 /* no data in for flush collection */
1692         }
1693         
1694 }
1695
1696
1697 static void
1698 dissect_osd_append(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1699                         guint offset, gboolean isreq, gboolean iscdb,
1700                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1701                         scsi_osd_conv_info_t *conv_info _U_,
1702                         scsi_osd_lun_info_t *lun_info)
1703 {
1704         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1705         if(isreq && iscdb){
1706                 /* options byte */
1707                 dissect_osd_option(tvb, offset, tree);
1708                 offset++;
1709
1710                 /* getset attributes byte / sort order */
1711                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1712                 dissect_osd_sortorder(tvb, offset, tree);
1713                 offset++;
1714
1715                 /* timestamps control */
1716                 dissect_osd_timestamps_control(tvb, offset, tree);
1717                 offset++;
1718
1719                 /* 3 reserved bytes */
1720                 offset+=3;
1721
1722                 /* partiton id */
1723                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1724                 offset+=8;
1725
1726                 /* user object id */
1727                 dissect_osd_user_object_id(tvb, offset, tree);
1728                 offset+=8;
1729
1730                 /* 4 reserved bytes */
1731                 offset+=4;
1732
1733                 /* length */
1734                 dissect_osd_length(tvb, offset, tree);
1735                 offset+=8;
1736
1737                 /* 8 reserved bytes */
1738                 offset+=8;
1739
1740                 /* attribute parameters */
1741                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1742                 offset+=28;
1743
1744                 /* capability */
1745                 dissect_osd_capability(tvb, offset, tree);
1746                 offset+=80;
1747
1748                 /* security parameters */
1749                 dissect_osd_security_parameters(tvb, offset, tree);
1750                 offset+=40;
1751         }
1752
1753         /* dissecting the DATA OUT */
1754         if(isreq && !iscdb){
1755                 /* attribute data out */
1756                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1757
1758                 /* xxx should dissect the data ? */
1759         }
1760
1761         /* dissecting the DATA IN */
1762         if(!isreq && !iscdb){
1763                 /* attribute data in */
1764                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1765
1766                 /* no data in for append */
1767         }
1768         
1769 }
1770
1771 static void
1772 dissect_osd_create_and_write(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1773                         guint offset, gboolean isreq, gboolean iscdb,
1774                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1775                         scsi_osd_conv_info_t *conv_info _U_,
1776                         scsi_osd_lun_info_t *lun_info)
1777 {
1778         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1779         if(isreq && iscdb){
1780                 /* options byte */
1781                 dissect_osd_option(tvb, offset, tree);
1782                 offset++;
1783
1784                 /* getset attributes byte */
1785                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1786                 offset++;
1787
1788                 /* timestamps control */
1789                 dissect_osd_timestamps_control(tvb, offset, tree);
1790                 offset++;
1791
1792                 /* 3 reserved bytes */
1793                 offset+=3;
1794
1795                 /* partiton id */
1796                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1797                 offset+=8;
1798
1799                 /* requested user_object id */
1800                 dissect_osd_requested_user_object_id(tvb, offset, tree);
1801                 offset+=8;
1802
1803                 /* 4 reserved bytes */
1804                 offset+=4;
1805
1806                 /* length */
1807                 dissect_osd_length(tvb, offset, tree);
1808                 offset+=8;
1809
1810                 /* starting byte address */
1811                 dissect_osd_starting_byte_address(tvb, offset, tree);
1812                 offset+=8;
1813
1814                 /* attribute parameters */
1815                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1816                 offset+=28;
1817
1818                 /* capability */
1819                 dissect_osd_capability(tvb, offset, tree);
1820                 offset+=80;
1821
1822                 /* security parameters */
1823                 dissect_osd_security_parameters(tvb, offset, tree);
1824                 offset+=40;
1825         }
1826
1827         /* dissecting the DATA OUT */
1828         if(isreq && !iscdb){
1829                 /* attribute data out */
1830                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1831
1832                 /* should we dissect the data? */
1833         }
1834
1835         /* dissecting the DATA IN */
1836         if(!isreq && !iscdb){
1837                 /* attribute data in */
1838                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1839
1840                 /* no data in for create and write*/
1841         }
1842         
1843 }
1844
1845
1846 static const value_string flush_osd_scope_vals[] = {
1847         {0,     "List of partitions contained in the OSD logical unit"},
1848         {1,     "Root object attributes only"},
1849         {2,     "Everything"},
1850         {0, NULL}
1851 };
1852
1853 static void
1854 dissect_osd_flush_osd_scope(tvbuff_t *tvb, int offset, proto_tree *tree)
1855 {
1856         /* flush osd scope */
1857         proto_tree_add_item(tree, hf_scsi_osd_flush_osd_scope, tvb, offset, 1, 0);
1858         offset++;
1859 }
1860
1861 static void
1862 dissect_osd_flush_osd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1863                         guint offset, gboolean isreq, gboolean iscdb,
1864                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1865                         scsi_osd_conv_info_t *conv_info _U_,
1866                         scsi_osd_lun_info_t *lun_info)
1867 {
1868         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1869         if(isreq && iscdb){
1870                 /* options byte */
1871                 dissect_osd_flush_osd_scope(tvb, offset, tree);
1872                 offset++;
1873
1874                 /* getset attributes byte */
1875                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1876                 offset++;
1877
1878                 /* timestamps control */
1879                 dissect_osd_timestamps_control(tvb, offset, tree);
1880                 offset++;
1881
1882                 /* 39 reserved bytes */
1883                 offset+=39;
1884
1885                 /* attribute parameters */
1886                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1887                 offset+=28;
1888
1889                 /* capability */
1890                 dissect_osd_capability(tvb, offset, tree);
1891                 offset+=80;
1892
1893                 /* security parameters */
1894                 dissect_osd_security_parameters(tvb, offset, tree);
1895                 offset+=40;
1896         }
1897
1898         /* dissecting the DATA OUT */
1899         if(isreq && !iscdb){
1900                 /* attribute data out */
1901                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1902
1903                 /* no data out for flush osd */
1904         }
1905
1906         /* dissecting the DATA IN */
1907         if(!isreq && !iscdb){
1908                 /* attribute data in */
1909                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1910
1911                 /* no data in for flush osd */
1912         }
1913         
1914 }
1915
1916
1917 static const value_string flush_partition_scope_vals[] = {
1918         {0,     "List of user objects and collections in the partition"},
1919         {1,     "Partition attributes only"},
1920         {2,     "Everything"},
1921         {0, NULL}
1922 };
1923
1924 static void
1925 dissect_osd_flush_partition_scope(tvbuff_t *tvb, int offset, proto_tree *tree)
1926 {
1927         /* flush partition scope */
1928         proto_tree_add_item(tree, hf_scsi_osd_flush_partition_scope, tvb, offset, 1, 0);
1929         offset++;
1930 }
1931
1932
1933 static void
1934 dissect_osd_flush_partition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1935                         guint offset, gboolean isreq, gboolean iscdb,
1936                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
1937                         scsi_osd_conv_info_t *conv_info _U_,
1938                         scsi_osd_lun_info_t *lun_info)
1939 {
1940         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
1941         if(isreq && iscdb){
1942                 /* options byte */
1943                 dissect_osd_flush_partition_scope(tvb, offset, tree);
1944                 offset++;
1945
1946                 /* getset attributes byte */
1947                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
1948                 offset++;
1949
1950                 /* timestamps control */
1951                 dissect_osd_timestamps_control(tvb, offset, tree);
1952                 offset++;
1953
1954                 /* 3 reserved bytes */
1955                 offset+=3;
1956
1957                 /* partiton id */
1958                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
1959                 offset+=8;
1960
1961                 /* 28 reserved bytes */
1962                 offset+=28;
1963
1964                 /* attribute parameters */
1965                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
1966                 offset+=28;
1967
1968                 /* capability */
1969                 dissect_osd_capability(tvb, offset, tree);
1970                 offset+=80;
1971
1972                 /* security parameters */
1973                 dissect_osd_security_parameters(tvb, offset, tree);
1974                 offset+=40;
1975         }
1976
1977         /* dissecting the DATA OUT */
1978         if(isreq && !iscdb){
1979                 /* attribute data out */
1980                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
1981
1982                 /* no data out for flush partition */
1983         }
1984
1985         /* dissecting the DATA IN */
1986         if(!isreq && !iscdb){
1987                 /* attribute data in */
1988                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
1989
1990                 /* no data in for flush partition */
1991         }
1992         
1993 }
1994
1995
1996 static void
1997 dissect_osd_get_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1998                         guint offset, gboolean isreq, gboolean iscdb,
1999                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
2000                         scsi_osd_conv_info_t *conv_info _U_,
2001                         scsi_osd_lun_info_t *lun_info)
2002 {
2003         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
2004         if(isreq && iscdb){
2005                 /* options byte */
2006                 dissect_osd_option(tvb, offset, tree);
2007                 offset++;
2008
2009                 /* getset attributes byte */
2010                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
2011                 offset++;
2012
2013                 /* timestamps control */
2014                 dissect_osd_timestamps_control(tvb, offset, tree);
2015                 offset++;
2016
2017                 /* 3 reserved bytes */
2018                 offset+=3;
2019
2020                 /* partiton id */
2021                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, TRUE);
2022                 offset+=8;
2023
2024                 /* user_object id */
2025                 dissect_osd_user_object_id(tvb, offset, tree);
2026                 offset+=8;
2027
2028                 /* 20 reserved bytes */
2029                 offset+=20;
2030
2031                 /* attribute parameters */
2032                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
2033                 offset+=28;
2034
2035                 /* capability */
2036                 dissect_osd_capability(tvb, offset, tree);
2037                 offset+=80;
2038
2039                 /* security parameters */
2040                 dissect_osd_security_parameters(tvb, offset, tree);
2041                 offset+=40;
2042         }
2043
2044         /* dissecting the DATA OUT */
2045         if(isreq && !iscdb){
2046                 /* attribute data out */
2047                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
2048
2049                 /* no data out for get attributes */
2050         }
2051
2052         /* dissecting the DATA IN */
2053         if(!isreq && !iscdb){
2054                 /* attribute data in */
2055                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
2056
2057                 /* no data in for get attributes */
2058         }
2059         
2060 }
2061
2062
2063 static void
2064 dissect_osd_list_collection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2065                         guint offset, gboolean isreq, gboolean iscdb,
2066                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
2067                         scsi_osd_conv_info_t *conv_info _U_,
2068                         scsi_osd_lun_info_t *lun_info)
2069 {
2070         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
2071         if(isreq && iscdb){
2072                 /* one reserved byte */
2073                 offset++;
2074
2075                 /* getset attributes byte */
2076                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
2077                 offset++;
2078
2079                 /* timestamps control */
2080                 dissect_osd_timestamps_control(tvb, offset, tree);
2081                 offset++;
2082
2083                 /* 3 reserved bytes */
2084                 offset+=3;
2085
2086                 /* partiton id */
2087                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
2088                 offset+=8;
2089
2090                 /* collection object id */
2091                 dissect_osd_collection_object_id(tvb, offset, tree);
2092                 offset+=8;
2093
2094                 /* list identifier */
2095                 dissect_osd_list_identifier(tvb, offset, tree);
2096                 offset+=4;
2097
2098                 /* allocation length */
2099                 dissect_osd_allocation_length(tvb, offset, tree);
2100                 offset+=8;
2101
2102                 /* initial object id */
2103                 dissect_osd_initial_object_id(tvb, offset, tree);
2104                 offset+=8;
2105
2106                 /* attribute parameters */
2107                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
2108                 offset+=28;
2109
2110                 /* capability */
2111                 dissect_osd_capability(tvb, offset, tree);
2112                 offset+=80;
2113
2114                 /* security parameters */
2115                 dissect_osd_security_parameters(tvb, offset, tree);
2116                 offset+=40;
2117         }
2118
2119         /* dissecting the DATA OUT */
2120         if(isreq && !iscdb){
2121                 /* attribute data out */
2122                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
2123
2124                 /* no data out for list collection */
2125         }
2126
2127         /* dissecting the DATA IN */
2128         if(!isreq && !iscdb){
2129                 /* attribute data in */
2130                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
2131
2132 /* XXX dissect the data */
2133         }
2134         
2135 }
2136
2137
2138
2139 static void
2140 dissect_osd_read(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2141                         guint offset, gboolean isreq, gboolean iscdb,
2142                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
2143                         scsi_osd_conv_info_t *conv_info _U_,
2144                         scsi_osd_lun_info_t *lun_info)
2145 {
2146         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
2147         if(isreq && iscdb){
2148                 /* options byte */
2149                 dissect_osd_option(tvb, offset, tree);
2150                 offset++;
2151
2152                 /* getset attributes byte / sort order */
2153                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
2154                 offset++;
2155
2156                 /* timestamps control */
2157                 dissect_osd_timestamps_control(tvb, offset, tree);
2158                 offset++;
2159
2160                 /* 3 reserved bytes */
2161                 offset+=3;
2162
2163                 /* partiton id */
2164                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, FALSE);
2165                 offset+=8;
2166
2167                 /* user object id */
2168                 dissect_osd_user_object_id(tvb, offset, tree);
2169                 offset+=8;
2170
2171                 /* 4 reserved bytes */
2172                 offset+=4;
2173
2174                 /* length */
2175                 dissect_osd_length(tvb, offset, tree);
2176                 offset+=8;
2177
2178                 /* starting byte address */
2179                 dissect_osd_starting_byte_address(tvb, offset, tree);
2180                 offset+=8;
2181
2182                 /* attribute parameters */
2183                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
2184                 offset+=28;
2185
2186                 /* capability */
2187                 dissect_osd_capability(tvb, offset, tree);
2188                 offset+=80;
2189
2190                 /* security parameters */
2191                 dissect_osd_security_parameters(tvb, offset, tree);
2192                 offset+=40;
2193         }
2194
2195         /* dissecting the DATA OUT */
2196         if(isreq && !iscdb){
2197                 /* attribute data out */
2198                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
2199
2200                 /* no data out for READ */
2201         }
2202
2203         /* dissecting the DATA IN */
2204         if(!isreq && !iscdb){
2205                 /* attribute data in */
2206                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
2207
2208 /* xxx should dissect the data ? */
2209         }
2210         
2211 }
2212
2213
2214 static void
2215 dissect_osd_set_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2216                         guint offset, gboolean isreq, gboolean iscdb,
2217                         guint payload_len _U_, scsi_task_data_t *cdata _U_,
2218                         scsi_osd_conv_info_t *conv_info _U_,
2219                         scsi_osd_lun_info_t *lun_info)
2220 {
2221         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
2222         if(isreq && iscdb){
2223                 /* options byte */
2224                 dissect_osd_option(tvb, offset, tree);
2225                 offset++;
2226
2227                 /* getset attributes byte */
2228                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
2229                 offset++;
2230
2231                 /* timestamps control */
2232                 dissect_osd_timestamps_control(tvb, offset, tree);
2233                 offset++;
2234
2235                 /* 3 reserved bytes */
2236                 offset+=3;
2237
2238                 /* partiton id */
2239                 dissect_osd_partition_id(pinfo, tvb, offset, tree, hf_scsi_osd_partition_id, lun_info, FALSE, TRUE);
2240                 offset+=8;
2241
2242                 /* user_object id */
2243                 dissect_osd_user_object_id(tvb, offset, tree);
2244                 offset+=8;
2245
2246                 /* 20 reserved bytes */
2247                 offset+=20;
2248
2249                 /* attribute parameters */
2250                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
2251                 offset+=28;
2252
2253                 /* capability */
2254                 dissect_osd_capability(tvb, offset, tree);
2255                 offset+=80;
2256
2257                 /* security parameters */
2258                 dissect_osd_security_parameters(tvb, offset, tree);
2259                 offset+=40;
2260         }
2261
2262         /* dissecting the DATA OUT */
2263         if(isreq && !iscdb){
2264                 /* attribute data out */
2265                 dissect_osd_attribute_data_out(tvb, offset, tree, cdata);
2266
2267                 /* no data out for set attributes */
2268         }
2269
2270         /* dissecting the DATA IN */
2271         if(!isreq && !iscdb){
2272                 /* attribute data in */
2273                 dissect_osd_attribute_data_in(tvb, offset, tree, cdata);
2274
2275                 /* no data in for set attributes */
2276         }
2277         
2278 }
2279
2280 /* OSD Service Actions */
2281 #define OSD_FORMAT_OSD          0x8801
2282 #define OSD_CREATE              0x8802
2283 #define OSD_LIST                0x8803
2284 #define OSD_READ                0x8805
2285 #define OSD_WRITE               0x8806
2286 #define OSD_APPEND              0x8807
2287 #define OSD_FLUSH               0x8808
2288 #define OSD_REMOVE              0x880a
2289 #define OSD_CREATE_PARTITION    0x880b
2290 #define OSD_REMOVE_PARTITION    0x880c
2291 #define OSD_GET_ATTRIBUTES      0x880e
2292 #define OSD_SET_ATTRIBUTES      0x880f
2293 #define OSD_CREATE_AND_WRITE    0x8812
2294 #define OSD_CREATE_COLLECTION   0x8815
2295 #define OSD_REMOVE_COLLECTION   0x8816
2296 #define OSD_LIST_COLLECTION     0x8817
2297 #define OSD_SET_KEY             0x8818
2298 #define OSD_FLUSH_COLLECTION    0x881a
2299 #define OSD_FLUSH_PARTITION     0x881b
2300 #define OSD_FLUSH_OSD           0x881c
2301 static const value_string scsi_osd_svcaction_vals[] = {
2302     {OSD_FORMAT_OSD,            "Format OSD"},
2303     {OSD_CREATE,                "Create"},
2304     {OSD_LIST,                  "List"},
2305     {OSD_READ,                  "Read"},
2306     {OSD_WRITE,                 "Write"},
2307     {OSD_APPEND,                "Append"},
2308     {OSD_FLUSH,                 "Flush"},
2309     {OSD_REMOVE,                "Remove"},
2310     {OSD_CREATE_PARTITION,      "Create Partition"},
2311     {OSD_REMOVE_PARTITION,      "Remove Partition"},
2312     {OSD_GET_ATTRIBUTES,        "Get Attributes"},
2313     {OSD_SET_ATTRIBUTES,        "Set Attributes"},
2314     {OSD_CREATE_AND_WRITE,      "Create And Write"},
2315     {OSD_CREATE_COLLECTION,     "Create Collection"},
2316     {OSD_REMOVE_COLLECTION,     "Remove Collection"},
2317     {OSD_LIST_COLLECTION,       "List Collection"},
2318     {OSD_SET_KEY,               "Set Key"},
2319     {OSD_FLUSH_COLLECTION,      "Flush Collection"},
2320     {OSD_FLUSH_PARTITION,       "Flush Partition"},
2321     {OSD_FLUSH_OSD,             "Flush OSD"},
2322     {0, NULL},
2323 };
2324
2325 /* OSD Service Action dissectors */
2326 typedef struct _scsi_osd_svcaction_t {
2327         guint16 svcaction;
2328         scsi_osd_dissector_t dissector;
2329 } scsi_osd_svcaction_t;
2330 static const scsi_osd_svcaction_t scsi_osd_svcaction[] = {
2331     {OSD_FORMAT_OSD,            dissect_osd_format_osd},
2332     {OSD_CREATE,                dissect_osd_create},
2333     {OSD_LIST,                  dissect_osd_list},
2334     {OSD_READ,                  dissect_osd_read},
2335     {OSD_WRITE,                 dissect_osd_write},
2336     {OSD_APPEND,                dissect_osd_append},
2337     {OSD_FLUSH,                 dissect_osd_flush},
2338     {OSD_REMOVE,                dissect_osd_remove},
2339     {OSD_CREATE_PARTITION,      dissect_osd_create_partition},
2340     {OSD_REMOVE_PARTITION,      dissect_osd_remove_partition},
2341     {OSD_GET_ATTRIBUTES,        dissect_osd_get_attributes},
2342     {OSD_SET_ATTRIBUTES,        dissect_osd_set_attributes},
2343     {OSD_CREATE_AND_WRITE,      dissect_osd_create_and_write},
2344     {OSD_CREATE_COLLECTION,     dissect_osd_create_collection},
2345     {OSD_REMOVE_COLLECTION,     dissect_osd_remove_collection},
2346     {OSD_LIST_COLLECTION,       dissect_osd_list_collection},
2347     {OSD_SET_KEY,               dissect_osd_set_key},
2348     {OSD_FLUSH_COLLECTION,      dissect_osd_flush_collection},
2349     {OSD_FLUSH_PARTITION,       dissect_osd_flush_partition},
2350     {OSD_FLUSH_OSD,             dissect_osd_flush_osd},
2351     {0, NULL},
2352 };
2353
2354 static scsi_osd_dissector_t
2355 find_svcaction_dissector(guint16 svcaction)
2356 {
2357         const scsi_osd_svcaction_t *sa=scsi_osd_svcaction;
2358
2359         while(sa&&sa->dissector){
2360                 if(sa->svcaction==svcaction){
2361                         return sa->dissector;
2362                 }
2363                 sa++;
2364         }
2365         return NULL;
2366 }
2367
2368
2369
2370 static void
2371 dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2372                         guint offset, gboolean isreq, gboolean iscdb,
2373                         guint payload_len, scsi_task_data_t *cdata)
2374 {
2375         guint16 svcaction=0;
2376         scsi_osd_dissector_t dissector;
2377         scsi_osd_conv_info_t *conv_info=NULL;
2378         scsi_osd_lun_info_t *lun_info=NULL;
2379
2380         if(!tree) {
2381                 return;
2382         }
2383
2384         /* We must have an itl an itlq and a conversation */
2385         if(!cdata || !cdata->itl || !cdata->itl->conversation || !cdata->itlq){
2386                 return;
2387         }
2388         /* make sure we have a conversation info for this */
2389         conv_info=conversation_get_proto_data(cdata->itl->conversation, proto_scsi_osd);
2390         if(!conv_info){
2391                 conv_info=se_alloc(sizeof(scsi_osd_conv_info_t));
2392                 conv_info->luns=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SCSI OSD luns tree");
2393                 conversation_add_proto_data(cdata->itl->conversation, proto_scsi_osd, conv_info);
2394         }
2395         /* make sure we have a lun_info structure for this */
2396         lun_info=se_tree_lookup32(conv_info->luns, cdata->itlq->lun);
2397         if(!lun_info){
2398                 lun_info=se_alloc(sizeof(scsi_osd_lun_info_t));
2399                 lun_info->partitions=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SCSI OSD partitions tree");
2400                 se_tree_insert32(conv_info->luns, cdata->itlq->lun, (void *)lun_info);
2401         }
2402
2403         /* dissecting the CDB */
2404         if (isreq && iscdb) {
2405                 proto_tree_add_item (tree, hf_scsi_control, tvb, offset, 1, 0);
2406                 offset++;
2407
2408                 /* 5 reserved bytes */
2409                 offset+=5;
2410
2411                 proto_tree_add_item (tree, hf_scsi_osd_add_cdblen, tvb, offset, 1, 0);
2412                 offset++;
2413
2414                 svcaction=tvb_get_ntohs(tvb, offset);
2415                 if(cdata && cdata->itlq){
2416                         /* We must store the service action for this itlq
2417                          * so we can indentify what the data contains
2418                          */
2419                         if((!pinfo->fd->flags.visited) && (!cdata->itlq->extra_data)){
2420                                 scsi_osd_extra_data_t *extra_data;
2421
2422                                 extra_data=se_alloc(sizeof(scsi_osd_extra_data_t));
2423                                 extra_data->svcaction=svcaction;
2424                                 extra_data->gsatype=0;
2425                                 cdata->itlq->extra_data=extra_data;
2426                         }
2427                 }
2428                 proto_tree_add_item (tree, hf_scsi_osd_svcaction, tvb, offset, 2, 0);
2429                 offset+=2;
2430
2431
2432                 if(check_col(pinfo->cinfo, COL_INFO)){
2433                         col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
2434                                 val_to_str(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction"));
2435                 }
2436                 dissector=find_svcaction_dissector(svcaction);
2437                 if(dissector){
2438                         (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata, conv_info, lun_info);
2439                 }
2440                 return;
2441         }
2442
2443         /* If it was not a CDB, try to find the service action and pass it
2444          * off to the service action dissector
2445          */
2446         if(cdata && cdata->itlq && cdata->itlq->extra_data){
2447                 scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
2448                 svcaction=extra_data->svcaction;
2449         }
2450         if(check_col(pinfo->cinfo, COL_INFO)){
2451                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
2452                         val_to_str(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction"));
2453         }
2454         if(svcaction){
2455                 proto_item *it;
2456                 it=proto_tree_add_uint_format(tree, hf_scsi_osd_svcaction, tvb, 0, 0, svcaction, "Service Action: 0x%04x", svcaction);
2457                 PROTO_ITEM_SET_GENERATED(it);
2458         }
2459         dissector=find_svcaction_dissector(svcaction);
2460         if(dissector){
2461                 (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata, conv_info, lun_info);
2462         }
2463
2464 }
2465
2466
2467 /* OSD Commands */
2468 const value_string scsi_osd_vals[] = {
2469     {SCSI_SPC2_INQUIRY                  , "Inquiry"},
2470     {SCSI_SPC2_LOGSELECT                , "Log Select"},
2471     {SCSI_SPC2_LOGSENSE                 , "Log Sense"},
2472     {SCSI_SPC2_MODESELECT10             , "Mode Select(10)"},
2473     {SCSI_SPC2_MODESENSE10              , "Mode Sense(10)"},
2474     {SCSI_SPC2_PERSRESVIN               , "Persistent Reserve In"},
2475     {SCSI_SPC2_PERSRESVOUT              , "Persistent Reserve Out"},
2476     {SCSI_SPC2_REPORTLUNS               , "Report LUNs"},
2477     {SCSI_OSD_OPCODE                    , "OSD Command" },
2478     {0, NULL},
2479 };
2480
2481
2482
2483 scsi_cdb_table_t scsi_osd_table[256] = {
2484 /*OSD 0x00*/{NULL},
2485 /*OSD 0x01*/{NULL},
2486 /*OSD 0x02*/{NULL},
2487 /*OSD 0x03*/{NULL},
2488 /*OSD 0x04*/{NULL},
2489 /*OSD 0x05*/{NULL},
2490 /*OSD 0x06*/{NULL},
2491 /*OSD 0x07*/{NULL},
2492 /*OSD 0x08*/{NULL},
2493 /*OSD 0x09*/{NULL},
2494 /*OSD 0x0a*/{NULL},
2495 /*OSD 0x0b*/{NULL},
2496 /*OSD 0x0c*/{NULL},
2497 /*OSD 0x0d*/{NULL},
2498 /*OSD 0x0e*/{NULL},
2499 /*OSD 0x0f*/{NULL},
2500 /*OSD 0x10*/{NULL},
2501 /*OSD 0x11*/{NULL},
2502 /*OSD 0x12*/{dissect_spc3_inquiry},
2503 /*OSD 0x13*/{NULL},
2504 /*OSD 0x14*/{NULL},
2505 /*OSD 0x15*/{NULL},
2506 /*OSD 0x16*/{NULL},
2507 /*OSD 0x17*/{NULL},
2508 /*OSD 0x18*/{NULL},
2509 /*OSD 0x19*/{NULL},
2510 /*OSD 0x1a*/{NULL},
2511 /*OSD 0x1b*/{NULL},
2512 /*OSD 0x1c*/{NULL},
2513 /*OSD 0x1d*/{NULL},
2514 /*OSD 0x1e*/{NULL},
2515 /*OSD 0x1f*/{NULL},
2516 /*OSD 0x20*/{NULL},
2517 /*OSD 0x21*/{NULL},
2518 /*OSD 0x22*/{NULL},
2519 /*OSD 0x23*/{NULL},
2520 /*OSD 0x24*/{NULL},
2521 /*OSD 0x25*/{NULL},
2522 /*OSD 0x26*/{NULL},
2523 /*OSD 0x27*/{NULL},
2524 /*OSD 0x28*/{NULL},
2525 /*OSD 0x29*/{NULL},
2526 /*OSD 0x2a*/{NULL},
2527 /*OSD 0x2b*/{NULL},
2528 /*OSD 0x2c*/{NULL},
2529 /*OSD 0x2d*/{NULL},
2530 /*OSD 0x2e*/{NULL},
2531 /*OSD 0x2f*/{NULL},
2532 /*OSD 0x30*/{NULL},
2533 /*OSD 0x31*/{NULL},
2534 /*OSD 0x32*/{NULL},
2535 /*OSD 0x33*/{NULL},
2536 /*OSD 0x34*/{NULL},
2537 /*OSD 0x35*/{NULL},
2538 /*OSD 0x36*/{NULL},
2539 /*OSD 0x37*/{NULL},
2540 /*OSD 0x38*/{NULL},
2541 /*OSD 0x39*/{NULL},
2542 /*OSD 0x3a*/{NULL},
2543 /*OSD 0x3b*/{NULL},
2544 /*OSD 0x3c*/{NULL},
2545 /*OSD 0x3d*/{NULL},
2546 /*OSD 0x3e*/{NULL},
2547 /*OSD 0x3f*/{NULL},
2548 /*OSD 0x40*/{NULL},
2549 /*OSD 0x41*/{NULL},
2550 /*OSD 0x42*/{NULL},
2551 /*OSD 0x43*/{NULL},
2552 /*OSD 0x44*/{NULL},
2553 /*OSD 0x45*/{NULL},
2554 /*OSD 0x46*/{NULL},
2555 /*OSD 0x47*/{NULL},
2556 /*OSD 0x48*/{NULL},
2557 /*OSD 0x49*/{NULL},
2558 /*OSD 0x4a*/{NULL},
2559 /*OSD 0x4b*/{NULL},
2560 /*OSD 0x4c*/{dissect_spc3_logselect},
2561 /*OSD 0x4d*/{dissect_spc3_logsense},
2562 /*OSD 0x4e*/{NULL},
2563 /*OSD 0x4f*/{NULL},
2564 /*OSD 0x50*/{NULL},
2565 /*OSD 0x51*/{NULL},
2566 /*OSD 0x52*/{NULL},
2567 /*OSD 0x53*/{NULL},
2568 /*OSD 0x54*/{NULL},
2569 /*OSD 0x55*/{dissect_spc3_modeselect10},
2570 /*OSD 0x56*/{NULL},
2571 /*OSD 0x57*/{NULL},
2572 /*OSD 0x58*/{NULL},
2573 /*OSD 0x59*/{NULL},
2574 /*OSD 0x5a*/{dissect_spc3_modesense10},
2575 /*OSD 0x5b*/{NULL},
2576 /*OSD 0x5c*/{NULL},
2577 /*OSD 0x5d*/{NULL},
2578 /*OSD 0x5e*/{dissect_spc3_persistentreservein},
2579 /*OSD 0x5f*/{dissect_spc3_persistentreserveout},
2580 /*OSD 0x60*/{NULL},
2581 /*OSD 0x61*/{NULL},
2582 /*OSD 0x62*/{NULL},
2583 /*OSD 0x63*/{NULL},
2584 /*OSD 0x64*/{NULL},
2585 /*OSD 0x65*/{NULL},
2586 /*OSD 0x66*/{NULL},
2587 /*OSD 0x67*/{NULL},
2588 /*OSD 0x68*/{NULL},
2589 /*OSD 0x69*/{NULL},
2590 /*OSD 0x6a*/{NULL},
2591 /*OSD 0x6b*/{NULL},
2592 /*OSD 0x6c*/{NULL},
2593 /*OSD 0x6d*/{NULL},
2594 /*OSD 0x6e*/{NULL},
2595 /*OSD 0x6f*/{NULL},
2596 /*OSD 0x70*/{NULL},
2597 /*OSD 0x71*/{NULL},
2598 /*OSD 0x72*/{NULL},
2599 /*OSD 0x73*/{NULL},
2600 /*OSD 0x74*/{NULL},
2601 /*OSD 0x75*/{NULL},
2602 /*OSD 0x76*/{NULL},
2603 /*OSD 0x77*/{NULL},
2604 /*OSD 0x78*/{NULL},
2605 /*OSD 0x79*/{NULL},
2606 /*OSD 0x7a*/{NULL},
2607 /*OSD 0x7b*/{NULL},
2608 /*OSD 0x7c*/{NULL},
2609 /*OSD 0x7d*/{NULL},
2610 /*OSD 0x7e*/{NULL},
2611 /*OSD 0x7f*/{dissect_osd_opcode},
2612 /*OSD 0x80*/{NULL},
2613 /*OSD 0x81*/{NULL},
2614 /*OSD 0x82*/{NULL},
2615 /*OSD 0x83*/{NULL},
2616 /*OSD 0x84*/{NULL},
2617 /*OSD 0x85*/{NULL},
2618 /*OSD 0x86*/{NULL},
2619 /*OSD 0x87*/{NULL},
2620 /*OSD 0x88*/{NULL},
2621 /*OSD 0x89*/{NULL},
2622 /*OSD 0x8a*/{NULL},
2623 /*OSD 0x8b*/{NULL},
2624 /*OSD 0x8c*/{NULL},
2625 /*OSD 0x8d*/{NULL},
2626 /*OSD 0x8e*/{NULL},
2627 /*OSD 0x8f*/{NULL},
2628 /*OSD 0x90*/{NULL},
2629 /*OSD 0x91*/{NULL},
2630 /*OSD 0x92*/{NULL},
2631 /*OSD 0x93*/{NULL},
2632 /*OSD 0x94*/{NULL},
2633 /*OSD 0x95*/{NULL},
2634 /*OSD 0x96*/{NULL},
2635 /*OSD 0x97*/{NULL},
2636 /*OSD 0x98*/{NULL},
2637 /*OSD 0x99*/{NULL},
2638 /*OSD 0x9a*/{NULL},
2639 /*OSD 0x9b*/{NULL},
2640 /*OSD 0x9c*/{NULL},
2641 /*OSD 0x9d*/{NULL},
2642 /*OSD 0x9e*/{NULL},
2643 /*OSD 0x9f*/{NULL},
2644 /*OSD 0xa0*/{dissect_spc3_reportluns},
2645 /*OSD 0xa1*/{NULL},
2646 /*OSD 0xa2*/{NULL},
2647 /*OSD 0xa3*/{NULL},
2648 /*OSD 0xa4*/{NULL},
2649 /*OSD 0xa5*/{NULL},
2650 /*OSD 0xa6*/{NULL},
2651 /*OSD 0xa7*/{NULL},
2652 /*OSD 0xa8*/{NULL},
2653 /*OSD 0xa9*/{NULL},
2654 /*OSD 0xaa*/{NULL},
2655 /*OSD 0xab*/{NULL},
2656 /*OSD 0xac*/{NULL},
2657 /*OSD 0xad*/{NULL},
2658 /*OSD 0xae*/{NULL},
2659 /*OSD 0xaf*/{NULL},
2660 /*OSD 0xb0*/{NULL},
2661 /*OSD 0xb1*/{NULL},
2662 /*OSD 0xb2*/{NULL},
2663 /*OSD 0xb3*/{NULL},
2664 /*OSD 0xb4*/{NULL},
2665 /*OSD 0xb5*/{NULL},
2666 /*OSD 0xb6*/{NULL},
2667 /*OSD 0xb7*/{NULL},
2668 /*OSD 0xb8*/{NULL},
2669 /*OSD 0xb9*/{NULL},
2670 /*OSD 0xba*/{NULL},
2671 /*OSD 0xbb*/{NULL},
2672 /*OSD 0xbc*/{NULL},
2673 /*OSD 0xbd*/{NULL},
2674 /*OSD 0xbe*/{NULL},
2675 /*OSD 0xbf*/{NULL},
2676 /*OSD 0xc0*/{NULL},
2677 /*OSD 0xc1*/{NULL},
2678 /*OSD 0xc2*/{NULL},
2679 /*OSD 0xc3*/{NULL},
2680 /*OSD 0xc4*/{NULL},
2681 /*OSD 0xc5*/{NULL},
2682 /*OSD 0xc6*/{NULL},
2683 /*OSD 0xc7*/{NULL},
2684 /*OSD 0xc8*/{NULL},
2685 /*OSD 0xc9*/{NULL},
2686 /*OSD 0xca*/{NULL},
2687 /*OSD 0xcb*/{NULL},
2688 /*OSD 0xcc*/{NULL},
2689 /*OSD 0xcd*/{NULL},
2690 /*OSD 0xce*/{NULL},
2691 /*OSD 0xcf*/{NULL},
2692 /*OSD 0xd0*/{NULL},
2693 /*OSD 0xd1*/{NULL},
2694 /*OSD 0xd2*/{NULL},
2695 /*OSD 0xd3*/{NULL},
2696 /*OSD 0xd4*/{NULL},
2697 /*OSD 0xd5*/{NULL},
2698 /*OSD 0xd6*/{NULL},
2699 /*OSD 0xd7*/{NULL},
2700 /*OSD 0xd8*/{NULL},
2701 /*OSD 0xd9*/{NULL},
2702 /*OSD 0xda*/{NULL},
2703 /*OSD 0xdb*/{NULL},
2704 /*OSD 0xdc*/{NULL},
2705 /*OSD 0xdd*/{NULL},
2706 /*OSD 0xde*/{NULL},
2707 /*OSD 0xdf*/{NULL},
2708 /*OSD 0xe0*/{NULL},
2709 /*OSD 0xe1*/{NULL},
2710 /*OSD 0xe2*/{NULL},
2711 /*OSD 0xe3*/{NULL},
2712 /*OSD 0xe4*/{NULL},
2713 /*OSD 0xe5*/{NULL},
2714 /*OSD 0xe6*/{NULL},
2715 /*OSD 0xe7*/{NULL},
2716 /*OSD 0xe8*/{NULL},
2717 /*OSD 0xe9*/{NULL},
2718 /*OSD 0xea*/{NULL},
2719 /*OSD 0xeb*/{NULL},
2720 /*OSD 0xec*/{NULL},
2721 /*OSD 0xed*/{NULL},
2722 /*OSD 0xee*/{NULL},
2723 /*OSD 0xef*/{NULL},
2724 /*OSD 0xf0*/{NULL},
2725 /*OSD 0xf1*/{NULL},
2726 /*OSD 0xf2*/{NULL},
2727 /*OSD 0xf3*/{NULL},
2728 /*OSD 0xf4*/{NULL},
2729 /*OSD 0xf5*/{NULL},
2730 /*OSD 0xf6*/{NULL},
2731 /*OSD 0xf7*/{NULL},
2732 /*OSD 0xf8*/{NULL},
2733 /*OSD 0xf9*/{NULL},
2734 /*OSD 0xfa*/{NULL},
2735 /*OSD 0xfb*/{NULL},
2736 /*OSD 0xfc*/{NULL},
2737 /*OSD 0xfd*/{NULL},
2738 /*OSD 0xfe*/{NULL},
2739 /*OSD 0xff*/{NULL}
2740 };
2741
2742
2743
2744
2745 void
2746 proto_register_scsi_osd(void)
2747 {
2748         static hf_register_info hf[] = {
2749         { &hf_scsi_osd_opcode,
2750           {"OSD Opcode", "scsi.osd.opcode", FT_UINT8, BASE_HEX,
2751            VALS (scsi_osd_vals), 0x0, "", HFILL}},
2752         { &hf_scsi_osd_add_cdblen,
2753           {"Additional CDB Length", "scsi.osd.addcdblen", FT_UINT8, BASE_DEC,
2754            NULL, 0x0, "", HFILL}},
2755         { &hf_scsi_osd_svcaction,
2756           {"Service Action", "scsi.osd.svcaction", FT_UINT16, BASE_HEX,
2757            VALS(scsi_osd_svcaction_vals), 0x0, "", HFILL}},
2758         { &hf_scsi_osd_option,
2759           {"Options Byte", "scsi.osd.option", FT_UINT8, BASE_HEX,
2760            NULL, 0x0, "", HFILL}},
2761         { &hf_scsi_osd_option_dpo,
2762           {"DPO", "scsi.osd.option.dpo", FT_BOOLEAN, 8,
2763            TFS(&option_dpo_tfs), 0x10, "", HFILL}},
2764         { &hf_scsi_osd_option_fua,
2765           {"FUA", "scsi.osd.option.fua", FT_BOOLEAN, 8,
2766            TFS(&option_fua_tfs), 0x08, "", HFILL}},
2767         { &hf_scsi_osd_getsetattrib,
2768           {"GET/SET CDBFMT", "scsi.osd.getset", FT_UINT8, BASE_HEX,
2769            VALS(scsi_osd_getsetattrib_vals), 0x30, "", HFILL}},
2770         { &hf_scsi_osd_timestamps_control,
2771           {"Timestamps Control", "scsi.osd.timestamps_control", FT_UINT8, BASE_HEX,
2772            VALS(scsi_osd_timestamps_control_vals), 0x0, "", HFILL}},
2773         { &hf_scsi_osd_formatted_capacity,
2774           {"Formatted Capacity", "scsi.osd.formatted_capacity", FT_UINT64, BASE_DEC,
2775            NULL, 0x0, "", HFILL}},
2776         { &hf_scsi_osd_get_attributes_page,
2777           {"Get Attributes Page", "scsi.osd.get_attributes_page", FT_UINT32, BASE_HEX,
2778            NULL, 0x0, "", HFILL}},
2779         { &hf_scsi_osd_get_attributes_list_length,
2780           {"Get Attributes List Length", "scsi.osd.get_attributes_list_length", FT_UINT32, BASE_HEX,
2781            NULL, 0x0, "", HFILL}},
2782         { &hf_scsi_osd_get_attributes_list_offset,
2783           {"Get Attributes List Offset", "scsi.osd.get_attributes_list_offset", FT_UINT32, BASE_HEX,
2784            NULL, 0x0, "", HFILL}},
2785         { &hf_scsi_osd_set_attributes_list_length,
2786           {"Set Attributes List Length", "scsi.osd.set_attributes_list_length", FT_UINT32, BASE_HEX,
2787            NULL, 0x0, "", HFILL}},
2788         { &hf_scsi_osd_set_attributes_list_offset,
2789           {"Set Attributes List Offset", "scsi.osd.set_attributes_list_offset", FT_UINT32, BASE_HEX,
2790            NULL, 0x0, "", HFILL}},
2791         { &hf_scsi_osd_get_attributes_allocation_length,
2792           {"Get Attributes Allocation Length", "scsi.osd.get_attributes_allocation_length", FT_UINT32, BASE_HEX,
2793            NULL, 0x0, "", HFILL}},
2794         { &hf_scsi_osd_retreived_attributes_offset,
2795           {"Retreived Attributes Offset", "scsi.osd.retreived_attributes_offset", FT_UINT32, BASE_HEX,
2796            NULL, 0x0, "", HFILL}},
2797         { &hf_scsi_osd_set_attributes_page,
2798           {"Set Attributes Page", "scsi.osd.set_attributes_page", FT_UINT32, BASE_HEX,
2799            NULL, 0x0, "", HFILL}},
2800         { &hf_scsi_osd_set_attribute_length,
2801           {"Set Attribute Length", "scsi.osd.set_attribute_length", FT_UINT32, BASE_HEX,
2802            NULL, 0x0, "", HFILL}},
2803         { &hf_scsi_osd_set_attribute_number,
2804           {"Set Attribute Number", "scsi.osd.set_attribute_number", FT_UINT32, BASE_HEX,
2805            NULL, 0x0, "", HFILL}},
2806         { &hf_scsi_osd_set_attributes_offset,
2807           {"Set Attributes Offset", "scsi.osd.set_attributes_offset", FT_UINT32, BASE_HEX,
2808            NULL, 0x0, "", HFILL}},
2809         { &hf_scsi_osd_capability_format,
2810           {"Capability Format", "scsi.osd.capability_format", FT_UINT8, BASE_HEX,
2811            VALS(scsi_osd_capability_format_vals), 0x0f, "", HFILL}},
2812         { &hf_scsi_osd_key_version,
2813           {"Key Version", "scsi.osd.key_version", FT_UINT8, BASE_HEX,
2814            NULL, 0xf0, "", HFILL}},
2815         { &hf_scsi_osd_icva,
2816           {"Integrity Check Value Algorithm", "scsi.osd.icva", FT_UINT8, BASE_HEX,
2817            NULL, 0x0f, "", HFILL}},
2818         { &hf_scsi_osd_security_method,
2819           {"Security Method", "scsi.osd.security_method", FT_UINT8, BASE_HEX,
2820            NULL, 0x0f, "", HFILL}},
2821         { &hf_scsi_osd_capability_expiration_time,
2822           {"Capability Expiration Time", "scsi.osd.capability_expiration_time", FT_BYTES, BASE_HEX,
2823            NULL, 0, "", HFILL}},
2824         { &hf_scsi_osd_audit,
2825           {"Audit", "scsi.osd.audit", FT_BYTES, BASE_HEX,
2826            NULL, 0, "", HFILL}},
2827         { &hf_scsi_osd_capability_discriminator,
2828           {"Capability Discriminator", "scsi.osd.capability_descriminator", FT_BYTES, BASE_HEX,
2829            NULL, 0, "", HFILL}},
2830         { &hf_scsi_osd_object_created_time,
2831           {"Object Created Time", "scsi.osd.object_created_time", FT_BYTES, BASE_HEX,
2832            NULL, 0, "", HFILL}},
2833         { &hf_scsi_osd_object_type,
2834           {"Object Type", "scsi.osd.object_type", FT_UINT8, BASE_HEX,
2835            VALS(scsi_osd_object_type_vals), 0, "", HFILL}},
2836         { &hf_scsi_osd_permissions,
2837           {"Permissions", "scsi.osd.permissions", FT_UINT16, BASE_HEX,
2838            NULL, 0, "", HFILL}},
2839         { &hf_scsi_osd_permissions_read,
2840           {"READ", "scsi.osd.permissions.read", FT_BOOLEAN, 16,
2841            TFS(&permissions_read_tfs), 0x8000, "", HFILL}},
2842         { &hf_scsi_osd_permissions_write,
2843           {"WRITE", "scsi.osd.permissions.write", FT_BOOLEAN, 16,
2844            TFS(&permissions_write_tfs), 0x4000, "", HFILL}},
2845         { &hf_scsi_osd_permissions_get_attr,
2846           {"GET_ATTR", "scsi.osd.permissions.get_attr", FT_BOOLEAN, 16,
2847            TFS(&permissions_get_attr_tfs), 0x2000, "", HFILL}},
2848         { &hf_scsi_osd_permissions_set_attr,
2849           {"SET_ATTR", "scsi.osd.permissions.set_attr", FT_BOOLEAN, 16,
2850            TFS(&permissions_set_attr_tfs), 0x1000, "", HFILL}},
2851         { &hf_scsi_osd_permissions_create,
2852           {"CREATE", "scsi.osd.permissions.create", FT_BOOLEAN, 16,
2853            TFS(&permissions_create_tfs), 0x0800, "", HFILL}},
2854         { &hf_scsi_osd_permissions_remove,
2855           {"REMOVE", "scsi.osd.permissions.remove", FT_BOOLEAN, 16,
2856            TFS(&permissions_remove_tfs), 0x0400, "", HFILL}},
2857         { &hf_scsi_osd_permissions_obj_mgmt,
2858           {"OBJ_MGMT", "scsi.osd.permissions.obj_mgmt", FT_BOOLEAN, 16,
2859            TFS(&permissions_obj_mgmt_tfs), 0x0200, "", HFILL}},
2860         { &hf_scsi_osd_permissions_append,
2861           {"APPEND", "scsi.osd.permissions.append", FT_BOOLEAN, 16,
2862            TFS(&permissions_append_tfs), 0x0100, "", HFILL}},
2863         { &hf_scsi_osd_permissions_dev_mgmt,
2864           {"DEV_MGMT", "scsi.osd.permissions.dev_mgmt", FT_BOOLEAN, 16,
2865            TFS(&permissions_dev_mgmt_tfs), 0x0080, "", HFILL}},
2866         { &hf_scsi_osd_permissions_global,
2867           {"GLOBAL", "scsi.osd.permissions.global", FT_BOOLEAN, 16,
2868            TFS(&permissions_global_tfs), 0x0040, "", HFILL}},
2869         { &hf_scsi_osd_permissions_pol_sec,
2870           {"POL/SEC", "scsi.osd.permissions.pol_sec", FT_BOOLEAN, 16,
2871            TFS(&permissions_pol_sec_tfs), 0x0020, "", HFILL}},
2872
2873         { &hf_scsi_osd_object_descriptor_type,
2874           {"Object Descriptor Type", "scsi.osd.object_descriptor_type", FT_UINT8, BASE_HEX,
2875            VALS(scsi_osd_object_descriptor_type_vals), 0xf0, "", HFILL}},
2876         { &hf_scsi_osd_object_descriptor,
2877           {"Object Descriptor", "scsi.osd.object_descriptor", FT_BYTES, BASE_HEX,
2878            NULL, 0, "", HFILL}},
2879         { &hf_scsi_osd_ricv,
2880           {"Request Integrity Check value", "scsi.osd.ricv", FT_BYTES, BASE_HEX,
2881            NULL, 0, "", HFILL}},
2882         { &hf_scsi_osd_request_nonce,
2883           {"Request Nonce", "scsi.osd.request_nonce", FT_BYTES, BASE_HEX,
2884            NULL, 0, "", HFILL}},
2885         { &hf_scsi_osd_diicvo,
2886           {"Data-In Integrity Check Value Offset", "scsi.osd.diicvo", FT_UINT32, BASE_DEC,
2887            NULL, 0, "", HFILL}},
2888         { &hf_scsi_osd_doicvo,
2889           {"Data-Out Integrity Check Value Offset", "scsi.osd.doicvo", FT_UINT32, BASE_DEC,
2890            NULL, 0, "", HFILL}},
2891         { &hf_scsi_osd_requested_partition_id,
2892           {"Requested Partition Id", "scsi.osd.requested_partition_id", FT_UINT64, BASE_HEX,
2893            NULL, 0, "", HFILL}},
2894         { &hf_scsi_osd_sortorder,
2895           {"Sort Order", "scsi.osd.sort_order", FT_UINT8, BASE_DEC,
2896            VALS(scsi_osd_sort_order_vals), 0x0f, "", HFILL}},
2897         { &hf_scsi_osd_partition_id,
2898           {"Partition Id", "scsi.osd.partition_id", FT_UINT64, BASE_HEX,
2899            NULL, 0, "", HFILL}},
2900         { &hf_scsi_osd_list_identifier,
2901           {"List Identifier", "scsi.osd.list_identifier", FT_UINT32, BASE_DEC,
2902            NULL, 0, "", HFILL}},
2903         { &hf_scsi_osd_allocation_length,
2904           {"Allocation Length", "scsi.osd.allocation_length", FT_UINT64, BASE_DEC,
2905            NULL, 0, "", HFILL}},
2906         { &hf_scsi_osd_length,
2907           {"Length", "scsi.osd.length", FT_UINT64, BASE_DEC,
2908            NULL, 0, "", HFILL}},
2909         { &hf_scsi_osd_starting_byte_address,
2910           {"Starting Byte Address", "scsi.osd.starting_byte_address", FT_UINT64, BASE_DEC,
2911            NULL, 0, "", HFILL}},
2912         { &hf_scsi_osd_initial_object_id,
2913           {"Initial Object Id", "scsi.osd.initial_object_id", FT_BYTES, BASE_HEX,
2914            NULL, 0, "", HFILL}},
2915         { &hf_scsi_osd_additional_length,
2916           {"Additional Length", "scsi.osd.additional_length", FT_UINT64, BASE_DEC,
2917            NULL, 0, "", HFILL}},
2918         { &hf_scsi_osd_continuation_object_id,
2919           {"Continuation Object Id", "scsi.osd.continuation_object_id", FT_BYTES, BASE_HEX,
2920            NULL, 0, "", HFILL}},
2921         { &hf_scsi_osd_user_object_id,
2922           {"User Object Id", "scsi.osd.user_object_id", FT_BYTES, BASE_HEX,
2923            NULL, 0, "", HFILL}},
2924         { &hf_scsi_osd_list_flags_lstchg,
2925           {"LSTCHG", "scsi.osd.list.lstchg", FT_BOOLEAN, 8,
2926            TFS(&list_lstchg_tfs), 0x02, "", HFILL}},
2927         { &hf_scsi_osd_list_flags_root,
2928           {"ROOT", "scsi.osd.list.root", FT_BOOLEAN, 8,
2929            TFS(&list_root_tfs), 0x01, "", HFILL}},
2930         { &hf_scsi_osd_requested_user_object_id,
2931           {"Requested User Object Id", "scsi.osd.requested_user_object_id", FT_BYTES, BASE_HEX,
2932            NULL, 0, "", HFILL}},
2933         { &hf_scsi_osd_number_of_user_objects,
2934           {"Number Of User Objects", "scsi.osd.number_of_user_objects", FT_UINT16, BASE_DEC,
2935            NULL, 0, "", HFILL}},
2936         { &hf_scsi_osd_key_to_set,
2937           {"Key to Set", "scsi.osd.key_to_set", FT_UINT8, BASE_DEC,
2938            VALS(key_to_set_vals), 0x03, "", HFILL}},
2939         { &hf_scsi_osd_set_key_version,
2940           {"Key Version", "scsi.osd.set_key_version", FT_UINT8, BASE_DEC,
2941            NULL, 0x0f, "", HFILL}},
2942         { &hf_scsi_osd_key_identifier,
2943           {"Key Identifier", "scsi.osd.key_identifier", FT_BYTES, BASE_HEX,
2944            NULL, 0, "", HFILL}},
2945         { &hf_scsi_osd_seed,
2946           {"Seed", "scsi.osd.seed", FT_BYTES, BASE_HEX,
2947            NULL, 0, "", HFILL}},
2948         { &hf_scsi_osd_collection_fcr,
2949           {"FCR", "scsi.osd.collection.fcr", FT_BOOLEAN, 8,
2950            TFS(&collection_fcr_tfs), 0x01, "", HFILL}},
2951         { &hf_scsi_osd_collection_object_id,
2952           {"Collection Object Id", "scsi.osd.collection_object_id", FT_BYTES, BASE_HEX,
2953            NULL, 0, "", HFILL}},
2954         { &hf_scsi_osd_requested_collection_object_id,
2955           {"Requested Collection Object Id", "scsi.osd.requested_collection_object_id", FT_BYTES, BASE_HEX,
2956            NULL, 0, "", HFILL}},
2957         { &hf_scsi_osd_partition_created_in,
2958           { "Created In", "scsi.osd.partition.created_in", FT_FRAMENUM, BASE_NONE,
2959           NULL, 0x0, "The frame this partition was created", HFILL }},
2960
2961         { &hf_scsi_osd_partition_removed_in,
2962           { "Removed In", "scsi.osd.partition.removed_in", FT_FRAMENUM, BASE_NONE,
2963           NULL, 0x0, "The frame this partition was removed", HFILL }},
2964
2965         { &hf_scsi_osd_flush_scope,
2966           {"Flush Scope", "scsi.osd.flush.scope", FT_UINT8, BASE_DEC,
2967            VALS(flush_scope_vals), 0x03, "", HFILL}},
2968
2969         { &hf_scsi_osd_flush_collection_scope,
2970           {"Flush Collection Scope", "scsi.osd.flush_collection.scope", FT_UINT8, BASE_DEC,
2971            VALS(flush_collection_scope_vals), 0x03, "", HFILL}},
2972
2973         { &hf_scsi_osd_flush_partition_scope,
2974           {"Flush Partition Scope", "scsi.osd.flush_partition.scope", FT_UINT8, BASE_DEC,
2975            VALS(flush_partition_scope_vals), 0x03, "", HFILL}},
2976
2977         { &hf_scsi_osd_flush_osd_scope,
2978           {"Flush OSD Scope", "scsi.osd.flush_osd.scope", FT_UINT8, BASE_DEC,
2979            VALS(flush_osd_scope_vals), 0x03, "", HFILL}},
2980         };
2981
2982         /* Setup protocol subtree array */
2983         static gint *ett[] = {
2984                 &ett_osd_option,
2985                 &ett_osd_partition,
2986                 &ett_osd_attribute_parameters,
2987                 &ett_osd_capability,
2988                 &ett_osd_permission_bitmask,
2989                 &ett_osd_security_parameters,
2990         };
2991
2992         /* Register the protocol name and description */
2993         proto_scsi_osd = proto_register_protocol("SCSI_OSD", "SCSI_OSD", "scsi_osd");
2994
2995         /* Required function calls to register the header fields and subtrees used */
2996         proto_register_field_array(proto_scsi_osd, hf, array_length(hf));
2997         proto_register_subtree_array(ett, array_length(ett));
2998 }
2999
3000 void
3001 proto_reg_handoff_scsi_osd(void)
3002 {
3003 }
3004