Ethereal-dev: [Ethereal-dev] Re: 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: Fri, 16 Aug 2002 08:57:18 +0900 (JST)
Hi,

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Subject: Wiretap routine for CoSine L2 debug output
Date: Wed, 31 Jul 2002 23:29:22 +0900 (JST)

> 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.

As promised, I added more annotations and cleaned up codes.

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



Index: packet-cosine.c
===================================================================
RCS file: /cvsroot/ethereal/packet-cosine.c,v
retrieving revision 1.2
diff -u -r1.2 packet-cosine.c
--- packet-cosine.c	2002/08/02 23:35:48	1.2
+++ packet-cosine.c	2002/08/15 23:52:02
@@ -43,8 +43,6 @@
 static int hf_pri = -1;
 static int hf_rm = -1;
 static int hf_err = -1;
-static int hf_code1 = -1;
-static int hf_code2 = -1;
 
 static gint ett_raw = -1;
 
@@ -85,10 +83,6 @@
     proto_tree_add_uint(fh_tree, hf_pri, tvb, 0, 0, pseudo_header->cosine.pri);
     proto_tree_add_uint(fh_tree, hf_rm,  tvb, 0, 0, pseudo_header->cosine.rm);
     proto_tree_add_uint(fh_tree, hf_err, tvb, 0, 0, pseudo_header->cosine.err);
-    proto_tree_add_uint(fh_tree, hf_code1, tvb, 0, 0, 
-			pseudo_header->cosine.code1);
-    proto_tree_add_uint(fh_tree, hf_code2, tvb, 0, 0, 
-			pseudo_header->cosine.code2);
     
     switch (pseudo_header->cosine.encap) {
     case COSINE_ENCAP_ETH:
@@ -158,19 +152,15 @@
 {
   static hf_register_info hf[] = {
     { &hf_pro, 
-      { "Pro",	"cosine.pro", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
+      { "Protocol", "cosine.pro", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}},
     { &hf_off, 
-      { "Pro",	"cosine.off", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
+      { "Offset", "cosine.off", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}},
     { &hf_pri, 
-      { "Pri",	"cosine.pri", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
+      { "Priority", "cosine.pri", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}},
     { &hf_rm, 
-      { "RM",	"cosine.rm",  FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
+      { "Rate Marking",	"cosine.rm",  FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}},
     { &hf_err, 
-      { "Err",	"cosine.err", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL}},
-    { &hf_code1, 
-      { "Code1", "cosine.code1", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
-    { &hf_code2, 
-      { "Code2", "cosine.code2", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+      { "Error Code", "cosine.err", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}},
   };
 
   static gint *ett[] = {
Index: wiretap/cosine.c
===================================================================
RCS file: /cvsroot/ethereal/wiretap/cosine.c,v
retrieving revision 1.3
diff -u -r1.3 cosine.c
--- cosine.c	2002/08/06 01:00:07	1.3
+++ cosine.c	2002/08/15 23:52:03
@@ -164,10 +164,7 @@
 #define COSINE_HEADER_LINES_TO_CHECK	200
 #define COSINE_LINE_LENGTH        	240	
 
-/*
- * XXX - is this the biggest packet we can get?
- */
-#define COSINE_MAX_PACKET_LEN	16384
+#define COSINE_MAX_PACKET_LEN	65536
 
 static gboolean empty_line(const guchar *line);
 static long cosine_seek_next_packet(wtap *wth, int *err, char *hdr);
@@ -442,8 +439,6 @@
 		pseudo_header->cosine.encap = COSINE_ENCAP_HDLC;
 	} else if (strncmp(if_name, "PPP:", 4) == 0) {
 		pseudo_header->cosine.encap = COSINE_ENCAP_PPP;
-	} else if (strncmp(if_name, "HDLC:", 5) == 0) {
-		pseudo_header->cosine.encap = COSINE_ENCAP_HDLC;
 	} else if (strncmp(if_name, "ETH:", 4) == 0) {
 		pseudo_header->cosine.encap = COSINE_ENCAP_ETH;
 	} else {
@@ -461,8 +456,6 @@
 	pseudo_header->cosine.pri = pri;
 	pseudo_header->cosine.rm = rm;
 	pseudo_header->cosine.err = error;
-	pseudo_header->cosine.code1 = code1;
-	pseudo_header->cosine.code2 = code2;
 
 	return pkt_len;
 }
Index: wiretap/wtap.h
===================================================================
RCS file: /cvsroot/ethereal/wiretap/wtap.h,v
retrieving revision 1.120
diff -u -r1.120 wtap.h
--- wtap.h	2002/07/31 22:41:34	1.120
+++ wtap.h	2002/08/15 23:52:03
@@ -299,7 +299,6 @@
 
 /* Packet "pseudo-header" for the output from CoSine L2 debug output. */
 
-/* XXX */
 #define COSINE_MAX_IF_NAME_LEN	128
 
 #define COSINE_ENCAP_TEST	1
@@ -315,18 +314,15 @@
 #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;		/*   */
+        char if_name[COSINE_MAX_IF_NAME_LEN];  /* Encap & Logical I/F name */
+	guint16 pro;		/* Protocol */
+	guint16 off;		/* Offset */
+	guint16 pri;		/* Priority */
+	guint16 rm;		/* Rate Marking */
+	guint16 err;		/* Error Code */
 };
 
 union wtap_pseudo_header {