Ethereal-dev: [Ethereal-dev] nettl (HP-UX) - Added EISA 100BT/FDDI and HSC FDDI

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

From: "Mark C. Brown" <mbrown@xxxxxxxxxx>
Date: Wed, 06 Oct 2004 05:18:29 -0400
Greetings,

Adding EISA 100BaseTX, EISA FDDI, and HSC FDDI support.

Small performance fix to HP-PB FDDI.

This should do it for link level support in nettl - with
the exception of ATM and newer serial interfaces...

Thanks!

-- 
"If a train station is where a train stops, | Mark C. Brown
 then what's a workstation?" -- D. Huber    | mbrown@xxxxxxxxxx
Index: nettl.c
===================================================================
--- nettl.c	(revision 12214)
+++ nettl.c	(working copy)
@@ -293,6 +293,7 @@
 
     switch (encap) {
 	case NETTL_SUBSYS_LAN100 :
+	case NETTL_SUBSYS_EISA100BT :
 	case NETTL_SUBSYS_BASE100 :
 	case NETTL_SUBSYS_GSC100BT :
 	case NETTL_SUBSYS_PCI100BT :
@@ -303,7 +304,9 @@
 	case NETTL_SUBSYS_IGELAN :
 	case NETTL_SUBSYS_IETHER :
 	case NETTL_SUBSYS_HPPB_FDDI :
+	case NETTL_SUBSYS_EISA_FDDI :
         case NETTL_SUBSYS_PCI_FDDI :
+        case NETTL_SUBSYS_HSC_FDDI :
         case NETTL_SUBSYS_TOKEN :
         case NETTL_SUBSYS_PCI_TR :
 	case NETTL_SUBSYS_NS_LS_IP :
@@ -326,7 +329,9 @@
 	    } else if (encap == NETTL_SUBSYS_NS_LS_ICMPV6) {
 		phdr->pkt_encap = WTAP_ENCAP_RAW_ICMPV6;
 	    } else if( (encap == NETTL_SUBSYS_HPPB_FDDI)
-		    || (encap == NETTL_SUBSYS_PCI_FDDI) ) {
+		    || (encap == NETTL_SUBSYS_EISA_FDDI)
+		    || (encap == NETTL_SUBSYS_PCI_FDDI)
+		    || (encap == NETTL_SUBSYS_HSC_FDDI) ) {
 		phdr->pkt_encap = WTAP_ENCAP_FDDI;
 	    } else if( (encap == NETTL_SUBSYS_PCI_TR)
 		    || (encap == NETTL_SUBSYS_TOKEN) ) {
@@ -382,7 +387,7 @@
 		   length = pntohl(&ip_hdr.caplen);
 		   phdr->caplen = length;
                 } else {
-	           /* outbound has an extra padding */
+	           /* outbound appears to have variable padding */
 		   bytes_read = file_read(dummyc, 1, 9, fh);
 		   if (bytes_read != 9) {
 		       *err = file_error(fh);
@@ -416,8 +421,10 @@
 		   length = pntohl(&ip_hdr.caplen);
 		   phdr->caplen = length - padlen;
                }
-	    } else if (encap == NETTL_SUBSYS_PCI_FDDI) {
-	        /* PCI FDDI has an extra 3 bytes of padding */
+	    } else if ( (encap == NETTL_SUBSYS_PCI_FDDI)
+	             || (encap == NETTL_SUBSYS_EISA_FDDI)
+	             || (encap == NETTL_SUBSYS_HSC_FDDI) ) {
+	        /* other flavor FDDI cards have an extra 3 bytes of padding */
 		bytes_read = file_read(dummy, 1, 3, fh);
 		if (bytes_read != 3) {
 		    *err = file_error(fh);
@@ -584,22 +591,22 @@
     guint8 dummy[3];
 
     if (fddihack == TRUE) {
-       /* read in FC, dest, src and DSAP */
-       if (file_read(pd, 1, 14, fh) == 14) {
+       /* read in FC, dest, src, DSAP and SSAP */
+       if (file_read(pd, 1, 15, fh) == 15) {
           if (pd[13] == 0xAA) {
              /* it's SNAP, have to eat 3 bytes??? */
              if (file_read(dummy, 1, 3, fh) == 3) {
-                p=pd+14;
-                bytes_read = file_read(p, 1, length-17, fh);
-                bytes_read += 17;
+                p=pd+15;
+                bytes_read = file_read(p, 1, length-18, fh);
+                bytes_read += 18;
              } else {
                 bytes_read = -1;
              }
           } else {
              /* not SNAP */
              p=pd+14;
-             bytes_read = file_read(p, 1, length-14, fh);
-             bytes_read += 14;
+             bytes_read = file_read(p, 1, length-15, fh);
+             bytes_read += 15;
           }
        } else
           bytes_read = -1;
Index: nettl.h
===================================================================
--- nettl.h	(revision 12214)
+++ nettl.h	(working copy)
@@ -76,6 +76,7 @@
 
 /* Ethernet cards */
 #define NETTL_SUBSYS_LAN100		164
+#define NETTL_SUBSYS_EISA100BT		172
 #define NETTL_SUBSYS_BASE100		173
 #define NETTL_SUBSYS_GSC100BT		178
 #define NETTL_SUBSYS_PCI100BT		179
@@ -88,7 +89,9 @@
 
 /* FDDI cards */
 #define NETTL_SUBSYS_HPPB_FDDI		95
+#define NETTL_SUBSYS_EISA_FDDI		174
 #define NETTL_SUBSYS_PCI_FDDI		176
+#define NETTL_SUBSYS_HSC_FDDI		177
 
 /* Token Ring cards */
 #define NETTL_SUBSYS_TOKEN		31