chiark / gitweb /
wireshark/packet-tripe.c: Catch up with Wireshark API changes.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 12 Jun 2016 12:22:48 +0000 (13:22 +0100)
  * Apparently `check_col' is now just dead, and its functionality
    included in the various `col_set_mumble' functions.

  * It seems that `dissector_add' has turned into `dissector_add_uint',
    and a number of other functions, for different field types, have
    been added.

This isn't well tested.

wireshark/packet-tripe.c

index d9e3ef1..28bfc83 100644 (file)
@@ -131,86 +131,82 @@ static void dissect_tripe(tvbuff_t *b, packet_info *p, proto_tree *t)
 
   /* --- Initialize the summary cells --- */
 
-  if (check_col(p->cinfo, COL_PROTOCOL))
-    col_set_str(p->cinfo, COL_PROTOCOL, "TrIPE");
-  if (check_col(p->cinfo, COL_INFO))
-    col_clear(p->cinfo, COL_INFO);
+  col_set_str(p->cinfo, COL_PROTOCOL, "TrIPE");
+  col_clear(p->cinfo, COL_INFO);
   ty = tvb_get_guint8(b, 0);
-  if (check_col(p->cinfo, COL_INFO)) {
-    col_clear(p->cinfo, COL_INFO);
-    switch (ty & MSG_CATMASK) {
-      case MSG_PACKET:
-       switch (ty & MSG_TYPEMASK) {
-         case 0:
-           col_set_str(p->cinfo, COL_INFO, "Packet data");
-           break;
-         default:
-           col_add_fstr(p->cinfo, COL_INFO,
-                        "Packet data, unknown type code %u",
-                        ty & MSG_TYPEMASK);
-           break;
-       }
-       break;
-      case MSG_KEYEXCH:
-       switch (ty & MSG_TYPEMASK) {
-         case KX_PRECHAL:
-           col_set_str(p->cinfo, COL_INFO, "Key exchange, prechallenge");
-           break;
-         case KX_CHAL:
-           col_set_str(p->cinfo, COL_INFO, "Key exchange, challenge");
-           break;
-         case KX_REPLY:
-           col_set_str(p->cinfo, COL_INFO, "Key exchange, reply");
-           break;
-         case KX_SWITCH:
-           col_set_str(p->cinfo, COL_INFO, "Key exchange, switch request");
-           break;
-         case KX_SWITCHOK:
-           col_set_str(p->cinfo, COL_INFO, "Key exchange, switch response");
-           break;
-         default:
-           col_add_fstr(p->cinfo, COL_INFO,
-                        "Key exchange, unknown type code %u",
-                        ty & MSG_TYPEMASK);
-           break;
-       }
-       break;
-      case MSG_MISC:
-       switch (ty & MSG_TYPEMASK) {
-         case MISC_NOP:
-           col_set_str(p->cinfo, COL_INFO, "Miscellaneous, no-operation");
-           break;
-         case MISC_PING:
-           col_set_str(p->cinfo, COL_INFO, "Miscellaneous, transport ping");
-           break;
-         case MISC_PONG:
-           col_set_str(p->cinfo, COL_INFO,
-                       "Miscellaneous, transport ping reply");
-           break;
-         case MISC_EPING:
-           col_set_str(p->cinfo, COL_INFO, "Miscellaneous, encrypted ping");
-           break;
-         case MISC_EPONG:
-           col_set_str(p->cinfo, COL_INFO,
-                       "Miscellaneous, encrypted ping reply");
-           break;
-         case MISC_GREET:
-           col_set_str(p->cinfo, COL_INFO,
-                       "Miscellaneous, greeting");
-           break;
-         default:
-           col_add_fstr(p->cinfo, COL_INFO,
-                        "Miscellaneous, unknown type code %u",
-                        ty & MSG_TYPEMASK);
-           break;
-       }
-       break;
-      default:
-       col_add_fstr(p->cinfo, COL_INFO,
-                    "Unknown category code %u, unknown type code %u",
-                    ty & MSG_CATMASK, ty & MSG_TYPEMASK);
-       break;
-    }
+  col_clear(p->cinfo, COL_INFO);
+  switch (ty & MSG_CATMASK) {
+    case MSG_PACKET:
+      switch (ty & MSG_TYPEMASK) {
+       case 0:
+         col_set_str(p->cinfo, COL_INFO, "Packet data");
+         break;
+       default:
+         col_add_fstr(p->cinfo, COL_INFO,
+                      "Packet data, unknown type code %u",
+                      ty & MSG_TYPEMASK);
+         break;
+      }
+      break;
+    case MSG_KEYEXCH:
+      switch (ty & MSG_TYPEMASK) {
+       case KX_PRECHAL:
+         col_set_str(p->cinfo, COL_INFO, "Key exchange, prechallenge");
+         break;
+       case KX_CHAL:
+         col_set_str(p->cinfo, COL_INFO, "Key exchange, challenge");
+         break;
+       case KX_REPLY:
+         col_set_str(p->cinfo, COL_INFO, "Key exchange, reply");
+         break;
+       case KX_SWITCH:
+         col_set_str(p->cinfo, COL_INFO, "Key exchange, switch request");
+         break;
+       case KX_SWITCHOK:
+         col_set_str(p->cinfo, COL_INFO, "Key exchange, switch response");
+         break;
+       default:
+         col_add_fstr(p->cinfo, COL_INFO,
+                      "Key exchange, unknown type code %u",
+                      ty & MSG_TYPEMASK);
+         break;
+      }
+      break;
+    case MSG_MISC:
+      switch (ty & MSG_TYPEMASK) {
+       case MISC_NOP:
+         col_set_str(p->cinfo, COL_INFO, "Miscellaneous, no-operation");
+         break;
+       case MISC_PING:
+         col_set_str(p->cinfo, COL_INFO, "Miscellaneous, transport ping");
+         break;
+       case MISC_PONG:
+         col_set_str(p->cinfo, COL_INFO,
+                     "Miscellaneous, transport ping reply");
+         break;
+       case MISC_EPING:
+         col_set_str(p->cinfo, COL_INFO, "Miscellaneous, encrypted ping");
+         break;
+       case MISC_EPONG:
+         col_set_str(p->cinfo, COL_INFO,
+                     "Miscellaneous, encrypted ping reply");
+         break;
+       case MISC_GREET:
+         col_set_str(p->cinfo, COL_INFO,
+                     "Miscellaneous, greeting");
+         break;
+       default:
+         col_add_fstr(p->cinfo, COL_INFO,
+                      "Miscellaneous, unknown type code %u",
+                      ty & MSG_TYPEMASK);
+         break;
+      }
+      break;
+    default:
+      col_add_fstr(p->cinfo, COL_INFO,
+                  "Unknown category code %u, unknown type code %u",
+                  ty & MSG_CATMASK, ty & MSG_TYPEMASK);
+      break;
   }
 
   /* --- Fill in the tree --- */
@@ -466,7 +462,7 @@ void proto_reg_handoff_tripe(void)
   dissector_handle_t dh;
 
   dh = create_dissector_handle(dissect_tripe, proto_tripe);
-  dissector_add("udp.port", TRIPE_PORT, dh);
+  dissector_add_uint("udp.port", TRIPE_PORT, dh);
 }
 
 G_MODULE_EXPORT void plugin_reg_handoff(void)