Ethereal-dev: [Ethereal-dev] Patch for packet-mtp3mg.c

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

From: Jonathan Perkins <jonathan.perkins@xxxxxxxxxxxx>
Date: Mon, 02 Feb 2004 09:35:12 +0000
Hi,

Here is a patch to packet-mtp3mg.c which fixes decode of SLTM/SLTA messages for ANSI systems. In ITU systems the SLC shares the SLS field, however in ANSI the SLC occupies previously spare bits:

ITU:

  -----------------------------------------------------------------
   Test Pattern | Length | Spare | H1  |  H0 | SLC |  OPC  | DPC  |
  -----------------------------------------------------------------

ANSI:

  -----------------------------------------------------------------
   Test Pattern | Length |  SLC  | H1  |  H0 | SLS |  OPC  | DPC  |
  -----------------------------------------------------------------

This patch adds decode of the SLC field to ANSI formated messages.

-----------------------------------------------------------------

--- packet-mtp3mg.c     2004-02-02 09:23:32.000000000 +0000
+++ packet-mtp3mg.c.new 2004-02-02 09:22:29.000000000 +0000
@@ -271,7 +271,6 @@
   { TEST_H1_SLTA, "SLTA" },
   { 0,            NULL } };

-
 #define COO_LENGTH         2
 #define ANSI_COO_SLC_MASK  0x000f
 #define ANSI_COO_FSN_MASK  0x07f0
@@ -313,6 +312,7 @@
 #define TEST_LENGTH_MASK    0xf0
 #define TEST_LENGTH_SHIFT   4
 #define TEST_PATTERN_OFFSET TEST_LENGTH
+#define ANSI_TEST_SLC_MASK  0x000f

 /* This list is slightly different from that in packet-mtp3.c */
 static const value_string service_indicator_code_vals[] = {
@@ -391,6 +391,7 @@
 static int hf_mtp3mg_upu_cause = -1;
 static int hf_mtp3test_h0 = -1;
 static int hf_mtp3mg_test_h1 = -1;
+static int hf_mtp3mg_test_ansi_slc = -1;
 static int hf_mtp3mg_test_length = -1;

 /* Initialize the subtree pointers */
@@ -821,6 +822,12 @@
     {
     case TEST_H1_SLTM:
     case TEST_H1_SLTA:
+       if (mtp3_standard == ANSI_STANDARD)
+       {
+           proto_tree_add_item(tree, hf_mtp3mg_test_ansi_slc, tvb, 0,
+                               TEST_LENGTH, TRUE);
+       }
+
proto_tree_add_item(tree, hf_mtp3mg_test_length, tvb, 0, TEST_LENGTH,
                            TRUE);

@@ -1192,7 +1199,11 @@
        { &hf_mtp3mg_test_length,
            { "Test length", "mtp3mg.test.length",
              FT_UINT8, BASE_DEC, NULL, H1_MASK,
-             "Signalling link test pattern length", HFILL }}
+             "Signalling link test pattern length", HFILL }},
+       { &hf_mtp3mg_test_ansi_slc,
+           { "Signalling Link Code", "mtp3mg.slc",
+             FT_UINT8, BASE_DEC, NULL, ANSI_TEST_SLC_MASK,
+             "SLC of affected link", HFILL }}
   };

     /* Setup protocol subtree array */

-----------------------------------------------------------------

Best regards,

Jonathan

--
=======================================================
Jonathan Perkins                Phone:  +44 1223 219019
ip.access Ltd                   Fax:    +44 1223 219099
CPC1, Capital Park
Fulbourn                        Registered No:  3400157
Cambridge CB1 5XE
UK                             http://www.ipaccess.com/
=======================================================