dissect H.248 over TPKT over TCP
authorlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 17 Mar 2007 21:44:22 +0000 (21:44 +0000)
committerlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 17 Mar 2007 21:44:22 +0000 (21:44 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21047 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-h248.c
epan/dissectors/packet-h248.h

index 18bd5cbcab057af0a4d738f4dd917612a22e27d2..7d0196e1ea0f3ce3b6b5f06c2aae509671b2aac9 100644 (file)
@@ -1,6 +1,6 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
-/* .\packet-h248.c                                                            */
+/* ./packet-h248.c                                                            */
 /* ../../tools/asn2wrs.py -b -e -p h248 -c h248.cnf -s packet-h248-template h248v3.asn */
 
 /* Input file: packet-h248-template.c */
@@ -34,6 +34,7 @@
  */
 
 #include "packet-h248.h"
+#include "packet-tpkt.h"
 
 #define PNAME  "H.248 MEGACO"
 #define PSNAME "H248"
@@ -41,6 +42,7 @@
 
 #define GATEWAY_CONTROL_PROTOCOL_USER_ID 14
 
+
 /* Initialize the protocol and registered fields */
 static int proto_h248                          = -1;
 static int hf_h248_mtpaddress_ni       = -1;
@@ -384,7 +386,7 @@ static int hf_h248_NotifyCompletion_otherReason = -1;
 static int hf_h248_NotifyCompletion_onIteration = -1;
 
 /*--- End of included file: packet-h248-hf.c ---*/
-#line 72 "packet-h248-template.c"
+#line 74 "packet-h248-template.c"
 
 /* Initialize the subtree pointers */
 static gint ett_h248 = -1;
@@ -547,7 +549,7 @@ static gint ett_h248_TimeNotation = -1;
 static gint ett_h248_Value = -1;
 
 /*--- End of included file: packet-h248-ett.c ---*/
-#line 91 "packet-h248-template.c"
+#line 93 "packet-h248-template.c"
 
 static dissector_handle_t h248_term_handle;
 
@@ -558,8 +560,12 @@ static emem_tree_t* ctxs = NULL;
 
 static gboolean h248_prefs_initialized = FALSE;
 static gboolean keep_persistent_data = FALSE;
-static guint32 udp_port = 0;
-static guint32 temp_udp_port = 0;
+static guint32 udp_port = 2945;
+static guint32 temp_udp_port = 2945;
+static guint32 tcp_port = 2945;
+static guint32 temp_tcp_port = 2945;
+static gboolean h248_desegment = TRUE;
+
 
 
 static proto_tree *h248_tree;
@@ -567,6 +573,7 @@ static tvbuff_t* h248_tvb;
 
 static dissector_handle_t h248_handle;
 static dissector_handle_t h248_term_handle;
+static dissector_handle_t h248_tpkt_handle;
 
 static const value_string term_types[] = {
   {   H248_TERM_TYPE_AAL1, "aal1" },
@@ -6428,7 +6435,11 @@ dissect_h248_ServiceChangeReasonStr(gboolean implicit_tag _U_, tvbuff_t *tvb, in
 
 
 /*--- End of included file: packet-h248-fn.c ---*/
-#line 1845 "packet-h248-template.c"
+#line 1852 "packet-h248-template.c"
+
+static void dissect_h248_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+       dissect_tpkt_encap(tvb, pinfo, tree, h248_desegment, h248_handle);
+}
 
 static void
 dissect_h248(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -6487,14 +6498,21 @@ static void h248_init(void)  {
     } else {
         if ( udp_port )
             dissector_delete("udp.port", udp_port, h248_handle);
+               
+               if ( tcp_port)
+            dissector_delete("tcp.port", tcp_port, h248_tpkt_handle);
        }
 
     udp_port = temp_udp_port;
-
+    tcp_port = temp_tcp_port;
+       
     if ( udp_port ) {
                dissector_add("udp.port", udp_port, h248_handle);
        }
 
+       if ( tcp_port) {
+               dissector_add("tcp.port", tcp_port, h248_tpkt_handle);
+       }
 }
 
 /*--- proto_register_h248 ----------------------------------------------*/
@@ -7786,7 +7804,7 @@ void proto_register_h248(void) {
         "", HFILL }},
 
 /*--- End of included file: packet-h248-hfarr.c ---*/
-#line 1990 "packet-h248-template.c"
+#line 2008 "packet-h248-template.c"
 
   { &hf_h248_ctx, { "Context", "h248.ctx", FT_UINT32, BASE_HEX, NULL, 0, "", HFILL }},
   { &hf_h248_ctx_term, { "Termination", "h248.ctx.term", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }},
@@ -7955,7 +7973,7 @@ void proto_register_h248(void) {
     &ett_h248_Value,
 
 /*--- End of included file: packet-h248-ettarr.c ---*/
-#line 2015 "packet-h248-template.c"
+#line 2033 "packet-h248-template.c"
   };
 
   module_t *h248_module;
@@ -7964,6 +7982,7 @@ void proto_register_h248(void) {
   /* Register protocol */
   proto_h248 = proto_register_protocol(PNAME, PSNAME, PFNAME);
   register_dissector("h248", dissect_h248, proto_h248);
+  register_dissector("h248.tpkt", dissect_h248_tpkt, proto_h248);
 
   /* Register fields and subtrees */
   proto_register_field_array(proto_h248, hf, array_length(hf));
@@ -7979,7 +7998,17 @@ void proto_register_h248(void) {
                                  "Port to be decoded as h248",
                                  10,
                                  &temp_udp_port);
-
+  prefs_register_uint_preference(h248_module, "tcp_port",
+                                 "TCP port",
+                                 "Port to be decoded as h248",
+                                 10,
+                                 &temp_tcp_port);
+  prefs_register_bool_preference(h248_module, "desegment",
+                                 "Desegment H.248 over TCP",
+                                 "Desegment H.248 messages that span more TCP segments",
+                                 &h248_desegment);
+  
+  
   register_init_routine( &h248_init );
 
   msgs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_msgs");
@@ -7994,10 +8023,12 @@ void proto_reg_handoff_h248(void) {
 
   h248_handle = find_dissector("h248");
   h248_term_handle = find_dissector("h248term");
+  h248_tpkt_handle = find_dissector("h248.tpkt");
 
   dissector_add("mtp3.service_indicator", GATEWAY_CONTROL_PROTOCOL_USER_ID, h248_handle);
   dissector_add("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, h248_handle);
   dissector_add("udp.port", udp_port, h248_handle);
+  dissector_add("tcp.port", tcp_port, h248_tpkt_handle);
 }
 
 
index c9e526ac99e001f825d3eb53fc54760264224c49..c2398c094d94091ddaff363133b4f37b7b8a0433 100644 (file)
@@ -1,6 +1,6 @@
 /* Do not modify this file.                                                   */
 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
-/* .\packet-h248.h                                                            */
+/* ./packet-h248.h                                                            */
 /* ../../tools/asn2wrs.py -b -e -p h248 -c h248.cnf -s packet-h248-template h248v3.asn */
 
 /* Input file: packet-h248-template.h */