Set the Info column to the correctly-capitalized name.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 26 Jun 2005 19:55:06 +0000 (19:55 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 26 Jun 2005 19:55:06 +0000 (19:55 +0000)
Use "val_to_str()" to set the Info column, and give the "hyperscsi.cmd"
field a value_string table.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14785 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-hyperscsi.c

index f4ed93349aa4cab83af4efa5740c262a07226da8..fb7856c9843cf30cb3e796ab81f91755fbefb2ba 100644 (file)
@@ -96,10 +96,9 @@ dissect_hyperscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   proto_tree *hs_tree = NULL;
   proto_item *ti;
   guint8     hs_cmd, hs_ver;
-  char       *opcode_str;
 
   if (check_col(pinfo->cinfo, COL_PROTOCOL))
-    col_set_str(pinfo->cinfo, COL_PROTOCOL, "HYPERSCSI");
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "HyperSCSI");
   if (check_col(pinfo->cinfo, COL_INFO))
     col_clear(pinfo->cinfo, COL_INFO);
 
@@ -148,13 +147,9 @@ dissect_hyperscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
   hs_cmd &= OPCODE_MASK;
 
-  opcode_str = match_strval(hs_cmd, hscsi_opcodes);
-
-  if (!opcode_str) 
-    opcode_str = "Unknown HyperSCSI Request or Response";
-
   if (check_col(pinfo->cinfo, COL_INFO)) {
-    col_append_str(pinfo->cinfo, COL_INFO, (char *)opcode_str);
+    col_append_str(pinfo->cinfo, COL_INFO,
+                   val_to_str(hs_cmd, hscsi_opcodes, "Unknown HyperSCSI Request or Response (%u)"));
   }
 
   if (tree) {
@@ -163,7 +158,7 @@ dissect_hyperscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
     proto_tree_add_uint(hs_pdu_tree, hf_hs_ver, tvb, 3, 1, hs_ver);
 
-    proto_tree_add_uint_format(hs_pdu_tree, hf_hs_cmd, tvb, 4, 1, hs_cmd, "HyperSCSI Command: %s", opcode_str);
+    proto_tree_add_uint(hs_pdu_tree, hf_hs_cmd, tvb, 4, 1, hs_cmd);
   }
 
 }
@@ -193,7 +188,7 @@ proto_register_hyperscsi(void)
        0x0, "", HFILL}},
 
     { &hf_hs_cmd,
-      { "HyperSCSI Command", "hyperscsi.cmd", FT_UINT8, BASE_DEC, NULL, 0x0, 
+      { "HyperSCSI Command", "hyperscsi.cmd", FT_UINT8, BASE_DEC, VALS(hscsi_opcodes), 0x0, 
        "", HFILL}},
   };