Ethereal-dev: [Ethereal-dev] Wiretap routine for CoSine L2 debug output

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

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Date: Wed, 31 Jul 2002 23:29:22 +0900 (JST)
Hi,

Please find attached a new wiretap routine to support CoSine L2 debug
output. Please note that this also includes a small patch against
Frame Relay dissector and Welfleet Compression frame dissector. I
needed to distinguish dissect_fr() and dissect_fr_uncompressed().

You may find that there are some fields added to CoSine pseudo header
(i.e. Pro, Off, Pri, Rm, Err, Code1 and Code2). These values have to
do with the internal Switching Fabric. Better annotation for these
values will come later.

Regards,

=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
 +----+----+     
 |.. .|    |     Motonori Shindo
 |_~__|    |     
 | .. |~~_~|     Sr. Systems Engineer
 | .  |    |     CoSine Communications Inc.
 +----+----+     
 C o S i n e     e-mail:  mshindo@xxxxxxxxxxxxx 
Communications
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=

Attachment: wiretap-cosine.tar.gz
Description: Binary data

Index: Makefile.am
===================================================================
RCS file: /cvsroot/ethereal/Makefile.am,v
retrieving revision 1.447
diff -u -r1.447 Makefile.am
--- Makefile.am	2002/07/12 22:52:33	1.447
+++ Makefile.am	2002/07/31 13:38:57
@@ -109,6 +109,7 @@
 	packet-clip.c  \
 	packet-clnp.c  \
 	packet-cops.c  \
+	packet-cosine.c  \
 	packet-cups.c  \
 	packet-data.c  \
 	packet-dccp.c \
Index: Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/Makefile.nmake,v
retrieving revision 1.196
diff -u -r1.196 Makefile.nmake
--- Makefile.nmake	2002/07/09 20:49:27	1.196
+++ Makefile.nmake	2002/07/31 13:38:58
@@ -50,6 +50,7 @@
 	packet-clip.c  \
 	packet-clnp.c  \
 	packet-cops.c  \
+	packet-cosine.c  \
 	packet-cups.c  \
 	packet-data.c  \
 	packet-dccp.c \
Index: README
===================================================================
RCS file: /cvsroot/ethereal/README,v
retrieving revision 1.58
diff -u -r1.58 README
--- README	2002/05/29 19:16:40	1.58
+++ README	2002/07/31 13:39:00
@@ -107,6 +107,7 @@
 VMS's TCPIPtrace utility
 DBS Etherwatch for VMS
 Traffic captures from Visual Networks' Visual UpTime
+CoSine L2 debug output
 
 In addition, it can read gzipped versions of any of these files
 automatically, if you have the zlib library available when compiling
@@ -147,9 +148,15 @@
 line of ISDN routers (TR-600 and TR-650). You can telnet to the router
 and start a dump session with "snoop dump".
 
-To use the Lucent/Ascend and Toshiba traces with Ethereal, you must capture
-the trace output to a file on disk.  The trace is happening inside the router
-and the router has no way of saving the trace to a file for you.
+CoSine L2 debug output can also be read by Ethereal. To get the L2
+debug output, get in the diags mode first and then use
+"create-pkt-log-profile" and "apply-pkt-log-profile" commands under
+layer-2 category. For more detail how to use these commands, you
+should examine the help command by "layer-2 create ?" or "layer-2 apply ?".
+
+To use the Lucent/Ascend, Toshiba and CoSine traces with Ethereal, you must 
+capture the trace output to a file on disk.  The trace is happening inside 
+the router and the router has no way of saving the trace to a file for you.
 An easy way of doing this under Unix is to run "telnet <ascend> | tee <outfile>".
 Or, if your system has the "script" command installed, you can save
 a shell session, including telnet to a file. For example, to a file named
Index: packet-fr.c
===================================================================
RCS file: /cvsroot/ethereal/packet-fr.c,v
retrieving revision 1.28
diff -u -r1.28 packet-fr.c
--- packet-fr.c	2002/01/21 07:36:34	1.28
+++ packet-fr.c	2002/07/31 13:39:03
@@ -419,7 +419,8 @@
   fr_subdissector_table = register_dissector_table("fr.ietf",
 	"Frame Relay NLPID", FT_UINT8, BASE_HEX);
 
-  register_dissector("fr", dissect_fr_uncompressed, proto_fr);
+  register_dissector("fr_uncompressed", dissect_fr_uncompressed, proto_fr);
+  register_dissector("fr", dissect_fr, proto_fr);
 }
 
 void proto_reg_handoff_fr(void)
