aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/systemd_journal.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-02-19 14:46:42 -0800
committerGuy Harris <gharris@sonic.net>2021-02-19 23:20:24 +0000
commitc80c16759ba23e29c70ec8fbe62e0a9870685a66 (patch)
tree713e51f79d78658eee7ad6eab0614d4627515d79 /wiretap/systemd_journal.c
parentabf9e027fcc43cc9b458fb881f4f615d314ee7f6 (diff)
wiretap: eliminate two WTAP_FILE_TYPE_SUBTYPE_ values.
Eliminate WTAP_FILE_TYPE_SUBTYPE_ERF and WTAP_FILE_TYPE_SUBTYPE_SYSTEMD_JOURNAL - instead, fetch the values by name, using wtap_name_to_file_type_subtype(). This requires that wtap_init() be called before epan_init(); that's currently the case, but put in comments to indicate why it must continue to be the case.
Diffstat (limited to 'wiretap/systemd_journal.c')
-rw-r--r--wiretap/systemd_journal.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/wiretap/systemd_journal.c b/wiretap/systemd_journal.c
index 4414404199..621241e8f8 100644
--- a/wiretap/systemd_journal.c
+++ b/wiretap/systemd_journal.c
@@ -62,6 +62,10 @@ static gboolean systemd_journal_read_export_entry(FILE_T fh, wtap_rec *rec,
#define FLD__REALTIME_TIMESTAMP "__REALTIME_TIMESTAMP="
#define FLD__MONOTONIC_TIMESTAMP "__MONOTONIC_TIMESTAMP="
+static int systemd_journal_file_type_subtype = -1;
+
+void register_systemd_journal(void);
+
wtap_open_return_val systemd_journal_open(wtap *wth, int *err _U_, gchar **err_info _U_)
{
gchar *entry_buff = (gchar*) g_malloc(MAX_EXPORT_ENTRY_LENGTH);
@@ -97,7 +101,7 @@ wtap_open_return_val systemd_journal_open(wtap *wth, int *err _U_, gchar **err_i
return WTAP_OPEN_NOT_MINE;
}
- wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_SYSTEMD_JOURNAL;
+ wth->file_type_subtype = systemd_journal_file_type_subtype;
wth->subtype_read = systemd_journal_read;
wth->subtype_seek_read = systemd_journal_seek_read;
wth->file_encap = WTAP_ENCAP_SYSTEMD_JOURNAL;
@@ -232,6 +236,24 @@ systemd_journal_read_export_entry(FILE_T fh, wtap_rec *rec, Buffer *buf, int *er
return TRUE;
}
+static const struct file_type_subtype_info systemd_journal_info = {
+ "systemd journal export", "systemd_journal", NULL, NULL,
+ FALSE, FALSE, 0,
+ NULL, NULL, NULL
+};
+
+void register_systemd_journal(void)
+{
+ systemd_journal_file_type_subtype = wtap_register_file_type_subtypes(&systemd_journal_info);
+
+ /*
+ * Register name for backwards compatibility with the
+ * wtap_filetypes table in Lua.
+ */
+ wtap_register_backwards_compatibility_lua_name("SYSTEMD_JOURNAL",
+ systemd_journal_file_type_subtype);
+}
+
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*