from Jeff Snyder
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 19 Aug 2005 21:19:49 +0000 (21:19 +0000)
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 19 Aug 2005 21:19:49 +0000 (21:19 +0000)
H245 updates
make multiple pdus/frame work

update to have nu limit on the max number of tappable pdus per frame

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

asn1/h245/packet-h245-template.c
epan/dissectors/packet-h245.c
epan/dissectors/packet-h245.h

index 8b87000ed3b72e49edf1f7ac8d327d4a4d80912b..7ecc6dfa1657f0f3dc5afac5c44271c22bc08a58 100644 (file)
@@ -49,6 +49,7 @@
 #include "packet-tpkt.h"
 #include "packet-per.h"
 #include <epan/t35.h>
+#include <epan/emem.h>
 #include "packet-rtp.h"
 #include "packet-rtcp.h"
 #include "packet-ber.h"
@@ -72,8 +73,6 @@ static int hf_h245Manufacturer = -1;
 static int h245_tap = -1;
 static int ett_h245 = -1;
 static int h245dg_tap = -1;
-static h245_packet_info pi_arr[5]; /* We assuming a maximum of 5 H245 messaages per packet */
-static int pi_current=0;
 h245_packet_info *h245_pi=NULL;
 
 static gboolean h245_reassembly = TRUE;
@@ -234,18 +233,11 @@ int proto_h245 = -1;
 static void
 dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
 {
-    pi_current++;
-    if(pi_current==5){
-        pi_current=0;
-    }
-    h245_pi=&pi_arr[pi_current];
-
-    reset_h245_packet_info(h245_pi);
-       h245_pi->msg_type = H245_OTHER;
-
+       /*
+        * MultimediaSystemControlMessage_handle is the handle for
+        * dissect_h245_h245, so we don't want to do any h245_pi or tap stuff here.
+        */
        dissect_tpkt_encap(tvb, pinfo, parent_tree, h245_reassembly, MultimediaSystemControlMessage_handle);
-
-       tap_queue_packet(h245_tap, pinfo, h245_pi);
 }
 
 static void
@@ -255,23 +247,20 @@ dissect_h245_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        proto_tree *tr;
        guint32 offset=0;
 
-    pi_current++;
-    if(pi_current==5){
-      pi_current=0;
-    }
-    h245_pi=&pi_arr[pi_current];
-
-    reset_h245_packet_info(h245_pi);
-    h245_pi->msg_type = H245_OTHER;
-
        if (check_col(pinfo->cinfo, COL_PROTOCOL)){
                col_set_str(pinfo->cinfo, COL_PROTOCOL, "H.245");
        }
 
        it=proto_tree_add_protocol_format(parent_tree, proto_h245, tvb, 0, tvb_length(tvb), "H.245");
        tr=proto_item_add_subtree(it, ett_h245);
-       dissect_h245_MultimediaSystemControlMessage(tvb, offset, pinfo ,tr, hf_h245_pdu_type);
-       tap_queue_packet(h245dg_tap, pinfo, h245_pi);
+
+       /* assume that whilst there is more tvb data, there are more h245 commands */
+       while ( tvb_length_remaining( tvb, offset>>3 )>0 ){
+               h245_pi=ep_alloc(sizeof(h245_packet_info));
+               offset = dissect_h245_MultimediaSystemControlMessage(tvb, offset, pinfo ,tr, hf_h245_pdu_type);
+               tap_queue_packet(h245dg_tap, pinfo, h245_pi);
+               offset = (offset+0x07) & 0xfffffff8;
+       }
 }
 
 int
index 9a5772a0a58711468483c178f169552f56b04957..8b13651e8967a5f57353fd0ab5a3e84711125190 100644 (file)
@@ -1,6 +1,6 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
-/* .\packet-h245.c                                                            */
+/* ./packet-h245.c                                                            */
 /* ../../tools/asn2eth.py -X -e -p h245 -c h245.cnf -s packet-h245-template h245.asn */
 
 /* Input file: packet-h245-template.c */
@@ -56,6 +56,7 @@
 #include "packet-tpkt.h"
 #include "packet-per.h"
 #include <epan/t35.h>
+#include <epan/emem.h>
 #include "packet-rtp.h"
 #include "packet-rtcp.h"
 #include "packet-ber.h"
@@ -79,8 +80,6 @@ static int hf_h245Manufacturer = -1;
 static int h245_tap = -1;
 static int ett_h245 = -1;
 static int h245dg_tap = -1;
-static h245_packet_info pi_arr[5]; /* We assuming a maximum of 5 H245 messaages per packet */
-static int pi_current=0;
 h245_packet_info *h245_pi=NULL;
 
 static gboolean h245_reassembly = TRUE;
@@ -16872,18 +16871,11 @@ dissect_h245_Moderfc2733(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot
 static void
 dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
 {
-    pi_current++;
-    if(pi_current==5){
-        pi_current=0;
-    }
-    h245_pi=&pi_arr[pi_current];
-
-    reset_h245_packet_info(h245_pi);
-       h245_pi->msg_type = H245_OTHER;
-
+       /*
+        * MultimediaSystemControlMessage_handle is the handle for
+        * dissect_h245_h245, so we don't want to do any h245_pi or tap stuff here.
+        */
        dissect_tpkt_encap(tvb, pinfo, parent_tree, h245_reassembly, MultimediaSystemControlMessage_handle);
-
-       tap_queue_packet(h245_tap, pinfo, h245_pi);
 }
 
 static void
@@ -16893,23 +16885,20 @@ dissect_h245_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        proto_tree *tr;
        guint32 offset=0;
 
-    pi_current++;
-    if(pi_current==5){
-      pi_current=0;
-    }
-    h245_pi=&pi_arr[pi_current];
-
-    reset_h245_packet_info(h245_pi);
-    h245_pi->msg_type = H245_OTHER;
-
        if (check_col(pinfo->cinfo, COL_PROTOCOL)){
                col_set_str(pinfo->cinfo, COL_PROTOCOL, "H.245");
        }
 
        it=proto_tree_add_protocol_format(parent_tree, proto_h245, tvb, 0, tvb_length(tvb), "H.245");
        tr=proto_item_add_subtree(it, ett_h245);
-       dissect_h245_MultimediaSystemControlMessage(tvb, offset, pinfo ,tr, hf_h245_pdu_type);
-       tap_queue_packet(h245dg_tap, pinfo, h245_pi);
+
+       /* assume that whilst there is more tvb data, there are more h245 commands */
+       while ( tvb_length_remaining( tvb, offset>>3 )>0 ){
+               h245_pi=ep_alloc(sizeof(h245_packet_info));
+               offset = dissect_h245_MultimediaSystemControlMessage(tvb, offset, pinfo ,tr, hf_h245_pdu_type);
+               tap_queue_packet(h245dg_tap, pinfo, h245_pi);
+               offset = (offset+0x07) & 0xfffffff8;
+       }
 }
 
 int
index 2d9094c11cf402c2866ca62776be027849080a88..2c0d3633a2a7f552e3312c9a03c817a6a82694a2 100644 (file)
@@ -1,6 +1,6 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
-/* .\packet-h245.h                                                            */
+/* ./packet-h245.h                                                            */
 /* ../../tools/asn2eth.py -X -e -p h245 -c h245.cnf -s packet-h245-template h245.asn */
 
 /* Input file: packet-h245-template.h */