Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] Transport Adapter Layer Interface (TALI) v1.0, RFC 3094 disse

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

From: Viorel Suman <vsuman@xxxxxxxx>
Date: Thu, 16 Sep 2004 16:30:58 +0300 (EEST)
Hello,

I've updated the TALI dissector in order to make it compliant with the 
request below. Dissector included in attached patch.

On Wed, 28 Jul 2004, Guy Harris wrote:

> On Tue, Jul 27, 2004 at 11:50:43AM +0300, Viorel Suman wrote:
> > I'd like to contribute the Transport Adapter Layer Interface v1.0 
> > (TALI) dissector. TALI v1.0 is specified by RFC 3094 
> > (http://www.ietf.org/rfc/rfc3094.txt). Dissector attached.
> 
> In Ethereal, dissectors register themselves in dissector tables, rather
> than the dissector that creates the dissector table registering other
> protocols.  The "tali.opcode" registrations should be added to the MTP3,
> SCCP, ISUP, and SAAL dissectors.
> 
> (Yes, either one would work, but it's generally cleaner to have each
> dissector register itself in the typically small number of dissector
> tables it needs to be registered in, rather than having the dissector
> with the table know about all the protocols that Ethereal supports.)
> 

-- 
WBR,

Viorel Suman
Software Developer

Avalanche Mobile NV (http://www.avmob.com)
Busitel 1, Orlyplein 85
1043 DS Amsterdam
The Netherlands

Phone: +31 (0) 20 403 74 70
Fax:   +31 (0) 20 403 73 10
diff -rNu ethereal-0.10.6-original/epan/dissectors/Makefile.common ethereal-0.10.6/epan/dissectors/Makefile.common
--- ethereal-0.10.6-original/epan/dissectors/Makefile.common	2004-08-13 01:42:04.000000000 +0300
+++ ethereal-0.10.6/epan/dissectors/Makefile.common	2004-09-16 15:11:31.000000000 +0300
@@ -459,6 +459,7 @@
 	packet-syslog.c	\
 	packet-t38.c	\
 	packet-tacacs.c	\
+	packet-tali.c	\
 	packet-tcap.c	\
 	packet-tcp.c	\
 	packet-tds.c	\
diff -rNu ethereal-0.10.6-original/epan/dissectors/Makefile.in ethereal-0.10.6/epan/dissectors/Makefile.in
--- ethereal-0.10.6-original/epan/dissectors/Makefile.in	2004-08-13 05:04:20.000000000 +0300
+++ ethereal-0.10.6/epan/dissectors/Makefile.in	2004-09-16 15:12:13.000000000 +0300
@@ -704,6 +704,7 @@
 	packet-syslog.c	\
 	packet-t38.c	\
 	packet-tacacs.c	\
+	packet-tali.c	\
 	packet-tcap.c	\
 	packet-tcp.c	\
 	packet-tds.c	\
diff -rNu ethereal-0.10.6-original/epan/dissectors/packet-isup.c ethereal-0.10.6/epan/dissectors/packet-isup.c
--- ethereal-0.10.6-original/epan/dissectors/packet-isup.c	2004-08-13 01:42:29.000000000 +0300
+++ ethereal-0.10.6/epan/dissectors/packet-isup.c	2004-09-16 15:43:00.000000000 +0300
@@ -6313,6 +6313,7 @@
   dissector_add("mtp3.service_indicator", MTP3_ISUP_SERVICE_INDICATOR, isup_handle);
   dissector_add("m3ua.protocol_data_si", MTP3_ISUP_SERVICE_INDICATOR, isup_handle);
   dissector_add_string("media_type","application/isup", application_isup_handle);
+  dissector_add_string("tali.opcode", "isot", isup_handle);
 
 }
 
diff -rNu ethereal-0.10.6-original/epan/dissectors/packet-mtp3.c ethereal-0.10.6/epan/dissectors/packet-mtp3.c
--- ethereal-0.10.6-original/epan/dissectors/packet-mtp3.c	2004-08-13 01:42:01.000000000 +0300
+++ ethereal-0.10.6/epan/dissectors/packet-mtp3.c	2004-09-16 15:43:30.000000000 +0300
@@ -689,6 +689,7 @@
   mtp3_handle = create_dissector_handle(dissect_mtp3, proto_mtp3); 	 
         	 
   dissector_add("wtap_encap", WTAP_ENCAP_MTP3, mtp3_handle); 	 
+  dissector_add_string("tali.opcode", "mtp3", mtp3_handle);
 	   	 
   data_handle = find_dissector("data");
 }