Index: packet-wcp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-wcp.c,v
retrieving revision 1.25
diff -u -r1.25 packet-wcp.c
--- packet-wcp.c	2002/06/06 22:42:27	1.25
+++ packet-wcp.c	2002/07/31 13:39:08
@@ -174,7 +174,7 @@
 static gint ett_wcp = -1;
 static gint ett_wcp_field = -1;
 
-static dissector_handle_t fr_handle;
+static dissector_handle_t fr_uncompressed_handle;
 
 /*
  * Bits in the address field.
@@ -397,7 +397,7 @@
 			tvb_reported_length( tvb)-1, 1,
 		 	tvb_get_guint8( tvb, tvb_reported_length(tvb)-1));
 
-	call_dissector(fr_handle, next_tvb, pinfo, tree);
+	call_dissector(fr_uncompressed_handle, next_tvb, pinfo, tree);
 
 	return;
 }
@@ -740,7 +740,7 @@
     /*
      * Get handle for the Frame Relay (uncompressed) dissector.
      */
-    fr_handle = find_dissector("fr");
+    fr_uncompressed_handle = find_dissector("fr_uncompressed");
 
     wcp_handle = create_dissector_handle(dissect_wcp, proto_wcp);
     dissector_add("fr.ietf", NLPID_COMPRESSED, wcp_handle);
Index: doc/editcap.pod
===================================================================
RCS file: /cvsroot/ethereal/doc/editcap.pod,v
retrieving revision 1.19
diff -u -r1.19 editcap.pod
--- editcap.pod	2002/03/26 06:15:08	1.19
+++ editcap.pod	2002/07/31 13:39:09
@@ -34,13 +34,13 @@
 from B<i4btrace> from the ISDN4BSD project, the output in B<IPLog>
 format from the Cisco Secure Intrusion Detection System, B<pppd logs>
 (pppdump format), the output from VMS's B<TCPIPtrace> utility, the text
-output from the B<DBS Etherwatch> VMS utility, and traffic capture files
-from Visual Networks' Visual UpTime.  There is no need to tell
-B<Editcap> what type of file you are reading; it will determine the file
-type by itself.  B<Editcap> is also capable of reading any of these file
-formats if they are compressed using gzip.  B<Editcap> recognizes this
-directly from the file; the '.gz' extension is not required for this
-purpose.
+output from the B<DBS Etherwatch> VMS utility, traffic capture files
+from Visual Networks' Visual UpTime and the output from B<CoSine> L2 
+debug. There is no need to tell B<Editcap> what type of file you are 
+reading; it will determine the file type by itself.  B<Editcap> is also 
+capable of reading any of these file formats if they are compressed 
+using gzip.  B<Editcap> recognizes this directly from the file; the 
+'.gz' extension is not required for this purpose.
 
 By default, it writes the capture file in B<libpcap> format, and writes
 all of the packets in the capture file to the output file.  The B<-F>
Index: doc/ethereal.pod.template
===================================================================
RCS file: /cvsroot/ethereal/doc/ethereal.pod.template,v
retrieving revision 1.320
diff -u -r1.320 ethereal.pod.template
--- ethereal.pod.template	2002/07/20 23:14:39	1.320
+++ ethereal.pod.template	2002/07/31 13:39:17
@@ -49,13 +49,13 @@
 output from B<i4btrace> from the ISDN4BSD project, the output in
 B<IPLog> format from the Cisco Secure Intrusion Detection System, B<pppd
 logs> (pppdump format), the output from VMS's B<TCPIPtrace> utility, the
-text output from the B<DBS Etherwatch> VMS utility, and traffic capture
-files from Visual Networks' Visual UpTime.  There is no need to tell
-B<Ethereal> what type of file you are reading; it will determine the
-file type by itself.  B<Ethereal> is also capable of reading any of
-these file formats if they are compressed using gzip.  B<Ethereal>
-recognizes this directly from the file; the '.gz' extension is not
-required for this purpose.
+text output from the B<DBS Etherwatch> VMS utility, traffic capture
+files from Visual Networks' Visual UpTime, and the output from B<CoSine> 
+L2 debug.  There is no need to tell B<Ethereal> what type of file you 
+are reading; it will determine the file type by itself.  B<Ethereal> 
+is also capable of reading any of these file formats if they are 
+compressed using gzip.  B<Ethereal> recognizes this directly from the 
+file; the '.gz' extension is not required for this purpose.
 
 Like other protocol analyzers, B<Ethereal>'s main window shows 3 views
 of a packet.  It shows a summary line, briefly describing what the
