aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_wrappers.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-01-21 08:59:21 +0000
committerGuy Harris <guy@alum.mit.edu>2012-01-21 08:59:21 +0000
commite4a193fe5e93318600be3af08eec7aaa4adcb1bc (patch)
tree3f904c84590e9cf4e6037e12938c6d9bb36df6ce /wiretap/file_wrappers.c
parent020d9491da11833e3cfa9c3842673e977bcea462 (diff)
Replace wtap_file_extensions_string() with a routine that returns a
GSList of extensions for a file type, including extensions for the compressed versions of those file types that we can read. svn path=/trunk/; revision=40623
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r--wiretap/file_wrappers.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 7baa0abe07..a5f4739f15 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -73,6 +73,37 @@
* Bzip2 format: http://bzip.org/
*/
+/*
+ * List of extensions for compressed files.
+ * If we add support for more compressed file types, this table
+ * might be expanded to include routines to handle the various
+ * compression types.
+ */
+static const char *compressed_file_extensions[] = {
+#ifdef HAVE_LIBZ
+ "gz",
+#endif
+ NULL
+};
+
+/*
+ * Return a GSList of all the compressed file extensions.
+ * The data pointers all point to items in compressed_file_extensions[],
+ * so the GSList can just be freed with g_slist_free().
+ */
+GSList *
+wtap_get_compressed_file_extensions(void)
+{
+ const char **extension;
+ GSList *extensions;
+
+ extensions = NULL;
+ for (extension = &compressed_file_extensions[0]; *extension != NULL;
+ extension++)
+ extensions = g_slist_append(extensions, (gpointer)(*extension));
+ return extensions;
+}
+
/* #define GZBUFSIZE 8192 */
#define GZBUFSIZE 4096