Ethereal-dev: [Ethereal-dev] PATCH

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Thu, 1 Jun 2006 17:04:36 +0400 (MSD)
Hi!
 
I had one problem with decode SS7 packets, when message contains non-standard SSN (SubSystem number) in parameter "Called Party address" (SCCP layer).
 
Our system uses SSN=238 for interaction with SMS Center.
I added option "ANSI MAP" in Preferences menu, that ansi_map protocol dissector can parse packets with non-standart SSN.

Best regards,

Michail Koreshkov
ZTE Corp.
Technical support engineer
__________________________________________
www.zte.ru
--- ../ethereal-0.99.0/epan/dissectors/packet-ansi_map.c	Mon Apr 17 18:46:42 2006
+++ ./epan/dissectors/packet-ansi_map.c	Thu Jun  1 16:31:48 2006
@@ -110,6 +110,7 @@
 #include <string.h>
 
 #include "epan/packet.h"
+#include <epan/prefs.h>
 #include <epan/asn1.h>
 #include <epan/tap.h>
 #include <epan/emem.h>
@@ -118,6 +119,15 @@
 #include "packet-ansi_map.h"
 #include "packet-tcap.h"
 
+
+
+/* Preferenc settings default */
+#define MAX_SSN 254
+static range_t *global_ssn_range;
+static range_t *ssn_range;
+dissector_handle_t ansi_map_handle;
+
+
 /* PROTOTYPES/FORWARDS */
 
 static gboolean dissect_ansi_param(ASN1_SCK *asn1, proto_tree *tree);
@@ -13016,10 +13026,53 @@
 }
 
 
+/*--- proto_reg_handoff_ansi_map ---------------------------------------*/
+static void range_delete_callback(guint32 ssn)
+{
+    if (ssn) {
+	delete_ansi_tcap_subdissector(ssn , ansi_map_handle);
+	add_itu_tcap_subdissector(ssn , ansi_map_handle);
+    }
+}
+
+
+
+static void range_add_callback(guint32 ssn)
+{
+    if (ssn) {
+	add_ansi_tcap_subdissector(ssn , ansi_map_handle);
+    }
+}
+
+
+void
+proto_reg_handoff_ansi_map(void)
+{
+    static int ansi_map_prefs_initialized = FALSE;
+    data_handle = find_dissector("data");
+    
+    if(!ansi_map_prefs_initialized)
+    {
+	ansi_map_prefs_initialized = TRUE;
+	ansi_map_handle = create_dissector_handle(dissect_ansi_map, proto_ansi_map);
+    }
+    else
+    {
+	range_foreach(ssn_range, range_delete_callback);
+    }
+    
+    g_free(ssn_range);
+    ssn_range = range_copy(global_ssn_range);
+
+    range_foreach(ssn_range, range_add_callback);
+}
+
 /* Register the protocol with Ethereal */
 void
 proto_register_ansi_map(void)
 {
+    
+    module_t *ansi_map_module;
     guint		i;
     gint		last_offset;
 
@@ -13139,26 +13192,17 @@
     proto_register_subtree_array(ett, array_length(ett));
 
     ansi_map_tap = register_tap("ansi_map");
-}
 
+    range_convert_str(&global_ssn_range, "5-14", MAX_SSN);
+    ssn_range = range_empty();
 
-void
-proto_reg_handoff_ansi_map(void)
-{
-    dissector_handle_t ansi_map_handle;
 
-    ansi_map_handle = create_dissector_handle(dissect_ansi_map, proto_ansi_map);
+    ansi_map_module = prefs_register_protocol(proto_ansi_map, proto_reg_handoff_ansi_map);
+    
+    prefs_register_range_preference(ansi_map_module, "map.ssn", "GSM MAP SSNs",
+				    "GSM MAP SSNs to decode as ANSI MAP",
+				    &global_ssn_range, MAX_SSN);
+}
+
 
-    add_ansi_tcap_subdissector(5, ansi_map_handle);
-    add_ansi_tcap_subdissector(6, ansi_map_handle);
-    add_ansi_tcap_subdissector(7, ansi_map_handle);
-    add_ansi_tcap_subdissector(8, ansi_map_handle);
-    add_ansi_tcap_subdissector(9 , ansi_map_handle);
-    add_ansi_tcap_subdissector(10 , ansi_map_handle);
-    add_ansi_tcap_subdissector(11 , ansi_map_handle);
-    add_ansi_tcap_subdissector(12 , ansi_map_handle);
-    add_ansi_tcap_subdissector(13 , ansi_map_handle);
-    add_ansi_tcap_subdissector(14 , ansi_map_handle);
 
-    data_handle = find_dissector("data");
-}
_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev