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

Ethereal-dev: [Ethereal-dev] nettl (HP-UX) fixes

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: Fri, 03 Sep 2004 14:49:17 -0400
Greetings,

Following fixes/changes for nettl (HP-UX):

1) Changed nettl subsystem ID's to decimal so as to
   match /etc/nettlgen.conf and ease maintenance

2) Added support for hp_apaport (PAgP), hp_apalacp,
   and IPv6 subsystem trace records

3) Corrected handling of LOOPBACK trace records


-- 
"If a train station is where a train stops, | Mark C. Brown
 then what's a workstation?" -- D. Huber    | mbrown@xxxxxxxxxx
Index: wiretap/nettl.c
===================================================================
--- wiretap/nettl.c	(revision 11879)
+++ wiretap/nettl.c	(working copy)
@@ -302,14 +302,19 @@
 	case NETTL_SUBSYS_NS_LS_LOOPBACK :
 	case NETTL_SUBSYS_NS_LS_TCP :
 	case NETTL_SUBSYS_NS_LS_UDP :
+	case NETTL_SUBSYS_HP_APAPORT :
+	case NETTL_SUBSYS_HP_APALACP :
+	case NETTL_SUBSYS_NS_LS_IPV6 :
+	case NETTL_SUBSYS_NS_LS_ICMPV6 :
 	case NETTL_SUBSYS_NS_LS_ICMP :
 	    if( (encap[3] == NETTL_SUBSYS_NS_LS_IP)
 	     || (encap[3] == NETTL_SUBSYS_NS_LS_LOOPBACK)
 	     || (encap[3] == NETTL_SUBSYS_NS_LS_UDP)
-	     || (encap[3] == NETTL_SUBSYS_NS_LS_TCP) ) {
+	     || (encap[3] == NETTL_SUBSYS_NS_LS_TCP)
+	     || (encap[3] == NETTL_SUBSYS_NS_LS_ICMP)
+	     || (encap[3] == NETTL_SUBSYS_NS_LS_IPV6)
+	     || (encap[3] == NETTL_SUBSYS_NS_LS_ICMPV6) ) {
 		phdr->pkt_encap = WTAP_ENCAP_RAW_IP;
-	    } else if (encap[3] == NETTL_SUBSYS_NS_LS_ICMP) {
-		phdr->pkt_encap = WTAP_ENCAP_UNKNOWN;
 	    } else if (encap[3] == NETTL_SUBSYS_PCI_FDDI) {
 		phdr->pkt_encap = WTAP_ENCAP_FDDI;
 	    } else if( (encap[3] == NETTL_SUBSYS_PCI_TR)
@@ -371,6 +376,26 @@
 		phdr->len = length - 3;
 		length = pntohl(&ip_hdr.caplen);
 		phdr->caplen = length - 3;
+	    } else if (encap[3] == NETTL_SUBSYS_NS_LS_LOOPBACK) {
+	        /* LOOPBACK has an extra 26 bytes of padding */
+		bytes_read = file_read(dummy, 1, 26, fh);
+		if (bytes_read != 26) {
+		    *err = file_error(fh);
+		    if (*err != 0)
+			return -1;
+		    if (bytes_read != 0) {
+			*err = WTAP_ERR_SHORT_READ;
+			return -1;
+		    }
+		    return 0;
+		}
+		offset += 26;
+		length = pntohl(&ip_hdr.length);
+		if (length <= 0)
+			return 0;
+		phdr->len = length - 26;
+		length = pntohl(&ip_hdr.caplen);
+		phdr->caplen = length - 26;
 	    } else {
 		length = pntohl(&ip_hdr.length);
 		if (length <= 0)
Index: wiretap/nettl.h
===================================================================
--- wiretap/nettl.h	(revision 11879)
+++ wiretap/nettl.h	(working copy)
@@ -24,68 +24,74 @@
 #ifndef __NETTL_H__
 #define __NETTL_H__
 
-#define NETTL_SUBSYS_NS_LS_LOGGING	0x00
-#define NETTL_SUBSYS_NS_LS_NFT		0x01
-#define NETTL_SUBSYS_NS_LS_LOOPBACK	0x02
-#define NETTL_SUBSYS_NS_LS_NI		0x03
-#define NETTL_SUBSYS_NS_LS_IPC		0x04
-#define NETTL_SUBSYS_NS_LS_SOCKREGD	0x05
-#define NETTL_SUBSYS_NS_LS_TCP		0x06
-#define NETTL_SUBSYS_NS_LS_PXP		0x07
-#define NETTL_SUBSYS_NS_LS_UDP		0x08
-#define NETTL_SUBSYS_NS_LS_IP		0x09
-#define NETTL_SUBSYS_NS_LS_PROBE	0x0A
-#define NETTL_SUBSYS_NS_LS_DRIVER	0x0B
-#define NETTL_SUBSYS_NS_LS_RLBD		0x0C
-#define NETTL_SUBSYS_NS_LS_BUFS		0x0D
-#define NETTL_SUBSYS_NS_LS_CASE21	0x0E
-#define NETTL_SUBSYS_NS_LS_ROUTER21	0x0F
-#define NETTL_SUBSYS_NS_LS_NFS		0x10
-#define NETTL_SUBSYS_NS_LS_NETISR	0x11
-#define NETTL_SUBSYS_NS_LS_NSE		0x13
-#define NETTL_SUBSYS_NS_LS_STRLOG	0x14
-#define NETTL_SUBSYS_NS_LS_TIRDWR	0x15
-#define NETTL_SUBSYS_NS_LS_TIMOD	0x16
-#define NETTL_SUBSYS_NS_LS_ICMP		0x17
-#define NETTL_SUBSYS_FILTER		0x1A
-#define NETTL_SUBSYS_NAME		0x1B
-#define NETTL_SUBSYS_IGMP		0x1D
-#define NETTL_SUBSYS_SX25L2		0x22
-#define NETTL_SUBSYS_SX25L3		0x23
-#define NETTL_SUBSYS_FTAM_INIT		0x40
-#define NETTL_SUBSYS_FTAM_RESP		0x41
-#define NETTL_SUBSYS_FTAM_VFS		0x46
-#define NETTL_SUBSYS_FTAM_USER		0x48
-#define NETTL_SUBSYS_OTS		0x5A
-#define NETTL_SUBSYS_NETWORK		0x5B
-#define NETTL_SUBSYS_TRANSPORT		0x5C
-#define NETTL_SUBSYS_SESSION		0x5D
-#define NETTL_SUBSYS_ACSE_PRES		0x5E
-#define NETTL_SUBSYS_SHM		0x74
-#define NETTL_SUBSYS_ACSE_US		0x77
-#define NETTL_SUBSYS_HPS		0x79
-#define NETTL_SUBSYS_CM			0x7A
-#define NETTL_SUBSYS_ULA_UTILS		0x7B
-#define NETTL_SUBSYS_EM			0x7C
+/* nettl subsystems are defined in /etc/nettlgen.conf */
 
+#define NETTL_SUBSYS_NS_LS_LOGGING	0
+#define NETTL_SUBSYS_NS_LS_NFT		1
+#define NETTL_SUBSYS_NS_LS_LOOPBACK	2
+#define NETTL_SUBSYS_NS_LS_NI		3
+#define NETTL_SUBSYS_NS_LS_IPC		4
+#define NETTL_SUBSYS_NS_LS_SOCKREGD	5
+#define NETTL_SUBSYS_NS_LS_TCP		6
+#define NETTL_SUBSYS_NS_LS_PXP		7
+#define NETTL_SUBSYS_NS_LS_UDP		8
+#define NETTL_SUBSYS_NS_LS_IP		9
+#define NETTL_SUBSYS_NS_LS_PROBE	10
+#define NETTL_SUBSYS_NS_LS_DRIVER	11
+#define NETTL_SUBSYS_NS_LS_RLBD		12
+#define NETTL_SUBSYS_NS_LS_BUFS		13
+#define NETTL_SUBSYS_NS_LS_CASE21	14
+#define NETTL_SUBSYS_NS_LS_ROUTER21	15
+#define NETTL_SUBSYS_NS_LS_NFS		16
+#define NETTL_SUBSYS_NS_LS_NETISR	17
+#define NETTL_SUBSYS_NS_LS_NSE		18
+#define NETTL_SUBSYS_NS_LS_STRLOG	19
+#define NETTL_SUBSYS_NS_LS_TIRDWR	21
+#define NETTL_SUBSYS_NS_LS_TIMOD	22
+#define NETTL_SUBSYS_NS_LS_ICMP		23
+#define NETTL_SUBSYS_FILTER		26
+#define NETTL_SUBSYS_NAME		27
+#define NETTL_SUBSYS_IGMP		29
+#define NETTL_SUBSYS_SX25L2		34
+#define NETTL_SUBSYS_SX25L3		35
+#define NETTL_SUBSYS_FTAM_INIT		64
+#define NETTL_SUBSYS_FTAM_RESP		65
+#define NETTL_SUBSYS_FTAM_VFS		70
+#define NETTL_SUBSYS_FTAM_USER		72
+#define NETTL_SUBSYS_OTS		90
+#define NETTL_SUBSYS_NETWORK		91
+#define NETTL_SUBSYS_TRANSPORT		92
+#define NETTL_SUBSYS_SESSION		93
+#define NETTL_SUBSYS_ACSE_PRES		94
+#define NETTL_SUBSYS_SHM		116
+#define NETTL_SUBSYS_ACSE_US		119
+#define NETTL_SUBSYS_HPS		121
+#define NETTL_SUBSYS_CM			122
+#define NETTL_SUBSYS_ULA_UTILS		123
+#define NETTL_SUBSYS_EM			124
+#define NETTL_SUBSYS_HP_APAPORT		189
+#define NETTL_SUBSYS_HP_APALACP		190
+#define NETTL_SUBSYS_NS_LS_IPV6		244
+#define NETTL_SUBSYS_NS_LS_ICMPV6	245
+
 /* Ethernet cards */
-#define NETTL_SUBSYS_LAN100		0xA4
-#define NETTL_SUBSYS_BASE100		0xAD
-#define NETTL_SUBSYS_GSC100BT		0xB2
-#define NETTL_SUBSYS_PCI100BT		0xB3
-#define NETTL_SUBSYS_SPP100BT		0xB4
-#define NETTL_SUBSYS_GELAN		0xB9
-#define NETTL_SUBSYS_BTLAN		0xD2
-#define NETTL_SUBSYS_INTL100		0xE9
-#define NETTL_SUBSYS_IGELAN		0xFC
-#define NETTL_SUBSYS_IETHER		0xFD
+#define NETTL_SUBSYS_LAN100		164
+#define NETTL_SUBSYS_BASE100		173
+#define NETTL_SUBSYS_GSC100BT		178
+#define NETTL_SUBSYS_PCI100BT		179
+#define NETTL_SUBSYS_SPP100BT		180
+#define NETTL_SUBSYS_GELAN		185
+#define NETTL_SUBSYS_BTLAN		210
+#define NETTL_SUBSYS_INTL100		233
+#define NETTL_SUBSYS_IGELAN		252
+#define NETTL_SUBSYS_IETHER		253
 
 /* FDDI cards */
-#define NETTL_SUBSYS_PCI_FDDI		0xB0
+#define NETTL_SUBSYS_PCI_FDDI		176
 
 /* Token Ring cards */
-#define NETTL_SUBSYS_TOKEN		0x1F
-#define NETTL_SUBSYS_PCI_TR		0xBB
+#define NETTL_SUBSYS_TOKEN		31
+#define NETTL_SUBSYS_PCI_TR		187
 
 int nettl_open(wtap *wth, int *err, gchar **err_info);