ae7388693f8bb36785335ff33005544676ad34de
[obnox/wireshark/wip.git] / epan / dissectors / packet-scsi-osd.c
1 /* packet-scsi-osd.c
2  * Ronnie sahlberg 2006
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 2002 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
28
29 #include <glib.h>
30 #include <string.h>
31 #include <epan/strutil.h>
32 #include <epan/packet.h>
33 #include <epan/prefs.h>
34 #include <epan/emem.h>
35 #include <epan/conversation.h>
36 #include <epan/tap.h>
37 #include "packet-fc.h"
38 #include "packet-scsi.h"
39 #include "packet-scsi-osd.h"
40
41 static int proto_scsi_osd               = -1;
42 int hf_scsi_osd_opcode                  = -1;
43 static int hf_scsi_osd_control          = -1;
44 static int hf_scsi_osd_add_cdblen       = -1;
45 static int hf_scsi_osd_svcaction        = -1;
46 static int hf_scsi_osd_option           = -1;
47 static int hf_scsi_osd_option_dpo       = -1;
48 static int hf_scsi_osd_option_fua       = -1;
49 static int hf_scsi_osd_getsetattrib     = -1;
50 static int hf_scsi_osd_timestamps_control       = -1;
51 static int hf_scsi_osd_formatted_capacity       = -1;
52 static int hf_scsi_osd_get_attributes_page      = -1;
53 static int hf_scsi_osd_get_attributes_allocation_length = -1;
54 static int hf_scsi_osd_retreived_attributes_offset = -1;
55 static int hf_scsi_osd_set_attributes_page      = -1;
56 static int hf_scsi_osd_set_attribute_length     = -1;
57 static int hf_scsi_osd_set_attribute_number     = -1;
58 static int hf_scsi_osd_set_attributes_offset    = -1;
59 static int hf_scsi_osd_capability_format        = -1;
60 static int hf_scsi_osd_key_version      = -1;
61 static int hf_scsi_osd_icva             = -1;
62 static int hf_scsi_osd_security_method  = -1;
63 static int hf_scsi_osd_capability_expiration_time= -1;
64 static int hf_scsi_osd_audit= -1;
65 static int hf_scsi_osd_capability_discriminator = -1;
66 static int hf_scsi_osd_object_created_time= -1;
67 static int hf_scsi_osd_object_type      = -1;
68 static int hf_scsi_osd_permission_bitmask= -1;
69 static int hf_scsi_osd_object_descriptor_type   = -1;
70 static int hf_scsi_osd_object_descriptor= -1;
71 static int hf_scsi_osd_ricv             = -1;
72 static int hf_scsi_osd_request_nonce    = -1;
73 static int hf_scsi_osd_diicvo           = -1;
74 static int hf_scsi_osd_doicvo           = -1;
75 static int hf_scsi_osd_requested_partition_id   = -1;
76
77
78 static gint ett_osd_option              = -1;
79
80
81 typedef struct _scsi_osd_extra_data_t {
82         guint16 svcaction;
83         guint8  gsatype;
84 } scsi_osd_extra_data_t;
85
86 static const true_false_string option_dpo_tfs = {
87         "DPO is SET",
88         "Dpo is NOT set"
89 };
90 static const true_false_string option_fua_tfs = {
91         "FUA is SET",
92         "Fua is NOT set"
93 };
94
95 /* OSD2 5.2.4 */
96 static void
97 dissect_osd_option(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
98 {
99         proto_tree *tree=NULL;
100         proto_item *it=NULL;
101         guint8 option;
102
103         option=tvb_get_guint8(tvb, offset);
104
105         if(parent_tree){
106                 it=proto_tree_add_item(parent_tree, hf_scsi_osd_option, tvb, offset, 1, 0);
107                 tree = proto_item_add_subtree(it, ett_osd_option);
108         }
109
110         proto_tree_add_item(tree, hf_scsi_osd_option_dpo, tvb, offset, 1, 0);
111         if(option&0x10){
112                 proto_item_append_text(tree, " DPO");
113         }
114
115         proto_tree_add_item(tree, hf_scsi_osd_option_fua, tvb, offset, 1, 0);
116         if(option&0x08){
117                 proto_item_append_text(tree, " FUA");
118         }
119 }
120
121
122 static const value_string scsi_osd_getsetattrib_vals[] = {
123     {2,         "Get an attributes page and set an attribute value"},
124     {3,         "Get and set attributes using a list"},
125     {0, NULL},
126 };
127 /* OSD2 5.2.2.1 */
128 static void
129 dissect_osd_getsetattrib(tvbuff_t *tvb, int offset, proto_tree *tree, scsi_task_data_t *cdata)
130 {
131         if(cdata && cdata->itlq && cdata->itlq->extra_data){
132                 scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
133                 extra_data->gsatype=(tvb_get_guint8(tvb, offset)>>4)&0x03;
134         }
135         proto_tree_add_item(tree, hf_scsi_osd_getsetattrib, tvb, offset, 1, 0);
136 }
137
138
139 static const value_string scsi_osd_timestamps_control_vals[] = {
140     {0x00,      "Timestamps shall be updated"},
141     {0x7f,      "Timestamps shall not be updated"},
142     {0, NULL},
143 };
144 /* OSD2 5.2.8 */
145 static void
146 dissect_osd_timestamps_control(tvbuff_t *tvb, int offset, proto_tree *tree)
147 {
148         proto_tree_add_item(tree, hf_scsi_osd_timestamps_control, tvb, offset, 1, 0);
149 }
150
151
152 static void
153 dissect_osd_formatted_capacity(tvbuff_t *tvb, int offset, proto_tree *tree)
154 {
155         proto_tree_add_item(tree, hf_scsi_osd_formatted_capacity, tvb, offset, 8, 0);
156 }
157
158
159 /* do we need to store these in the itlq structure ?*/
160 static void
161 dissect_osd_attribute_parameters(tvbuff_t *tvb, int offset, proto_tree *tree, scsi_task_data_t *cdata)
162 {
163         guint8 gsatype=0;
164
165         if(cdata && cdata->itlq && cdata->itlq->extra_data){
166                 scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
167                 gsatype=extra_data->gsatype;
168         } else {
169                 return;
170         }
171
172         switch(gsatype){
173         case 2: /* 5.2.2.2  attribute page */
174                 proto_tree_add_item(tree, hf_scsi_osd_get_attributes_page, tvb, offset, 4, 0);
175                 offset+=4;
176                 proto_tree_add_item(tree, hf_scsi_osd_get_attributes_allocation_length, tvb, offset, 4, 0);
177                 offset+=4;
178                 proto_tree_add_item(tree, hf_scsi_osd_retreived_attributes_offset, tvb, offset, 4, 0);
179                 offset+=4;
180                 proto_tree_add_item(tree, hf_scsi_osd_set_attributes_page, tvb, offset, 4, 0);
181                 offset+=4;
182                 proto_tree_add_item(tree, hf_scsi_osd_set_attribute_length, tvb, offset, 4, 0);
183                 offset+=4;
184                 proto_tree_add_item(tree, hf_scsi_osd_set_attribute_number, tvb, offset, 4, 0);
185                 offset+=4;
186                 proto_tree_add_item(tree, hf_scsi_osd_set_attributes_offset, tvb, offset, 4, 0);
187                 offset+=4;
188                 break;
189         case 3: /* 5.2.2.3  attribute list */
190 /*qqq*/
191                 break;
192         }
193 }
194
195
196 static const value_string scsi_osd_capability_format_vals[] = {
197     {0x00,      "No Capability"},
198     {0x01,      "SCSI OSD2 Capabilities"},
199     {0, NULL},
200 };
201 static const value_string scsi_osd_object_type_vals[] = {
202     {0x01,      "ROOT"},
203     {0x02,      "PARTITION"},
204     {0x40,      "COLLECTION"},
205     {0x80,      "USER"},
206     {0, NULL},
207 };
208 static const value_string scsi_osd_object_descriptor_type_vals[] = {
209     {0, "NONE: the object descriptor field shall be ignored"},
210     {1, "U/C: a single collection or user object"},
211     {2, "PAR: a single partition, including partition zero"},
212     {0, NULL},
213 };
214
215 /* 4.9.2.2 */
216 static void
217 dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *tree)
218 {
219         /* capability format */
220         proto_tree_add_item(tree, hf_scsi_osd_capability_format, tvb, offset, 1, 0);
221         offset++;
222
223         /* key version and icva */
224         proto_tree_add_item(tree, hf_scsi_osd_key_version, tvb, offset, 1, 0);
225         proto_tree_add_item(tree, hf_scsi_osd_icva, tvb, offset, 1, 0);
226         offset++;
227
228         /* security method */
229         proto_tree_add_item(tree, hf_scsi_osd_security_method, tvb, offset, 1, 0);
230         offset++;
231
232         /* a reserved byte */
233         offset++;
234
235         /* capability expiration time */
236         proto_tree_add_item(tree, hf_scsi_osd_capability_expiration_time, tvb, offset, 6, 0);
237         offset+=6;
238
239         /* audit */
240         proto_tree_add_item(tree, hf_scsi_osd_audit, tvb, offset, 20, 0);
241         offset+=20;
242
243         /* capability discriminator */
244         proto_tree_add_item(tree, hf_scsi_osd_capability_discriminator, tvb, offset, 12, 0);
245         offset+=12;
246
247         /* object created time */
248         proto_tree_add_item(tree, hf_scsi_osd_object_created_time, tvb, offset, 6, 0);
249         offset+=6;
250
251         /* object type */
252         proto_tree_add_item(tree, hf_scsi_osd_object_type, tvb, offset, 1, 0);
253         offset++;
254
255         /* permission bitmask */
256 /*qqq should be broken out into a helper and have the individual bits dissected */
257         proto_tree_add_item(tree, hf_scsi_osd_permission_bitmask, tvb, offset, 5, 0);
258         offset+=5;
259
260         /* a reserved byte */
261         offset++;
262
263         /* object descriptor type */
264         proto_tree_add_item(tree, hf_scsi_osd_object_descriptor_type, tvb, offset, 1, 0);
265         offset++;
266
267         /* object descriptor */
268         proto_tree_add_item(tree, hf_scsi_osd_object_descriptor, tvb, offset, 24, 0);
269         offset+=24;
270 }
271
272
273
274 /* 5.2.6 */
275 static void
276 dissect_osd_security_parameters(tvbuff_t *tvb, int offset, proto_tree *tree)
277 {
278         /* request integrity check value */
279         proto_tree_add_item(tree, hf_scsi_osd_ricv, tvb, offset, 20, 0);
280         offset+=20;
281
282         /* request nonce */
283         proto_tree_add_item(tree, hf_scsi_osd_request_nonce, tvb, offset, 12, 0);
284         offset+=12;
285
286         /* data in integrity check value offset */
287         proto_tree_add_item(tree, hf_scsi_osd_diicvo, tvb, offset, 4, 0);
288         offset+=4;
289
290         /* data out integrity check value offset */
291         proto_tree_add_item(tree, hf_scsi_osd_doicvo, tvb, offset, 4, 0);
292         offset+=4;
293 }
294
295 static void
296 dissect_osd_format_osd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
297                         guint offset, gboolean isreq, gboolean iscdb,
298                         guint payload_len _U_, scsi_task_data_t *cdata _U_)
299 {
300         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
301         if(isreq && iscdb){
302                 /* options byte */
303                 dissect_osd_option(tvb, offset, tree);
304                 offset++;
305
306                 /* getset attributes byte */
307                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
308                 offset++;
309
310                 /* timestamps control */
311                 dissect_osd_timestamps_control(tvb, offset, tree);
312                 offset++;
313
314                 /* 23 reserved bytes */
315                 offset+=23;
316
317                 /* formatted capacity */
318                 dissect_osd_formatted_capacity(tvb, offset, tree);
319                 offset+=8;
320
321                 /* 8 reserved bytes */
322                 offset+=8;
323
324                 /* attribute parameters */
325                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
326                 offset+=28;
327
328                 /* capability */
329                 dissect_osd_capability(tvb, offset, tree);
330                 offset+=80;
331
332                 /* security parameters */
333                 dissect_osd_security_parameters(tvb, offset, tree);
334                 offset+=40;
335         }
336
337         /* dissecting the DATA OUT */
338         if(isreq && !iscdb){
339                 /* no data out for format osd */
340         }
341
342         /* dissecting the DATA IN */
343         if(!isreq && !iscdb){
344                 /* no data in for format osd */
345         }
346         
347 }
348
349
350 static void
351 dissect_osd_requested_partition_id(tvbuff_t *tvb, int offset, proto_tree *tree)
352 {
353         /* request partition id */
354         proto_tree_add_item(tree, hf_scsi_osd_requested_partition_id, tvb, offset, 8, 0);
355         offset+=8;
356 }
357
358 static void
359 dissect_osd_create_partition(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
360                         guint offset, gboolean isreq, gboolean iscdb,
361                         guint payload_len _U_, scsi_task_data_t *cdata _U_)
362 {
363         /* dissecting the CDB   dissection starts at byte 10 of the CDB */
364         if(isreq && iscdb){
365                 /* options byte */
366                 dissect_osd_option(tvb, offset, tree);
367                 offset++;
368
369                 /* getset attributes byte */
370                 dissect_osd_getsetattrib(tvb, offset, tree, cdata);
371                 offset++;
372
373                 /* timestamps control */
374                 dissect_osd_timestamps_control(tvb, offset, tree);
375                 offset++;
376
377                 /* 3 reserved bytes */
378                 offset+=3;
379
380                 /* requested partiton id */
381                 dissect_osd_requested_partition_id(tvb, offset, tree);
382                 offset+=8;
383
384                 /* 28 reserved bytes */
385                 offset+=28;
386
387                 /* attribute parameters */
388                 dissect_osd_attribute_parameters(tvb, offset, tree, cdata);
389                 offset+=28;
390
391                 /* capability */
392                 dissect_osd_capability(tvb, offset, tree);
393                 offset+=80;
394
395                 /* security parameters */
396                 dissect_osd_security_parameters(tvb, offset, tree);
397                 offset+=40;
398         }
399
400         /* dissecting the DATA OUT */
401         if(isreq && !iscdb){
402                 /* no data out for create partition */
403         }
404
405         /* dissecting the DATA IN */
406         if(!isreq && !iscdb){
407                 /* no data in for create partition */
408         }
409         
410 }
411
412
413 /* OSD Service Actions */
414 #define OSD_FORMAT_OSD          0x8801
415 #define OSD_CREATE_PARTITION    0x880b
416 static const value_string scsi_osd_svcaction_vals[] = {
417     {OSD_FORMAT_OSD,            "Format OSD"},
418     {OSD_CREATE_PARTITION,      "Create Partition"},
419     {0, NULL},
420 };
421
422 /* OSD Service Action dissectors */
423 typedef struct _scsi_osd_svcaction_t {
424         guint16 svcaction;
425         scsi_dissector_t dissector;
426 } scsi_osd_svcaction_t;
427 static const scsi_osd_svcaction_t scsi_osd_svcaction[] = {
428     {OSD_FORMAT_OSD,            dissect_osd_format_osd},
429     {OSD_CREATE_PARTITION,      dissect_osd_create_partition},
430     {0, NULL},
431 };
432
433 static scsi_dissector_t
434 find_svcaction_dissector(guint16 svcaction)
435 {
436         const scsi_osd_svcaction_t *sa=scsi_osd_svcaction;
437
438         while(sa&&sa->dissector){
439                 if(sa->svcaction==svcaction){
440                         return sa->dissector;
441                 }
442                 sa++;
443         }
444         return NULL;
445 }
446
447
448
449 static void
450 dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
451                         guint offset, gboolean isreq, gboolean iscdb,
452                         guint payload_len, scsi_task_data_t *cdata)
453 {
454         guint16 svcaction=0;
455         scsi_dissector_t dissector;
456
457         if(!tree) {
458                 return;
459         }
460
461         /* dissecting the CDB */
462         if (isreq && iscdb) {
463                 proto_tree_add_item (tree, hf_scsi_osd_control, tvb, offset, 1, 0);
464                 offset++;
465
466                 /* 5 reserved bytes */
467                 offset+=5;
468
469                 proto_tree_add_item (tree, hf_scsi_osd_add_cdblen, tvb, offset, 1, 0);
470                 offset++;
471
472                 svcaction=tvb_get_ntohs(tvb, offset);
473                 if(cdata && cdata->itlq){
474                         /* We must store the service action for this itlq
475                          * so we can indentify what the data contains
476                          */
477                         if((!pinfo->fd->flags.visited) && (!cdata->itlq->extra_data)){
478                                 scsi_osd_extra_data_t *extra_data;
479
480                                 extra_data=se_alloc(sizeof(scsi_osd_extra_data_t));
481                                 extra_data->svcaction=svcaction;
482                                 extra_data->gsatype=0;
483                                 cdata->itlq->extra_data=extra_data;
484                         }
485                 }
486                 proto_tree_add_item (tree, hf_scsi_osd_svcaction, tvb, offset, 2, 0);
487                 offset+=2;
488
489
490                 if(check_col(pinfo->cinfo, COL_INFO)){
491                         col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
492                                 val_to_str(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction"));
493                 }
494                 dissector=find_svcaction_dissector(svcaction);
495                 if(dissector){
496                         (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata);
497                 }
498                 return;
499         }
500
501         /* If it was not a CDB, try to find the service action and pass it
502          * off to the service action dissector
503          */
504         if(cdata && cdata->itlq && cdata->itlq->extra_data){
505                 scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
506                 svcaction=extra_data->svcaction;
507         }
508         if(check_col(pinfo->cinfo, COL_INFO)){
509                 col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
510                         val_to_str(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction"));
511         }
512         if(svcaction){
513                 proto_item *it;
514                 it=proto_tree_add_uint_format(tree, hf_scsi_osd_svcaction, tvb, 0, 0, svcaction, "Service Action: 0x%04x", svcaction);
515                 PROTO_ITEM_SET_GENERATED(it);
516         }
517         dissector=find_svcaction_dissector(svcaction);
518         if(dissector){
519                 (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata);
520         }
521
522 }
523
524
525 /* OSD Commands */
526 const value_string scsi_osd_vals[] = {
527     {SCSI_SPC2_INQUIRY                  , "Inquiry"},
528     {SCSI_SPC2_LOGSELECT                , "Log Select"},
529     {SCSI_SPC2_LOGSENSE                 , "Log Sense"},
530     {SCSI_SPC2_MODESELECT10             , "Mode Select(10)"},
531     {SCSI_SPC2_MODESENSE10              , "Mode Sense(10)"},
532     {SCSI_SPC2_PERSRESVIN               , "Persistent Reserve In"},
533     {SCSI_SPC2_PERSRESVOUT              , "Persistent Reserve Out"},
534     {SCSI_SPC2_REPORTLUNS               , "Report LUNs"},
535     {SCSI_OSD_OPCODE                    , "OSD Command" },
536     {0, NULL},
537 };
538
539
540
541 scsi_cdb_table_t scsi_osd_table[256] = {
542 /*OSD 0x00*/{NULL},
543 /*OSD 0x01*/{NULL},
544 /*OSD 0x02*/{NULL},
545 /*OSD 0x03*/{NULL},
546 /*OSD 0x04*/{NULL},
547 /*OSD 0x05*/{NULL},
548 /*OSD 0x06*/{NULL},
549 /*OSD 0x07*/{NULL},
550 /*OSD 0x08*/{NULL},
551 /*OSD 0x09*/{NULL},
552 /*OSD 0x0a*/{NULL},
553 /*OSD 0x0b*/{NULL},
554 /*OSD 0x0c*/{NULL},
555 /*OSD 0x0d*/{NULL},
556 /*OSD 0x0e*/{NULL},
557 /*OSD 0x0f*/{NULL},
558 /*OSD 0x10*/{NULL},
559 /*OSD 0x11*/{NULL},
560 /*OSD 0x12*/{dissect_spc3_inquiry},
561 /*OSD 0x13*/{NULL},
562 /*OSD 0x14*/{NULL},
563 /*OSD 0x15*/{NULL},
564 /*OSD 0x16*/{NULL},
565 /*OSD 0x17*/{NULL},
566 /*OSD 0x18*/{NULL},
567 /*OSD 0x19*/{NULL},
568 /*OSD 0x1a*/{NULL},
569 /*OSD 0x1b*/{NULL},
570 /*OSD 0x1c*/{NULL},
571 /*OSD 0x1d*/{NULL},
572 /*OSD 0x1e*/{NULL},
573 /*OSD 0x1f*/{NULL},
574 /*OSD 0x20*/{NULL},
575 /*OSD 0x21*/{NULL},
576 /*OSD 0x22*/{NULL},
577 /*OSD 0x23*/{NULL},
578 /*OSD 0x24*/{NULL},
579 /*OSD 0x25*/{NULL},
580 /*OSD 0x26*/{NULL},
581 /*OSD 0x27*/{NULL},
582 /*OSD 0x28*/{NULL},
583 /*OSD 0x29*/{NULL},
584 /*OSD 0x2a*/{NULL},
585 /*OSD 0x2b*/{NULL},
586 /*OSD 0x2c*/{NULL},
587 /*OSD 0x2d*/{NULL},
588 /*OSD 0x2e*/{NULL},
589 /*OSD 0x2f*/{NULL},
590 /*OSD 0x30*/{NULL},
591 /*OSD 0x31*/{NULL},
592 /*OSD 0x32*/{NULL},
593 /*OSD 0x33*/{NULL},
594 /*OSD 0x34*/{NULL},
595 /*OSD 0x35*/{NULL},
596 /*OSD 0x36*/{NULL},
597 /*OSD 0x37*/{NULL},
598 /*OSD 0x38*/{NULL},
599 /*OSD 0x39*/{NULL},
600 /*OSD 0x3a*/{NULL},
601 /*OSD 0x3b*/{NULL},
602 /*OSD 0x3c*/{NULL},
603 /*OSD 0x3d*/{NULL},
604 /*OSD 0x3e*/{NULL},
605 /*OSD 0x3f*/{NULL},
606 /*OSD 0x40*/{NULL},
607 /*OSD 0x41*/{NULL},
608 /*OSD 0x42*/{NULL},
609 /*OSD 0x43*/{NULL},
610 /*OSD 0x44*/{NULL},
611 /*OSD 0x45*/{NULL},
612 /*OSD 0x46*/{NULL},
613 /*OSD 0x47*/{NULL},
614 /*OSD 0x48*/{NULL},
615 /*OSD 0x49*/{NULL},
616 /*OSD 0x4a*/{NULL},
617 /*OSD 0x4b*/{NULL},
618 /*OSD 0x4c*/{dissect_spc3_logselect},
619 /*OSD 0x4d*/{dissect_spc3_logsense},
620 /*OSD 0x4e*/{NULL},
621 /*OSD 0x4f*/{NULL},
622 /*OSD 0x50*/{NULL},
623 /*OSD 0x51*/{NULL},
624 /*OSD 0x52*/{NULL},
625 /*OSD 0x53*/{NULL},
626 /*OSD 0x54*/{NULL},
627 /*OSD 0x55*/{dissect_spc3_modeselect10},
628 /*OSD 0x56*/{NULL},
629 /*OSD 0x57*/{NULL},
630 /*OSD 0x58*/{NULL},
631 /*OSD 0x59*/{NULL},
632 /*OSD 0x5a*/{dissect_spc3_modesense10},
633 /*OSD 0x5b*/{NULL},
634 /*OSD 0x5c*/{NULL},
635 /*OSD 0x5d*/{NULL},
636 /*OSD 0x5e*/{dissect_spc3_persistentreservein},
637 /*OSD 0x5f*/{dissect_spc3_persistentreserveout},
638 /*OSD 0x60*/{NULL},
639 /*OSD 0x61*/{NULL},
640 /*OSD 0x62*/{NULL},
641 /*OSD 0x63*/{NULL},
642 /*OSD 0x64*/{NULL},
643 /*OSD 0x65*/{NULL},
644 /*OSD 0x66*/{NULL},
645 /*OSD 0x67*/{NULL},
646 /*OSD 0x68*/{NULL},
647 /*OSD 0x69*/{NULL},
648 /*OSD 0x6a*/{NULL},
649 /*OSD 0x6b*/{NULL},
650 /*OSD 0x6c*/{NULL},
651 /*OSD 0x6d*/{NULL},
652 /*OSD 0x6e*/{NULL},
653 /*OSD 0x6f*/{NULL},
654 /*OSD 0x70*/{NULL},
655 /*OSD 0x71*/{NULL},
656 /*OSD 0x72*/{NULL},
657 /*OSD 0x73*/{NULL},
658 /*OSD 0x74*/{NULL},
659 /*OSD 0x75*/{NULL},
660 /*OSD 0x76*/{NULL},
661 /*OSD 0x77*/{NULL},
662 /*OSD 0x78*/{NULL},
663 /*OSD 0x79*/{NULL},
664 /*OSD 0x7a*/{NULL},
665 /*OSD 0x7b*/{NULL},
666 /*OSD 0x7c*/{NULL},
667 /*OSD 0x7d*/{NULL},
668 /*OSD 0x7e*/{NULL},
669 /*OSD 0x7f*/{dissect_osd_opcode},
670 /*OSD 0x80*/{NULL},
671 /*OSD 0x81*/{NULL},
672 /*OSD 0x82*/{NULL},
673 /*OSD 0x83*/{NULL},
674 /*OSD 0x84*/{NULL},
675 /*OSD 0x85*/{NULL},
676 /*OSD 0x86*/{NULL},
677 /*OSD 0x87*/{NULL},
678 /*OSD 0x88*/{NULL},
679 /*OSD 0x89*/{NULL},
680 /*OSD 0x8a*/{NULL},
681 /*OSD 0x8b*/{NULL},
682 /*OSD 0x8c*/{NULL},
683 /*OSD 0x8d*/{NULL},
684 /*OSD 0x8e*/{NULL},
685 /*OSD 0x8f*/{NULL},
686 /*OSD 0x90*/{NULL},
687 /*OSD 0x91*/{NULL},
688 /*OSD 0x92*/{NULL},
689 /*OSD 0x93*/{NULL},
690 /*OSD 0x94*/{NULL},
691 /*OSD 0x95*/{NULL},
692 /*OSD 0x96*/{NULL},
693 /*OSD 0x97*/{NULL},
694 /*OSD 0x98*/{NULL},
695 /*OSD 0x99*/{NULL},
696 /*OSD 0x9a*/{NULL},
697 /*OSD 0x9b*/{NULL},
698 /*OSD 0x9c*/{NULL},
699 /*OSD 0x9d*/{NULL},
700 /*OSD 0x9e*/{NULL},
701 /*OSD 0x9f*/{NULL},
702 /*OSD 0xa0*/{dissect_spc3_reportluns},
703 /*OSD 0xa1*/{NULL},
704 /*OSD 0xa2*/{NULL},
705 /*OSD 0xa3*/{NULL},
706 /*OSD 0xa4*/{NULL},
707 /*OSD 0xa5*/{NULL},
708 /*OSD 0xa6*/{NULL},
709 /*OSD 0xa7*/{NULL},
710 /*OSD 0xa8*/{NULL},
711 /*OSD 0xa9*/{NULL},
712 /*OSD 0xaa*/{NULL},
713 /*OSD 0xab*/{NULL},
714 /*OSD 0xac*/{NULL},
715 /*OSD 0xad*/{NULL},
716 /*OSD 0xae*/{NULL},
717 /*OSD 0xaf*/{NULL},
718 /*OSD 0xb0*/{NULL},
719 /*OSD 0xb1*/{NULL},
720 /*OSD 0xb2*/{NULL},
721 /*OSD 0xb3*/{NULL},
722 /*OSD 0xb4*/{NULL},
723 /*OSD 0xb5*/{NULL},
724 /*OSD 0xb6*/{NULL},
725 /*OSD 0xb7*/{NULL},
726 /*OSD 0xb8*/{NULL},
727 /*OSD 0xb9*/{NULL},
728 /*OSD 0xba*/{NULL},
729 /*OSD 0xbb*/{NULL},
730 /*OSD 0xbc*/{NULL},
731 /*OSD 0xbd*/{NULL},
732 /*OSD 0xbe*/{NULL},
733 /*OSD 0xbf*/{NULL},
734 /*OSD 0xc0*/{NULL},
735 /*OSD 0xc1*/{NULL},
736 /*OSD 0xc2*/{NULL},
737 /*OSD 0xc3*/{NULL},
738 /*OSD 0xc4*/{NULL},
739 /*OSD 0xc5*/{NULL},
740 /*OSD 0xc6*/{NULL},
741 /*OSD 0xc7*/{NULL},
742 /*OSD 0xc8*/{NULL},
743 /*OSD 0xc9*/{NULL},
744 /*OSD 0xca*/{NULL},
745 /*OSD 0xcb*/{NULL},
746 /*OSD 0xcc*/{NULL},
747 /*OSD 0xcd*/{NULL},
748 /*OSD 0xce*/{NULL},
749 /*OSD 0xcf*/{NULL},
750 /*OSD 0xd0*/{NULL},
751 /*OSD 0xd1*/{NULL},
752 /*OSD 0xd2*/{NULL},
753 /*OSD 0xd3*/{NULL},
754 /*OSD 0xd4*/{NULL},
755 /*OSD 0xd5*/{NULL},
756 /*OSD 0xd6*/{NULL},
757 /*OSD 0xd7*/{NULL},
758 /*OSD 0xd8*/{NULL},
759 /*OSD 0xd9*/{NULL},
760 /*OSD 0xda*/{NULL},
761 /*OSD 0xdb*/{NULL},
762 /*OSD 0xdc*/{NULL},
763 /*OSD 0xdd*/{NULL},
764 /*OSD 0xde*/{NULL},
765 /*OSD 0xdf*/{NULL},
766 /*OSD 0xe0*/{NULL},
767 /*OSD 0xe1*/{NULL},
768 /*OSD 0xe2*/{NULL},
769 /*OSD 0xe3*/{NULL},
770 /*OSD 0xe4*/{NULL},
771 /*OSD 0xe5*/{NULL},
772 /*OSD 0xe6*/{NULL},
773 /*OSD 0xe7*/{NULL},
774 /*OSD 0xe8*/{NULL},
775 /*OSD 0xe9*/{NULL},
776 /*OSD 0xea*/{NULL},
777 /*OSD 0xeb*/{NULL},
778 /*OSD 0xec*/{NULL},
779 /*OSD 0xed*/{NULL},
780 /*OSD 0xee*/{NULL},
781 /*OSD 0xef*/{NULL},
782 /*OSD 0xf0*/{NULL},
783 /*OSD 0xf1*/{NULL},
784 /*OSD 0xf2*/{NULL},
785 /*OSD 0xf3*/{NULL},
786 /*OSD 0xf4*/{NULL},
787 /*OSD 0xf5*/{NULL},
788 /*OSD 0xf6*/{NULL},
789 /*OSD 0xf7*/{NULL},
790 /*OSD 0xf8*/{NULL},
791 /*OSD 0xf9*/{NULL},
792 /*OSD 0xfa*/{NULL},
793 /*OSD 0xfb*/{NULL},
794 /*OSD 0xfc*/{NULL},
795 /*OSD 0xfd*/{NULL},
796 /*OSD 0xfe*/{NULL},
797 /*OSD 0xff*/{NULL}
798 };
799
800
801
802
803 void
804 proto_register_scsi_osd(void)
805 {
806         static hf_register_info hf[] = {
807         { &hf_scsi_osd_opcode,
808           {"OSD Opcode", "scsi.osd.opcode", FT_UINT8, BASE_HEX,
809            VALS (scsi_osd_vals), 0x0, "", HFILL}},
810         { &hf_scsi_osd_control,
811           {"Control", "scsi.osd.cdb.control", FT_UINT8, BASE_HEX,
812            NULL, 0x0, "", HFILL}},
813         { &hf_scsi_osd_add_cdblen,
814           {"Additional CDB Length", "scsi.osd.addcdblen", FT_UINT8, BASE_DEC,
815            NULL, 0x0, "", HFILL}},
816         { &hf_scsi_osd_svcaction,
817           {"Service Action", "scsi.osd.svcaction", FT_UINT16, BASE_HEX,
818            VALS(scsi_osd_svcaction_vals), 0x0, "", HFILL}},
819         { &hf_scsi_osd_option,
820           {"Option", "scsi.osd.option", FT_UINT8, BASE_HEX,
821            NULL, 0x0, "", HFILL}},
822         { &hf_scsi_osd_option_dpo,
823           {"DPO", "scsi.osd.option.dpo", FT_BOOLEAN, 8,
824            TFS(&option_dpo_tfs), 0x10, "", HFILL}},
825         { &hf_scsi_osd_option_fua,
826           {"FUA", "scsi.osd.option.fua", FT_BOOLEAN, 8,
827            TFS(&option_fua_tfs), 0x08, "", HFILL}},
828         { &hf_scsi_osd_getsetattrib,
829           {"GET/SET CDBFMT", "scsi.osd.getset", FT_UINT8, BASE_HEX,
830            VALS(scsi_osd_getsetattrib_vals), 0x30, "", HFILL}},
831         { &hf_scsi_osd_timestamps_control,
832           {"Timestamps Control", "scsi.osd.timestamps_control", FT_UINT8, BASE_HEX,
833            VALS(scsi_osd_timestamps_control_vals), 0x0, "", HFILL}},
834         { &hf_scsi_osd_formatted_capacity,
835           {"Formatted Capacity", "scsi.osd.formatted_capacity", FT_UINT64, BASE_DEC,
836            NULL, 0x0, "", HFILL}},
837         { &hf_scsi_osd_get_attributes_page,
838           {"Get Attributes Page", "scsi.osd.get_attributes_page", FT_UINT32, BASE_HEX,
839            NULL, 0x0, "", HFILL}},
840         { &hf_scsi_osd_get_attributes_allocation_length,
841           {"Get Attributes Allocation Length", "scsi.osd.get_attributes_allocation_length", FT_UINT32, BASE_HEX,
842            NULL, 0x0, "", HFILL}},
843         { &hf_scsi_osd_retreived_attributes_offset,
844           {"Retreived Attributes Offset", "scsi.osd.retreived_attributes_offset", FT_UINT32, BASE_HEX,
845            NULL, 0x0, "", HFILL}},
846         { &hf_scsi_osd_set_attributes_page,
847           {"Set Attributes Page", "scsi.osd.set_attributes_page", FT_UINT32, BASE_HEX,
848            NULL, 0x0, "", HFILL}},
849         { &hf_scsi_osd_set_attribute_length,
850           {"Set Attribute Length", "scsi.osd.set_attribute_length", FT_UINT32, BASE_HEX,
851            NULL, 0x0, "", HFILL}},
852         { &hf_scsi_osd_set_attribute_number,
853           {"Set Attribute Number", "scsi.osd.set_attribute_number", FT_UINT32, BASE_HEX,
854            NULL, 0x0, "", HFILL}},
855         { &hf_scsi_osd_set_attributes_offset,
856           {"Set Attributes Offset", "scsi.osd.set_attributes_offset", FT_UINT32, BASE_HEX,
857            NULL, 0x0, "", HFILL}},
858         { &hf_scsi_osd_capability_format,
859           {"Capability Format", "scsi.osd.capability_format", FT_UINT8, BASE_HEX,
860            VALS(scsi_osd_capability_format_vals), 0x0f, "", HFILL}},
861         { &hf_scsi_osd_key_version,
862           {"Key Version", "scsi.osd.key_version", FT_UINT8, BASE_HEX,
863            NULL, 0xf0, "", HFILL}},
864         { &hf_scsi_osd_icva,
865           {"Integrity Check Value Algorithm", "scsi.osd.icva", FT_UINT8, BASE_HEX,
866            NULL, 0x0f, "", HFILL}},
867         { &hf_scsi_osd_security_method,
868           {"Security Method", "scsi.osd.security_method", FT_UINT8, BASE_HEX,
869            NULL, 0x0f, "", HFILL}},
870         { &hf_scsi_osd_capability_expiration_time,
871           {"Capability Expiration Time", "scsi.osd.capability_expiration_time", FT_BYTES, BASE_HEX,
872            NULL, 0, "", HFILL}},
873         { &hf_scsi_osd_audit,
874           {"Audit", "scsi.osd.audit", FT_BYTES, BASE_HEX,
875            NULL, 0, "", HFILL}},
876         { &hf_scsi_osd_capability_discriminator,
877           {"Capability Discriminator", "scsi.osd.capability_descriminator", FT_BYTES, BASE_HEX,
878            NULL, 0, "", HFILL}},
879         { &hf_scsi_osd_object_created_time,
880           {"Object Created Time", "scsi.osd.object_created_time", FT_BYTES, BASE_HEX,
881            NULL, 0, "", HFILL}},
882         { &hf_scsi_osd_object_type,
883           {"Object Type", "scsi.osd.object_type", FT_UINT8, BASE_HEX,
884            VALS(scsi_osd_object_type_vals), 0, "", HFILL}},
885         { &hf_scsi_osd_permission_bitmask,
886           {"Permission Bitmask", "scsi.osd.permission_bitmask", FT_BYTES, BASE_HEX,
887            NULL, 0, "", HFILL}},
888         { &hf_scsi_osd_object_descriptor_type,
889           {"Object Descriptor Type", "scsi.osd.object_descriptor_type", FT_UINT8, BASE_HEX,
890            VALS(scsi_osd_object_descriptor_type_vals), 0xf0, "", HFILL}},
891         { &hf_scsi_osd_object_descriptor,
892           {"Object Descriptor", "scsi.osd.object_descriptor", FT_BYTES, BASE_HEX,
893            NULL, 0, "", HFILL}},
894         { &hf_scsi_osd_ricv,
895           {"Request Integrity Check value", "scsi.osd.ricv", FT_BYTES, BASE_HEX,
896            NULL, 0, "", HFILL}},
897         { &hf_scsi_osd_request_nonce,
898           {"Request Nonce", "scsi.osd.request_nonce", FT_BYTES, BASE_HEX,
899            NULL, 0, "", HFILL}},
900         { &hf_scsi_osd_diicvo,
901           {"Data-In Integrity Check Value Offset", "scsi.osd.diicvo", FT_UINT32, BASE_DEC,
902            NULL, 0, "", HFILL}},
903         { &hf_scsi_osd_doicvo,
904           {"Data-Out Integrity Check Value Offset", "scsi.osd.doicvo", FT_UINT32, BASE_DEC,
905            NULL, 0, "", HFILL}},
906         { &hf_scsi_osd_requested_partition_id,
907           {"Requested Partition Id", "scsi.osd.requested_partition_id", FT_BYTES, BASE_HEX,
908            NULL, 0, "", HFILL}},
909         };
910
911         /* Setup protocol subtree array */
912         static gint *ett[] = {
913                 &ett_osd_option,
914         };
915
916         /* Register the protocol name and description */
917         proto_scsi_osd = proto_register_protocol("SCSI_OSD", "SCSI_OSD", "scsi_osd");
918
919         /* Required function calls to register the header fields and subtrees used */
920         proto_register_field_array(proto_scsi_osd, hf, array_length(hf));
921         proto_register_subtree_array(ett, array_length(ett));
922 }
923
924 void
925 proto_reg_handoff_scsi_osd(void)
926 {
927 }
928