2014-10-14 06:45:05 +00:00
|
|
|
/* capsa.c
|
|
|
|
*
|
|
|
|
* Wiretap Library
|
|
|
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-10-14 06:45:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "wtap-int.h"
|
|
|
|
#include "file_wrappers.h"
|
|
|
|
#include "capsa.h"
|
2021-05-23 23:46:43 +00:00
|
|
|
#include <wsutil/ws_assert.h>
|
2014-10-14 06:45:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* A file begins with a header containing:
|
|
|
|
*
|
|
|
|
* a 4-byte magic number, with 'c', 'p', 's', 'e';
|
|
|
|
*
|
2015-08-12 05:42:26 +00:00
|
|
|
* either a 2-byte little-endian "format indicator" (version number?),
|
|
|
|
* or a 1-byte major version number followed by a 1-byte minor version
|
|
|
|
* number, or a 1-byte "format indicator" followed by something else
|
|
|
|
* that's always been 0;
|
2014-10-14 06:45:05 +00:00
|
|
|
*
|
|
|
|
* a 2-byte 0xe8 0x03 (1000 - a data rate? megabits/second?)
|
|
|
|
*
|
2015-08-12 02:00:26 +00:00
|
|
|
* 4 bytes of 0x01 0x00 0x01 0x00;
|
2014-10-14 06:45:05 +00:00
|
|
|
*
|
2015-08-12 02:00:26 +00:00
|
|
|
* either a 4-byte little-endian file size followed by 0x00 0x00 0x00 0x00
|
|
|
|
* or an 8-byte little-endian file size;
|
2014-10-14 06:45:05 +00:00
|
|
|
*
|
|
|
|
* a 4-byte little-endian packet count (in dns_error_of_udp, it exceeds?)
|
|
|
|
*
|
|
|
|
* a 4-byte little-endian number?
|
|
|
|
*
|
|
|
|
* hex 2c 01 c8 00 00 00 da 36 00 00 00 00 00 00;
|
|
|
|
*
|
|
|
|
* the same 4-byte little-endian number as above (yes, misaligned);
|
|
|
|
*
|
|
|
|
* 0x01 or 0x03;
|
|
|
|
*
|
|
|
|
* a bunch of 0s, up to an offset of 0x36d6;
|
|
|
|
*
|
|
|
|
* more stuff.
|
|
|
|
*
|
|
|
|
* Following that is a sequence of { record offset block, up to 200 records }
|
|
|
|
* pairs.
|
|
|
|
*
|
2014-10-16 00:55:04 +00:00
|
|
|
* A record offset block has 1 byte with the value 0xfe, a sequence of
|
|
|
|
* up to 200 4-byte little-endian record offsets, and 4 or more bytes
|
|
|
|
* of unknown data, making the block 805 bytes long.
|
|
|
|
*
|
|
|
|
* The record offsets are offsets, from the beginning of the record offset
|
|
|
|
* block (i.e., from the 0xfe byte), of the records following the block.
|
2014-10-14 06:45:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Magic number in Capsa files. */
|
|
|
|
static const char capsa_magic[] = {
|
|
|
|
'c', 'p', 's', 'e'
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Before each group of 200 or fewer records there's a block of frame
|
|
|
|
* offsets, giving the offsets, from the beginning of that block minus
|
|
|
|
* one(1), of the next N records.
|
|
|
|
*/
|
|
|
|
#define N_RECORDS_PER_GROUP 200
|
|
|
|
|
|
|
|
/* Capsa (format indicator 1) record header. */
|
|
|
|
struct capsarec_hdr {
|
|
|
|
guint32 unknown1; /* low-order 32 bits of a number? */
|
|
|
|
guint32 unknown2; /* 0x00 0x00 0x00 0x00 */
|
2015-08-12 01:38:08 +00:00
|
|
|
guint32 timestamplo; /* low-order 32 bits of the time stamp, in microseconds since January 1, 1970, 00:00:00 UTC */
|
|
|
|
guint32 timestamphi; /* high-order 32 bits of the time stamp, in microseconds since January 1, 1970, 00:00:00 UTC */
|
2014-10-14 06:45:05 +00:00
|
|
|
guint16 rec_len; /* length of record */
|
|
|
|
guint16 incl_len; /* number of octets captured in file */
|
|
|
|
guint16 orig_len; /* actual length of packet */
|
|
|
|
guint16 unknown5; /* 0x00 0x00 */
|
2014-10-14 06:55:08 +00:00
|
|
|
guint8 count1; /* count1*4 bytes after unknown8 */
|
2014-10-14 06:45:05 +00:00
|
|
|
guint8 count2; /* count2*4 bytes after that */
|
|
|
|
guint16 unknown7; /* 0x01 0x10 */
|
|
|
|
guint32 unknown8; /* 0x00 0x00 0x00 0x00 or random numbers */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Packet Builder (format indicator 2) record header. */
|
|
|
|
struct pbrec_hdr {
|
|
|
|
guint16 rec_len; /* length of record */
|
|
|
|
guint16 incl_len; /* number of octets captured in file */
|
|
|
|
guint16 orig_len; /* actual length of packet */
|
|
|
|
guint16 unknown1;
|
|
|
|
guint16 unknown2;
|
|
|
|
guint16 unknown3;
|
|
|
|
guint32 unknown4;
|
2015-08-12 01:38:08 +00:00
|
|
|
guint32 timestamplo; /* low-order 32 bits of the time stamp, in microseconds since January 1, 1970, 00:00:00 UTC */
|
|
|
|
guint32 timestamphi; /* high-order 32 bits of the time stamp, in microseconds since January 1, 1970, 00:00:00 UTC */
|
2014-10-14 06:45:05 +00:00
|
|
|
guint32 unknown5;
|
|
|
|
guint32 unknown6;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
2014-10-14 07:11:16 +00:00
|
|
|
guint16 format_indicator;
|
2014-10-14 06:45:05 +00:00
|
|
|
guint32 number_of_frames;
|
|
|
|
guint32 frame_count;
|
|
|
|
gint64 base_offset;
|
|
|
|
guint32 record_offsets[N_RECORDS_PER_GROUP];
|
|
|
|
} capsa_t;
|
|
|
|
|
2019-04-05 01:56:27 +00:00
|
|
|
static gboolean capsa_read(wtap *wth, wtap_rec *rec, Buffer *buf,
|
|
|
|
int *err, gchar **err_info, gint64 *data_offset);
|
2014-10-14 06:45:05 +00:00
|
|
|
static gboolean capsa_seek_read(wtap *wth, gint64 seek_off,
|
2018-02-09 00:19:12 +00:00
|
|
|
wtap_rec *rec, Buffer *buf, int *err, gchar **err_info);
|
|
|
|
static int capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec,
|
2014-10-14 06:45:05 +00:00
|
|
|
Buffer *buf, int *err, gchar **err_info);
|
|
|
|
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
static int capsa_file_type_subtype = -1;
|
|
|
|
static int packet_builder_file_type_subtype = -1;
|
|
|
|
|
|
|
|
void register_capsa(void);
|
|
|
|
|
2014-10-14 06:45:05 +00:00
|
|
|
wtap_open_return_val capsa_open(wtap *wth, int *err, gchar **err_info)
|
|
|
|
{
|
|
|
|
char magic[sizeof capsa_magic];
|
|
|
|
guint16 format_indicator;
|
|
|
|
int file_type_subtype;
|
|
|
|
guint32 number_of_frames;
|
|
|
|
capsa_t *capsa;
|
|
|
|
|
|
|
|
/* Read in the string that should be at the start of a Capsa file */
|
|
|
|
if (!wtap_read_bytes(wth->fh, magic, sizeof magic, err, err_info)) {
|
|
|
|
if (*err != WTAP_ERR_SHORT_READ)
|
|
|
|
return WTAP_OPEN_ERROR;
|
|
|
|
return WTAP_OPEN_NOT_MINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (memcmp(magic, capsa_magic, sizeof capsa_magic) != 0) {
|
|
|
|
return WTAP_OPEN_NOT_MINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the mysterious "format indicator" */
|
|
|
|
if (!wtap_read_bytes(wth->fh, &format_indicator, sizeof format_indicator,
|
|
|
|
err, err_info))
|
|
|
|
return WTAP_OPEN_ERROR;
|
|
|
|
format_indicator = GUINT16_FROM_LE(format_indicator);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure it's a format we support.
|
|
|
|
*/
|
|
|
|
switch (format_indicator) {
|
|
|
|
|
|
|
|
case 1: /* Capsa */
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
file_type_subtype = capsa_file_type_subtype;
|
2014-10-14 06:45:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* Packet Builder */
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
file_type_subtype = packet_builder_file_type_subtype;
|
2014-10-14 06:45:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
*err = WTAP_ERR_UNSUPPORTED;
|
2021-12-18 18:48:20 +00:00
|
|
|
*err_info = ws_strdup_printf("capsa: format indicator %u unsupported",
|
2014-10-14 06:45:05 +00:00
|
|
|
format_indicator);
|
|
|
|
return WTAP_OPEN_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Link speed, in megabytes/second?
|
|
|
|
*/
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(wth->fh, NULL, 2, err, err_info))
|
2014-10-14 08:47:37 +00:00
|
|
|
return WTAP_OPEN_ERROR;
|
2014-10-14 06:45:05 +00:00
|
|
|
|
|
|
|
/*
|
2015-08-12 05:42:26 +00:00
|
|
|
* Flags of some sort? Four 1-byte numbers, two of which are 1
|
|
|
|
* and two of which are zero? Two 2-byte numbers or flag fields,
|
|
|
|
* both of which are 1?
|
2014-10-14 06:45:05 +00:00
|
|
|
*/
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(wth->fh, NULL, 4, err, err_info))
|
2014-10-14 08:47:37 +00:00
|
|
|
return WTAP_OPEN_ERROR;
|
2014-10-14 06:45:05 +00:00
|
|
|
|
|
|
|
/*
|
2015-08-12 05:42:26 +00:00
|
|
|
* File size, in bytes.
|
2014-10-14 06:45:05 +00:00
|
|
|
*/
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(wth->fh, NULL, 4, err, err_info))
|
2014-10-14 08:47:37 +00:00
|
|
|
return WTAP_OPEN_ERROR;
|
2014-10-14 06:45:05 +00:00
|
|
|
|
|
|
|
/*
|
2015-08-12 05:42:26 +00:00
|
|
|
* Zeroes? Or upper 4 bytes of file size?
|
2014-10-14 06:45:05 +00:00
|
|
|
*/
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(wth->fh, NULL, 4, err, err_info))
|
2014-10-14 08:47:37 +00:00
|
|
|
return WTAP_OPEN_ERROR;
|
2014-10-14 06:45:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Count of packets.
|
|
|
|
*/
|
|
|
|
if (!wtap_read_bytes(wth->fh, &number_of_frames, sizeof number_of_frames,
|
|
|
|
err, err_info))
|
|
|
|
return WTAP_OPEN_ERROR;
|
|
|
|
number_of_frames = GUINT32_FROM_LE(number_of_frames);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip past what we think is file header.
|
|
|
|
*/
|
2014-10-16 00:55:04 +00:00
|
|
|
if (!file_seek(wth->fh, 0x44ef, SEEK_SET, err))
|
2014-10-14 06:45:05 +00:00
|
|
|
return WTAP_OPEN_ERROR;
|
|
|
|
|
|
|
|
wth->file_type_subtype = file_type_subtype;
|
2020-12-21 02:30:28 +00:00
|
|
|
capsa = g_new(capsa_t, 1);
|
2014-10-14 06:45:05 +00:00
|
|
|
capsa->format_indicator = format_indicator;
|
|
|
|
capsa->number_of_frames = number_of_frames;
|
|
|
|
capsa->frame_count = 0;
|
|
|
|
wth->priv = (void *)capsa;
|
|
|
|
wth->subtype_read = capsa_read;
|
|
|
|
wth->subtype_seek_read = capsa_seek_read;
|
|
|
|
/*
|
|
|
|
* XXX - we've never seen a Wi-Fi Capsa capture, so we don't
|
|
|
|
* yet know how to handle them.
|
|
|
|
*/
|
|
|
|
wth->file_encap = WTAP_ENCAP_ETHERNET;
|
|
|
|
wth->snapshot_length = 0; /* not available in header */
|
|
|
|
wth->file_tsprec = WTAP_TSPREC_USEC;
|
2020-07-29 08:30:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add an IDB; we don't know how many interfaces were
|
|
|
|
* involved, so we just say one interface, about which
|
|
|
|
* we only know the link-layer type, snapshot length,
|
|
|
|
* and time stamp resolution.
|
|
|
|
*/
|
|
|
|
wtap_add_generated_idb(wth);
|
|
|
|
|
2014-10-14 06:45:05 +00:00
|
|
|
return WTAP_OPEN_MINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the next packet */
|
2019-04-05 01:56:27 +00:00
|
|
|
static gboolean capsa_read(wtap *wth, wtap_rec *rec, Buffer *buf,
|
|
|
|
int *err, gchar **err_info, gint64 *data_offset)
|
2014-10-14 06:45:05 +00:00
|
|
|
{
|
|
|
|
capsa_t *capsa = (capsa_t *)wth->priv;
|
|
|
|
guint32 frame_within_block;
|
|
|
|
int padbytes;
|
|
|
|
|
|
|
|
if (capsa->frame_count == capsa->number_of_frames) {
|
|
|
|
/*
|
|
|
|
* No more frames left. Return an EOF.
|
|
|
|
*/
|
|
|
|
*err = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
frame_within_block = capsa->frame_count % N_RECORDS_PER_GROUP;
|
|
|
|
if (frame_within_block == 0) {
|
|
|
|
/*
|
|
|
|
* Here's a record offset block.
|
2014-10-16 00:55:04 +00:00
|
|
|
* Get the offset of the block, and then skip the
|
|
|
|
* first byte.
|
2014-10-14 06:45:05 +00:00
|
|
|
*/
|
2014-10-16 00:55:04 +00:00
|
|
|
capsa->base_offset = file_tell(wth->fh);
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(wth->fh, NULL, 1, err, err_info))
|
2014-10-16 00:55:04 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now read the record offsets.
|
|
|
|
*/
|
|
|
|
if (!wtap_read_bytes(wth->fh, &capsa->record_offsets,
|
2014-10-14 06:45:05 +00:00
|
|
|
sizeof capsa->record_offsets, err, err_info))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/*
|
2014-10-16 00:55:04 +00:00
|
|
|
* And finish processing all 805 bytes by skipping
|
|
|
|
* the last 4 bytes.
|
2014-10-14 06:45:05 +00:00
|
|
|
*/
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(wth->fh, NULL, 4, err, err_info))
|
2014-10-14 06:45:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*data_offset = capsa->base_offset +
|
|
|
|
GUINT32_FROM_LE(capsa->record_offsets[frame_within_block]);
|
|
|
|
if (!file_seek(wth->fh, *data_offset, SEEK_SET, err))
|
|
|
|
return FALSE;
|
|
|
|
|
2019-04-05 01:56:27 +00:00
|
|
|
padbytes = capsa_read_packet(wth, wth->fh, rec, buf, err, err_info);
|
2014-10-14 06:45:05 +00:00
|
|
|
if (padbytes == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip over the padding, if any.
|
|
|
|
*/
|
|
|
|
if (padbytes != 0) {
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(wth->fh, NULL, padbytes, err, err_info))
|
2014-10-14 06:45:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
capsa->frame_count++;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
capsa_seek_read(wtap *wth, gint64 seek_off,
|
2018-02-09 00:19:12 +00:00
|
|
|
wtap_rec *rec, Buffer *buf, int *err, gchar **err_info)
|
2014-10-14 06:45:05 +00:00
|
|
|
{
|
|
|
|
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
2018-02-09 00:19:12 +00:00
|
|
|
if (capsa_read_packet(wth, wth->random_fh, rec, buf, err, err_info) == -1) {
|
2014-10-14 06:45:05 +00:00
|
|
|
if (*err == 0)
|
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2018-02-09 00:19:12 +00:00
|
|
|
capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec,
|
2014-10-14 06:45:05 +00:00
|
|
|
Buffer *buf, int *err, gchar **err_info)
|
|
|
|
{
|
|
|
|
capsa_t *capsa = (capsa_t *)wth->priv;
|
|
|
|
struct capsarec_hdr capsarec_hdr;
|
|
|
|
struct pbrec_hdr pbrec_hdr;
|
|
|
|
guint32 rec_size;
|
|
|
|
guint32 packet_size;
|
|
|
|
guint32 orig_size;
|
|
|
|
guint32 header_size;
|
|
|
|
guint64 timestamp;
|
|
|
|
|
|
|
|
/* Read record header. */
|
|
|
|
switch (capsa->format_indicator) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
if (!wtap_read_bytes_or_eof(fh, &capsarec_hdr,
|
|
|
|
sizeof capsarec_hdr, err, err_info))
|
|
|
|
return -1;
|
|
|
|
rec_size = GUINT16_FROM_LE(capsarec_hdr.rec_len);
|
|
|
|
orig_size = GUINT16_FROM_LE(capsarec_hdr.orig_len);
|
|
|
|
packet_size = GUINT16_FROM_LE(capsarec_hdr.incl_len);
|
|
|
|
header_size = sizeof capsarec_hdr;
|
|
|
|
timestamp = (((guint64)GUINT32_FROM_LE(capsarec_hdr.timestamphi))<<32) + GUINT32_FROM_LE(capsarec_hdr.timestamplo);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OK, the rest of this is variable-length.
|
|
|
|
* We skip: (count1+count2)*4 bytes.
|
|
|
|
* XXX - what is that? Measured statistics?
|
|
|
|
* Calculated statistics?
|
|
|
|
*/
|
2016-09-28 23:45:23 +00:00
|
|
|
if (!wtap_read_bytes(fh, NULL,
|
|
|
|
(capsarec_hdr.count1 + capsarec_hdr.count2)*4,
|
|
|
|
err, err_info))
|
2014-10-14 06:45:05 +00:00
|
|
|
return -1;
|
|
|
|
header_size += (capsarec_hdr.count1 + capsarec_hdr.count2)*4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
if (!wtap_read_bytes_or_eof(fh, &pbrec_hdr,
|
|
|
|
sizeof pbrec_hdr, err, err_info))
|
|
|
|
return -1;
|
|
|
|
rec_size = GUINT16_FROM_LE(pbrec_hdr.rec_len);
|
|
|
|
orig_size = GUINT16_FROM_LE(pbrec_hdr.orig_len);
|
|
|
|
packet_size = GUINT16_FROM_LE(pbrec_hdr.incl_len);
|
|
|
|
header_size = sizeof pbrec_hdr;
|
|
|
|
timestamp = (((guint64)GUINT32_FROM_LE(pbrec_hdr.timestamphi))<<32) + GUINT32_FROM_LE(pbrec_hdr.timestamplo);
|
2014-10-14 19:30:00 +00:00
|
|
|
/*
|
2014-10-16 10:01:28 +00:00
|
|
|
* XXX - from the results of some conversions between
|
|
|
|
* Capsa format and pcap by Colasoft Packet Builder,
|
|
|
|
* I do not trust its conversion of time stamps (at
|
|
|
|
* least one of Colasoft's sample files, when
|
|
|
|
* converted to pcap format, has, as its time stamps,
|
|
|
|
* time stamps on the day after the conversion was
|
|
|
|
* done, which seems like more than just coincidence).
|
2014-10-14 19:30:00 +00:00
|
|
|
*/
|
2014-10-14 06:45:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2021-05-23 23:46:43 +00:00
|
|
|
ws_assert_not_reached();
|
2014-10-14 06:45:05 +00:00
|
|
|
*err = WTAP_ERR_INTERNAL;
|
2021-12-18 18:48:20 +00:00
|
|
|
*err_info = ws_strdup_printf("capsa: format indicator is %u", capsa->format_indicator);
|
2014-10-14 06:45:05 +00:00
|
|
|
return -1;
|
|
|
|
}
|
Allow bigger snapshot lengths for D-Bus captures.
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except
for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for
them, because that's the largest possible D-Bus message size. See
https://bugs.freedesktop.org/show_bug.cgi?id=100220
for an example of the problems caused by limiting the snapshot length to
256KB for D-Bus.
Have a snapshot length of 0 in a capture_file structure mean "there is
no snapshot length for the file"; we don't need the has_snap field in
that case, a value of 0 mean "no, we don't have a snapshot length".
In dumpcap, start out with a pipe buffer size of 2KB, and grow it as
necessary. When checking for a too-big packet from a pipe, check
against the appropriate maximum - 128MB for DLT_DBUS, 256KB for
everything else.
Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20
Reviewed-on: https://code.wireshark.org/review/21952
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-05 01:58:40 +00:00
|
|
|
if (orig_size > WTAP_MAX_PACKET_SIZE_STANDARD) {
|
2014-10-14 06:45:05 +00:00
|
|
|
/*
|
|
|
|
* Probably a corrupt capture file; don't blow up trying
|
|
|
|
* to allocate space for an immensely-large packet.
|
|
|
|
*/
|
|
|
|
*err = WTAP_ERR_BAD_FILE;
|
2021-12-18 18:48:20 +00:00
|
|
|
*err_info = ws_strdup_printf("capsa: File has %u-byte original length, bigger than maximum of %u",
|
Allow bigger snapshot lengths for D-Bus captures.
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except
for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for
them, because that's the largest possible D-Bus message size. See
https://bugs.freedesktop.org/show_bug.cgi?id=100220
for an example of the problems caused by limiting the snapshot length to
256KB for D-Bus.
Have a snapshot length of 0 in a capture_file structure mean "there is
no snapshot length for the file"; we don't need the has_snap field in
that case, a value of 0 mean "no, we don't have a snapshot length".
In dumpcap, start out with a pipe buffer size of 2KB, and grow it as
necessary. When checking for a too-big packet from a pipe, check
against the appropriate maximum - 128MB for DLT_DBUS, 256KB for
everything else.
Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20
Reviewed-on: https://code.wireshark.org/review/21952
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-05 01:58:40 +00:00
|
|
|
orig_size, WTAP_MAX_PACKET_SIZE_STANDARD);
|
2014-10-14 06:45:05 +00:00
|
|
|
return -1;
|
|
|
|
}
|
Allow bigger snapshot lengths for D-Bus captures.
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except
for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for
them, because that's the largest possible D-Bus message size. See
https://bugs.freedesktop.org/show_bug.cgi?id=100220
for an example of the problems caused by limiting the snapshot length to
256KB for D-Bus.
Have a snapshot length of 0 in a capture_file structure mean "there is
no snapshot length for the file"; we don't need the has_snap field in
that case, a value of 0 mean "no, we don't have a snapshot length".
In dumpcap, start out with a pipe buffer size of 2KB, and grow it as
necessary. When checking for a too-big packet from a pipe, check
against the appropriate maximum - 128MB for DLT_DBUS, 256KB for
everything else.
Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20
Reviewed-on: https://code.wireshark.org/review/21952
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-05 01:58:40 +00:00
|
|
|
if (packet_size > WTAP_MAX_PACKET_SIZE_STANDARD) {
|
2014-10-14 06:45:05 +00:00
|
|
|
/*
|
|
|
|
* Probably a corrupt capture file; don't blow up trying
|
|
|
|
* to allocate space for an immensely-large packet.
|
|
|
|
*/
|
|
|
|
*err = WTAP_ERR_BAD_FILE;
|
2021-12-18 18:48:20 +00:00
|
|
|
*err_info = ws_strdup_printf("capsa: File has %u-byte packet, bigger than maximum of %u",
|
Allow bigger snapshot lengths for D-Bus captures.
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except
for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for
them, because that's the largest possible D-Bus message size. See
https://bugs.freedesktop.org/show_bug.cgi?id=100220
for an example of the problems caused by limiting the snapshot length to
256KB for D-Bus.
Have a snapshot length of 0 in a capture_file structure mean "there is
no snapshot length for the file"; we don't need the has_snap field in
that case, a value of 0 mean "no, we don't have a snapshot length".
In dumpcap, start out with a pipe buffer size of 2KB, and grow it as
necessary. When checking for a too-big packet from a pipe, check
against the appropriate maximum - 128MB for DLT_DBUS, 256KB for
everything else.
Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20
Reviewed-on: https://code.wireshark.org/review/21952
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-05 01:58:40 +00:00
|
|
|
packet_size, WTAP_MAX_PACKET_SIZE_STANDARD);
|
2014-10-14 06:45:05 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (header_size + packet_size > rec_size) {
|
|
|
|
/*
|
|
|
|
* Probably a corrupt capture file.
|
|
|
|
*/
|
|
|
|
*err = WTAP_ERR_BAD_FILE;
|
2021-12-18 18:48:20 +00:00
|
|
|
*err_info = ws_strdup_printf("capsa: File has %u-byte packet with %u-byte record header, bigger than record size %u",
|
2014-10-14 06:45:05 +00:00
|
|
|
packet_size, header_size, rec_size);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The "on the wire" record size always includes the CRC.
|
|
|
|
* If it's greater than the "captured" size by 4, then
|
|
|
|
* we subtract 4 from it, to reflect the way the "on the wire"
|
|
|
|
* record size works for other file formats.
|
|
|
|
*/
|
|
|
|
if (orig_size == packet_size + 4)
|
|
|
|
orig_size = packet_size;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We assume there's no FCS in this frame.
|
|
|
|
* XXX - is there ever one?
|
|
|
|
*/
|
2018-02-09 00:19:12 +00:00
|
|
|
rec->rec_header.packet_header.pseudo_header.eth.fcs_len = 0;
|
|
|
|
|
|
|
|
rec->rec_type = REC_TYPE_PACKET;
|
2021-08-30 02:12:13 +00:00
|
|
|
rec->block = wtap_block_create(WTAP_BLOCK_PACKET);
|
2018-02-09 00:19:12 +00:00
|
|
|
rec->rec_header.packet_header.caplen = packet_size;
|
|
|
|
rec->rec_header.packet_header.len = orig_size;
|
|
|
|
rec->presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_TS;
|
|
|
|
rec->ts.secs = (time_t)(timestamp / 1000000);
|
|
|
|
rec->ts.nsecs = ((int)(timestamp % 1000000))*1000;
|
2014-10-14 06:45:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Read the packet data.
|
|
|
|
*/
|
|
|
|
if (!wtap_read_packet_bytes(fh, buf, packet_size, err, err_info))
|
|
|
|
return -1; /* failed */
|
|
|
|
|
|
|
|
return rec_size - (header_size + packet_size);
|
|
|
|
}
|
2015-01-02 00:45:22 +00:00
|
|
|
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
static const struct supported_block_type capsa_blocks_supported[] = {
|
|
|
|
/*
|
|
|
|
* We support packet blocks, with no comments or other options.
|
|
|
|
*/
|
|
|
|
{ WTAP_BLOCK_PACKET, MULTIPLE_BLOCKS_SUPPORTED, NO_OPTIONS_SUPPORTED }
|
|
|
|
};
|
|
|
|
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
static const struct file_type_subtype_info capsa_info = {
|
|
|
|
"Colasoft Capsa format", "capsa", "cscpkt", NULL,
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
FALSE, BLOCKS_SUPPORTED(capsa_blocks_supported),
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
NULL, NULL, NULL
|
|
|
|
};
|
|
|
|
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
static const struct supported_block_type packet_builder_blocks_supported[] = {
|
|
|
|
/*
|
|
|
|
* We support packet blocks, with no comments or other options.
|
|
|
|
*/
|
|
|
|
{ WTAP_BLOCK_PACKET, MULTIPLE_BLOCKS_SUPPORTED, NO_OPTIONS_SUPPORTED }
|
|
|
|
};
|
|
|
|
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
static const struct file_type_subtype_info packet_builder_info = {
|
|
|
|
"Colasoft Packet Builder format", "colasoft-pb", "cscpkt", NULL,
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
FALSE, BLOCKS_SUPPORTED(packet_builder_blocks_supported),
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
NULL, NULL, NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
void register_capsa(void)
|
|
|
|
{
|
2021-02-24 03:10:35 +00:00
|
|
|
capsa_file_type_subtype = wtap_register_file_type_subtype(&capsa_info);
|
|
|
|
packet_builder_file_type_subtype = wtap_register_file_type_subtype(&packet_builder_info);
|
wiretap: more work on file type/subtypes.
Provide a wiretap routine to get an array of all savable file
type/subtypes, sorted with pcap and pcapng at the top, followed by the
other types, sorted either by the name or the description.
Use that routine to list options for the -F flag for various commands
Rename wtap_get_savable_file_types_subtypes() to
wtap_get_savable_file_types_subtypes_for_file(), to indicate that it
provides an array of all file type/subtypes in which a given file can be
saved. Have it sort all types, other than the default type/subtype and,
if there is one, the "other" type (both of which are put at the top), by
the name or the description.
Don't allow wtap_register_file_type_subtypes() to override any existing
registrations; have them always register a new type. In that routine,
if there are any emply slots in the table, due to an entry being
unregistered, use it rather than allocating a new slot.
Don't allow unregistration of built-in types.
Rename the "dump open table" to the "file type/subtype table", as it has
entries for all types/subtypes, even if we can't write them.
Initialize that table in a routine that pre-allocates the GArray before
filling it with built-in types/subtypes, so it doesn't keep getting
reallocated.
Get rid of wtap_num_file_types_subtypes - it's just a copy of the size
of the GArray.
Don't have wtap_file_type_subtype_description() crash if handed an
file type/subtype that isn't a valid array index - just return NULL, as
we do with wtap_file_type_subtype_name().
In wtap_name_to_file_type_subtype(), don't use WTAP_FILE_TYPE_SUBTYPE_
names for the backwards-compatibility names - map those names to the
current names, and then look them up. This reduces the number of
uses of hardwired WTAP_FILE_TYPE_SUBTYPE_ values.
Clean up the type of wtap_module_count - it has no need to be a gulong.
Have built-in wiretap file handlers register names to be used for their
file type/subtypes, rather than building the table in init.lua.
Add a new Lua C function get_wtap_filetypes() to construct the
wtap_filetypes table, based on the registered names, and use it in
init.lua.
Add a #define WSLUA_INTERNAL_FUNCTION to register functions intended
only for internal use in init.lua, so they can be made available from
Lua without being documented.
Get rid of WTAP_NUM_FILE_TYPES_SUBTYPES - most code has no need to use
it, as it can just request arrays of types, and the space of
type/subtype codes can be sparse due to registration in any case, so
code has to be careful using it.
wtap_get_num_file_types_subtypes() is no longer used, so remove it. It
returns the number of elements in the file type/subtype array, which is
not necessarily the name of known file type/subtypes, as there may have
been some deregistered types, and those types do *not* get removed from
the array, they just get cleared so that they're available for future
allocation (we don't want the indices of any registered types to changes
if another type is deregistered, as those indicates are the type/subtype
values, so we can't shrink the array).
Clean up white space and remove some comments that shouldn't have been
added.
2021-02-17 06:24:47 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register names for backwards compatibility with the
|
|
|
|
* wtap_filetypes table in Lua.
|
|
|
|
*/
|
|
|
|
wtap_register_backwards_compatibility_lua_name("COLASOFT_CAPSA",
|
|
|
|
capsa_file_type_subtype);
|
|
|
|
wtap_register_backwards_compatibility_lua_name("COLASOFT_PACKET_BUILDER",
|
|
|
|
packet_builder_file_type_subtype);
|
wiretap: register most built-in file types from its module.
Remove most of the built-in file types from the table in
wiretap/file_access.c and, instead, have the file types register
themselves, using wtap_register_file_type_subtypes().
This reduces the source code changes needed to add a new file type from
three (add the handler, add the file type to the table in file_access.c,
add a #define for the file type in wiretap/wtap.h) to one (add the
handler). (It also requires adding the handler's source file to
wiretap/CMakeLists.txt, but that's required in both cases.)
A few remain because the WTAP_FILE_TYPE_SUBTYPE_ #define is used
elsewhere; that needs to be fixed.
Fix the wiretap/CMakefile.txt file to scan k12text.l, as that now
contains a registration routine. In the process, avoid scanning files
that don't implement a file type and won't ever have a registration
routine.
Add a Lua routine to fetch the total number of file types; we use that
in some code to construct the wtap_filetypes table, which we need to do
in order to continue to have all the values that used to come from the
WTAP_FILE_TYPE_SUBTYPE_ types.
While we're at it, add modelines to a file that lacked them.
2021-02-14 08:34:10 +00:00
|
|
|
}
|
|
|
|
|
2015-01-02 00:45:22 +00:00
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2015-01-02 00:45:22 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|