forked from osmocom/wireshark
Add an API to get a description of a compression type, and use it.
Add wtap_compression_type_description(), which returns NULL for WTAP_UNCOMPRESSED and a descriptive string for other compression types. Instead of checking for WTAP_GZIP_COMPRESSED and appending "(gzip compressed)", just pass the compression type to wtap_compression_type_description() and, if the result is non-null, append its result, wrapped in parentheses, with a space before the left parenthesis. Change-Id: I79a999c7838a883953795d5cbab009966e14b65e Reviewed-on: https://code.wireshark.org/review/30666 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>thomas/dect
parent
eea4997f7e
commit
b894c53d5e
14
capinfos.c
14
capinfos.c
|
@ -583,10 +583,16 @@ print_stats(const gchar *filename, capture_info *cf_info)
|
|||
file_encap_string = wtap_encap_string(cf_info->file_encap);
|
||||
|
||||
if (filename) printf ("File name: %s\n", filename);
|
||||
if (cap_file_type) printf ("File type: %s%s\n",
|
||||
file_type_string,
|
||||
cf_info->compression_type == WTAP_GZIP_COMPRESSED ? " (gzip compressed)" : "");
|
||||
|
||||
if (cap_file_type) {
|
||||
const char *compression_type_description;
|
||||
compression_type_description = wtap_compression_type_description(cf_info->compression_type);
|
||||
if (compression_type_description == NULL)
|
||||
printf ("File type: %s\n",
|
||||
file_type_string);
|
||||
else
|
||||
printf ("File type: %s (%s)\n",
|
||||
file_type_string, compression_type_description);
|
||||
}
|
||||
if (cap_file_encap) {
|
||||
printf ("File encapsulation: %s\n", file_encap_string);
|
||||
if (cf_info->file_encap == WTAP_ENCAP_PER_PACKET) {
|
||||
|
|
|
@ -177,8 +177,9 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
|
|||
<< table_row_end;
|
||||
|
||||
QString format_str = wtap_file_type_subtype_string(summary.file_type);
|
||||
if (summary.compression_type == WTAP_GZIP_COMPRESSED) {
|
||||
format_str.append(tr(" (gzip compressed)"));
|
||||
const char *compression_type_description = wtap_compression_type_description(summary.compression_type);
|
||||
if (compression_type_description != NULL) {
|
||||
format_str += QString::asprintf(" (%s)", compression_type_description);
|
||||
}
|
||||
out << table_row_begin
|
||||
<< table_vheader_tmpl.arg(tr("Format"))
|
||||
|
|
|
@ -107,8 +107,9 @@ QString GsmMapSummaryDialog::summaryToHtml()
|
|||
<< table_row_end;
|
||||
|
||||
QString format_str = wtap_file_type_subtype_string(summary.file_type);
|
||||
if (summary.compression_type == WTAP_GZIP_COMPRESSED) {
|
||||
format_str.append(tr(" (gzip compressed)"));
|
||||
const char *compression_type_description = wtap_compression_type_description(summary.compression_type);
|
||||
if (compression_type_description != NULL) {
|
||||
format_str += QString::asprintf(" (%s)", compression_type_description);
|
||||
}
|
||||
out << table_row_begin
|
||||
<< table_vheader_tmpl.arg(tr("Format"))
|
||||
|
|
|
@ -111,8 +111,9 @@ QString Mtp3SummaryDialog::summaryToHtml()
|
|||
<< table_row_end;
|
||||
|
||||
QString format_str = wtap_file_type_subtype_string(summary.file_type);
|
||||
if (summary.compression_type == WTAP_GZIP_COMPRESSED) {
|
||||
format_str.append(tr(" (gzip compressed)"));
|
||||
const char *compression_type_description = wtap_compression_type_description(summary.compression_type);
|
||||
if (compression_type_description != NULL) {
|
||||
format_str += QString::asprintf(" (%s)", compression_type_description);
|
||||
}
|
||||
out << table_row_begin
|
||||
<< table_vheader_tmpl.arg(tr("Format"))
|
||||
|
|
|
@ -936,10 +936,6 @@
|
|||
<source>Hash (SHA1)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (gzip-komprimiert)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
@ -3068,10 +3064,6 @@ Achtung: Eine Option MUSS ausgewählt sein.</translation>
|
|||
<source>Length</source>
|
||||
<translation>Länge</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (gzip komprimiert)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
@ -7884,10 +7876,6 @@ Achtung: Eine Option MUSS ausgewählt sein.</translation>
|
|||
<source>Length</source>
|
||||
<translation>Länge</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (gzip-komprimiert)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
|
|
@ -936,10 +936,6 @@
|
|||
<source>Hash (SHA1)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -3056,10 +3052,6 @@ PLEASE NOTE: One option MUST be selected.</source>
|
|||
<source>Length</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -7818,10 +7810,6 @@ PLEASE NOTE: One option MUST be selected.</source>
|
|||
<source>Length</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
|
|
@ -913,10 +913,6 @@
|
|||
<source>Hash (SHA1)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation>(compressé gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
@ -3036,10 +3032,6 @@ NOTE: Une option DOIT être sélectionnée.</translation>
|
|||
<source>Length</source>
|
||||
<translation>Longueur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation>(compressé gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
@ -7848,10 +7840,6 @@ Changer la direction de la connexion (voir le flux inverse).</p></body&
|
|||
<source>Length</source>
|
||||
<translation>Longueur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation>(compressé gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
|
|
@ -936,10 +936,6 @@
|
|||
<source>Hash (SHA1)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (compresso con gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Formato</translation>
|
||||
|
@ -3068,10 +3064,6 @@ NOTA: un'opzione DEVE essere selezionata.</translation>
|
|||
<source>Length</source>
|
||||
<translation>Lunghezza</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (compresso con gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Formato</translation>
|
||||
|
@ -7884,10 +7876,6 @@ NOTA: un'opzione DEVE essere selezionata.</translation>
|
|||
<source>Length</source>
|
||||
<translation>Lunghezza</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (compresso con gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Formato</translation>
|
||||
|
|
|
@ -910,10 +910,6 @@
|
|||
<source>Hash (SHA1)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (gzip圧縮)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>形式</translation>
|
||||
|
@ -3024,10 +3020,6 @@ PLEASE NOTE: One option MUST be selected.</source>
|
|||
<source>Length</source>
|
||||
<translation>長さ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (gzip圧縮)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>フォーマット</translation>
|
||||
|
@ -7839,10 +7831,6 @@ PLEASE NOTE: One option MUST be selected.</source>
|
|||
<source>Length</source>
|
||||
<translation>長さ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (gzip圧縮)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>フォーマット</translation>
|
||||
|
|
|
@ -916,10 +916,6 @@
|
|||
<source>Hash (SHA1)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (skompresowany gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
@ -3044,10 +3040,6 @@ UWAGA: Przynajmniej jedna opcja MUSI zostać zaznaczona.</translation>
|
|||
<source>Length</source>
|
||||
<translation>Długość</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (skompresowany gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
@ -7858,10 +7850,6 @@ UWAGA: Przynajmniej jedna opcja MUSI zostać zaznaczona.</translation>
|
|||
<source>Length</source>
|
||||
<translation>Długość</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation>(skompresowany gzip)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>Format</translation>
|
||||
|
|
|
@ -930,10 +930,6 @@
|
|||
<source>Hash (SHA1)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation>(gzip 压缩)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>格式</translation>
|
||||
|
@ -3045,10 +3041,6 @@ PLEASE NOTE: One option MUST be selected.</source>
|
|||
<source>Length</source>
|
||||
<translation>长度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation> (gzip 压缩)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>格式</translation>
|
||||
|
@ -7856,10 +7848,6 @@ PLEASE NOTE: One option MUST be selected.</source>
|
|||
<source>Length</source>
|
||||
<translation>长度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (gzip compressed)</source>
|
||||
<translation>(gzip 压缩)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format</source>
|
||||
<translation>格式</translation>
|
||||
|
|
|
@ -86,6 +86,18 @@ wtap_get_compression_type(wtap *wth)
|
|||
return is_compressed ? WTAP_GZIP_COMPRESSED : WTAP_UNCOMPRESSED;
|
||||
}
|
||||
|
||||
static const char *compression_type_descriptions[WTAP_NUM_COMPRESSION_TYPES] = {
|
||||
NULL, /* uncompressed */
|
||||
"gzip compressed"
|
||||
};
|
||||
|
||||
const char *
|
||||
wtap_compression_type_description(wtap_compression_type compression_type)
|
||||
{
|
||||
g_assert(compression_type >= 0 && compression_type < WTAP_NUM_COMPRESSION_TYPES);
|
||||
return compression_type_descriptions[compression_type];
|
||||
}
|
||||
|
||||
guint
|
||||
wtap_snapshot_length(wtap *wth)
|
||||
{
|
||||
|
|
|
@ -1695,7 +1695,8 @@ void wtap_rec_cleanup(wtap_rec *rec);
|
|||
*/
|
||||
typedef enum {
|
||||
WTAP_UNCOMPRESSED,
|
||||
WTAP_GZIP_COMPRESSED
|
||||
WTAP_GZIP_COMPRESSED,
|
||||
WTAP_NUM_COMPRESSION_TYPES
|
||||
} wtap_compression_type;
|
||||
|
||||
/*** get various information snippets about the current file ***/
|
||||
|
@ -1709,6 +1710,8 @@ gint64 wtap_file_size(wtap *wth, int *err);
|
|||
WS_DLL_PUBLIC
|
||||
wtap_compression_type wtap_get_compression_type(wtap *wth);
|
||||
WS_DLL_PUBLIC
|
||||
const char *wtap_compression_type_description(wtap_compression_type compression_type);
|
||||
WS_DLL_PUBLIC
|
||||
guint wtap_snapshot_length(wtap *wth); /* per file */
|
||||
WS_DLL_PUBLIC
|
||||
int wtap_file_type_subtype(wtap *wth);
|
||||
|
|
Loading…
Reference in New Issue