aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-02-17 22:26:02 -0800
committerGuy Harris <gharris@sonic.net>2021-02-18 07:48:11 +0000
commit8b775000bc304b36a4fc033282df3fa88e83ff78 (patch)
tree760264ad1ddc9985ba30a5eac001599b1f3928a9 /wiretap
parentc9423a9a132beaa78e6ce916d9e161ae2ddc63fb (diff)
wiretap: register BUSMASTER log and candump file formats.
*Don't* use WTAP_FILE_TYPE_SUBTYPE_UNKNOWN for the file type/subtype.
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/busmaster.c25
-rw-r--r--wiretap/candump.c21
2 files changed, 44 insertions, 2 deletions
diff --git a/wiretap/busmaster.c b/wiretap/busmaster.c
index 8dee4ed6dd..e57e13acc3 100644
--- a/wiretap/busmaster.c
+++ b/wiretap/busmaster.c
@@ -33,6 +33,18 @@ busmaster_seek_read(wtap *wth, gint64 seek_off,
wtap_rec *rec, Buffer *buf,
int *err, gchar **err_info);
+static int busmaster_file_type_subtype = -1;
+
+void register_busmaster(void);
+
+/*
+ * See
+ *
+ * http://rbei-etas.github.io/busmaster/
+ *
+ * for the BUSMASTER software.
+ */
+
static gboolean
busmaster_gen_packet(wtap_rec *rec, Buffer *buf,
const busmaster_priv_t *priv_entry, const msg_t *msg,
@@ -252,7 +264,7 @@ busmaster_open(wtap *wth, int *err, char **err_info)
wth->subtype_close = busmaster_close;
wth->subtype_read = busmaster_read;
wth->subtype_seek_read = busmaster_seek_read;
- wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
+ wth->file_type_subtype = busmaster_file_type_subtype;
wth->file_encap = WTAP_ENCAP_WIRESHARK_UPPER_PDU;
wth->file_tsprec = WTAP_TSPREC_USEC;
@@ -430,6 +442,17 @@ busmaster_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec,
return busmaster_gen_packet(rec, buf, priv_entry, &state.msg, err, err_info);
}
+static const struct file_type_subtype_info busmaster_info = {
+ "BUSMASTER log file", "busmaster", "log", NULL,
+ FALSE, FALSE, 0,
+ NULL, NULL, NULL
+};
+
+void register_busmaster(void)
+{
+ busmaster_file_type_subtype = wtap_register_file_type_subtypes(&busmaster_info);
+}
+
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
diff --git a/wiretap/candump.c b/wiretap/candump.c
index 0def7bcb50..dd85992e96 100644
--- a/wiretap/candump.c
+++ b/wiretap/candump.c
@@ -26,6 +26,14 @@ static gboolean candump_seek_read(wtap *wth, gint64 seek_off,
wtap_rec *rec, Buffer *buf,
int *err, gchar **err_info);
+static int candump_file_type_subtype = -1;
+
+void register_candump(void);
+
+/*
+ * This is written by the candump utility on Linux.
+ */
+
static void
candump_write_packet(wtap_rec *rec, Buffer *buf, const msg_t *msg)
{
@@ -164,7 +172,7 @@ candump_open(wtap *wth, int *err, char **err_info)
}
wth->priv = NULL;
- wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
+ wth->file_type_subtype = candump_file_type_subtype;
wth->file_encap = WTAP_ENCAP_WIRESHARK_UPPER_PDU;
wth->file_tsprec = WTAP_TSPREC_USEC;
wth->subtype_read = candump_read;
@@ -221,6 +229,17 @@ candump_seek_read(wtap *wth , gint64 seek_off, wtap_rec *rec,
return TRUE;
}
+static const struct file_type_subtype_info candump_info = {
+ "Linux candump file", "candump", NULL, NULL,
+ FALSE, FALSE, 0,
+ NULL, NULL, NULL
+};
+
+void register_candump(void)
+{
+ candump_file_type_subtype = wtap_register_file_type_subtypes(&candump_info);
+}
+
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*