aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2007-01-01 14:48:18 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2007-01-01 14:48:18 +0000
commit224a21ecfe5e0a1ede7d524e99b948012cf1802b (patch)
tree9068be73d4fb53fb45eae61c1f69c78c28f2c676 /wiretap
parent33310e87b662cec65ab8b3b90f174f251ccbfafa (diff)
From Mark C. Brown:
HP-UX 11.31 will add a new nettl trace subsystem, NS_LS_TELNET (ID=267). NS_LS_TELNET is just raw telnet data. There is no layer 2/3/4 headers, so there's just the HP-UX nettl record header followed directly by the TCP payload for a telnet connection. Thus the need for a new wiretap encapsulation type... svn path=/trunk/; revision=20253
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/nettl.c80
-rw-r--r--wiretap/nettl.h4
-rw-r--r--wiretap/wtap.c7
-rw-r--r--wiretap/wtap.h13
4 files changed, 58 insertions, 46 deletions
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 3e994caaa2..eca0c66a92 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -20,7 +20,7 @@
*
* 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -268,11 +268,14 @@ int nettl_open(wtap *wth, int *err, gchar **err_info _U_)
wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
break;
case NETTL_SUBSYS_NS_LS_ICMPV6 :
- wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
- break;
- default:
- /* If this assumption is bad, the read will catch it */
- wth->file_encap = WTAP_ENCAP_NETTL_ETHERNET;
+ wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
+ break;
+ case NETTL_SUBSYS_NS_LS_TELNET :
+ wth->file_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
+ break;
+ default:
+ /* If this assumption is bad, the read will catch it */
+ wth->file_encap = WTAP_ENCAP_NETTL_ETHERNET;
}
if (file_seek(wth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) {
@@ -433,22 +436,25 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
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( (subsys == NETTL_SUBSYS_NS_LS_IP)
- || (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK)
- || (subsys == NETTL_SUBSYS_NS_LS_UDP)
+ case NETTL_SUBSYS_NS_LS_IPV6 :
+ case NETTL_SUBSYS_NS_LS_ICMPV6 :
+ case NETTL_SUBSYS_NS_LS_ICMP :
+ case NETTL_SUBSYS_NS_LS_TELNET :
+ if( (subsys == NETTL_SUBSYS_NS_LS_IP)
+ || (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK)
+ || (subsys == NETTL_SUBSYS_NS_LS_UDP)
|| (subsys == NETTL_SUBSYS_NS_LS_TCP)
|| (subsys == NETTL_SUBSYS_NS_LS_IPV6)) {
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
} else if (subsys == NETTL_SUBSYS_NS_LS_ICMP) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
- } else if (subsys == NETTL_SUBSYS_NS_LS_ICMPV6) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
- } else if( (subsys == NETTL_SUBSYS_HPPB_FDDI)
- || (subsys == NETTL_SUBSYS_EISA_FDDI)
- || (subsys == NETTL_SUBSYS_PCI_FDDI)
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
+ } else if (subsys == NETTL_SUBSYS_NS_LS_ICMPV6) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
+ } else if (subsys == NETTL_SUBSYS_NS_LS_TELNET) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
+ } else if( (subsys == NETTL_SUBSYS_HPPB_FDDI)
+ || (subsys == NETTL_SUBSYS_EISA_FDDI)
+ || (subsys == NETTL_SUBSYS_PCI_FDDI)
|| (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
phdr->pkt_encap = WTAP_ENCAP_NETTL_FDDI;
} else if( (subsys == NETTL_SUBSYS_PCI_TR)
@@ -574,17 +580,17 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
}
if (length < padlen) {
- *err = WTAP_ERR_BAD_RECORD;
- *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u",
- length, padlen);
- return -1;
+ *err = WTAP_ERR_BAD_RECORD;
+ *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u",
+ length, padlen);
+ return -1;
}
phdr->len = length - padlen;
if (caplen < padlen) {
- *err = WTAP_ERR_BAD_RECORD;
- *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u",
- caplen, padlen);
- return -1;
+ *err = WTAP_ERR_BAD_RECORD;
+ *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u",
+ caplen, padlen);
+ return -1;
}
phdr->caplen = caplen - padlen;
phdr->ts.secs = pntohl(&rec_hdr.sec);
@@ -659,11 +665,12 @@ int nettl_dump_can_write_encap(int encap)
case WTAP_ENCAP_NETTL_ETHERNET:
case WTAP_ENCAP_NETTL_FDDI:
case WTAP_ENCAP_NETTL_TOKEN_RING:
- case WTAP_ENCAP_NETTL_RAW_IP:
- case WTAP_ENCAP_NETTL_RAW_ICMP:
- case WTAP_ENCAP_NETTL_RAW_ICMPV6:
+ case WTAP_ENCAP_NETTL_RAW_IP:
+ case WTAP_ENCAP_NETTL_RAW_ICMP:
+ case WTAP_ENCAP_NETTL_RAW_ICMPV6:
+ case WTAP_ENCAP_NETTL_RAW_TELNET:
/*
- case WTAP_ENCAP_NETTL_X25:
+ case WTAP_ENCAP_NETTL_X25:
*/
case WTAP_ENCAP_PER_PACKET:
case WTAP_ENCAP_UNKNOWN:
@@ -741,12 +748,13 @@ static gboolean nettl_dump(wtap_dumper *wdh,
/* fall through and fill the rest of the fields */
case WTAP_ENCAP_NETTL_ETHERNET:
case WTAP_ENCAP_NETTL_TOKEN_RING:
- case WTAP_ENCAP_NETTL_RAW_IP:
- case WTAP_ENCAP_NETTL_RAW_ICMP:
- case WTAP_ENCAP_NETTL_RAW_ICMPV6:
- case WTAP_ENCAP_NETTL_UNKNOWN:
- rec_hdr.subsys = g_htons(pseudo_header->nettl.subsys);
- rec_hdr.devid = g_htonl(pseudo_header->nettl.devid);
+ case WTAP_ENCAP_NETTL_RAW_IP:
+ case WTAP_ENCAP_NETTL_RAW_ICMP:
+ case WTAP_ENCAP_NETTL_RAW_ICMPV6:
+ case WTAP_ENCAP_NETTL_RAW_TELNET:
+ case WTAP_ENCAP_NETTL_UNKNOWN:
+ rec_hdr.subsys = g_htons(pseudo_header->nettl.subsys);
+ rec_hdr.devid = g_htonl(pseudo_header->nettl.devid);
rec_hdr.kind = g_htonl(pseudo_header->nettl.kind);
rec_hdr.pid = g_htonl(pseudo_header->nettl.pid);
rec_hdr.uid = g_htons(pseudo_header->nettl.uid);
diff --git a/wiretap/nettl.h b/wiretap/nettl.h
index b72b9b200e..b1701a9e5d 100644
--- a/wiretap/nettl.h
+++ b/wiretap/nettl.h
@@ -20,8 +20,7 @@
*
* 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.
- *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __NETTL_H__
@@ -76,6 +75,7 @@
#define NETTL_SUBSYS_HP_APALACP 190
#define NETTL_SUBSYS_NS_LS_IPV6 244
#define NETTL_SUBSYS_NS_LS_ICMPV6 245
+#define NETTL_SUBSYS_NS_LS_TELNET 267
/* Ethernet cards */
#define NETTL_SUBSYS_100VG 37
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 3aafb753a5..c0972ec1e6 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -17,7 +17,7 @@
*
* 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -369,6 +369,9 @@ static const struct encap_type_info {
/* WTAP_ENCAP_IEEE802_16_MAC_CPS */
{ "IEEE 802.16 MAC Common Part Sublayer", "ieee-802-16-mac-cps" },
+
+ /* WTAP_ENCAP_NETTL_RAW_TELNET */
+ { "Raw telnet with nettl headers", "raw-telnet-nettl" }
};
/* Name that should be somewhat descriptive. */
@@ -423,7 +426,7 @@ static const char *wtap_errlist[] = {
"Uncompression error: data oddly truncated",
"Uncompression error: data would overflow buffer",
"Uncompression error: bad LZ77 offset",
- "The standard input cannot be opened for random access",
+ "The standard input cannot be opened for random access"
};
#define WTAP_ERRLIST_SIZE (sizeof wtap_errlist / sizeof wtap_errlist[0])
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index adc58b5278..f439c5bff0 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -17,7 +17,7 @@
*
* 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __WTAP_H__
@@ -184,9 +184,10 @@
#define WTAP_ENCAP_JUNIPER_VP 91
#define WTAP_ENCAP_USB 92
#define WTAP_ENCAP_IEEE802_16_MAC_CPS 93
+#define WTAP_ENCAP_NETTL_RAW_TELNET 94
/* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES 94
+#define WTAP_NUM_ENCAP_TYPES 95
/* File types that can be read by wiretap.
We support writing some many of these file types, too, so we
@@ -475,9 +476,9 @@ struct nettl_phdr {
/* Packet "pseudo-header" for MTP2 files. */
struct mtp2_phdr {
- guint8 sent;
- guint8 annex_a_used;
- guint16 link_number;
+ guint8 sent;
+ guint8 annex_a_used;
+ guint16 link_number;
};
/* Packet "pseudo-header" for K12 files. */
@@ -486,7 +487,7 @@ typedef union {
struct {
guint16 vp;
guint16 vc;
- guint16 cid;
+ guint16 cid;
} atm;
guint32 ds0mask;