summaryrefslogtreecommitdiffstats
path: root/fileset.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
commit9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 (patch)
tree2784370cda9bbf2da9114d70f05399c0b229d28c /fileset.h
parentAdding debian version 4.2.6-1. (diff)
downloadwireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.tar.xz
wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fileset.h')
-rw-r--r--fileset.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/fileset.h b/fileset.h
index 9155b43f..06680bfc 100644
--- a/fileset.h
+++ b/fileset.h
@@ -12,6 +12,9 @@
#ifndef __FILESET_H__
#define __FILESET_H__
+#include <inttypes.h>
+#include <time.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -21,13 +24,30 @@ typedef struct _fileset_entry {
char *name; /* File name without path (g_strdup'ed) */
time_t ctime; /* create time */
time_t mtime; /* last modified time */
- gint64 size; /* size of file in bytes */
- gboolean current; /* is this the currently loaded file? */
+ int64_t size; /* size of file in bytes */
+ bool current; /* is this the currently loaded file? */
} fileset_entry;
-
-/* helper: is this a probable file of a file set (does the naming pattern match)? */
-extern gboolean fileset_filename_match_pattern(const char *fname);
+typedef enum {
+ FILESET_NO_MATCH,
+ FILESET_TIME_NUM,
+ FILESET_NUM_TIME
+} fileset_match_t;
+
+/* helper: is this a probable file of a file set (does the naming pattern match)?
+ * Possible naming patterns are prefix_NNNNN_YYYYMMDDHHMMSS.ext[.gz] and
+ * prefix_YYYYMMDDHHMMSS_NNNNN.ext[.gz], where any compression suffix
+ * supported by libwiretap is allowed. The validation is minimal; e.g., the
+ * time is only checked to see if all 14 characters are digits.
+ *
+ * @param[in] fname The filename to check for a naming pattern.
+ * @param[out] prefix If not NULL and the filename matches, the prefix
+ * @param[out] suffix If not NULL and the filename matches, the suffix
+ * (file extension) not including the compression suffix
+ * @param[out] time If not NULL and the filename matches, the time component
+ * @return The type of pattern match, or FILESET_NO_MATCH.
+ * */
+extern fileset_match_t fileset_filename_match_pattern(const char *fname, char **prefix, char **suffix, char **time);
extern void fileset_add_dir(const char *fname, void *window);