Convert T.124 API to use "new style" dissectors.
authorMichael Mann <mmann78@netscape.net>
Tue, 24 Nov 2015 13:22:57 +0000 (08:22 -0500)
committerMichael Mann <mmann78@netscape.net>
Tue, 24 Nov 2015 14:52:17 +0000 (14:52 +0000)
This seems like an unnecessary encapsulation of registering a dissector, but it can be used at runtime and not just a handoff function.

Change-Id: Ic13e34b5cecf493115f27a984bb886f2f76bc7de
Reviewed-on: https://code.wireshark.org/review/12096
Reviewed-by: Michael Mann <mmann78@netscape.net>
asn1/t124/packet-t124-template.c
asn1/t124/packet-t124-template.h
epan/dissectors/packet-rdp.c
epan/dissectors/packet-t124.c
epan/dissectors/packet-t124.h

index c8a7f27ac98c3090d07f1e6027cdb14207d3971a..6dab75f2145d886f11c90f613e0b6b3090675093 100644 (file)
@@ -74,15 +74,15 @@ static const per_sequence_t t124Heur_sequence[] = {
 };
 
 void
-register_t124_ns_dissector(const char *nsKey, dissector_t dissector, int proto)
+register_t124_ns_dissector(const char *nsKey, new_dissector_t dissector, int proto)
 {
   dissector_handle_t dissector_handle;
 
-  dissector_handle=create_dissector_handle(dissector, proto);
+  dissector_handle=new_create_dissector_handle(dissector, proto);
   dissector_add_string("t124.ns", nsKey, dissector_handle);
 }
 
-void register_t124_sd_dissector(packet_info *pinfo _U_, guint32 channelId_param, dissector_t dissector, int proto)
+void register_t124_sd_dissector(packet_info *pinfo _U_, guint32 channelId_param, new_dissector_t dissector, int proto)
 {
   /* XXX: we should keep the sub-dissectors list per conversation
      as the same channels may be used.
@@ -91,7 +91,7 @@ void register_t124_sd_dissector(packet_info *pinfo _U_, guint32 channelId_param,
 
   dissector_handle_t dissector_handle;
 
-  dissector_handle=create_dissector_handle(dissector, proto);
+  dissector_handle=new_create_dissector_handle(dissector, proto);
   dissector_add_uint("t124.sd", channelId_param, dissector_handle);
 
 }
index 487718c86a24716ac1e80121d2d41810c3202216..f86b48501c9fbb200ce65cc645e3c4799bdbe0f7 100644 (file)
@@ -31,8 +31,8 @@ extern int dissect_DomainMCSPDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, p
 extern guint32 t124_get_last_channelId(void);
 extern void t124_set_top_tree(proto_tree *tree);
 
-extern void register_t124_ns_dissector(const char *nsKey, dissector_t dissector, int proto);
-extern void register_t124_sd_dissector(packet_info *pinfo, guint32 channelId, dissector_t dissector, int proto);
+extern void register_t124_ns_dissector(const char *nsKey, new_dissector_t dissector, int proto);
+extern void register_t124_sd_dissector(packet_info *pinfo, guint32 channelId, new_dissector_t dissector, int proto);
 
 #include "packet-t124-exp.h"
 
index 7bccabacdd80cfdf147c05335ff6b17563d8831c..3e77b1aa9c031cc73d1141459afd5a6d5a2f7921 100644 (file)
@@ -1377,8 +1377,8 @@ dissect_rdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
   return tree;
 }
 
-static void
-dissect_rdp_SendData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int
+dissect_rdp_SendData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
   proto_item      *pi;
   int              offset       = 0;
   guint32          flags        = 0;
@@ -1575,7 +1575,7 @@ dissect_rdp_SendData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
       break;
     }
 
-    return;
+    return tvb_captured_length(tvb);
   } /* licensing stage */
 
   if (rdp_info && (t124_get_last_channelId() == rdp_info->staticChannelId)) {
@@ -1619,7 +1619,7 @@ dissect_rdp_SendData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
     /* we may get multiple control headers in a single frame */
     col_set_fence(pinfo->cinfo, COL_INFO);
 
-    return;
+    return tvb_captured_length(tvb);
   } /* (rdp_info && (t124_get_last_channelId() == rdp_info->staticChannelId)) */
 
   /* Virtual Channel */
@@ -1631,10 +1631,12 @@ dissect_rdp_SendData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
     /*offset =*/ dissect_rdp_channelPDU(tvb, offset, pinfo, tree);
   else
     /*offset =*/ dissect_rdp_encrypted(tvb, offset, pinfo, tree, "Channel PDU");
+
+  return tvb_captured_length(tvb);
 }
 
-static void
-dissect_rdp_ClientData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int
+dissect_rdp_ClientData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
   int              offset    = 0;
   proto_item      *pi;
   proto_tree      *next_tree;
@@ -1802,10 +1804,11 @@ dissect_rdp_ClientData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
     }
     offset += MAX(4, length);   /* Use length from header, but advance at least 4 bytes */
   }
+  return tvb_captured_length(tvb);
 }
 
-static void
-dissect_rdp_ServerData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int
+dissect_rdp_ServerData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
   int              offset           = 0;
   proto_item      *pi;
   proto_tree      *next_tree;
@@ -1985,6 +1988,7 @@ dissect_rdp_ServerData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
     }
     offset += MAX(4, length);   /* Use length from header, but advance at least 4 bytes */
   }
+  return tvb_captured_length(tvb);
 }
 
 /*--- proto_register_rdp -------------------------------------------*/
index 19fd89da515e62a1e2c21eb2fe808a22e6f1179b..d9a9fd2790e8a67d16d714fcb8fcf41517bc91ab 100644 (file)
@@ -2884,15 +2884,15 @@ static const per_sequence_t t124Heur_sequence[] = {
 };
 
 void
-register_t124_ns_dissector(const char *nsKey, dissector_t dissector, int proto)
+register_t124_ns_dissector(const char *nsKey, new_dissector_t dissector, int proto)
 {
   dissector_handle_t dissector_handle;
 
-  dissector_handle=create_dissector_handle(dissector, proto);
+  dissector_handle=new_create_dissector_handle(dissector, proto);
   dissector_add_string("t124.ns", nsKey, dissector_handle);
 }
 
-void register_t124_sd_dissector(packet_info *pinfo _U_, guint32 channelId_param, dissector_t dissector, int proto)
+void register_t124_sd_dissector(packet_info *pinfo _U_, guint32 channelId_param, new_dissector_t dissector, int proto)
 {
   /* XXX: we should keep the sub-dissectors list per conversation
      as the same channels may be used.
@@ -2901,7 +2901,7 @@ void register_t124_sd_dissector(packet_info *pinfo _U_, guint32 channelId_param,
 
   dissector_handle_t dissector_handle;
 
-  dissector_handle=create_dissector_handle(dissector, proto);
+  dissector_handle=new_create_dissector_handle(dissector, proto);
   dissector_add_uint("t124.sd", channelId_param, dissector_handle);
 
 }
index 48c15accc81a41c60c83da19d4ead91ffa2fb67d..802001445cb66ea67261deb4d19c95dec7ba42b6 100644 (file)
@@ -39,8 +39,8 @@ extern int dissect_DomainMCSPDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, p
 extern guint32 t124_get_last_channelId(void);
 extern void t124_set_top_tree(proto_tree *tree);
 
-extern void register_t124_ns_dissector(const char *nsKey, dissector_t dissector, int proto);
-extern void register_t124_sd_dissector(packet_info *pinfo, guint32 channelId, dissector_t dissector, int proto);
+extern void register_t124_ns_dissector(const char *nsKey, new_dissector_t dissector, int proto);
+extern void register_t124_sd_dissector(packet_info *pinfo, guint32 channelId, new_dissector_t dissector, int proto);
 
 
 /*--- Included file: packet-t124-exp.h ---*/