Index: doc/mergecap.pod
===================================================================
RCS file: /cvsroot/ethereal/doc/mergecap.pod,v
retrieving revision 1.12
diff -u -r1.12 mergecap.pod
--- mergecap.pod	2002/03/26 06:15:08	1.12
+++ mergecap.pod	2002/07/31 13:39:18
@@ -31,13 +31,13 @@
 from B<i4btrace> from the ISDN4BSD project, the output in B<IPLog>
 format from the Cisco Secure Intrusion Detection System, B<pppd logs>
 (pppdump format), the output from VMS's B<TCPIPtrace> utility, the text
-output from the B<DBS Etherwatch> VMS utility, and traffic capture files
-from Visual Networks' Visual UpTime.  There is no need to tell
-B<Mergecap> what type of file you are reading; it will determine the
-file type by itself.  B<Mergecap> is also capable of reading any of
-these file formats if they are compressed using gzip.  B<Mergecap>
-recognizes this directly from the file; the '.gz' extension is not
-required for this purpose.
+output from the B<DBS Etherwatch> VMS utility, traffic capture files
+from Visual Networks' Visual UpTime, and the output from B<CoSine> L2 
+debug.  There is no need to tell B<Mergecap> what type of file you are 
+reading; it will determine the file type by itself.  B<Mergecap> is 
+also capable of reading any of these file formats if they are compressed 
+using gzip.  B<Mergecap> recognizes this directly from the file; the 
+'.gz' extension is not required for this purpose.
 
 By default, it writes the capture file in B<libpcap> format, and writes
 all of the packets in both input capture files to the output file.  The
Index: doc/tethereal.pod.template
===================================================================
RCS file: /cvsroot/ethereal/doc/tethereal.pod.template,v
retrieving revision 1.52
diff -u -r1.52 tethereal.pod.template
--- tethereal.pod.template	2002/07/16 07:15:06	1.52
+++ tethereal.pod.template	2002/07/31 13:39:21
@@ -49,12 +49,13 @@
 ISDN4BSD project, the output in B<IPLog> format from the Cisco Secure
 Intrusion Detection System, B<pppd logs> (pppdump format), the output
 from VMS's B<TCPIPtrace> utility, the text output from the B<DBS
-Etherwatch> VMS utility, and traffic capture files from Visual Networks'
-Visual UpTime.  There is no need to tell B<Tethereal> what type of file
-you are reading; it will determine the file type by itself. 
-B<Tethereal> is also capable of reading any of these file formats if
-they are compressed using gzip.  B<Tethereal> recognizes this directly
-from the file; the '.gz' extension is not required for this purpose.
+Etherwatch> VMS utility, traffic capture files from Visual Networks'
+Visual UpTime, and the output from B<CoSine> L2 debug.  There is no 
+need to tell B<Tethereal> what type of file you are reading; it will 
+determine the file type by itself. B<Tethereal> is also capable of 
+reading any of these file formats if they are compressed using gzip.  
+B<Tethereal> recognizes this directly from the file; the '.gz' extension 
+is not required for this purpose.
 
 If the B<-w> flag is not specified, B<Tethereal> prints a decoded form
 of the packets it captures or reads; otherwise, it writes those packets
Index: wiretap/Makefile.am
===================================================================
RCS file: /cvsroot/ethereal/wiretap/Makefile.am,v
retrieving revision 1.38
diff -u -r1.38 Makefile.am
--- Makefile.am	2002/06/07 21:11:24	1.38
+++ Makefile.am	2002/07/31 13:39:23
@@ -42,6 +42,8 @@
 	atm.h			\
 	buffer.c		\
 	buffer.h		\
+	cosine.h		\
+	cosine.c		\
 	csids.c			\
 	csids.h			\
 	dbs-etherwatch.c	\
Index: wiretap/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/wiretap/Makefile.nmake,v
retrieving revision 1.27
diff -u -r1.27 Makefile.nmake
--- Makefile.nmake	2002/06/13 10:39:29	1.27
+++ Makefile.nmake	2002/07/31 13:39:23
@@ -18,6 +18,7 @@
 	ascend.obj \
 	atm.obj \
 	buffer.obj \
+	cosine.obj \
 	csids.obj \
 	dbs-etherwatch.obj \
 	etherpeek.obj \
Index: wiretap/file.c
===================================================================
RCS file: /cvsroot/ethereal/wiretap/file.c,v
retrieving revision 1.95
diff -u -r1.95 file.c
--- file.c	2002/07/29 06:09:58	1.95
+++ file.c	2002/07/31 13:39:26
@@ -67,6 +67,7 @@
 #include "vms.h"
 #include "dbs-etherwatch.h"
 #include "visual.h"
