diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2007-01-01 14:48:18 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2007-01-01 14:48:18 +0000 |
commit | 224a21ecfe5e0a1ede7d524e99b948012cf1802b (patch) | |
tree | 9068be73d4fb53fb45eae61c1f69c78c28f2c676 /wiretap/nettl.c | |
parent | 33310e87b662cec65ab8b3b90f174f251ccbfafa (diff) | |
download | wireshark-224a21ecfe5e0a1ede7d524e99b948012cf1802b.tar.gz |
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/nettl.c')
-rw-r--r-- | wiretap/nettl.c | 80 |
1 files changed, 44 insertions, 36 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); |