Whitespace cleanups.
Change-Id: I92f983b2e04defab30eb31c14c484b9f0f582413 Reviewed-on: https://code.wireshark.org/review/4513 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
683d657d49
commit
ffd48cefa6
|
@ -37,7 +37,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_IO_H
|
#ifdef HAVE_IO_H
|
||||||
#include <io.h> /* for isatty() on win32 */
|
#include <io.h> /* for isatty() on win32 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wtap-int.h"
|
#include "wtap-int.h"
|
||||||
|
|
|
@ -48,7 +48,7 @@ typedef struct commview_header {
|
||||||
guint8 version;
|
guint8 version;
|
||||||
guint16 year;
|
guint16 year;
|
||||||
guint8 month;
|
guint8 month;
|
||||||
guint8 day;
|
guint8 day;
|
||||||
guint8 hours;
|
guint8 hours;
|
||||||
guint8 minutes;
|
guint8 minutes;
|
||||||
guint8 seconds;
|
guint8 seconds;
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
#define COSINE_REC_MAGIC_STR2 COSINE_HDR_MAGIC_STR2
|
#define COSINE_REC_MAGIC_STR2 COSINE_HDR_MAGIC_STR2
|
||||||
|
|
||||||
#define COSINE_HEADER_LINES_TO_CHECK 200
|
#define COSINE_HEADER_LINES_TO_CHECK 200
|
||||||
#define COSINE_LINE_LENGTH 240
|
#define COSINE_LINE_LENGTH 240
|
||||||
|
|
||||||
#define COSINE_MAX_PACKET_LEN 65536
|
#define COSINE_MAX_PACKET_LEN 65536
|
||||||
|
|
||||||
|
|
|
@ -501,7 +501,7 @@ parse_dbs_etherwatch_packet(struct wtap_pkthdr *phdr, FILE_T fh, Buffer* buf,
|
||||||
#define TYPE_CHECK_BOTH '[' /* Value at pos. that indicates BOTH type */
|
#define TYPE_CHECK_BOTH '[' /* Value at pos. that indicates BOTH type */
|
||||||
#define COUNT_POS_BOTH 21 /* Count position BOTH type */
|
#define COUNT_POS_BOTH 21 /* Count position BOTH type */
|
||||||
#define COUNT_POS_HEX 1 /* Count position HEX type */
|
#define COUNT_POS_HEX 1 /* Count position HEX type */
|
||||||
#define COUNT_SIZE 5 /* Length counter */
|
#define COUNT_SIZE 5 /* Length counter */
|
||||||
#define HEX_DUMP_START '[' /* Start char */
|
#define HEX_DUMP_START '[' /* Start char */
|
||||||
#define HEX_DUMP_SPR ' ' /* Seperator char */
|
#define HEX_DUMP_SPR ' ' /* Seperator char */
|
||||||
#define HEX_DUMP_END ']' /* End char */
|
#define HEX_DUMP_END ']' /* End char */
|
||||||
|
|
|
@ -121,7 +121,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
|
||||||
|
|
||||||
if (!wtap_read_bytes_or_eof(wth->fh,&header,sizeof(header),err,err_info)) {
|
if (!wtap_read_bytes_or_eof(wth->fh,&header,sizeof(header),err,err_info)) {
|
||||||
if (*err == 0) {
|
if (*err == 0) {
|
||||||
/* EOF - all records have been successfully checked */
|
/* EOF - all records have been successfully checked */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (*err == WTAP_ERR_SHORT_READ) {
|
if (*err == WTAP_ERR_SHORT_READ) {
|
||||||
|
@ -254,7 +254,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
if (*err != WTAP_ERR_SHORT_READ) {
|
if (*err != WTAP_ERR_SHORT_READ) {
|
||||||
/* A real error */
|
/* A real error */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* ERF record too short, accept the file,
|
/* ERF record too short, accept the file,
|
||||||
|
|
|
@ -46,10 +46,10 @@ typedef struct {
|
||||||
gint32 unit; /* controller unit number */
|
gint32 unit; /* controller unit number */
|
||||||
gint32 type; /* type of channel */
|
gint32 type; /* type of channel */
|
||||||
#define TRC_CH_I 0 /* Layer 1 INFO's */
|
#define TRC_CH_I 0 /* Layer 1 INFO's */
|
||||||
#define TRC_CH_D 1 /* D channel */
|
#define TRC_CH_D 1 /* D channel */
|
||||||
#define TRC_CH_B1 2 /* B1 channel */
|
#define TRC_CH_B1 2 /* B1 channel */
|
||||||
#define TRC_CH_B2 3 /* B2 channel */
|
#define TRC_CH_B2 3 /* B2 channel */
|
||||||
gint32 dir; /* direction */
|
gint32 dir; /* direction */
|
||||||
#define FROM_TE 0 /* user -> network */
|
#define FROM_TE 0 /* user -> network */
|
||||||
#define FROM_NT 1 /* network -> user */
|
#define FROM_NT 1 /* network -> user */
|
||||||
gint32 trunc; /* # of truncated bytes (frame > MCLBYTES) */
|
gint32 trunc; /* # of truncated bytes (frame > MCLBYTES) */
|
||||||
|
@ -67,14 +67,14 @@ typedef struct {
|
||||||
#define INFO4_10 6
|
#define INFO4_10 6
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
* ioctl via /dev/i4btrc device(s):
|
* ioctl via /dev/i4btrc device(s):
|
||||||
* get/set current trace flag settings
|
* get/set current trace flag settings
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define I4B_TRC_GET _IOR('T', 0, int) /* get trace settings */
|
#define I4B_TRC_GET _IOR('T', 0, int) /* get trace settings */
|
||||||
#define I4B_TRC_SET _IOW('T', 1, int) /* set trace settings */
|
#define I4B_TRC_SET _IOW('T', 1, int) /* set trace settings */
|
||||||
|
|
||||||
#define TRACE_OFF 0x00 /* tracing off */
|
#define TRACE_OFF 0x00 /* tracing off */
|
||||||
#define TRACE_I 0x01 /* trace L1 INFO's on */
|
#define TRACE_I 0x01 /* trace L1 INFO's on */
|
||||||
#define TRACE_D_TX 0x02 /* trace D channel on */
|
#define TRACE_D_TX 0x02 /* trace D channel on */
|
||||||
#define TRACE_D_RX 0x04 /* trace D channel on */
|
#define TRACE_D_RX 0x04 /* trace D channel on */
|
||||||
|
|
|
@ -520,7 +520,7 @@ static gint get_record(k12_t *file_data, FILE_T fh, gint64 file_offset,
|
||||||
* looping.
|
* looping.
|
||||||
*/
|
*/
|
||||||
while (left > buffer_len) {
|
while (left > buffer_len) {
|
||||||
buffer = (guint8*)g_realloc(buffer,buffer_len*=2);
|
buffer = (guint8*)g_realloc(buffer,buffer_len*=2);
|
||||||
if (is_random) {
|
if (is_random) {
|
||||||
file_data->rand_read_buff = buffer;
|
file_data->rand_read_buff = buffer;
|
||||||
file_data->rand_read_buff_len = buffer_len;
|
file_data->rand_read_buff_len = buffer_len;
|
||||||
|
@ -990,7 +990,7 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Record viewer generated files don't have this information */
|
/* Record viewer generated files don't have this information */
|
||||||
if (rec_len < K12_SRCDESC_PORT_TYPE + 1) {
|
if (rec_len < K12_SRCDESC_PORT_TYPE + 1) {
|
||||||
/* Record isn't long enough to have a source descriptor extra type field */
|
/* Record isn't long enough to have a source descriptor extra type field */
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
|
@ -1011,9 +1011,9 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
|
||||||
/* XXX - this is assumed, in a number of places (not just in the
|
/* XXX - this is assumed, in a number of places (not just in the
|
||||||
ascii_strdown_inplace() call below) to be null-terminated;
|
ascii_strdown_inplace() call below) to be null-terminated;
|
||||||
is that guaranteed (even with a corrupt file)?
|
is that guaranteed (even with a corrupt file)?
|
||||||
Obviously not, as a corrupt file could contain anything
|
Obviously not, as a corrupt file could contain anything
|
||||||
here; the Tektronix document says the strings "must end
|
here; the Tektronix document says the strings "must end
|
||||||
with \0", but a bad file could fail to add the \0. */
|
with \0", but a bad file could fail to add the \0. */
|
||||||
if (rec_len < K12_SRCDESC_EXTRATYPE + extra_len + name_len + stack_len) {
|
if (rec_len < K12_SRCDESC_EXTRATYPE + extra_len + name_len + stack_len) {
|
||||||
/* Record isn't long enough to have a source descriptor extra type field */
|
/* Record isn't long enough to have a source descriptor extra type field */
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
|
|
|
@ -64,12 +64,12 @@ static gint detect_version(FILE_T fh, int *err, gchar **err_info)
|
||||||
|
|
||||||
/* 16-bit payload length */
|
/* 16-bit payload length */
|
||||||
if (!wtap_read_bytes_or_eof(fh, &tmp, 2, err, err_info)) {
|
if (!wtap_read_bytes_or_eof(fh, &tmp, 2, err, err_info)) {
|
||||||
if (*err == 0) {
|
if (*err == 0) {
|
||||||
/*
|
/*
|
||||||
* Got an EOF at the beginning.
|
* Got an EOF at the beginning.
|
||||||
*/
|
*/
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
if (*err == WTAP_ERR_SHORT_READ) {
|
if (*err == WTAP_ERR_SHORT_READ) {
|
||||||
/*
|
/*
|
||||||
* Not enough bytes for a packet, so not a logcat file.
|
* Not enough bytes for a packet, so not a logcat file.
|
||||||
|
@ -119,7 +119,7 @@ static gint detect_version(FILE_T fh, int *err, gchar **err_info)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wtap_read_bytes(fh, buffer + read_sofar, entry_len - read_sofar, err, err_info)) {
|
if (!wtap_read_bytes(fh, buffer + read_sofar, entry_len - read_sofar, err, err_info)) {
|
||||||
g_free(buffer);
|
g_free(buffer);
|
||||||
if (*err == WTAP_ERR_SHORT_READ) {
|
if (*err == WTAP_ERR_SHORT_READ) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1351,7 +1351,7 @@ static gboolean nstrace_seek_read_v10(wtap *wth, gint64 seek_off,
|
||||||
** Read the record header.
|
** Read the record header.
|
||||||
*/
|
*/
|
||||||
if (!wtap_read_bytes(wth->random_fh, (void *)&hdr, sizeof hdr,
|
if (!wtap_read_bytes(wth->random_fh, (void *)&hdr, sizeof hdr,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1366,9 +1366,9 @@ static gboolean nstrace_seek_read_v10(wtap *wth, gint64 seek_off,
|
||||||
pd = ws_buffer_start_ptr(buf);
|
pd = ws_buffer_start_ptr(buf);
|
||||||
memcpy(pd, (void *)&hdr, sizeof hdr);
|
memcpy(pd, (void *)&hdr, sizeof hdr);
|
||||||
if (record_length > sizeof hdr) {
|
if (record_length > sizeof hdr) {
|
||||||
bytes_to_read = (unsigned int)(record_length - sizeof hdr);
|
bytes_to_read = (unsigned int)(record_length - sizeof hdr);
|
||||||
if (!wtap_read_bytes(wth->random_fh, pd + sizeof hdr, bytes_to_read,
|
if (!wtap_read_bytes(wth->random_fh, pd + sizeof hdr, bytes_to_read,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1440,7 +1440,7 @@ static gboolean nstrace_seek_read_v20(wtap *wth, gint64 seek_off,
|
||||||
*/
|
*/
|
||||||
if (hdr.phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES) {
|
if (hdr.phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES) {
|
||||||
if (!wtap_read_bytes(wth->random_fh, (void *)&hdr.phd_RecordSizeHigh, 1,
|
if (!wtap_read_bytes(wth->random_fh, (void *)&hdr.phd_RecordSizeHigh, 1,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
hdrlen = 3;
|
hdrlen = 3;
|
||||||
}
|
}
|
||||||
|
@ -1457,9 +1457,9 @@ static gboolean nstrace_seek_read_v20(wtap *wth, gint64 seek_off,
|
||||||
pd = ws_buffer_start_ptr(buf);
|
pd = ws_buffer_start_ptr(buf);
|
||||||
memcpy(pd, (void *)&hdr, hdrlen);
|
memcpy(pd, (void *)&hdr, hdrlen);
|
||||||
if (record_length > hdrlen) {
|
if (record_length > hdrlen) {
|
||||||
bytes_to_read = (unsigned int)(record_length - hdrlen);
|
bytes_to_read = (unsigned int)(record_length - hdrlen);
|
||||||
if (!wtap_read_bytes(wth->random_fh, pd + hdrlen, bytes_to_read,
|
if (!wtap_read_bytes(wth->random_fh, pd + hdrlen, bytes_to_read,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1540,8 +1540,8 @@ static gboolean nstrace_seek_read_v30(wtap *wth, gint64 seek_off,
|
||||||
** Is there a third byte? If so, read it.
|
** Is there a third byte? If so, read it.
|
||||||
*/
|
*/
|
||||||
if (hdr.phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES) {
|
if (hdr.phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES) {
|
||||||
if (!wtap_read_bytes(wth->random_fh, (void *)&hdr.phd_RecordSizeHigh, 1,
|
if (!wtap_read_bytes(wth->random_fh, (void *)&hdr.phd_RecordSizeHigh, 1,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
hdrlen = 3;
|
hdrlen = 3;
|
||||||
}
|
}
|
||||||
|
@ -1560,7 +1560,7 @@ static gboolean nstrace_seek_read_v30(wtap *wth, gint64 seek_off,
|
||||||
if (record_length > hdrlen) {
|
if (record_length > hdrlen) {
|
||||||
bytes_to_read = (unsigned int)(record_length - hdrlen);
|
bytes_to_read = (unsigned int)(record_length - hdrlen);
|
||||||
if (!wtap_read_bytes(wth->random_fh, pd + hdrlen, bytes_to_read,
|
if (!wtap_read_bytes(wth->random_fh, pd + hdrlen, bytes_to_read,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#define NETSCREEN_REC_MAGIC_STR1 NETSCREEN_HDR_MAGIC_STR1
|
#define NETSCREEN_REC_MAGIC_STR1 NETSCREEN_HDR_MAGIC_STR1
|
||||||
#define NETSCREEN_REC_MAGIC_STR2 NETSCREEN_HDR_MAGIC_STR2
|
#define NETSCREEN_REC_MAGIC_STR2 NETSCREEN_HDR_MAGIC_STR2
|
||||||
|
|
||||||
#define NETSCREEN_LINE_LENGTH 128
|
#define NETSCREEN_LINE_LENGTH 128
|
||||||
#define NETSCREEN_HEADER_LINES_TO_CHECK 32
|
#define NETSCREEN_HEADER_LINES_TO_CHECK 32
|
||||||
#define NETSCREEN_MAX_INFOLINES 8
|
#define NETSCREEN_MAX_INFOLINES 8
|
||||||
#define NETSCREEN_SPACES_ON_INFO_LINE 14
|
#define NETSCREEN_SPACES_ON_INFO_LINE 14
|
||||||
|
|
638
wiretap/nettl.c
638
wiretap/nettl.c
|
@ -239,35 +239,35 @@ int nettl_open(wtap *wth, int *err, gchar **err_info)
|
||||||
case NETTL_SUBSYS_EISA_FDDI :
|
case NETTL_SUBSYS_EISA_FDDI :
|
||||||
case NETTL_SUBSYS_PCI_FDDI :
|
case NETTL_SUBSYS_PCI_FDDI :
|
||||||
case NETTL_SUBSYS_HSC_FDDI :
|
case NETTL_SUBSYS_HSC_FDDI :
|
||||||
wth->file_encap = WTAP_ENCAP_NETTL_FDDI;
|
wth->file_encap = WTAP_ENCAP_NETTL_FDDI;
|
||||||
break;
|
break;
|
||||||
case NETTL_SUBSYS_TOKEN :
|
case NETTL_SUBSYS_TOKEN :
|
||||||
case NETTL_SUBSYS_PCI_TR :
|
case NETTL_SUBSYS_PCI_TR :
|
||||||
wth->file_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
|
wth->file_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
|
||||||
break;
|
break;
|
||||||
case NETTL_SUBSYS_NS_LS_IP :
|
case NETTL_SUBSYS_NS_LS_IP :
|
||||||
case NETTL_SUBSYS_NS_LS_LOOPBACK :
|
case NETTL_SUBSYS_NS_LS_LOOPBACK :
|
||||||
case NETTL_SUBSYS_NS_LS_TCP :
|
case NETTL_SUBSYS_NS_LS_TCP :
|
||||||
case NETTL_SUBSYS_NS_LS_UDP :
|
case NETTL_SUBSYS_NS_LS_UDP :
|
||||||
case NETTL_SUBSYS_NS_LS_IPV6 :
|
case NETTL_SUBSYS_NS_LS_IPV6 :
|
||||||
wth->file_encap = WTAP_ENCAP_NETTL_RAW_IP;
|
wth->file_encap = WTAP_ENCAP_NETTL_RAW_IP;
|
||||||
break;
|
break;
|
||||||
case NETTL_SUBSYS_NS_LS_ICMP :
|
case NETTL_SUBSYS_NS_LS_ICMP :
|
||||||
wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
|
wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
|
||||||
break;
|
break;
|
||||||
case NETTL_SUBSYS_NS_LS_ICMPV6 :
|
case NETTL_SUBSYS_NS_LS_ICMPV6 :
|
||||||
wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
|
wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
|
||||||
break;
|
break;
|
||||||
case NETTL_SUBSYS_NS_LS_TELNET :
|
case NETTL_SUBSYS_NS_LS_TELNET :
|
||||||
wth->file_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
|
wth->file_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* If this assumption is bad, the read will catch it */
|
/* If this assumption is bad, the read will catch it */
|
||||||
wth->file_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
wth->file_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_seek(wth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) {
|
if (file_seek(wth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
wth->file_tsprec = WTAP_TSPREC_USEC;
|
wth->file_tsprec = WTAP_TSPREC_USEC;
|
||||||
|
|
||||||
|
@ -282,8 +282,8 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
|
||||||
*data_offset = file_tell(wth->fh);
|
*data_offset = file_tell(wth->fh);
|
||||||
if (!nettl_read_rec(wth, wth->fh, &wth->phdr, wth->frame_buffer,
|
if (!nettl_read_rec(wth, wth->fh, &wth->phdr, wth->frame_buffer,
|
||||||
err, err_info)) {
|
err, err_info)) {
|
||||||
/* Read error or EOF */
|
/* Read error or EOF */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -295,10 +295,10 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
|
||||||
* have a single encapsulation for all packets in the file.
|
* have a single encapsulation for all packets in the file.
|
||||||
*/
|
*/
|
||||||
if (wth->file_encap == WTAP_ENCAP_UNKNOWN)
|
if (wth->file_encap == WTAP_ENCAP_UNKNOWN)
|
||||||
wth->file_encap = wth->phdr.pkt_encap;
|
wth->file_encap = wth->phdr.pkt_encap;
|
||||||
else {
|
else {
|
||||||
if (wth->file_encap != wth->phdr.pkt_encap)
|
if (wth->file_encap != wth->phdr.pkt_encap)
|
||||||
wth->file_encap = WTAP_ENCAP_PER_PACKET;
|
wth->file_encap = WTAP_ENCAP_PER_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -306,26 +306,26 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
nettl_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
|
nettl_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
|
||||||
Buffer *buf, int *err, gchar **err_info)
|
Buffer *buf, int *err, gchar **err_info)
|
||||||
{
|
{
|
||||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Read record. */
|
/* Read record. */
|
||||||
if (!nettl_read_rec(wth, wth->random_fh, phdr, buf, err, err_info)) {
|
if (!nettl_read_rec(wth, wth->random_fh, phdr, buf, err, err_info)) {
|
||||||
/* Read error or EOF */
|
/* Read error or EOF */
|
||||||
if (*err == 0) {
|
if (*err == 0) {
|
||||||
/* EOF means "short read" in random-access mode */
|
/* EOF means "short read" in random-access mode */
|
||||||
*err = WTAP_ERR_SHORT_READ;
|
*err = WTAP_ERR_SHORT_READ;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
int *err, gchar **err_info)
|
int *err, gchar **err_info)
|
||||||
{
|
{
|
||||||
union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||||
nettl_t *nettl = (nettl_t *)wth->priv;
|
nettl_t *nettl = (nettl_t *)wth->priv;
|
||||||
|
@ -344,21 +344,21 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
errno = WTAP_ERR_CANT_READ;
|
errno = WTAP_ERR_CANT_READ;
|
||||||
if (!wtap_read_bytes_or_eof(fh, &rec_hdr.hdr_len, sizeof rec_hdr.hdr_len,
|
if (!wtap_read_bytes_or_eof(fh, &rec_hdr.hdr_len, sizeof rec_hdr.hdr_len,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
hdr_len = g_ntohs(rec_hdr.hdr_len);
|
hdr_len = g_ntohs(rec_hdr.hdr_len);
|
||||||
if (hdr_len < NETTL_REC_HDR_LEN) {
|
if (hdr_len < NETTL_REC_HDR_LEN) {
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup_printf("nettl: record header length %u too short",
|
*err_info = g_strdup_printf("nettl: record header length %u too short",
|
||||||
hdr_len);
|
hdr_len);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!wtap_read_bytes(fh, &rec_hdr.subsys, NETTL_REC_HDR_LEN - 2,
|
if (!wtap_read_bytes(fh, &rec_hdr.subsys, NETTL_REC_HDR_LEN - 2,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
subsys = g_ntohs(rec_hdr.subsys);
|
subsys = g_ntohs(rec_hdr.subsys);
|
||||||
hdr_len -= NETTL_REC_HDR_LEN;
|
hdr_len -= NETTL_REC_HDR_LEN;
|
||||||
if (file_seek(fh, hdr_len, SEEK_CUR, err) == -1)
|
if (file_seek(fh, hdr_len, SEEK_CUR, err) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ( (pntoh32(&rec_hdr.kind) & NETTL_HDR_PDU_MASK) == 0 ) {
|
if ( (pntoh32(&rec_hdr.kind) & NETTL_HDR_PDU_MASK) == 0 ) {
|
||||||
/* not actually a data packet (PDU) trace record */
|
/* not actually a data packet (PDU) trace record */
|
||||||
|
@ -367,72 +367,72 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
caplen = pntoh32(&rec_hdr.caplen);
|
caplen = pntoh32(&rec_hdr.caplen);
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
} else switch (subsys) {
|
} else switch (subsys) {
|
||||||
case NETTL_SUBSYS_LAN100 :
|
case NETTL_SUBSYS_LAN100 :
|
||||||
case NETTL_SUBSYS_EISA100BT :
|
case NETTL_SUBSYS_EISA100BT :
|
||||||
case NETTL_SUBSYS_BASE100 :
|
case NETTL_SUBSYS_BASE100 :
|
||||||
case NETTL_SUBSYS_GSC100BT :
|
case NETTL_SUBSYS_GSC100BT :
|
||||||
case NETTL_SUBSYS_PCI100BT :
|
case NETTL_SUBSYS_PCI100BT :
|
||||||
case NETTL_SUBSYS_SPP100BT :
|
case NETTL_SUBSYS_SPP100BT :
|
||||||
case NETTL_SUBSYS_100VG :
|
case NETTL_SUBSYS_100VG :
|
||||||
case NETTL_SUBSYS_GELAN :
|
case NETTL_SUBSYS_GELAN :
|
||||||
case NETTL_SUBSYS_BTLAN :
|
case NETTL_SUBSYS_BTLAN :
|
||||||
case NETTL_SUBSYS_INTL100 :
|
case NETTL_SUBSYS_INTL100 :
|
||||||
case NETTL_SUBSYS_IGELAN :
|
case NETTL_SUBSYS_IGELAN :
|
||||||
case NETTL_SUBSYS_IETHER :
|
case NETTL_SUBSYS_IETHER :
|
||||||
case NETTL_SUBSYS_IXGBE :
|
case NETTL_SUBSYS_IXGBE :
|
||||||
case NETTL_SUBSYS_HSSN :
|
case NETTL_SUBSYS_HSSN :
|
||||||
case NETTL_SUBSYS_IGSSN :
|
case NETTL_SUBSYS_IGSSN :
|
||||||
case NETTL_SUBSYS_ICXGBE :
|
case NETTL_SUBSYS_ICXGBE :
|
||||||
case NETTL_SUBSYS_IEXGBE :
|
case NETTL_SUBSYS_IEXGBE :
|
||||||
case NETTL_SUBSYS_IOCXGBE :
|
case NETTL_SUBSYS_IOCXGBE :
|
||||||
case NETTL_SUBSYS_IQXGBE :
|
case NETTL_SUBSYS_IQXGBE :
|
||||||
case NETTL_SUBSYS_HPPB_FDDI :
|
case NETTL_SUBSYS_HPPB_FDDI :
|
||||||
case NETTL_SUBSYS_EISA_FDDI :
|
case NETTL_SUBSYS_EISA_FDDI :
|
||||||
case NETTL_SUBSYS_PCI_FDDI :
|
case NETTL_SUBSYS_PCI_FDDI :
|
||||||
case NETTL_SUBSYS_HSC_FDDI :
|
case NETTL_SUBSYS_HSC_FDDI :
|
||||||
case NETTL_SUBSYS_TOKEN :
|
case NETTL_SUBSYS_TOKEN :
|
||||||
case NETTL_SUBSYS_PCI_TR :
|
case NETTL_SUBSYS_PCI_TR :
|
||||||
case NETTL_SUBSYS_NS_LS_IP :
|
case NETTL_SUBSYS_NS_LS_IP :
|
||||||
case NETTL_SUBSYS_NS_LS_LOOPBACK :
|
case NETTL_SUBSYS_NS_LS_LOOPBACK :
|
||||||
case NETTL_SUBSYS_NS_LS_TCP :
|
case NETTL_SUBSYS_NS_LS_TCP :
|
||||||
case NETTL_SUBSYS_NS_LS_UDP :
|
case NETTL_SUBSYS_NS_LS_UDP :
|
||||||
case NETTL_SUBSYS_HP_APAPORT :
|
case NETTL_SUBSYS_HP_APAPORT :
|
||||||
case NETTL_SUBSYS_HP_APALACP :
|
case NETTL_SUBSYS_HP_APALACP :
|
||||||
case NETTL_SUBSYS_NS_LS_IPV6 :
|
case NETTL_SUBSYS_NS_LS_IPV6 :
|
||||||
case NETTL_SUBSYS_NS_LS_ICMPV6 :
|
case NETTL_SUBSYS_NS_LS_ICMPV6 :
|
||||||
case NETTL_SUBSYS_NS_LS_ICMP :
|
case NETTL_SUBSYS_NS_LS_ICMP :
|
||||||
case NETTL_SUBSYS_NS_LS_TELNET :
|
case NETTL_SUBSYS_NS_LS_TELNET :
|
||||||
case NETTL_SUBSYS_NS_LS_SCTP :
|
case NETTL_SUBSYS_NS_LS_SCTP :
|
||||||
if( (subsys == NETTL_SUBSYS_NS_LS_IP)
|
if( (subsys == NETTL_SUBSYS_NS_LS_IP)
|
||||||
|| (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK)
|
|| (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK)
|
||||||
|| (subsys == NETTL_SUBSYS_NS_LS_UDP)
|
|| (subsys == NETTL_SUBSYS_NS_LS_UDP)
|
||||||
|| (subsys == NETTL_SUBSYS_NS_LS_TCP)
|
|| (subsys == NETTL_SUBSYS_NS_LS_TCP)
|
||||||
|| (subsys == NETTL_SUBSYS_NS_LS_SCTP)
|
|| (subsys == NETTL_SUBSYS_NS_LS_SCTP)
|
||||||
|| (subsys == NETTL_SUBSYS_NS_LS_IPV6)) {
|
|| (subsys == NETTL_SUBSYS_NS_LS_IPV6)) {
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
|
||||||
} else if (subsys == NETTL_SUBSYS_NS_LS_ICMP) {
|
} else if (subsys == NETTL_SUBSYS_NS_LS_ICMP) {
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
|
||||||
} else if (subsys == NETTL_SUBSYS_NS_LS_ICMPV6) {
|
} else if (subsys == NETTL_SUBSYS_NS_LS_ICMPV6) {
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
|
||||||
} else if (subsys == NETTL_SUBSYS_NS_LS_TELNET) {
|
} else if (subsys == NETTL_SUBSYS_NS_LS_TELNET) {
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
|
||||||
} else if( (subsys == NETTL_SUBSYS_HPPB_FDDI)
|
} else if( (subsys == NETTL_SUBSYS_HPPB_FDDI)
|
||||||
|| (subsys == NETTL_SUBSYS_EISA_FDDI)
|
|| (subsys == NETTL_SUBSYS_EISA_FDDI)
|
||||||
|| (subsys == NETTL_SUBSYS_PCI_FDDI)
|
|| (subsys == NETTL_SUBSYS_PCI_FDDI)
|
||||||
|| (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
|
|| (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_FDDI;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_FDDI;
|
||||||
} else if( (subsys == NETTL_SUBSYS_PCI_TR)
|
} else if( (subsys == NETTL_SUBSYS_PCI_TR)
|
||||||
|| (subsys == NETTL_SUBSYS_TOKEN) ) {
|
|| (subsys == NETTL_SUBSYS_TOKEN) ) {
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
|
||||||
} else {
|
} else {
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = pntoh32(&rec_hdr.length);
|
length = pntoh32(&rec_hdr.length);
|
||||||
caplen = pntoh32(&rec_hdr.caplen);
|
caplen = pntoh32(&rec_hdr.caplen);
|
||||||
|
|
||||||
/* HPPB FDDI has different inbound vs outbound trace records */
|
/* HPPB FDDI has different inbound vs outbound trace records */
|
||||||
if (subsys == NETTL_SUBSYS_HPPB_FDDI) {
|
if (subsys == NETTL_SUBSYS_HPPB_FDDI) {
|
||||||
if (pntoh32(&rec_hdr.kind) == NETTL_HDR_PDUIN) {
|
if (pntoh32(&rec_hdr.kind) == NETTL_HDR_PDUIN) {
|
||||||
/* inbound is very strange...
|
/* inbound is very strange...
|
||||||
there are an extra 3 bytes after the DSAP and SSAP
|
there are an extra 3 bytes after the DSAP and SSAP
|
||||||
|
@ -441,24 +441,24 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
fddihack=TRUE;
|
fddihack=TRUE;
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
} else {
|
} else {
|
||||||
/* outbound appears to have variable padding */
|
/* outbound appears to have variable padding */
|
||||||
if (!wtap_read_bytes(fh, dummyc, 9, err, err_info))
|
if (!wtap_read_bytes(fh, dummyc, 9, err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* padding is usually either a total 11 or 16 bytes??? */
|
/* padding is usually either a total 11 or 16 bytes??? */
|
||||||
padlen = (int)dummyc[8];
|
padlen = (int)dummyc[8];
|
||||||
if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
|
if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
padlen += 9;
|
padlen += 9;
|
||||||
}
|
}
|
||||||
} else if ( (subsys == NETTL_SUBSYS_PCI_FDDI)
|
} else if ( (subsys == NETTL_SUBSYS_PCI_FDDI)
|
||||||
|| (subsys == NETTL_SUBSYS_EISA_FDDI)
|
|| (subsys == NETTL_SUBSYS_EISA_FDDI)
|
||||||
|| (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
|
|| (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
|
||||||
/* other flavor FDDI cards have an extra 3 bytes of padding */
|
/* other flavor FDDI cards have an extra 3 bytes of padding */
|
||||||
if (file_seek(fh, 3, SEEK_CUR, err) == -1)
|
if (file_seek(fh, 3, SEEK_CUR, err) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
padlen = 3;
|
padlen = 3;
|
||||||
} else if (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK) {
|
} else if (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK) {
|
||||||
/* LOOPBACK has an extra 26 bytes of padding */
|
/* LOOPBACK has an extra 26 bytes of padding */
|
||||||
if (file_seek(fh, 26, SEEK_CUR, err) == -1)
|
if (file_seek(fh, 26, SEEK_CUR, err) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
padlen = 26;
|
padlen = 26;
|
||||||
|
@ -476,68 +476,68 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
if (file_seek(fh, 8, SEEK_CUR, err) == -1)
|
if (file_seek(fh, 8, SEEK_CUR, err) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
padlen = 8;
|
padlen = 8;
|
||||||
} else {
|
} else {
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETTL_SUBSYS_NS_LS_DRIVER :
|
case NETTL_SUBSYS_NS_LS_DRIVER :
|
||||||
/* XXX we don't know how to identify this as ethernet frames, so
|
/* XXX we don't know how to identify this as ethernet frames, so
|
||||||
we assume everything is. We will crash and burn for anything else */
|
we assume everything is. We will crash and burn for anything else */
|
||||||
/* for encapsulated 100baseT we do this */
|
/* for encapsulated 100baseT we do this */
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
||||||
if (!wtap_read_bytes(fh, &drv_eth_hdr, NS_LS_DRV_ETH_HDR_LEN,
|
if (!wtap_read_bytes(fh, &drv_eth_hdr, NS_LS_DRV_ETH_HDR_LEN,
|
||||||
err, err_info))
|
err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
length = pntoh16(&drv_eth_hdr.length);
|
length = pntoh16(&drv_eth_hdr.length);
|
||||||
caplen = pntoh16(&drv_eth_hdr.caplen);
|
caplen = pntoh16(&drv_eth_hdr.caplen);
|
||||||
/*
|
/*
|
||||||
* XXX - is there a length field that would give the length
|
* XXX - is there a length field that would give the length
|
||||||
* of this header, so that we don't have to check for
|
* of this header, so that we don't have to check for
|
||||||
* nettl files from HP-UX 11?
|
* nettl files from HP-UX 11?
|
||||||
*
|
*
|
||||||
* And what are the extra two bytes?
|
* And what are the extra two bytes?
|
||||||
*/
|
*/
|
||||||
if (nettl->is_hpux_11) {
|
if (nettl->is_hpux_11) {
|
||||||
if (file_seek(fh, 2, SEEK_CUR, err) == -1) return FALSE;
|
if (file_seek(fh, 2, SEEK_CUR, err) == -1) return FALSE;
|
||||||
}
|
}
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETTL_SUBSYS_SX25L2:
|
case NETTL_SUBSYS_SX25L2:
|
||||||
case NETTL_SUBSYS_SX25L3:
|
case NETTL_SUBSYS_SX25L3:
|
||||||
/*
|
/*
|
||||||
* XXX - is the 24-byte padding actually a header with
|
* XXX - is the 24-byte padding actually a header with
|
||||||
* packet lengths, time stamps, etc., just as is the case
|
* packet lengths, time stamps, etc., just as is the case
|
||||||
* for NETTL_SUBSYS_NS_LS_DRIVER? It might be
|
* for NETTL_SUBSYS_NS_LS_DRIVER? It might be
|
||||||
*
|
*
|
||||||
* guint8 caplen[2];
|
* guint8 caplen[2];
|
||||||
* guint8 length[2];
|
* guint8 length[2];
|
||||||
* guint8 xxc[4];
|
* guint8 xxc[4];
|
||||||
* guint8 sec[4];
|
* guint8 sec[4];
|
||||||
* guint8 usec[4];
|
* guint8 usec[4];
|
||||||
* guint8 xxd[4];
|
* guint8 xxd[4];
|
||||||
*
|
*
|
||||||
* or something such as that - if it has 4 bytes before that
|
* or something such as that - if it has 4 bytes before that
|
||||||
* (making it 24 bytes), it'd be like struct
|
* (making it 24 bytes), it'd be like struct
|
||||||
* nettlrec_ns_ls_drv_eth_hdr but with 2 more bytes at the end.
|
* nettlrec_ns_ls_drv_eth_hdr but with 2 more bytes at the end.
|
||||||
*
|
*
|
||||||
* And is "from_dce" at xxa[0] in the nettlrec_hdr structure?
|
* And is "from_dce" at xxa[0] in the nettlrec_hdr structure?
|
||||||
*/
|
*/
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_X25;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_X25;
|
||||||
length = pntoh32(&rec_hdr.length);
|
length = pntoh32(&rec_hdr.length);
|
||||||
caplen = pntoh32(&rec_hdr.caplen);
|
caplen = pntoh32(&rec_hdr.caplen);
|
||||||
padlen = 24; /* sizeof (struct nettlrec_sx25l2_hdr) - NETTL_REC_HDR_LEN + 4 */
|
padlen = 24; /* sizeof (struct nettlrec_sx25l2_hdr) - NETTL_REC_HDR_LEN + 4 */
|
||||||
if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
|
if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* We're going to assume it's ethernet if we don't recognize the
|
/* We're going to assume it's ethernet if we don't recognize the
|
||||||
subsystem -- We'll probably spew junks and core if it isn't... */
|
subsystem -- We'll probably spew junks and core if it isn't... */
|
||||||
wth->file_encap = WTAP_ENCAP_PER_PACKET;
|
wth->file_encap = WTAP_ENCAP_PER_PACKET;
|
||||||
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
|
||||||
length = pntoh32(&rec_hdr.length);
|
length = pntoh32(&rec_hdr.length);
|
||||||
caplen = pntoh32(&rec_hdr.caplen);
|
caplen = pntoh32(&rec_hdr.caplen);
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
|
@ -545,19 +545,19 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length < padlen) {
|
if (length < padlen) {
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u",
|
*err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u",
|
||||||
length, padlen);
|
length, padlen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
phdr->rec_type = REC_TYPE_PACKET;
|
phdr->rec_type = REC_TYPE_PACKET;
|
||||||
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
|
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
|
||||||
phdr->len = length - padlen;
|
phdr->len = length - padlen;
|
||||||
if (caplen < padlen) {
|
if (caplen < padlen) {
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u",
|
*err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u",
|
||||||
caplen, padlen);
|
caplen, padlen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
datalen = caplen - padlen;
|
datalen = caplen - padlen;
|
||||||
phdr->caplen = datalen;
|
phdr->caplen = datalen;
|
||||||
|
@ -571,14 +571,14 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
pseudo_header->nettl.uid = pntoh16(&rec_hdr.uid);
|
pseudo_header->nettl.uid = pntoh16(&rec_hdr.uid);
|
||||||
|
|
||||||
if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
|
if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
|
||||||
/*
|
/*
|
||||||
* Probably a corrupt capture file; don't blow up trying
|
* Probably a corrupt capture file; don't blow up trying
|
||||||
* to allocate space for an immensely-large packet.
|
* to allocate space for an immensely-large packet.
|
||||||
*/
|
*/
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u",
|
*err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u",
|
||||||
phdr->caplen, WTAP_MAX_PACKET_SIZE);
|
phdr->caplen, WTAP_MAX_PACKET_SIZE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -609,14 +609,14 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
datalen -= bytes_to_read;
|
datalen -= bytes_to_read;
|
||||||
if (datalen == 0) {
|
if (datalen == 0) {
|
||||||
/* There's nothing past the FC, dest, src, DSAP, SSAP, and 3 bytes to eat */
|
/* There's nothing past the FC, dest, src, DSAP, SSAP, and 3 bytes to eat */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!wtap_read_bytes(fh, pd + 15, datalen, err, err_info))
|
if (!wtap_read_bytes(fh, pd + 15, datalen, err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (!wtap_read_bytes(fh, pd, datalen, err, err_info))
|
if (!wtap_read_bytes(fh, pd, datalen, err, err_info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -630,27 +630,27 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
|
||||||
int nettl_dump_can_write_encap(int encap)
|
int nettl_dump_can_write_encap(int encap)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (encap) {
|
switch (encap) {
|
||||||
case WTAP_ENCAP_ETHERNET:
|
case WTAP_ENCAP_ETHERNET:
|
||||||
case WTAP_ENCAP_FDDI_BITSWAPPED:
|
case WTAP_ENCAP_FDDI_BITSWAPPED:
|
||||||
case WTAP_ENCAP_TOKEN_RING:
|
case WTAP_ENCAP_TOKEN_RING:
|
||||||
case WTAP_ENCAP_NETTL_ETHERNET:
|
case WTAP_ENCAP_NETTL_ETHERNET:
|
||||||
case WTAP_ENCAP_NETTL_FDDI:
|
case WTAP_ENCAP_NETTL_FDDI:
|
||||||
case WTAP_ENCAP_NETTL_TOKEN_RING:
|
case WTAP_ENCAP_NETTL_TOKEN_RING:
|
||||||
case WTAP_ENCAP_NETTL_RAW_IP:
|
case WTAP_ENCAP_NETTL_RAW_IP:
|
||||||
case WTAP_ENCAP_NETTL_RAW_ICMP:
|
case WTAP_ENCAP_NETTL_RAW_ICMP:
|
||||||
case WTAP_ENCAP_NETTL_RAW_ICMPV6:
|
case WTAP_ENCAP_NETTL_RAW_ICMPV6:
|
||||||
case WTAP_ENCAP_NETTL_RAW_TELNET:
|
case WTAP_ENCAP_NETTL_RAW_TELNET:
|
||||||
/*
|
/*
|
||||||
case WTAP_ENCAP_NETTL_X25:
|
case WTAP_ENCAP_NETTL_X25:
|
||||||
*/
|
*/
|
||||||
case WTAP_ENCAP_PER_PACKET:
|
case WTAP_ENCAP_PER_PACKET:
|
||||||
case WTAP_ENCAP_UNKNOWN:
|
case WTAP_ENCAP_UNKNOWN:
|
||||||
case WTAP_ENCAP_NETTL_UNKNOWN:
|
case WTAP_ENCAP_NETTL_UNKNOWN:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
return WTAP_ERR_UNSUPPORTED_ENCAP;
|
return WTAP_ERR_UNSUPPORTED_ENCAP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -658,151 +658,151 @@ int nettl_dump_can_write_encap(int encap)
|
||||||
sets "*err" to an error code on failure */
|
sets "*err" to an error code on failure */
|
||||||
gboolean nettl_dump_open(wtap_dumper *wdh, int *err)
|
gboolean nettl_dump_open(wtap_dumper *wdh, int *err)
|
||||||
{
|
{
|
||||||
struct nettl_file_hdr file_hdr;
|
struct nettl_file_hdr file_hdr;
|
||||||
|
|
||||||
/* This is a nettl file */
|
/* This is a nettl file */
|
||||||
wdh->subtype_write = nettl_dump;
|
wdh->subtype_write = nettl_dump;
|
||||||
wdh->subtype_close = NULL;
|
wdh->subtype_close = NULL;
|
||||||
|
|
||||||
/* Write the file header. */
|
/* Write the file header. */
|
||||||
memset(&file_hdr,0,sizeof(file_hdr));
|
memset(&file_hdr,0,sizeof(file_hdr));
|
||||||
memcpy(file_hdr.magic,nettl_magic_hpux10,sizeof(file_hdr.magic));
|
memcpy(file_hdr.magic,nettl_magic_hpux10,sizeof(file_hdr.magic));
|
||||||
g_strlcpy(file_hdr.file_name,"/tmp/wireshark.TRC000",NETTL_FILENAME_SIZE);
|
g_strlcpy(file_hdr.file_name,"/tmp/wireshark.TRC000",NETTL_FILENAME_SIZE);
|
||||||
g_strlcpy(file_hdr.tz,"UTC",20);
|
g_strlcpy(file_hdr.tz,"UTC",20);
|
||||||
g_strlcpy(file_hdr.host_name,"",9);
|
g_strlcpy(file_hdr.host_name,"",9);
|
||||||
g_strlcpy(file_hdr.os_vers,"B.11.11",9);
|
g_strlcpy(file_hdr.os_vers,"B.11.11",9);
|
||||||
file_hdr.os_v=0x55;
|
file_hdr.os_v=0x55;
|
||||||
g_strlcpy(file_hdr.model,"9000/800",11);
|
g_strlcpy(file_hdr.model,"9000/800",11);
|
||||||
file_hdr.unknown=g_htons(0x406);
|
file_hdr.unknown=g_htons(0x406);
|
||||||
if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
|
if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
wdh->bytes_dumped += sizeof(file_hdr);
|
wdh->bytes_dumped += sizeof(file_hdr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write a record for a packet to a dump file.
|
/* Write a record for a packet to a dump file.
|
||||||
Returns TRUE on success, FALSE on failure. */
|
Returns TRUE on success, FALSE on failure. */
|
||||||
static gboolean nettl_dump(wtap_dumper *wdh,
|
static gboolean nettl_dump(wtap_dumper *wdh,
|
||||||
const struct wtap_pkthdr *phdr,
|
const struct wtap_pkthdr *phdr,
|
||||||
const guint8 *pd, int *err)
|
const guint8 *pd, int *err)
|
||||||
{
|
{
|
||||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||||
struct nettlrec_hdr rec_hdr;
|
struct nettlrec_hdr rec_hdr;
|
||||||
guint8 dummyc[24];
|
guint8 dummyc[24];
|
||||||
|
|
||||||
/* We can only write packet records. */
|
/* We can only write packet records. */
|
||||||
if (phdr->rec_type != REC_TYPE_PACKET) {
|
if (phdr->rec_type != REC_TYPE_PACKET) {
|
||||||
*err = WTAP_ERR_REC_TYPE_UNSUPPORTED;
|
*err = WTAP_ERR_REC_TYPE_UNSUPPORTED;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't write anything we're not willing to read. */
|
/* Don't write anything we're not willing to read. */
|
||||||
if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
|
if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
|
||||||
*err = WTAP_ERR_PACKET_TOO_LARGE;
|
*err = WTAP_ERR_PACKET_TOO_LARGE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&rec_hdr,0,sizeof(rec_hdr));
|
memset(&rec_hdr,0,sizeof(rec_hdr));
|
||||||
/* HP-UX 11.X header should be 68 bytes */
|
/* HP-UX 11.X header should be 68 bytes */
|
||||||
rec_hdr.hdr_len = g_htons(sizeof(rec_hdr) + 4);
|
rec_hdr.hdr_len = g_htons(sizeof(rec_hdr) + 4);
|
||||||
rec_hdr.kind = g_htonl(NETTL_HDR_PDUIN);
|
rec_hdr.kind = g_htonl(NETTL_HDR_PDUIN);
|
||||||
rec_hdr.sec = g_htonl(phdr->ts.secs);
|
rec_hdr.sec = g_htonl(phdr->ts.secs);
|
||||||
rec_hdr.usec = g_htonl(phdr->ts.nsecs/1000);
|
rec_hdr.usec = g_htonl(phdr->ts.nsecs/1000);
|
||||||
rec_hdr.caplen = g_htonl(phdr->caplen);
|
rec_hdr.caplen = g_htonl(phdr->caplen);
|
||||||
rec_hdr.length = g_htonl(phdr->len);
|
rec_hdr.length = g_htonl(phdr->len);
|
||||||
rec_hdr.devid = -1;
|
rec_hdr.devid = -1;
|
||||||
rec_hdr.pid = -1;
|
rec_hdr.pid = -1;
|
||||||
rec_hdr.uid = -1;
|
rec_hdr.uid = -1;
|
||||||
|
|
||||||
switch (phdr->pkt_encap) {
|
switch (phdr->pkt_encap) {
|
||||||
|
|
||||||
case WTAP_ENCAP_NETTL_FDDI:
|
case WTAP_ENCAP_NETTL_FDDI:
|
||||||
/* account for pad bytes */
|
/* account for pad bytes */
|
||||||
rec_hdr.caplen = g_htonl(phdr->caplen + 3);
|
rec_hdr.caplen = g_htonl(phdr->caplen + 3);
|
||||||
rec_hdr.length = g_htonl(phdr->len + 3);
|
rec_hdr.length = g_htonl(phdr->len + 3);
|
||||||
/* fall through and fill the rest of the fields */
|
/* fall through and fill the rest of the fields */
|
||||||
case WTAP_ENCAP_NETTL_ETHERNET:
|
case WTAP_ENCAP_NETTL_ETHERNET:
|
||||||
case WTAP_ENCAP_NETTL_TOKEN_RING:
|
case WTAP_ENCAP_NETTL_TOKEN_RING:
|
||||||
case WTAP_ENCAP_NETTL_RAW_IP:
|
case WTAP_ENCAP_NETTL_RAW_IP:
|
||||||
case WTAP_ENCAP_NETTL_RAW_ICMP:
|
case WTAP_ENCAP_NETTL_RAW_ICMP:
|
||||||
case WTAP_ENCAP_NETTL_RAW_ICMPV6:
|
case WTAP_ENCAP_NETTL_RAW_ICMPV6:
|
||||||
case WTAP_ENCAP_NETTL_RAW_TELNET:
|
case WTAP_ENCAP_NETTL_RAW_TELNET:
|
||||||
case WTAP_ENCAP_NETTL_UNKNOWN:
|
case WTAP_ENCAP_NETTL_UNKNOWN:
|
||||||
rec_hdr.subsys = g_htons(pseudo_header->nettl.subsys);
|
rec_hdr.subsys = g_htons(pseudo_header->nettl.subsys);
|
||||||
rec_hdr.devid = g_htonl(pseudo_header->nettl.devid);
|
rec_hdr.devid = g_htonl(pseudo_header->nettl.devid);
|
||||||
rec_hdr.kind = g_htonl(pseudo_header->nettl.kind);
|
rec_hdr.kind = g_htonl(pseudo_header->nettl.kind);
|
||||||
rec_hdr.pid = g_htonl(pseudo_header->nettl.pid);
|
rec_hdr.pid = g_htonl(pseudo_header->nettl.pid);
|
||||||
rec_hdr.uid = g_htons(pseudo_header->nettl.uid);
|
rec_hdr.uid = g_htons(pseudo_header->nettl.uid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_RAW_IP:
|
case WTAP_ENCAP_RAW_IP:
|
||||||
rec_hdr.subsys = g_htons(NETTL_SUBSYS_NS_LS_IP);
|
rec_hdr.subsys = g_htons(NETTL_SUBSYS_NS_LS_IP);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_ETHERNET:
|
case WTAP_ENCAP_ETHERNET:
|
||||||
rec_hdr.subsys = g_htons(NETTL_SUBSYS_BTLAN);
|
rec_hdr.subsys = g_htons(NETTL_SUBSYS_BTLAN);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_FDDI_BITSWAPPED:
|
case WTAP_ENCAP_FDDI_BITSWAPPED:
|
||||||
rec_hdr.subsys = g_htons(NETTL_SUBSYS_PCI_FDDI);
|
rec_hdr.subsys = g_htons(NETTL_SUBSYS_PCI_FDDI);
|
||||||
/* account for pad bytes */
|
/* account for pad bytes */
|
||||||
rec_hdr.caplen = g_htonl(phdr->caplen + 3);
|
rec_hdr.caplen = g_htonl(phdr->caplen + 3);
|
||||||
rec_hdr.length = g_htonl(phdr->len + 3);
|
rec_hdr.length = g_htonl(phdr->len + 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_TOKEN_RING:
|
case WTAP_ENCAP_TOKEN_RING:
|
||||||
rec_hdr.subsys = g_htons(NETTL_SUBSYS_PCI_TR);
|
rec_hdr.subsys = g_htons(NETTL_SUBSYS_PCI_TR);
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
case WTAP_ENCAP_NETTL_X25:
|
case WTAP_ENCAP_NETTL_X25:
|
||||||
rec_hdr.caplen = g_htonl(phdr->caplen + 24);
|
rec_hdr.caplen = g_htonl(phdr->caplen + 24);
|
||||||
rec_hdr.length = g_htonl(phdr->len + 24);
|
rec_hdr.length = g_htonl(phdr->len + 24);
|
||||||
rec_hdr.subsys = g_htons(pseudo_header->nettl.subsys);
|
rec_hdr.subsys = g_htons(pseudo_header->nettl.subsys);
|
||||||
rec_hdr.devid = g_htonl(pseudo_header->nettl.devid);
|
rec_hdr.devid = g_htonl(pseudo_header->nettl.devid);
|
||||||
rec_hdr.kind = g_htonl(pseudo_header->nettl.kind);
|
rec_hdr.kind = g_htonl(pseudo_header->nettl.kind);
|
||||||
rec_hdr.pid = g_htonl(pseudo_header->nettl.pid);
|
rec_hdr.pid = g_htonl(pseudo_header->nettl.pid);
|
||||||
rec_hdr.uid = g_htons(pseudo_header->nettl.uid);
|
rec_hdr.uid = g_htons(pseudo_header->nettl.uid);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
/* found one we don't support */
|
/* found one we don't support */
|
||||||
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
|
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
|
if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
wdh->bytes_dumped += sizeof(rec_hdr);
|
wdh->bytes_dumped += sizeof(rec_hdr);
|
||||||
|
|
||||||
/* Write out 4 extra bytes of unknown stuff for HP-UX11
|
/* Write out 4 extra bytes of unknown stuff for HP-UX11
|
||||||
* header format.
|
* header format.
|
||||||
*/
|
*/
|
||||||
memset(dummyc, 0, sizeof dummyc);
|
memset(dummyc, 0, sizeof dummyc);
|
||||||
if (!wtap_dump_file_write(wdh, dummyc, 4, err))
|
if (!wtap_dump_file_write(wdh, dummyc, 4, err))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
wdh->bytes_dumped += 4;
|
wdh->bytes_dumped += 4;
|
||||||
|
|
||||||
if ((phdr->pkt_encap == WTAP_ENCAP_FDDI_BITSWAPPED) ||
|
if ((phdr->pkt_encap == WTAP_ENCAP_FDDI_BITSWAPPED) ||
|
||||||
(phdr->pkt_encap == WTAP_ENCAP_NETTL_FDDI)) {
|
(phdr->pkt_encap == WTAP_ENCAP_NETTL_FDDI)) {
|
||||||
/* add those weird 3 bytes of padding */
|
/* add those weird 3 bytes of padding */
|
||||||
if (!wtap_dump_file_write(wdh, dummyc, 3, err))
|
if (!wtap_dump_file_write(wdh, dummyc, 3, err))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
wdh->bytes_dumped += 3;
|
wdh->bytes_dumped += 3;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
} else if (phdr->pkt_encap == WTAP_ENCAP_NETTL_X25) {
|
} else if (phdr->pkt_encap == WTAP_ENCAP_NETTL_X25) {
|
||||||
if (!wtap_dump_file_write(wdh, dummyc, 24, err))
|
if (!wtap_dump_file_write(wdh, dummyc, 24, err))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
wdh->bytes_dumped += 24;
|
wdh->bytes_dumped += 24;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* write actual PDU data */
|
/* write actual PDU data */
|
||||||
|
|
||||||
if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
|
if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
wdh->bytes_dumped += phdr->caplen;
|
wdh->bytes_dumped += phdr->caplen;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct netxray_hdr {
|
||||||
* For WAN captures (all of which are done with a pod), it indicates
|
* For WAN captures (all of which are done with a pod), it indicates
|
||||||
* the link-layer type.
|
* the link-layer type.
|
||||||
*/
|
*/
|
||||||
#define CAPTYPE_NDIS 0 /* Capture on network interface using NDIS */
|
#define CAPTYPE_NDIS 0 /* Capture on network interface using NDIS */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ethernet capture types.
|
* Ethernet capture types.
|
||||||
|
@ -131,7 +131,7 @@ struct netxray_hdr {
|
||||||
#define WAN_CAPTYPE_SMDS 10 /* SMDS DXI */
|
#define WAN_CAPTYPE_SMDS 10 /* SMDS DXI */
|
||||||
#define WAN_CAPTYPE_BROUTER4 11 /* Bridge/router captured with pod */
|
#define WAN_CAPTYPE_BROUTER4 11 /* Bridge/router captured with pod */
|
||||||
#define WAN_CAPTYPE_BROUTER5 12 /* Bridge/router captured with pod */
|
#define WAN_CAPTYPE_BROUTER5 12 /* Bridge/router captured with pod */
|
||||||
#define WAN_CAPTYPE_CHDLC 19 /* Cisco router (CHDLC) captured with pod */
|
#define WAN_CAPTYPE_CHDLC 19 /* Cisco router (CHDLC) captured with pod */
|
||||||
|
|
||||||
#define CAPTYPE_ATM 15 /* ATM captured with pod */
|
#define CAPTYPE_ATM 15 /* ATM captured with pod */
|
||||||
|
|
||||||
|
@ -1199,7 +1199,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
|
||||||
* We have 4 bytes of stuff at the
|
* We have 4 bytes of stuff at the
|
||||||
* end of the frame - FCS, or junk?
|
* end of the frame - FCS, or junk?
|
||||||
*/
|
*/
|
||||||
if (netxray->fcs_valid) {
|
if (netxray->fcs_valid) {
|
||||||
/*
|
/*
|
||||||
* FCS.
|
* FCS.
|
||||||
*/
|
*/
|
||||||
|
@ -1240,7 +1240,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
|
||||||
* We have 4 bytes of stuff at the
|
* We have 4 bytes of stuff at the
|
||||||
* end of the frame - FCS, or junk?
|
* end of the frame - FCS, or junk?
|
||||||
*/
|
*/
|
||||||
if (netxray->fcs_valid) {
|
if (netxray->fcs_valid) {
|
||||||
/*
|
/*
|
||||||
* FCS.
|
* FCS.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -217,10 +217,10 @@ static const struct {
|
||||||
/*
|
/*
|
||||||
* Linux "cooked mode" captures, used by the current CVS version
|
* Linux "cooked mode" captures, used by the current CVS version
|
||||||
* of libpcap
|
* of libpcap
|
||||||
* OR
|
* OR
|
||||||
* it could be a packet in Cisco's ERSPAN encapsulation which uses
|
* it could be a packet in Cisco's ERSPAN encapsulation which uses
|
||||||
* this number as well (why can't people stick to protocols when it
|
* this number as well (why can't people stick to protocols when it
|
||||||
* comes to allocating/using DLT types).
|
* comes to allocating/using DLT types).
|
||||||
*/
|
*/
|
||||||
{ 113, WTAP_ENCAP_SLL }, /* Linux cooked capture */
|
{ 113, WTAP_ENCAP_SLL }, /* Linux cooked capture */
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ static const struct {
|
||||||
/* Ethernet PPPoE frames captured on a service PIC */
|
/* Ethernet PPPoE frames captured on a service PIC */
|
||||||
{ 167, WTAP_ENCAP_JUNIPER_PPPOE },
|
{ 167, WTAP_ENCAP_JUNIPER_PPPOE },
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 168 is reserved for more Juniper private-chassis-
|
* 168 is reserved for more Juniper private-chassis-
|
||||||
* internal meta-information.
|
* internal meta-information.
|
||||||
*/
|
*/
|
||||||
|
@ -328,15 +328,15 @@ static const struct {
|
||||||
/* VOIP Frames prepended with meta-information */
|
/* VOIP Frames prepended with meta-information */
|
||||||
{ 183, WTAP_ENCAP_JUNIPER_VP },
|
{ 183, WTAP_ENCAP_JUNIPER_VP },
|
||||||
/* raw USB packets */
|
/* raw USB packets */
|
||||||
{ 186, WTAP_ENCAP_USB },
|
{ 186, WTAP_ENCAP_USB },
|
||||||
/* Bluetooth HCI UART transport (part H:4) frames, like hcidump */
|
/* Bluetooth HCI UART transport (part H:4) frames, like hcidump */
|
||||||
{ 187, WTAP_ENCAP_BLUETOOTH_H4 },
|
{ 187, WTAP_ENCAP_BLUETOOTH_H4 },
|
||||||
/* IEEE 802.16 MAC Common Part Sublayer */
|
/* IEEE 802.16 MAC Common Part Sublayer */
|
||||||
{ 188, WTAP_ENCAP_IEEE802_16_MAC_CPS },
|
{ 188, WTAP_ENCAP_IEEE802_16_MAC_CPS },
|
||||||
/* USB packets with Linux-specified header */
|
/* USB packets with Linux-specified header */
|
||||||
{ 189, WTAP_ENCAP_USB_LINUX },
|
{ 189, WTAP_ENCAP_USB_LINUX },
|
||||||
/* CAN 2.0b frame */
|
/* CAN 2.0b frame */
|
||||||
{ 190, WTAP_ENCAP_CAN20B },
|
{ 190, WTAP_ENCAP_CAN20B },
|
||||||
/* Per-Packet Information header */
|
/* Per-Packet Information header */
|
||||||
{ 192, WTAP_ENCAP_PPI },
|
{ 192, WTAP_ENCAP_PPI },
|
||||||
/* IEEE 802.15.4 Wireless PAN */
|
/* IEEE 802.15.4 Wireless PAN */
|
||||||
|
@ -348,29 +348,29 @@ static const struct {
|
||||||
/* IPMB */
|
/* IPMB */
|
||||||
{ 199, WTAP_ENCAP_IPMB },
|
{ 199, WTAP_ENCAP_IPMB },
|
||||||
/* Bluetooth HCI UART transport (part H:4) frames, like hcidump */
|
/* Bluetooth HCI UART transport (part H:4) frames, like hcidump */
|
||||||
{ 201, WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR },
|
{ 201, WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR },
|
||||||
/* AX.25 packet with a 1-byte KISS header */
|
/* AX.25 packet with a 1-byte KISS header */
|
||||||
{ 202, WTAP_ENCAP_AX25_KISS },
|
{ 202, WTAP_ENCAP_AX25_KISS },
|
||||||
/* LAPD frame */
|
/* LAPD frame */
|
||||||
{ 203, WTAP_ENCAP_LAPD },
|
{ 203, WTAP_ENCAP_LAPD },
|
||||||
/* PPP with pseudoheader */
|
/* PPP with pseudoheader */
|
||||||
{ 204, WTAP_ENCAP_PPP_WITH_PHDR },
|
{ 204, WTAP_ENCAP_PPP_WITH_PHDR },
|
||||||
/* IPMB/I2C */
|
/* IPMB/I2C */
|
||||||
{ 209, WTAP_ENCAP_I2C },
|
{ 209, WTAP_ENCAP_I2C },
|
||||||
/* FlexRay frame */
|
/* FlexRay frame */
|
||||||
{ 210, WTAP_ENCAP_FLEXRAY },
|
{ 210, WTAP_ENCAP_FLEXRAY },
|
||||||
/* MOST frame */
|
/* MOST frame */
|
||||||
{ 211, WTAP_ENCAP_MOST },
|
{ 211, WTAP_ENCAP_MOST },
|
||||||
/* LIN frame */
|
/* LIN frame */
|
||||||
{ 212, WTAP_ENCAP_LIN },
|
{ 212, WTAP_ENCAP_LIN },
|
||||||
/* X2E Xoraya serial frame */
|
/* X2E Xoraya serial frame */
|
||||||
{ 213, WTAP_ENCAP_X2E_SERIAL },
|
{ 213, WTAP_ENCAP_X2E_SERIAL },
|
||||||
/* X2E Xoraya frame */
|
/* X2E Xoraya frame */
|
||||||
{ 214, WTAP_ENCAP_X2E_XORAYA },
|
{ 214, WTAP_ENCAP_X2E_XORAYA },
|
||||||
/* IEEE 802.15.4 Wireless PAN non-ASK PHY */
|
/* IEEE 802.15.4 Wireless PAN non-ASK PHY */
|
||||||
{ 215, WTAP_ENCAP_IEEE802_15_4_NONASK_PHY },
|
{ 215, WTAP_ENCAP_IEEE802_15_4_NONASK_PHY },
|
||||||
/* USB packets with padded Linux-specified header */
|
/* USB packets with padded Linux-specified header */
|
||||||
{ 220, WTAP_ENCAP_USB_LINUX_MMAPPED },
|
{ 220, WTAP_ENCAP_USB_LINUX_MMAPPED },
|
||||||
/* Fibre Channel FC-2 frame */
|
/* Fibre Channel FC-2 frame */
|
||||||
{ 224, WTAP_ENCAP_FIBRE_CHANNEL_FC2 },
|
{ 224, WTAP_ENCAP_FIBRE_CHANNEL_FC2 },
|
||||||
/* Fibre Channel FC-2 frame with Delimiter */
|
/* Fibre Channel FC-2 frame with Delimiter */
|
||||||
|
|
|
@ -2274,7 +2274,7 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
|
||||||
errno = WTAP_ERR_CANT_READ;
|
errno = WTAP_ERR_CANT_READ;
|
||||||
if (!wtap_read_bytes_or_eof(wth->fh, &bh, sizeof bh, err, err_info)) {
|
if (!wtap_read_bytes_or_eof(wth->fh, &bh, sizeof bh, err, err_info)) {
|
||||||
if (*err == 0) {
|
if (*err == 0) {
|
||||||
/* EOF */
|
/* EOF */
|
||||||
pcapng_debug0("No more IDBs available...");
|
pcapng_debug0("No more IDBs available...");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
||||||
|
|
||||||
if (!collate(state, wth->fh, err, err_info, buf, &num_bytes, &direction,
|
if (!collate(state, wth->fh, err, err_info, buf, &num_bytes, &direction,
|
||||||
pid, 0)) {
|
pid, 0)) {
|
||||||
if (pid != NULL)
|
if (pid != NULL)
|
||||||
g_free(pid);
|
g_free(pid);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,8 +405,8 @@ parse_single_hex_dump_line(char* rec, guint8 *buf, guint byte_offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go through the substring representing the values and:
|
/* Go through the substring representing the values and:
|
||||||
* 1. Replace any spaces with '0's
|
* 1. Replace any spaces with '0's
|
||||||
* 2. Place \0's every 5 bytes (to terminate the string)
|
* 2. Place \0's every 5 bytes (to terminate the string)
|
||||||
*
|
*
|
||||||
* Then read the eight sets of hex bytes
|
* Then read the eight sets of hex bytes
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -358,45 +358,45 @@ parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gch
|
||||||
|
|
||||||
/* First look for the Format 1 type sequencing */
|
/* First look for the Format 1 type sequencing */
|
||||||
num_items_scanned = sscanf(p,
|
num_items_scanned = sscanf(p,
|
||||||
"packet %9d at %2d-%3s-%4d %2d:%2d:%2d.%9d",
|
"packet %9d at %2d-%3s-%4d %2d:%2d:%2d.%9d",
|
||||||
&pktnum, &tm.tm_mday, mon,
|
&pktnum, &tm.tm_mday, mon,
|
||||||
&tm.tm_year, &tm.tm_hour,
|
&tm.tm_year, &tm.tm_hour,
|
||||||
&tm.tm_min, &tm.tm_sec, &csec);
|
&tm.tm_min, &tm.tm_sec, &csec);
|
||||||
/* Next look for the Format 2 type sequencing */
|
/* Next look for the Format 2 type sequencing */
|
||||||
if (num_items_scanned != 8) {
|
if (num_items_scanned != 8) {
|
||||||
num_items_scanned = sscanf(p,
|
num_items_scanned = sscanf(p,
|
||||||
"packet seq # = %9d at %2d-%3s-%4d %2d:%2d:%2d.%9d",
|
"packet seq # = %9d at %2d-%3s-%4d %2d:%2d:%2d.%9d",
|
||||||
&pktnum, &tm.tm_mday, mon,
|
&pktnum, &tm.tm_mday, mon,
|
||||||
&tm.tm_year, &tm.tm_hour,
|
&tm.tm_year, &tm.tm_hour,
|
||||||
&tm.tm_min, &tm.tm_sec, &csec);
|
&tm.tm_min, &tm.tm_sec, &csec);
|
||||||
}
|
}
|
||||||
/* if unknown format then exit with error */
|
/* if unknown format then exit with error */
|
||||||
/* We will need to add code to handle new format */
|
/* We will need to add code to handle new format */
|
||||||
if (num_items_scanned != 8) {
|
if (num_items_scanned != 8) {
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup_printf("vms: header line not valid");
|
*err_info = g_strdup_printf("vms: header line not valid");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( (! pkt_len) && (p = strstr(line, "Length"))) {
|
if ( (! pkt_len) && (p = strstr(line, "Length"))) {
|
||||||
p += sizeof("Length ");
|
p += sizeof("Length ");
|
||||||
while (*p && ! isdigit((guchar)*p))
|
while (*p && ! isdigit((guchar)*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if ( !*p ) {
|
if ( !*p ) {
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup_printf("vms: Length field not valid");
|
*err_info = g_strdup_printf("vms: Length field not valid");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt_len = atoi(p);
|
pkt_len = atoi(p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (! isdumpline(line));
|
} while (! isdumpline(line));
|
||||||
|
|
||||||
p = strstr(months, mon);
|
p = strstr(months, mon);
|
||||||
if (p)
|
if (p)
|
||||||
tm.tm_mon = (int) (p - months) / 3;
|
tm.tm_mon = (int) (p - months) / 3;
|
||||||
tm.tm_year -= 1900;
|
tm.tm_year -= 1900;
|
||||||
tm.tm_isdst = -1;
|
tm.tm_isdst = -1;
|
||||||
|
|
||||||
|
@ -413,34 +413,34 @@ parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gch
|
||||||
|
|
||||||
/* Convert the ASCII hex dump to binary data */
|
/* Convert the ASCII hex dump to binary data */
|
||||||
for (i = 0; i < pkt_len; i += 16) {
|
for (i = 0; i < pkt_len; i += 16) {
|
||||||
if (file_gets(line, VMS_LINE_LENGTH, fh) == NULL) {
|
if (file_gets(line, VMS_LINE_LENGTH, fh) == NULL) {
|
||||||
*err = file_error(fh, err_info);
|
*err = file_error(fh, err_info);
|
||||||
if (*err == 0) {
|
if (*err == 0) {
|
||||||
*err = WTAP_ERR_SHORT_READ;
|
*err = WTAP_ERR_SHORT_READ;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
line[VMS_LINE_LENGTH] = '\0';
|
line[VMS_LINE_LENGTH] = '\0';
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
while (! isdumpline(line)) { /* advance to start of hex data */
|
while (! isdumpline(line)) { /* advance to start of hex data */
|
||||||
if (file_gets(line, VMS_LINE_LENGTH, fh) == NULL) {
|
if (file_gets(line, VMS_LINE_LENGTH, fh) == NULL) {
|
||||||
*err = file_error(fh, err_info);
|
*err = file_error(fh, err_info);
|
||||||
if (*err == 0) {
|
if (*err == 0) {
|
||||||
*err = WTAP_ERR_SHORT_READ;
|
*err = WTAP_ERR_SHORT_READ;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
line[VMS_LINE_LENGTH] = '\0';
|
line[VMS_LINE_LENGTH] = '\0';
|
||||||
}
|
}
|
||||||
while (line[offset] && !isxdigit((guchar)line[offset]))
|
while (line[offset] && !isxdigit((guchar)line[offset]))
|
||||||
offset++;
|
offset++;
|
||||||
}
|
}
|
||||||
if (!parse_single_hex_dump_line(line, pd, i,
|
if (!parse_single_hex_dump_line(line, pd, i,
|
||||||
offset, pkt_len - i)) {
|
offset, pkt_len - i)) {
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup_printf("vms: hex dump not valid");
|
*err_info = g_strdup_printf("vms: hex dump not valid");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Avoid TCPIPTRACE-W-BUFFERSFUL, TCPIPtrace could not save n packets.
|
/* Avoid TCPIPTRACE-W-BUFFERSFUL, TCPIPtrace could not save n packets.
|
||||||
* errors.
|
* errors.
|
||||||
|
@ -449,13 +449,13 @@ parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gch
|
||||||
* Wiretap API, we should parse those lines and return "n" as
|
* Wiretap API, we should parse those lines and return "n" as
|
||||||
* a packet drop count. */
|
* a packet drop count. */
|
||||||
if (!file_gets(line, VMS_LINE_LENGTH, fh)) {
|
if (!file_gets(line, VMS_LINE_LENGTH, fh)) {
|
||||||
*err = file_error(fh, err_info);
|
*err = file_error(fh, err_info);
|
||||||
if (*err == 0) {
|
if (*err == 0) {
|
||||||
/* There is no next line, so there's no "TCPIPtrace could not
|
/* There is no next line, so there's no "TCPIPtrace could not
|
||||||
* save n packets" line; not an error. */
|
* save n packets" line; not an error. */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ parse_single_hex_dump_line(char* rec, guint8 *buf, long byte_offset,
|
||||||
value = (int)strtoul(s + 45 + in_off, NULL, 16); /* XXX - error check? */
|
value = (int)strtoul(s + 45 + in_off, NULL, 16); /* XXX - error check? */
|
||||||
|
|
||||||
if (value != byte_offset) {
|
if (value != byte_offset) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remaining > 16)
|
if (remaining > 16)
|
||||||
|
@ -504,10 +504,10 @@ parse_single_hex_dump_line(char* rec, guint8 *buf, long byte_offset,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < remaining; i++) {
|
for (i = 0; i < remaining; i++) {
|
||||||
lbuf[0] = rec[offsets[i] + in_off];
|
lbuf[0] = rec[offsets[i] + in_off];
|
||||||
lbuf[1] = rec[offsets[i] + 1 + in_off];
|
lbuf[1] = rec[offsets[i] + 1 + in_off];
|
||||||
|
|
||||||
buf[byte_offset + i] = (guint8) strtoul(lbuf, NULL, 16);
|
buf[byte_offset + i] = (guint8) strtoul(lbuf, NULL, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -645,8 +645,8 @@ static struct encap_type_info encap_table_base[] = {
|
||||||
/* WTAP_ENCAP_BACNET_MS_TP_WITH_PHDR */
|
/* WTAP_ENCAP_BACNET_MS_TP_WITH_PHDR */
|
||||||
{ "BACnet MS/TP with Directional Info", "bacnet-ms-tp-with-direction" },
|
{ "BACnet MS/TP with Directional Info", "bacnet-ms-tp-with-direction" },
|
||||||
|
|
||||||
/* WTAP_ENCAP_IXVERIWAVE */
|
/* WTAP_ENCAP_IXVERIWAVE */
|
||||||
{ "IxVeriWave header and stats block", "ixveriwave" },
|
{ "IxVeriWave header and stats block", "ixveriwave" },
|
||||||
|
|
||||||
/* WTAP_ENCAP_IEEE_802_11_AIROPEEK */
|
/* WTAP_ENCAP_IEEE_802_11_AIROPEEK */
|
||||||
{ "IEEE 802.11 plus AiroPeek radio header", "ieee-802-11-airopeek" },
|
{ "IEEE 802.11 plus AiroPeek radio header", "ieee-802-11-airopeek" },
|
||||||
|
|
Loading…
Reference in New Issue