Ethereal-dev: Re: [Ethereal-dev] new dissector: SCCP

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

From: Jeff Morriss <jeff.morriss@xxxxxxxxxxx>
Date: Tue, 05 Mar 2002 18:17:53 -0500
Guy Harris wrote:
> 
> On Mon, Mar 04, 2002 at 06:35:41PM -0500, Jeff Morriss wrote:
> > What about having the preference stored in MTP3 but the preference show
> > up in each protocol?
> 
> "Show up in each protocol" in that you have 2 preference items, one
> under MTP3 and one under SCCP, that both affect the same flag variable
> inside Ethereal?

Yeah, that's what I meant.

> If so, then note that if you have two preference items, like that,
> they'll have different names in the preferences file, which lets people
> set them differently.  Which one should rule?

The last one, of course!  ;)

But I see your point...

> Another alternative, if all the protocols that have ITU vs. ANSI
> switches are part of SS7, would be to have an "SS7" item in the
> preferences dialog, with that option.  It *is* possible to create an
> item in the preferences dialog that doesn't have a protocol associated
> with it (as there's no "SS7" protocol, there are multiple SS7
> protocols), you'd just directly use "prefs_register_module()" rather
> than using "prefs_register_protocol()".
> 
> However, users would have to know that, to affect MTP3 and SCCP, they'd
> have to change the item under "SS7".

For some reason, I think I had contemplated this before but didn't like
it because it's really not uncommon to run, for example, ANSI TCAP over
ITU SCCP and having an "SS7" preference makes it look like it would also
affect TCAP--which arguably should have its own preference setting.

But, given that M3UA won't be calling MTP3, I guess the best is to label
the preference SS7 after all...

Attached is a patch which does that.  I left the actual variable in the
MTP3 dissector.  Feel free to reject the patch if you think it should be
in "packet-ss7.{h,c}" (which would be rather short files).

Regards,
-Jeff
Index: packet-sccp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-sccp.c,v
retrieving revision 1.2
diff -u -r1.2 packet-sccp.c
--- packet-sccp.c	2002/03/05 00:09:21	1.2
+++ packet-sccp.c	2002/03/05 22:56:05
@@ -857,7 +857,7 @@
   call_ai_tree = proto_item_add_subtree(call_ai_item, called ? ett_sccp_called_ai
 							     : ett_sccp_calling_ai);
 