+#include "cosine.h"
 
 /* The open_file_* routines should return:
  *
@@ -119,6 +120,7 @@
 	csids_open,
 	vms_open,
 	dbs_etherwatch_open,
+	cosine_open,
 };
 
 #define	N_FILE_TYPES	(sizeof open_routines / sizeof open_routines[0])
@@ -437,6 +439,10 @@
 	/* WTAP_FILE_VISUAL_NETWORKS */
 	{ "Visual Networks traffic capture", "visual",
 	  visual_dump_can_write_encap, visual_dump_open },
+
+	/* WTAP_FILE_COSINE */
+	{ "CoSine IPSX L2 capture", "cosine",
+	  NULL, NULL },
 };
 
 /* Name that should be somewhat descriptive. */
Index: wiretap/wtap.c
===================================================================
RCS file: /cvsroot/ethereal/wiretap/wtap.c,v
retrieving revision 1.68
diff -u -r1.68 wtap.c
--- wtap.c	2002/07/29 06:09:59	1.68
+++ wtap.c	2002/07/31 13:39:27
@@ -142,6 +142,9 @@
 
 	/* WTAP_ENCAP_HHDLC */
 	{ "HiPath HDLC", "hhdlc" },
+
+	/* WTAP_ENCAP_COSINE */
+	{ "CoSine L2 debug log", "cosine" },
 };
 
 /* Name that should be somewhat descriptive. */
Index: wiretap/wtap.h
===================================================================
RCS file: /cvsroot/ethereal/wiretap/wtap.h,v
retrieving revision 1.118
diff -u -r1.118 wtap.h
--- wtap.h	2002/07/29 06:09:59	1.118
+++ wtap.h	2002/07/31 13:39:29
@@ -114,9 +114,10 @@
 #define WTAP_ENCAP_PFLOG			26
 #define WTAP_ENCAP_HHDLC			27
 #define WTAP_ENCAP_DOCSIS			28
+#define WTAP_ENCAP_COSINE			29
 
 /* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES			29
+#define WTAP_NUM_ENCAP_TYPES			30
 
 /* File types that can be read by wiretap.
    We support writing some many of these file types, too, so we
@@ -153,9 +154,10 @@
 #define WTAP_FILE_VMS				29
 #define WTAP_FILE_DBS_ETHERWATCH		30
 #define WTAP_FILE_VISUAL_NETWORKS		31
+#define WTAP_FILE_COSINE			32
 
 /* last WTAP_FILE_ value + 1 */
-#define WTAP_NUM_FILE_TYPES			32
+#define WTAP_NUM_FILE_TYPES			33
 
 /*
  * Maximum packet size we'll support.
@@ -291,12 +293,45 @@
 	guint8	signal_level;	/* percentage */
 };
 
+/* Packet "pseudo-header" for the output from CoSine L2 debug output. */
+
+/* XXX */
+#define COSINE_MAX_IF_NAME_LEN	128
+
+#define COSINE_ENCAP_TEST	1
+#define COSINE_ENCAP_PPoATM	2
+#define COSINE_ENCAP_PPoFR	3
+#define COSINE_ENCAP_ATM	4
+#define COSINE_ENCAP_FR		5
+#define COSINE_ENCAP_HDLC	6
+#define COSINE_ENCAP_PPP	7
+#define COSINE_ENCAP_ETH	8
+#define COSINE_ENCAP_UNKNOWN	99
+
+#define COSINE_DIR_TX 1
+#define COSINE_DIR_RX 2
+
+/* XXX */
+struct cosine_phdr {
+	guint8 encap;		/* COSINE_ENCAP_* as defined above */
+	guint8 direction;	/* COSINE_DIR_*, as defined above */
+	char if_name[COSINE_MAX_IF_NAME_LEN];
+	guint16 pro;		/*   */
+	guint16 off;		/*   */
+	guint16 pri;		/*   */
+	guint16 rm;		/*   */
+	guint16 err;		/*   */
+	guint16 code1;		/*   */
+	guint16 code2;		/*   */
+};
+
 union wtap_pseudo_header {
 	struct x25_phdr		x25;
 	struct atm_phdr		atm;
 	struct ascend_phdr	ascend;
 	struct p2p_phdr		p2p;
 	struct ieee_802_11_phdr	ieee_802_11;
+	struct cosine_phdr	cosine;
 };
 
 struct wtap_pkthdr {