diff options
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 9 | ||||
-rw-r--r-- | ui/win32/file_dlg_win32.c | 9 | ||||
-rw-r--r-- | wiretap/file_access.c | 95 | ||||
-rw-r--r-- | wiretap/wtap.h | 22 |
4 files changed, 78 insertions, 57 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index f9c4f97374..16df1c0631 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -379,16 +379,15 @@ QStringList CaptureFileDialog::buildFileOpenTypeList() { filters << QString(tr("All Files (" ALL_FILES_WILDCARD ")")); /* - * Add an "All Capture Files" entry, with all the extensions we - * know about. + * Add an "All Capture Files" entry, with all the capture file + * extensions we know about. */ filter = tr("All Capture Files"); /* - * Construct its list of patterns from a list of all extensions - * we support. + * Construct its list of patterns. */ - extensions_list = wtap_get_all_file_extensions_list(); + extensions_list = wtap_get_all_capture_file_extensions_list(); sep = " ("; for (extension = extensions_list; extension != NULL; extension = g_slist_next(extension)) { diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index ab4c92bfa7..7c25f16378 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -1488,19 +1488,18 @@ build_file_open_type_list(void) { sa = g_array_append_val(sa, zero); /* - * Add an "All Capture Files" entry, with all the extensions we - * know about. + * Add an "All Capture Files" entry, with all the capture file + * extensions we know about. */ str16 = utf_8to16("All Capture Files"); sa = g_array_append_vals(sa, str16, (guint) strlen("All Capture Files")); sa = g_array_append_val(sa, zero); /* - * Construct its list of patterns from a list of all extensions - * we support. + * Construct its list of patterns. */ pattern_str = g_string_new(""); - extensions_list = wtap_get_all_file_extensions_list(); + extensions_list = wtap_get_all_capture_file_extensions_list(); sep = '\0'; for (extension = extensions_list; extension != NULL; extension = g_slist_next(extension)) { diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 1466f562ff..434ec12490 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -124,36 +124,36 @@ add_extensions(GSList *extensions, const gchar *extension, * extension used by a number of capture file types. */ static const struct file_extension_info file_type_extensions_base[] = { - { "Wireshark/tcpdump/... - pcap", "pcap;cap;dmp" }, - { "Wireshark/... - pcapng", "pcapng;ntar" }, - { "Network Monitor, Surveyor, NetScaler", "cap" }, - { "InfoVista 5View capture", "5vw" }, - { "Sniffer (DOS)", "cap;enc;trc;fdc;syc" }, - { "Cinco NetXRay, Sniffer (Windows)", "cap;caz" }, - { "Endace ERF capture", "erf" }, - { "EyeSDN USB S0/E1 ISDN trace format", "trc" }, - { "HP-UX nettl trace", "trc0;trc1" }, - { "Network Instruments Observer", "bfr" }, - { "Colasoft Capsa", "cscpkt" }, - { "Novell LANalyzer", "tr1" }, - { "Tektronix K12xx 32-bit .rf5 format", "rf5" }, - { "Savvius *Peek", "pkt;tpc;apc;wpz" }, - { "Catapult DCT2000 trace (.out format)", "out" }, - { "Micropross mplog", "mplog" }, - { "MPEG files", "mpg;mp3" }, - { "TamoSoft CommView", "ncf" }, - { "Symbian OS btsnoop", "log" }, - { "Transport-Neutral Encapsulation Format", "tnef" }, - { "XML files (including Gammu DCT3 traces)", "xml" }, - { "OS X PacketLogger", "pklg" }, - { "Daintree SNA", "dcf" }, - { "JPEG/JFIF files", "jpg;jpeg;jfif" }, - { "IPFIX File Format", "pfx;ipfix" }, - { "Aethra .aps file", "aps" }, - { "MPEG2 transport stream", "mp2t;ts;mpg" }, - { "Ixia IxVeriWave .vwr Raw 802.11 Capture", "vwr" }, - { "CAM Inspector file", "camins" }, - { "JavaScript Object Notation file", "json" } + { "Wireshark/tcpdump/... - pcap", TRUE, "pcap;cap;dmp" }, + { "Wireshark/... - pcapng", TRUE, "pcapng;ntar" }, + { "Network Monitor, Surveyor, NetScaler", TRUE, "cap" }, + { "InfoVista 5View capture", TRUE, "5vw" }, + { "Sniffer (DOS)", TRUE, "cap;enc;trc;fdc;syc" }, + { "Cinco NetXRay, Sniffer (Windows)", TRUE, "cap;caz" }, + { "Endace ERF capture", TRUE, "erf" }, + { "EyeSDN USB S0/E1 ISDN trace format", TRUE, "trc" }, + { "HP-UX nettl trace", TRUE, "trc0;trc1" }, + { "Network Instruments Observer", TRUE, "bfr" }, + { "Colasoft Capsa", TRUE, "cscpkt" }, + { "Novell LANalyzer", TRUE, "tr1" }, + { "Tektronix K12xx 32-bit .rf5 format", TRUE, "rf5" }, + { "Savvius *Peek", TRUE, "pkt;tpc;apc;wpz" }, + { "Catapult DCT2000 trace (.out format)", TRUE, "out" }, + { "Micropross mplog", TRUE, "mplog" }, + { "TamoSoft CommView", TRUE, "ncf" }, + { "Symbian OS btsnoop", TRUE, "log" }, + { "XML files (including Gammu DCT3 traces)", TRUE, "xml" }, + { "OS X PacketLogger", TRUE, "pklg" }, + { "Daintree SNA", TRUE, "dcf" }, + { "IPFIX File Format", TRUE, "pfx;ipfix" }, + { "Aethra .aps file", TRUE, "aps" }, + { "MPEG2 transport stream", TRUE, "mp2t;ts;mpg" }, + { "Ixia IxVeriWave .vwr Raw 802.11 Capture", TRUE, "vwr" }, + { "CAM Inspector file", TRUE, "camins" }, + { "MPEG files", FALSE, "mpg;mp3" }, + { "Transport-Neutral Encapsulation Format", FALSE, "tnef" }, + { "JPEG/JFIF files", FALSE, "jpg;jpeg;jfif" }, + { "JavaScript Object Notation file", FALSE, "json" } }; #define N_FILE_TYPE_EXTENSIONS (sizeof file_type_extensions_base / sizeof file_type_extensions_base[0]) @@ -253,14 +253,24 @@ wtap_get_file_extension_type_extensions(guint extension_type) return extensions; } -/* Return a list of all extensions that are used by all file types, - including compressed extensions, e.g. not just "pcap" but also - "pcap.gz" if we can read gzipped files. +/* Return a list of all extensions that are used by all capture file + types, including compressed extensions, e.g. not just "pcap" but + also "pcap.gz" if we can read gzipped files. + + "Capture files" means "include file types that correspond to + collections of network packets, but not file types that + store data that just happens to be transported over protocols + such as HTTP but that aren't collections of network packets", + so that it could be used for "All Capture Files" without picking + up JPEG files or files such as that - those aren't capture files, + and we *do* have them listed in the long list of individual file + types, so omitting them from "All Capture Files" is the right + thing to do. All strings in the list are allocated with g_malloc() and must be freed with g_free(). */ GSList * -wtap_get_all_file_extensions_list(void) +wtap_get_all_capture_file_extensions_list(void) { GSList *extensions; unsigned int i; @@ -271,11 +281,17 @@ wtap_get_all_file_extensions_list(void) for (i = 0; i < file_type_extensions_arr->len; i++) { /* - * Add all this file extension type's extensions, with - * compressed variants. + * Is this a capture file, rather than one of the + * other random file types we can read? */ - extensions = add_extensions_for_file_extensions_type(i, - extensions, compressed_file_extension_table); + if (file_type_extensions[i].is_capture_file) { + /* + * Yes. Add all this file extension type's + * extensions, with compressed variants. + */ + extensions = add_extensions_for_file_extensions_type(i, + extensions, compressed_file_extension_table); + } } return extensions; @@ -2068,7 +2084,8 @@ wtap_get_file_extensions_list(int file_type_subtype, gboolean include_compressed /* * Free a list returned by wtap_get_file_extension_type_extensions(), - * wtap_get_all_file_extensions_list, or wtap_get_file_extensions_list(). + * wtap_get_all_capture_file_extensions_list, or + * wtap_get_file_extensions_list(). */ void wtap_free_extensions_list(GSList *extensions) diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 20a3b188f3..7a8b1d94c2 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1359,23 +1359,29 @@ typedef struct wtap_wslua_file_info { } wtap_wslua_file_info_t; /* - * For registering extensions used for capture file formats. + * For registering extensions used for file formats. * * These items are used in dialogs for opening files, so that * the user can ask to see all capture files (as identified * by file extension) or particular types of capture files. * - * Each file type has a description and a list of extensions the file - * might have. Some file types aren't real file types, they're - * just generic types, such as "text file" or "XML file", that can - * be used for, among other things, captures we can read, or for - * extensions such as ".cap" that were unimaginatively chosen by - * several different sniffers for their file formats. + * Each file type has a description, a flag indicating whether it's + * a capture file or just some file whose contents we can dissect, + * and a list of extensions the file might have. + * + * Some file types aren't real file types, they're just generic types, + * such as "text file" or "XML file", that can be used for, among other + * things, captures we can read, or for extensions such as ".cap" that + * were unimaginatively chosen by several different sniffers for their + * file formats. */ struct file_extension_info { /* the file type name */ const char *name; + /* TRUE if this is a capture file type */ + gboolean is_capture_file; + /* a semicolon-separated list of file extensions used for this type */ const char *extensions; }; @@ -1897,7 +1903,7 @@ int wtap_short_string_to_file_type_subtype(const char *short_name); /*** various file extension functions ***/ WS_DLL_PUBLIC -GSList *wtap_get_all_file_extensions_list(void); +GSList *wtap_get_all_capture_file_extensions_list(void); WS_DLL_PUBLIC const char *wtap_default_file_extension(int filetype); WS_DLL_PUBLIC |