-  if (mtp3_standard == ANSI_STANDARD)
+  if (ss7_standard == ANSI_STANDARD)
   {
     national = tvb_get_guint8(tvb, 0) & ANSI_NATIONAL_MASK;
     proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_national_indicator
@@ -872,7 +872,7 @@
 
   gti = tvb_get_guint8(tvb, 0) & GTI_MASK;
 
-  if (mtp3_standard == ITU_STANDARD || national == 0) {
+  if (ss7_standard == ITU_STANDARD || national == 0) {
 
     proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_itu_global_title_indicator
 					     : hf_sccp_called_itu_global_title_indicator,
@@ -923,7 +923,7 @@
 				called);
     }
 
-  } else if (mtp3_standard == ANSI_STANDARD) {
+  } else if (ss7_standard == ANSI_STANDARD) {
 
     proto_tree_add_uint(call_ai_tree, called ? hf_sccp_called_ansi_global_title_indicator
 					     : hf_sccp_calling_ansi_global_title_indicator,
@@ -1352,7 +1352,7 @@
       break;
 
     case PARAMETER_IMPORTANCE:
-      if (mtp3_standard == ITU_STANDARD)
+      if (ss7_standard == ITU_STANDARD)
 	dissect_sccp_importance_param(parameter_tvb, sccp_tree, parameter_length);
       else
 	dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
@@ -1360,7 +1360,7 @@
       break;
 
     case PARAMETER_LONG_DATA:
-      if (mtp3_standard == ITU_STANDARD)
+      if (ss7_standard == ITU_STANDARD)
 	dissect_sccp_data_param(parameter_tvb, pinfo, sccp_tree, tree);
       else
 	dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
@@ -1368,7 +1368,7 @@
       break;
 
     case PARAMETER_ISNI:
-      if (mtp3_standard == ANSI_STANDARD)
+      if (ss7_standard == ANSI_STANDARD)
 	dissect_sccp_isni_param(parameter_tvb, sccp_tree, parameter_length);
       else
 	dissect_sccp_unknown_param(parameter_tvb, sccp_tree, parameter_type,
@@ -1762,7 +1762,7 @@
     break;
 
   case MESSAGE_TYPE_LUDT:
-    if (mtp3_standard == ITU_STANDARD)
+    if (ss7_standard == ITU_STANDARD)
     {
       offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
 				       PARAMETER_CLASS, offset,
@@ -1789,7 +1789,7 @@
     break;
 
   case MESSAGE_TYPE_LUDTS:
-    if (mtp3_standard == ITU_STANDARD)
+    if (ss7_standard == ITU_STANDARD)
     {
       offset += dissect_sccp_parameter(tvb, pinfo, sccp_tree, tree,
 				       PARAMETER_RETURN_CAUSE, offset,
Index: packet-mtp3.h
===================================================================
RCS file: /cvsroot/ethereal/packet-mtp3.h,v
retrieving revision 1.1
diff -u -r1.1 packet-mtp3.h
--- packet-mtp3.h	2002/03/04 22:39:22	1.1
+++ packet-mtp3.h	2002/03/05 22:55:53
@@ -26,7 +26,7 @@
   ANSI_STANDARD = 2
 } Standard_Type;
 
-extern Standard_Type mtp3_standard;
+extern Standard_Type ss7_standard;
 
 #define ITU_PC_LENGTH     2
 #define ITU_PC_MASK       0x3FFF
Index: packet-mtp3.c
===================================================================
RCS file: /cvsroot/ethereal/packet-mtp3.c,v
retrieving revision 1.11
diff -u -r1.11 packet-mtp3.c
--- packet-mtp3.c	2002/03/04 22:39:22	1.11
+++ packet-mtp3.c	2002/03/05 23:13:23
@@ -64,7 +64,7 @@
 static dissector_table_t mtp3_sio_dissector_table;
 
 #include <packet-mtp3.h>
-Standard_Type mtp3_standard = ITU_STANDARD;
+Standard_Type ss7_standard = ITU_STANDARD;
 
 #define SIO_LENGTH                1
 
@@ -145,7 +145,7 @@
   sio = tvb_get_guint8(tvb, SIO_OFFSET);
   proto_tree_add_uint(sio_tree, hf_mtp3_network_indicator, tvb, SIO_OFFSET, SIO_LENGTH, sio);
   
-  switch(mtp3_standard){
+  switch(ss7_standard){
   case ANSI_STANDARD:
     proto_tree_add_uint(sio_tree, hf_mtp3_ansi_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio);
     break;
@@ -165,7 +165,7 @@
   proto_item *label_item, *label_dpc_item, *label_opc_item;
   proto_tree *label_tree, *label_dpc_tree, *label_opc_tree;
 
-  switch (mtp3_standard) {
+  switch (ss7_standard) {
   case ITU_STANDARD:
     label_item = proto_tree_add_text(mtp3_tree, tvb, ITU_ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, "Routing label");
     label_tree = proto_item_add_subtree(label_item, ett_mtp3_label);
@@ -225,7 +225,7 @@
   sio               = tvb_get_guint8(tvb, SIO_OFFSET);
   service_indicator = sio & SERVICE_INDICATOR_MASK;
 
-  switch (mtp3_standard) {
+  switch (ss7_standard) {
   case ITU_STANDARD:
     payload_tvb = tvb_new_subset(tvb, ITU_MTP_PAYLOAD_OFFSET, -1, -1);
     break;
@@ -256,7 +256,7 @@
 
   if (tree) {
     /* create display subtree for the protocol */
-    switch (mtp3_standard) {
+    switch (ss7_standard) {
     case ITU_STANDARD:
       mtp3_item = proto_tree_add_item(tree, proto_mtp3, tvb, 0, ITU_HEADER_LENGTH, FALSE);
       break;
@@ -348,7 +348,7 @@
     &ett_mtp3_label_opc
   };
 
-  static enum_val_t mtp3_options[] = {
+  static enum_val_t ss7_options[] = {
     { "ITU",  ITU_STANDARD },
     { "ANSI", ANSI_STANDARD },
     { NULL, 0 }
@@ -363,8 +363,8 @@
   proto_register_subtree_array(ett, array_length(ett));
 
   mtp3_sio_dissector_table = register_dissector_table("mtp3.service_indicator", "MTP3 Service indicator", FT_UINT8, BASE_HEX);
-  mtp3_module = prefs_register_protocol(proto_mtp3, NULL);
-  prefs_register_enum_preference(mtp3_module, "mtp3_standard", "MTP3 standard", "MTP3 standard",  (gint *)&mtp3_standard, mtp3_options, FALSE);
+  mtp3_module = prefs_register_module("ss7", "SS7", NULL);
+  prefs_register_enum_preference(mtp3_module, "ss7_standard", "SS7 standard", "SS7 standard (used by MTP3 and SCCP)",  (gint *)&ss7_standard, ss7_options, FALSE);
 }
 
 void
begin:vcard 
n:Morriss;Jeff
tel;fax:+1-856-222-9947
tel;work:+1-856-787-2824
x-mozilla-html:FALSE
url:http://www.ulticom.com
org:Ulticom, Inc.;Customer Support
version:2.1
email;internet:jeff.morriss[AT]ulticom.com
title:Senior Support Engineer
adr;quoted-printable:;;Ulticom, Inc.=0D=0A1020 Briggs Rd.=0D=0A;Mount Laurel;NJ;08054;USA
fn:Jeff Morriss
end:vcard