Allow try_conversation_dissector() to pass data to subdissectors.
authorMichael Mann <mmann78@netscape.net>
Fri, 1 Nov 2013 23:45:10 +0000 (23:45 -0000)
committerMichael Mann <mmann78@netscape.net>
Fri, 1 Nov 2013 23:45:10 +0000 (23:45 -0000)
svn path=/trunk/; revision=53035

epan/conversation.c
epan/conversation.h
epan/dissectors/packet-atalk.c
epan/dissectors/packet-dccp.c
epan/dissectors/packet-rlogin.c
epan/dissectors/packet-soupbintcp.c
epan/dissectors/packet-tcp.c
epan/dissectors/packet-udp.c

index 4a70470db21e8db90169fdeeac380f64490bf30a..848775b1a3f35e9a4f5a62858435720bd1c77395 100644 (file)
@@ -1254,7 +1254,7 @@ conversation_set_dissector(conversation_t *conversation, const dissector_handle_
 gboolean
 try_conversation_dissector(const address *addr_a, const address *addr_b, const port_type ptype,
     const guint32 port_a, const guint32 port_b, tvbuff_t *tvb, packet_info *pinfo,
-    proto_tree *tree)
+    proto_tree *tree, void* data)
 {
        conversation_t *conversation;
 
@@ -1266,7 +1266,7 @@ try_conversation_dissector(const address *addr_a, const address *addr_b, const p
                if (conversation->dissector_handle == NULL)
                        return FALSE;
                ret=call_dissector_only(conversation->dissector_handle, tvb, pinfo,
-                   tree, NULL);
+                   tree, data);
                if(!ret) {
                        /* this packet was rejected by the dissector
                         * so return FALSE in case our caller wants
index ac3518d866127029f57f26f3325dba3c5752f846..5cb8bcd7f6ea856ae83dc7f28b4044ece2c645b0 100644 (file)
@@ -176,7 +176,7 @@ WS_DLL_PUBLIC void conversation_set_dissector(conversation_t *conversation,
 extern gboolean
 try_conversation_dissector(const address *addr_a, const address *addr_b, const port_type ptype,
     const guint32 port_a, const guint32 port_b, tvbuff_t *tvb, packet_info *pinfo,
-    proto_tree *tree);
+    proto_tree *tree, void* data);
 
 /* These routines are used to set undefined values for a conversation */
 
index 9ac0e143d9b438e8913268880f2886b2f1fb5f50..2575a6473a5a813d8bd7c8648c4e74004d582cb2 100644 (file)
@@ -936,7 +936,7 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
         conversation_set_dissector(conversation, sub);
       }
       else if (!try_conversation_dissector(&pinfo->src, &pinfo->dst, pinfo->ptype,
-                                           pinfo->srcport, pinfo->destport, new_tvb,pinfo, tree)) {
+                                           pinfo->srcport, pinfo->destport, new_tvb,pinfo, tree, NULL)) {
         call_dissector(data_handle, new_tvb, pinfo, tree);
 
       }
index 75460c333b6cfe0c662232721c3ec1be0e93feb1..2f04031ce8005e3f0af0d40b3512140086bc0d88 100644 (file)
@@ -211,7 +211,7 @@ decode_dccp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
      * for the conversation if available
      */
     if (try_conversation_dissector(&pinfo->src, &pinfo->dst, PT_DCCP, sport,
-                                   dport, next_tvb, pinfo, tree)) {
+                                   dport, next_tvb, pinfo, tree, NULL)) {
         return;
     }
 
index c0fbd2c17f639144a8a191006e41f88226df5f66..be81991db64998ff2b0d59bb9b261d7a26ed12b8 100644 (file)
@@ -378,8 +378,8 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info,
 /****************************************************************
  * Main dissection function
  ****************************************************************/
-static void
-dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
 {
        struct tcpinfo *tcpinfo = (struct tcpinfo *)pinfo->private_data;
        conversation_t *conversation;
@@ -471,6 +471,8 @@ dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
        /* Dissect in detail */
        rlogin_display(hash_info, tvb, pinfo, tree, tcpinfo);
+
+       return tvb_length(tvb);
 }
 
 
@@ -574,6 +576,6 @@ void proto_register_rlogin(void)
 void proto_reg_handoff_rlogin(void)
 {
        /* Dissector install routine */
-       dissector_handle_t rlogin_handle = create_dissector_handle(dissect_rlogin,proto_rlogin);
+       dissector_handle_t rlogin_handle = new_create_dissector_handle(dissect_rlogin,proto_rlogin);
        dissector_add_uint("tcp.port", RLOGIN_PORT, rlogin_handle);
 }
index 1e6bf7268cd9d358da471aa24dd15d3078458690..fbfce6117374895aca2581d578e482c79bbb53b3 100644 (file)
@@ -410,14 +410,9 @@ dissect_soupbintcp_common(
 
         /* If this packet is part of a conversation, call dissector
          * for the conversation if available */
-        if (try_conversation_dissector(&pinfo->dst,
-                                       &pinfo->src,
-                                       pinfo->ptype,
-                                       pinfo->srcport,
-                                       pinfo->destport,
-                                       sub_tvb,
-                                       pinfo,
-                                       tree)) {
+        if (try_conversation_dissector(&pinfo->dst, &pinfo->src, pinfo->ptype,
+                                       pinfo->srcport, pinfo->destport,
+                                       sub_tvb, pinfo, tree, NULL)) {
             return;
         }
 
index 024dc5f890c7aa6744e441cba62f9573c60dcb8c..f09a2af61749f2b669a8a430d38484c091c61c85 100644 (file)
@@ -3808,7 +3808,7 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
 /* for the conversation if available */
 
     if (try_conversation_dissector(&pinfo->src, &pinfo->dst, PT_TCP,
-                                   src_port, dst_port, next_tvb, pinfo, tree)) {
+                                   src_port, dst_port, next_tvb, pinfo, tree, NULL)) {
         pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
         return TRUE;
     }
index 1ca8ddc9bacb3ce109f35620113ca83b773cb51c..38541d09de835f632ff1e73f96e0b55d60f0ecae 100644 (file)
@@ -321,7 +321,7 @@ decode_udp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
 /* for the conversation if available */
 
   if (try_conversation_dissector(&pinfo->dst, &pinfo->src, PT_UDP,
-                                 uh_dport, uh_sport, next_tvb, pinfo, tree)) {
+                                 uh_dport, uh_sport, next_tvb, pinfo, tree, NULL)) {
     return;
   }