Don't pass tvb data to col_set_str(), as it will not stay around.
authorStig Bjørlykke <stig@bjorlykke.org>
Wed, 14 Jul 2010 20:24:38 +0000 (20:24 -0000)
committerStig Bjørlykke <stig@bjorlykke.org>
Wed, 14 Jul 2010 20:24:38 +0000 (20:24 -0000)
Added support for Note (dumping as text).
Renamed Info to Power (as used in PacketLogger).

svn path=/trunk/; revision=33526

epan/dissectors/packet-packetlogger.c
wiretap/packetlogger.c

index 85ec834ccad124e9a6d2a10de2d1b579a6e438be..09c883311da2d6205922f8fba4a990eaad150094 100644 (file)
@@ -48,7 +48,8 @@ static gint ett_packetlogger = -1;
 #define PKT_HCI_EVENT       0x01
 #define PKT_SENT_ACL_DATA   0x02
 #define PKT_RECV_ACL_DATA   0x03
-#define PKT_INFO            0xFB
+#define PKT_POWER           0xFB
+#define PKT_NOTE            0xFC
 #define PKT_NEW_CONTROLLER  0xFE
 
 static const value_string type_vals[] = {
@@ -56,7 +57,8 @@ static const value_string type_vals[] = {
   { PKT_HCI_EVENT,       "HCI Event"       },
   { PKT_SENT_ACL_DATA,   "Sent ACL Data"   },
   { PKT_RECV_ACL_DATA,   "Recv ACL Data"   },
-  { PKT_INFO,            "Info"            },
+  { PKT_POWER,           "Power"           },
+  { PKT_NOTE,            "Note"            },
   { PKT_NEW_CONTROLLER,  "New Controller"  },
   { 0, NULL }
 };
@@ -120,10 +122,11 @@ static void dissect_packetlogger (tvbuff_t *tvb, packet_info *pinfo, proto_tree
   } else {
     /* PacketLogger data */
     switch (pl_type) {
-    case PKT_INFO:
+    case PKT_POWER:
+    case PKT_NOTE:
     case PKT_NEW_CONTROLLER:
       proto_tree_add_item (packetlogger_tree, hf_info, next_tvb, 0, len, FALSE);
-      col_set_str (pinfo->cinfo, COL_INFO, tvb_format_stringzpad_wsp (next_tvb, 0, len));
+      col_add_fstr (pinfo->cinfo, COL_INFO, "%s", tvb_format_stringzpad_wsp (next_tvb, 0, len));
       break;
     default:
       call_dissector (data_handle, next_tvb, pinfo, tree);
index 021ed129efd89a188aabde19fabef8cf877e56b1..5c7e19c82e8db8875299b48404e69cb3292a24f3 100644 (file)
@@ -73,7 +73,7 @@ int packetlogger_open(wtap *wth, int *err, gchar **err_info _U_)
 
        /* Verify this file belongs to us */
        if (!((8 <= pl_hdr.len) && (pl_hdr.len < 65536) &&
-             (type < 0x04 || type == 0xFB || type == 0xFE || type == 0xFF)))
+             (type < 0x04 || type == 0xFB || type == 0xFC || type == 0xFE || type == 0xFF)))
                return 0;
 
        /* No file header. Reset the fh to 0 so we can read the first packet */