diff -rNu ethereal-0.10.6-original/epan/dissectors/packet-sccp.c ethereal-0.10.6/epan/dissectors/packet-sccp.c
--- ethereal-0.10.6-original/epan/dissectors/packet-sccp.c	2004-08-13 01:42:25.000000000 +0300
+++ ethereal-0.10.6/epan/dissectors/packet-sccp.c	2004-09-16 15:43:53.000000000 +0300
@@ -2361,6 +2361,7 @@
 
   dissector_add("mtp3.service_indicator", SCCP_SI, sccp_handle);
   dissector_add("m3ua.protocol_data_si", SCCP_SI, sccp_handle);
+  dissector_add_string("tali.opcode", "sccp", sccp_handle);
 
   data_handle = find_dissector("data");
 }
diff -rNu ethereal-0.10.6-original/epan/dissectors/packet-tali.c ethereal-0.10.6/epan/dissectors/packet-tali.c
--- ethereal-0.10.6-original/epan/dissectors/packet-tali.c	1970-01-01 02:00:00.000000000 +0200
+++ ethereal-0.10.6/epan/dissectors/packet-tali.c	2004-09-16 15:17:11.000000000 +0300
@@ -0,0 +1,202 @@
+/* packet-tali.c
+ *
+ * Routines for Transport Adapter Layer Interface (TALI) version 1.0 dissection (RFC 3094)
+ *
+ * Copyright : 2004 Viorel Suman, <vsuman[AT]avmob.ro>
+ *             In association with Avalanche Mobile BV, http://www.avmob.com
+ *
+ * Dissector of a TALI (Transport Adapter Layer Interface) version 1.0, as defined by the
+ * Tekelec (www.tekelec.com) in RFC 3094, http://www.ietf.org/rfc/rfc3094.txt
+ *
+ * $Id: packet-tali.c,v 1.4 2004/08/06 08:55:36 jcall Exp $
+ *
+ * Refer to the AUTHORS file or the AUTHORS section in the man page
+ * for contacting the author(s) of this file.
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <string.h>
+#include <glib.h>
+
+#ifdef NEED_SNPRINTF_H
+#include "snprintf.h"
+#endif
+
+#include <epan/packet.h>
+#include "tap.h"
+#include "prefs.h"
+
+#define TALI_SYNC_LENGTH    4
+#define TALI_OPCODE_LENGTH  4
+#define TALI_MSU_LENGTH     2
+#define TALI_HEADER_LENGTH  TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH + TALI_MSU_LENGTH
+
+#define TALI_SYNC "TALI"
+#define TALI_TEST "test"
+#define TALI_ALLO "allo"
+#define TALI_PROH "proh"
+#define TALI_PROA "proa"
+#define TALI_MONI "moni"
+#define TALI_MONA "mona"
+#define TALI_SCCP "sccp"
+#define TALI_ISOT "isot"
+#define TALI_MTP3 "mtp3"
+#define TALI_SAAL "saal"
+
+/* Initialize the subtree pointers */
+static gint ett_tali = -1;
+static gint ett_tali_sync = -1;
+static gint ett_tali_opcode = -1;
+static gint ett_tali_msu_length = -1;
+
+static int proto_tali  = -1;
+static module_t *tali_module;
+static dissector_handle_t tali_handle;
+static dissector_table_t tali_dissector_table;
+
+/* Initialize the protocol and registered fields */
+static int hf_tali_sync_indicator = -1;
+static int hf_tali_opcode_indicator = -1;
+static int hf_tali_length_indicator = -1;
+
+static dissector_handle_t data_handle;
+
+/* Code to actually dissect the packets */
+static void
+dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+  guint8* opcode; /* TALI opcode */
+  guint16 length; /* TALI length */
+  tvbuff_t *payload_tvb = NULL;
+  
+  /* Set up structures needed to add the protocol subtree and manage it */
+  proto_item *tali_item = NULL;
+  proto_tree *tali_tree = NULL;
+  
+  opcode = tvb_get_string(tvb, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH);
+  length = tvb_get_letohs(tvb, TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH);
+
+  /* Make entries in Protocol column on summary display */
+  if (check_col(pinfo->cinfo, COL_PROTOCOL))
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "TALI");
+  
+  if (check_col(pinfo->cinfo, COL_INFO)) {
+    col_set_str(pinfo->cinfo, COL_INFO, "");
+    col_append_fstr(pinfo->cinfo, COL_INFO, "[%s] packet, [%d] bytes in payload", opcode, length);
+  }
+
+  if (tree) {
+    /* create display subtree for the protocol */
+    tali_item = proto_tree_add_item(tree, proto_tali, tvb, 0, TALI_HEADER_LENGTH, TRUE);
+    tali_tree = proto_item_add_subtree(tali_item, ett_tali);
+    proto_tree_add_string(tali_tree, hf_tali_sync_indicator,   tvb, 0, TALI_SYNC_LENGTH, TALI_SYNC);
+    proto_tree_add_string(tali_tree, hf_tali_opcode_indicator, tvb, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH, opcode);
+    proto_tree_add_uint(tali_tree, hf_tali_length_indicator, tvb, TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH, TALI_MSU_LENGTH, length);
+  }
+
+  if (length > 0) {
+    payload_tvb = tvb_new_subset(tvb, TALI_HEADER_LENGTH, -1, length);
+    if (payload_tvb != NULL && !dissector_try_string(tali_dissector_table, opcode, payload_tvb, pinfo, tree)) {
+      call_dissector(data_handle, payload_tvb, pinfo, tree);
+    }
+  }
+}
+
+/*
+ * A 'heuristic dissector' that attemtps to establish whether we have
+ * a TALI MSU here.
+ * Only works when:
+ *	the fixed header is there
+ *	it is a 'well-known' operation
+ */
+static gboolean
+dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+  guint8* sync;   /* TALI sync */
+  guint8* opcode; /* TALI opcode */
+
+  if (tvb_reported_length(tvb) < TALI_HEADER_LENGTH)	/* Mandatory header	*/
+  return FALSE;
+
+  sync = tvb_get_string(tvb, 0, TALI_SYNC_LENGTH);
+  if (strncmp(sync, TALI_SYNC, TALI_SYNC_LENGTH) != 0)
+  return FALSE;
+
+  opcode = tvb_get_string(tvb, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH);
+  if (strncmp(opcode, TALI_TEST, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_ALLO, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_PROH, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_PROA, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_MONI, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_MONA, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_SCCP, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_ISOT, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_MTP3, TALI_OPCODE_LENGTH) != 0)
+  if (strncmp(opcode, TALI_SAAL, TALI_OPCODE_LENGTH) != 0)
+  return FALSE;
+
+  dissect_tali(tvb, pinfo, tree);
+  return TRUE;
+}
+
+void
+proto_register_tali(void)
+{
+  static hf_register_info hf[] = {
+    { &hf_tali_sync_indicator,
+      { "Sync", "tali.sync", FT_STRING, BASE_NONE, NULL, 0x00, "Tali SYNC", HFILL }},
+    { &hf_tali_opcode_indicator,
+      { "Opcode", "tali.opcode", FT_STRING, BASE_NONE, NULL, 0x00, "Tali Operation Code", HFILL }},
+    { &hf_tali_length_indicator,
+      { "Length", "tali.msu_length", FT_UINT16, BASE_DEC, NULL, 0x00, "Tali MSU Length", HFILL }}
+  };
+
+  /* Setup protocol subtree array */
+  static gint *ett[] = {
+    &ett_tali,
+    &ett_tali_sync,
+    &ett_tali_opcode,
+    &ett_tali_msu_length
+  };
+
+  /* Register the protocol name and description */
+  proto_tali = proto_register_protocol("Transport Adapter Layer Interface v1.0, RFC 3094", "TALI", "tali");
+  register_dissector("tali", dissect_tali, proto_tali);
+  tali_handle = create_dissector_handle(dissect_tali, proto_tali);
+  
+  /* Required function calls to register the header fields and subtrees used */
+  proto_register_field_array(proto_tali, hf, array_length(hf));
+  proto_register_subtree_array(ett, array_length(ett));
+
+  tali_dissector_table = register_dissector_table("tali.opcode", "Tali OPCODE", FT_STRING, BASE_NONE);
+  tali_module = prefs_register_protocol(proto_tali, NULL);
+}
+
+void
+proto_reg_handoff_tali(void)
+{
+  heur_dissector_add("tcp", dissect_tali_heur, proto_tali);
+
+  data_handle = find_dissector("data");
+}
+