The "file types" we have are actually combinations of types and

subtypes, e.g. Network Monitor version 1 and Network Monitor version 2
are separate "file types", even though they both come from Network
Monitor.

Rename various functions, #defines, and variables appropriately.

svn path=/trunk/; revision=53166
This commit is contained in:
Guy Harris 2013-11-08 09:53:01 +00:00
parent 5cec175b07
commit 853da2eb9b
72 changed files with 518 additions and 511 deletions

View File

@ -469,7 +469,7 @@ print_stats(const gchar *filename, capture_info *cf_info)
gchar *size_string;
/* Build printable strings for various stats */
file_type_string = wtap_file_type_string(cf_info->file_type);
file_type_string = wtap_file_type_subtype_string(cf_info->file_type);
file_encap_string = wtap_encap_string(cf_info->file_encap);
start_time_t = (time_t)cf_info->start_time;
stop_time_t = (time_t)cf_info->stop_time;
@ -644,7 +644,7 @@ print_stats_table(const gchar *filename, capture_info *cf_info)
time_t stop_time_t;
/* Build printable strings for various stats */
file_type_string = wtap_file_type_string(cf_info->file_type);
file_type_string = wtap_file_type_subtype_string(cf_info->file_type);
file_encap_string = wtap_encap_string(cf_info->file_encap);
start_time_t = (time_t)cf_info->start_time;
stop_time_t = (time_t)cf_info->stop_time;
@ -941,7 +941,7 @@ process_cap_file(wtap *wth, const char *filename)
cf_info.filesize = size;
/* File Type */
cf_info.file_type = wtap_file_type(wth);
cf_info.file_type = wtap_file_type_subtype(wth);
cf_info.iscompressed = wtap_iscompressed(wth);
/* File Encapsulation */

View File

@ -132,7 +132,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
/* Seen only when opening a capture file for writing. */
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" is a pipe, and %s capture files can't be "
"written to a pipe.", wtap_file_type_string(file_type));
"written to a pipe.", wtap_file_type_subtype_string(file_type));
errmsg = errmsg_errno;
break;
@ -220,7 +220,7 @@ gboolean capture_info_new_file(const char *new_filename)
info_data.wtap = wtap_open_offline(new_filename, &err, &err_info, FALSE);
if (!info_data.wtap) {
err_msg = g_strdup_printf(cf_open_error_message(err, err_info, FALSE, WTAP_FILE_PCAP),
err_msg = g_strdup_printf(cf_open_error_message(err, err_info, FALSE, WTAP_FILE_TYPE_SUBTYPE_UNKNOWN),
new_filename);
g_warning("capture_info_new_file: %d (%s)", err, err_msg);
g_free (err_msg);

View File

@ -157,9 +157,9 @@ static struct select_item selectfrm[MAX_SELECTIONS];
static int max_selected = -1;
static int keep_em = 0;
#ifdef PCAP_NG_DEFAULT
static int out_file_type = WTAP_FILE_PCAPNG; /* default to pcapng */
static int out_file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAPNG; /* default to pcapng */
#else
static int out_file_type = WTAP_FILE_PCAP; /* default to pcap */
static int out_file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP; /* default to pcap */
#endif
static int out_frame_type = -2; /* Leave frame type alone */
static int verbose = 0; /* Not so verbose */
@ -810,12 +810,12 @@ list_capture_types(void) {
struct string_elem *captypes;
GSList *list = NULL;
captypes = g_new(struct string_elem,WTAP_NUM_FILE_TYPES);
captypes = g_new(struct string_elem,WTAP_NUM_FILE_TYPES_SUBTYPES);
fprintf(stderr, "editcap: The available capture file types for the \"-F\" flag are:\n");
for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
for (i = 0; i < WTAP_NUM_FILE_TYPES_SUBTYPES; i++) {
if (wtap_dump_can_open(i)) {
captypes[i].sstr = wtap_file_type_short_string(i);
captypes[i].lstr = wtap_file_type_string(i);
captypes[i].sstr = wtap_file_type_subtype_short_string(i);
captypes[i].lstr = wtap_file_type_subtype_string(i);
list = g_slist_insert_sorted(list, &captypes[i], string_compare);
}
}
@ -1037,8 +1037,8 @@ main(int argc, char *argv[])
break;
case 'F':
out_file_type = wtap_short_string_to_file_type(optarg);
if (out_file_type < 0) {
out_file_type_subtype = wtap_short_string_to_file_type_subtype(optarg);
if (out_file_type_subtype < 0) {
fprintf(stderr, "editcap: \"%s\" isn't a valid capture file type\n\n",
optarg);
list_capture_types();
@ -1176,7 +1176,7 @@ main(int argc, char *argv[])
if (verbose) {
fprintf(stderr, "File %s is a %s capture file.\n", argv[optind],
wtap_file_type_string(wtap_file_type(wth)));
wtap_file_type_subtype_string(wtap_file_type_subtype(wth)));
}
shb_hdr = wtap_file_get_shb_info(wth);
@ -1228,7 +1228,7 @@ main(int argc, char *argv[])
shb_hdr->shb_user_appl = appname;
}
pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type,
pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
FALSE /* compressed */, shb_hdr, idb_inf, &err);
@ -1259,7 +1259,7 @@ main(int argc, char *argv[])
if (verbose)
fprintf(stderr, "Continuing writing in file %s\n", filename);
pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type,
pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
FALSE /* compressed */, shb_hdr, idb_inf, &err);
@ -1287,7 +1287,7 @@ main(int argc, char *argv[])
if (verbose)
fprintf(stderr, "Continuing writing in file %s\n", filename);
pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type,
pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
FALSE /* compressed */, shb_hdr, idb_inf, &err);
if (pdh == NULL) {
@ -1482,7 +1482,7 @@ main(int argc, char *argv[])
int real_data_start = 0;
/* Protect non-protocol data */
if (wtap_file_type(wth) == WTAP_FILE_CATAPULT_DCT2000)
if (wtap_file_type_subtype(wth) == WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000)
real_data_start = find_dct2000_real_data(buf);
for (i = real_data_start; i < (int) phdr->caplen; i++) {
@ -1576,7 +1576,7 @@ main(int argc, char *argv[])
g_free (filename);
filename = g_strdup(argv[optind+1]);
pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type,
pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
snaplen ? MIN(snaplen, wtap_snapshot_length(wth)): wtap_snapshot_length(wth),
FALSE /* compressed */, shb_hdr, idb_inf, &err);
if (pdh == NULL) {

View File

@ -207,7 +207,7 @@ WSLUA_CONSTRUCTOR Dumper_new(lua_State* L) {
#define WSLUA_OPTARG_Dumper_new_ENCAP 3 /* The encapsulation to be used in the file to be created */
Dumper d;
const char* fname = luaL_checkstring(L,WSLUA_ARG_Dumper_new_FILENAME);
int filetype = luaL_optint(L,WSLUA_OPTARG_Dumper_new_FILETYPE,WTAP_FILE_PCAP);
int filetype = luaL_optint(L,WSLUA_OPTARG_Dumper_new_FILETYPE,WTAP_FILE_TYPE_SUBTYPE_PCAP);
int encap = luaL_optint(L,WSLUA_OPTARG_Dumper_new_ENCAP,WTAP_ENCAP_ETHERNET);
int err = 0;
const char* filename;
@ -223,12 +223,12 @@ WSLUA_CONSTRUCTOR Dumper_new(lua_State* L) {
switch (err) {
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
luaL_error(L,"Files of file type %s cannot be written",
wtap_file_type_string(filetype));
wtap_file_type_subtype_string(filetype));
break;
case WTAP_ERR_UNSUPPORTED_ENCAP:
luaL_error(L,"Files of file type %s don't support encapsulation %s",
wtap_file_type_string(filetype),
wtap_file_type_subtype_string(filetype),
wtap_encap_short_string(encap));
break;
@ -338,7 +338,7 @@ WSLUA_METHOD Dumper_new_for_current(lua_State* L) {
#define WSLUA_OPTARG_Dumper_new_for_current_FILETYPE 2 /* The file type. Defaults to pcap. */
Dumper d;
const char* fname = luaL_checkstring(L,1);
int filetype = luaL_optint(L,WSLUA_OPTARG_Dumper_new_for_current_FILETYPE,WTAP_FILE_PCAP);
int filetype = luaL_optint(L,WSLUA_OPTARG_Dumper_new_for_current_FILETYPE,WTAP_FILE_TYPE_SUBTYPE_PCAP);
int encap;
int err = 0;
const char* filename;
@ -358,12 +358,12 @@ WSLUA_METHOD Dumper_new_for_current(lua_State* L) {
switch (err) {
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
luaL_error(L,"Files of file type %s cannot be written",
wtap_file_type_string(filetype));
wtap_file_type_subtype_string(filetype));
break;
case WTAP_ERR_UNSUPPORTED_ENCAP:
luaL_error(L,"Files of file type %s don't support encapsulation %s",
wtap_file_type_string(filetype),
wtap_file_type_subtype_string(filetype),
wtap_encap_short_string(encap));
break;

23
file.c
View File

@ -376,7 +376,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
cf->computed_elapsed = 0;
cf->cd_t = wtap_file_type(cf->wth);
cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
cf->count = 0;
cf->packet_comment_count = 0;
@ -409,7 +409,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
packet_list_queue_draw();
cf_callback_invoke(cf_cb_file_opened, cf);
if (cf->cd_t == WTAP_FILE_BER) {
if (cf->cd_t == WTAP_FILE_TYPE_SUBTYPE_BER) {
/* tell the BER dissector the file name */
ber_set_filename(cf->filename);
}
@ -1349,7 +1349,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
* We need something similar when merging pcapng files possibly with an option to say
* the same interface(s) used in all in files. SHBs comments should be merged together.
*/
if ((selected_frame_type == WTAP_ENCAP_PER_PACKET)&&(file_type == WTAP_FILE_PCAP)) {
if ((selected_frame_type == WTAP_ENCAP_PER_PACKET)&&(file_type == WTAP_FILE_TYPE_SUBTYPE_PCAP)) {
/* Write output in pcapng format */
wtapng_section_t *shb_hdr;
wtapng_iface_descriptions_t *idb_inf, *idb_inf_merge_file;
@ -1362,7 +1362,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
comment_gstr = g_string_new("");
g_string_append_printf(comment_gstr, "%s \n",shb_hdr->opt_comment);
g_string_append_printf(comment_gstr, "File created by merging: \n");
file_type = WTAP_FILE_PCAPNG;
file_type = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
for (i = 0; i < in_file_count; i++) {
g_string_append_printf(comment_gstr, "File%d: %s \n",i+1,in_files[i].filename);
@ -1523,9 +1523,10 @@ cf_merge_files(char **out_filenamep, int in_file_count,
break;
}
/* If we have WTAP_ENCAP_PER_PACKETend the infiles are of type WTAP_FILE_PCAP
* we need to set the interface id in the paket header = the interface index we used
* in the IDBs interface description for this file(encapsulation type).
/* If we have WTAP_ENCAP_PER_PACKET and the infiles are of type
* WTAP_FILE_TYPE_SUBTYPE_PCAP, we need to set the interface id
* in the paket header = the interface index we used in the IDBs
* interface description for this file(encapsulation type).
*/
if (fake_interface_ids) {
struct wtap_pkthdr *phdr;
@ -1623,7 +1624,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
simple_error_message_box(
"Frame %u of \"%s\" has a network type that can't be saved in a \"%s\" file.",
in_file->packet_num, display_basename,
wtap_file_type_string(file_type));
wtap_file_type_subtype_string(file_type));
g_free(display_basename);
break;
@ -4144,7 +4145,7 @@ save_packet(capture_file *cf _U_, frame_data *fdata,
*/
simple_error_message_box(
"Frame %u has a network type that can't be saved in a \"%s\" file.",
fdata->num, wtap_file_type_string(args->file_type));
fdata->num, wtap_file_type_subtype_string(args->file_type));
break;
default:
@ -4322,7 +4323,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
/* No user changes yet. */
cf->unsaved_changes = FALSE;
cf->cd_t = wtap_file_type(cf->wth);
cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
cf->snap = wtap_snapshot_length(cf->wth);
@ -4986,7 +4987,7 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
simple_error_message_box(
"The file \"%s\" is a pipe, and %s capture files can't be "
"written to a pipe.",
display_basename, wtap_file_type_string(file_type));
display_basename, wtap_file_type_subtype_string(file_type));
break;
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:

View File

@ -165,13 +165,13 @@ list_capture_types(void) {
struct string_elem *captypes;
GSList *list = NULL;
captypes = g_new(struct string_elem,WTAP_NUM_FILE_TYPES);
captypes = g_new(struct string_elem,WTAP_NUM_FILE_TYPES_SUBTYPES);
fprintf(stderr, "mergecap: The available capture file types for the \"-F\" flag are:\n");
for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
for (i = 0; i < WTAP_NUM_FILE_TYPES_SUBTYPES; i++) {
if (wtap_dump_can_open(i)) {
captypes[i].sstr = wtap_file_type_short_string(i);
captypes[i].lstr = wtap_file_type_string(i);
captypes[i].sstr = wtap_file_type_subtype_short_string(i);
captypes[i].lstr = wtap_file_type_subtype_string(i);
list = g_slist_insert_sorted(list, &captypes[i], string_compare);
}
}
@ -209,9 +209,9 @@ main(int argc, char *argv[])
int in_file_count = 0;
guint snaplen = 0;
#ifdef PCAP_NG_DEFAULT
int file_type = WTAP_FILE_PCAPNG; /* default to pcap format */
int file_type = WTAP_FILE_TYPE_SUBTYPE_PCAPNG; /* default to pcap format */
#else
int file_type = WTAP_FILE_PCAP; /* default to pcapng format */
int file_type = WTAP_FILE_TYPE_SUBTYPE_PCAP; /* default to pcapng format */
#endif
int frame_type = -2;
int out_fd;
@ -240,7 +240,7 @@ main(int argc, char *argv[])
break;
case 'F':
file_type = wtap_short_string_to_file_type(optarg);
file_type = wtap_short_string_to_file_type_subtype(optarg);
if (file_type < 0) {
fprintf(stderr, "mergecap: \"%s\" isn't a valid capture file type\n",
optarg);
@ -326,7 +326,7 @@ main(int argc, char *argv[])
if (verbose) {
for (i = 0; i < in_file_count; i++)
fprintf(stderr, "mergecap: %s is type %s.\n", argv[optind + i],
wtap_file_type_string(wtap_file_type(in_files[i].wth)));
wtap_file_type_subtype_string(wtap_file_type_subtype(in_files[i].wth)));
}
if (snaplen == 0) {
@ -389,7 +389,7 @@ main(int argc, char *argv[])
}
/* prepare the outfile */
if(file_type == WTAP_FILE_PCAPNG ){
if(file_type == WTAP_FILE_TYPE_SUBTYPE_PCAPNG ){
wtapng_section_t *shb_hdr;
GString *comment_gstr;

View File

@ -552,7 +552,7 @@ main(int argc, char **argv)
example = find_example(produce_type);
dump = wtap_dump_open(produce_filename, WTAP_FILE_PCAP,
dump = wtap_dump_open(produce_filename, WTAP_FILE_TYPE_SUBTYPE_PCAP,
example->sample_wtap_encap, produce_max_bytes, FALSE /* compressed */, &err);
if (!dump) {
fprintf(stderr,

View File

@ -1674,7 +1674,7 @@ raw_cf_open(capture_file *cf, const char *fname)
/* No user changes yet. */
cf->unsaved_changes = FALSE;
cf->cd_t = WTAP_FILE_UNKNOWN;
cf->cd_t = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
cf->count = 0;
cf->drops_known = FALSE;
cf->drops = 0;

View File

@ -226,13 +226,13 @@ int main(int argc, char *argv[])
}
exit(1);
}
DEBUG_PRINT("file_type is %u\n", wtap_file_type(wth));
DEBUG_PRINT("file_type_subtype is %u\n", wtap_file_type_subtype(wth));
shb_hdr = wtap_file_get_shb_info(wth);
idb_inf = wtap_file_get_idb_info(wth);
/* Open outfile (same filetype/encap as input file) */
pdh = wtap_dump_open_ng(outfile, wtap_file_type(wth), wtap_file_encap(wth),
pdh = wtap_dump_open_ng(outfile, wtap_file_type_subtype(wth), wtap_file_encap(wth),
65535, FALSE, shb_hdr, idb_inf, &err);
g_free(idb_inf);
if (pdh == NULL) {

View File

@ -221,13 +221,13 @@ list_capture_types(void) {
struct string_elem *captypes;
GSList *list = NULL;
captypes = g_new(struct string_elem, WTAP_NUM_FILE_TYPES);
captypes = g_new(struct string_elem, WTAP_NUM_FILE_TYPES_SUBTYPES);
fprintf(stderr, "tshark: The available capture file types for the \"-F\" flag are:\n");
for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
for (i = 0; i < WTAP_NUM_FILE_TYPES_SUBTYPES; i++) {
if (wtap_dump_can_open(i)) {
captypes[i].sstr = wtap_file_type_short_string(i);
captypes[i].lstr = wtap_file_type_string(i);
captypes[i].sstr = wtap_file_type_subtype_short_string(i);
captypes[i].lstr = wtap_file_type_subtype_string(i);
list = g_slist_insert_sorted(list, &captypes[i], string_compare);
}
}
@ -915,9 +915,9 @@ main(int argc, char *argv[])
#endif
gboolean quiet = FALSE;
#ifdef PCAP_NG_DEFAULT
volatile int out_file_type = WTAP_FILE_PCAPNG;
volatile int out_file_type = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
#else
volatile int out_file_type = WTAP_FILE_PCAP;
volatile int out_file_type = WTAP_FILE_TYPE_SUBTYPE_PCAP;
#endif
volatile gboolean out_file_name_res = FALSE;
gchar *volatile cf_name = NULL;
@ -1314,7 +1314,7 @@ main(int argc, char *argv[])
}
break;
case 'F':
out_file_type = wtap_short_string_to_file_type(optarg);
out_file_type = wtap_short_string_to_file_type_subtype(optarg);
if (out_file_type < 0) {
cmdarg_err("\"%s\" isn't a valid capture file type", optarg);
list_capture_types();
@ -1735,11 +1735,13 @@ main(int argc, char *argv[])
/* They specified a "-w" flag, so we'll be saving to a capture file. */
/* When capturing, we only support writing pcap or pcap-ng format. */
if (out_file_type != WTAP_FILE_PCAP && out_file_type != WTAP_FILE_PCAPNG) {
if (out_file_type != WTAP_FILE_TYPE_SUBTYPE_PCAP &&
out_file_type != WTAP_FILE_TYPE_SUBTYPE_PCAPNG) {
cmdarg_err("Live captures can only be saved in libpcap format.");
return 1;
}
if (global_capture_opts.capture_comment && out_file_type != WTAP_FILE_PCAPNG) {
if (global_capture_opts.capture_comment &&
out_file_type != WTAP_FILE_TYPE_SUBTYPE_PCAPNG) {
cmdarg_err("A capture comment can only be written to a pcapng file.");
return 1;
}
@ -2997,7 +2999,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
shb_hdr->shb_user_appl = appname;
}
if (linktype != WTAP_ENCAP_PER_PACKET && out_file_type == WTAP_FILE_PCAP)
if (linktype != WTAP_ENCAP_PER_PACKET &&
out_file_type == WTAP_FILE_TYPE_SUBTYPE_PCAP)
pdh = wtap_dump_open(save_file, out_file_type, linktype,
snapshot_length, FALSE /* compressed */, &err);
else
@ -3018,7 +3021,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
case WTAP_ERR_UNSUPPORTED_ENCAP:
case WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED:
cmdarg_err("The capture file being read can't be written as a "
"\"%s\" file.", wtap_file_type_short_string(out_file_type));
"\"%s\" file.", wtap_file_type_subtype_short_string(out_file_type));
break;
case WTAP_ERR_CANT_OPEN:
@ -3054,7 +3057,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
if (pdh && out_file_name_res) {
if (!wtap_dump_set_addrinfo_list(pdh, get_addrinfo_list())) {
cmdarg_err("The file format \"%s\" doesn't support name resolution information.",
wtap_file_type_short_string(out_file_type));
wtap_file_type_subtype_short_string(out_file_type));
}
}
@ -3155,7 +3158,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
fprintf(stderr,
"Frame %u of \"%s\" has a network type that can't be saved in a \"%s\" file.\n",
framenum, cf->filename,
wtap_file_type_short_string(out_file_type));
wtap_file_type_subtype_short_string(out_file_type));
break;
default:
@ -3219,7 +3222,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
fprintf(stderr,
"Frame %u of \"%s\" has a network type that can't be saved in a \"%s\" file.\n",
framenum, cf->filename,
wtap_file_type_short_string(out_file_type));
wtap_file_type_subtype_short_string(out_file_type));
break;
default:
@ -3886,7 +3889,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
/* No user changes yet. */
cf->unsaved_changes = FALSE;
cf->cd_t = wtap_file_type(cf->wth);
cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->count = 0;
cf->drops_known = FALSE;
cf->drops = 0;
@ -4024,7 +4027,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
/* Seen only when opening a capture file for writing. */
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" is a pipe, and \"%s\" capture files can't be "
"written to a pipe.", wtap_file_type_short_string(file_type));
"written to a pipe.", wtap_file_type_subtype_short_string(file_type));
errmsg = errmsg_errno;
break;
@ -4037,7 +4040,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
if (for_writing) {
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"TShark can't save this capture as a \"%s\" file.",
wtap_file_type_short_string(file_type));
wtap_file_type_subtype_short_string(file_type));
} else {
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" is a capture for a network type that TShark doesn't support.\n"
@ -4051,7 +4054,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
if (for_writing) {
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"TShark can't save this capture as a \"%s\" file.",
wtap_file_type_short_string(file_type));
wtap_file_type_subtype_short_string(file_type));
errmsg = errmsg_errno;
} else
errmsg = "The file \"%s\" is a capture for a network type that TShark doesn't support.";

View File

@ -162,7 +162,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
gtk_label_set_text(GTK_LABEL(label), string_buff);
/* type */
g_strlcpy(string_buff, wtap_file_type_string(wtap_file_type(wth)), PREVIEW_STR_MAX);
g_strlcpy(string_buff, wtap_file_type_subtype_string(wtap_file_type_subtype(wth)), PREVIEW_STR_MAX);
label = (GtkWidget *)g_object_get_data(G_OBJECT(prev), PREVIEW_FORMAT_KEY);
gtk_label_set_text(GTK_LABEL(label), string_buff);
@ -1483,7 +1483,7 @@ set_file_type_list(GtkWidget *combo_box, capture_file *cf,
gboolean must_support_all_comments)
{
guint32 required_comment_types;
GArray *savable_file_types;
GArray *savable_file_types_subtypes;
guint i;
int ft;
int default_ft = -1;
@ -1495,22 +1495,23 @@ set_file_type_list(GtkWidget *combo_box, capture_file *cf,
required_comment_types = 0; /* none of them */
/* What types of file can we save this file as? */
savable_file_types = wtap_get_savable_file_types(cf->cd_t, cf->linktypes,
required_comment_types);
savable_file_types_subtypes = wtap_get_savable_file_types_subtypes(cf->cd_t,
cf->linktypes,
required_comment_types);
if (savable_file_types != NULL) {
if (savable_file_types_subtypes != NULL) {
/* OK, we have at least one file type we can save this file as.
(If we didn't, we shouldn't have gotten here in the first
place.) Add them all to the combo box. */
for (i = 0; i < savable_file_types->len; i++) {
ft = g_array_index(savable_file_types, int, i);
for (i = 0; i < savable_file_types_subtypes->len; i++) {
ft = g_array_index(savable_file_types_subtypes, int, i);
if (default_ft == -1)
default_ft = ft; /* first file type is the default */
ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(combo_box),
wtap_file_type_string(ft),
wtap_file_type_subtype_string(ft),
GINT_TO_POINTER(ft));
}
g_array_free(savable_file_types, TRUE);
g_array_free(savable_file_types_subtypes, TRUE);
}
return default_ft;

View File

@ -215,7 +215,7 @@ dnd_open_file_cmd(gchar *cf_names_freeme)
/* merge the files in chronological order */
tmpname = NULL;
if (cf_merge_files(&tmpname, in_file_count, in_filenames,
WTAP_FILE_PCAP, FALSE) == CF_OK) {
WTAP_FILE_TYPE_SUBTYPE_PCAP, FALSE) == CF_OK) {
/* Merge succeeded; close the currently-open file and try
to open the merged capture file. */
cf_close(&cfile);

View File

@ -180,7 +180,7 @@ exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data)
g_array_append_val(idb_inf->interface_data, int_data);
exp_pdu_tap_data->wdh = wtap_dump_fdopen_ng(import_file_fd, WTAP_FILE_PCAPNG, WTAP_ENCAP_WIRESHARK_UPPER_PDU, WTAP_MAX_PACKET_SIZE, FALSE, shb_hdr, idb_inf, &err);
exp_pdu_tap_data->wdh = wtap_dump_fdopen_ng(import_file_fd, WTAP_FILE_TYPE_SUBTYPE_PCAPNG, WTAP_ENCAP_WIRESHARK_UPPER_PDU, WTAP_MAX_PACKET_SIZE, FALSE, shb_hdr, idb_inf, &err);
if (exp_pdu_tap_data->wdh == NULL) {
open_failure_alert_box(capfile_name, err, TRUE);
goto end;

View File

@ -516,7 +516,7 @@ file_import_open(text_import_info_t *info)
g_array_append_val(idb_inf->interface_data, int_data);
info->wdh = wtap_dump_fdopen_ng(import_file_fd, WTAP_FILE_PCAPNG, info->encapsulation, info->max_frame_length, FALSE, shb_hdr, idb_inf, &err);
info->wdh = wtap_dump_fdopen_ng(import_file_fd, WTAP_FILE_TYPE_SUBTYPE_PCAPNG, info->encapsulation, info->max_frame_length, FALSE, shb_hdr, idb_inf, &err);
if (info->wdh == NULL) {
open_failure_alert_box(capfile_name, err, TRUE);
fclose(info->import_text_file);

View File

@ -114,7 +114,7 @@ void gsm_map_stat_gtk_sum_cb(GtkAction *action _U_, gpointer user_data _U_)
add_string_to_box(string_buff, file_box);
/* format */
g_snprintf(string_buff, SUM_STR_MAX, "Format: %s", wtap_file_type_string(summary.file_type));
g_snprintf(string_buff, SUM_STR_MAX, "Format: %s", wtap_file_type_subtype_string(summary.file_type));
add_string_to_box(string_buff, file_box);
if (summary.has_snap) {

View File

@ -316,7 +316,7 @@ mtp3_sum_gtk_sum_cb(GtkAction *action _U_, gpointer user_data _U_)
add_string_to_box(string_buff, file_box);
/* format */
file_type = wtap_file_type_string(summary.file_type);
file_type = wtap_file_type_subtype_string(summary.file_type);
g_snprintf(string_buff, SUM_STR_MAX, "Format: %s", (file_type ? file_type : "N/A"));
add_string_to_box(string_buff, file_box);

View File

@ -269,7 +269,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* format */
g_snprintf(string_buff, SUM_STR_MAX, "%s%s",
wtap_file_type_string(summary.file_type),
wtap_file_type_subtype_string(summary.file_type),
summary.iscompressed? " (gzip compressed)" : "");
add_string_to_grid(grid, &row, "Format:", string_buff);
@ -716,7 +716,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
/* format */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "Format: %s%s",
wtap_file_type_string(summary.file_type),
wtap_file_type_subtype_string(summary.file_type),
summary.iscompressed? " (gzip compressed)\n" : "\n");
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);

View File

@ -334,7 +334,7 @@ QString CaptureFileDialog::fileType(int ft, bool extension_globs)
QString filter;
GSList *extensions_list;
filter = wtap_file_type_string(ft);
filter = wtap_file_type_subtype_string(ft);
if (!extension_globs) {
return filter;
@ -672,7 +672,7 @@ int CaptureFileDialog::merge(QString &file_name) {
QStringList CaptureFileDialog::buildFileSaveAsTypeList(bool must_support_all_comments) {
QStringList filters;
guint32 required_comment_types;
GArray *savable_file_types;
GArray *savable_file_types_subtypes;
guint i;
type_hash_.clear();
@ -684,25 +684,25 @@ QStringList CaptureFileDialog::buildFileSaveAsTypeList(bool must_support_all_com
required_comment_types = 0; /* none of them */
/* What types of file can we save this file as? */
savable_file_types = wtap_get_savable_file_types(cap_file_->cd_t,
cap_file_->linktypes,
required_comment_types);
savable_file_types_subtypes = wtap_get_savable_file_types_subtypes(cap_file_->cd_t,
cap_file_->linktypes,
required_comment_types);
if (savable_file_types != NULL) {
if (savable_file_types_subtypes != NULL) {
QString file_type;
int ft;
/* OK, we have at least one file type we can save this file as.
(If we didn't, we shouldn't have gotten here in the first
place.) Add them all to the combo box. */
for (i = 0; i < savable_file_types->len; i++) {
ft = g_array_index(savable_file_types, int, i);
for (i = 0; i < savable_file_types_subtypes->len; i++) {
ft = g_array_index(savable_file_types_subtypes, int, i);
if (default_ft_ < 1)
default_ft_ = ft; /* first file type is the default */
file_type = fileType(ft);
filters << file_type;
type_hash_[file_type] = ft;
}
g_array_free(savable_file_types, TRUE);
g_array_free(savable_file_types_subtypes, TRUE);
}
return filters;
@ -777,7 +777,7 @@ void CaptureFileDialog::preview(const QString & path)
}
// Format
preview_format_.setText(QString::fromUtf8(wtap_file_type_string(wtap_file_type(wth))));
preview_format_.setText(QString::fromUtf8(wtap_file_type_subtype_string(wtap_file_type_subtype(wth))));
// Size
preview_size_.setText(QString(tr("%1 bytes")).arg(wtap_file_size(wth, &err)));

View File

@ -122,7 +122,7 @@ void ImportTextDialog::convertTextFile() {
import_file_fd = create_tempfile(&tmpname, "import");
capfile_name_.append(tmpname);
import_info_.wdh = wtap_dump_fdopen(import_file_fd, WTAP_FILE_PCAP, import_info_.encapsulation, import_info_.max_frame_length, FALSE, &err);
import_info_.wdh = wtap_dump_fdopen(import_file_fd, WTAP_FILE_TYPE_SUBTYPE_PCAP, import_info_.encapsulation, import_info_.max_frame_length, FALSE, &err);
qDebug() << capfile_name_ << ":" << import_info_.wdh << import_info_.encapsulation << import_info_.max_frame_length;
if (import_info_.wdh == NULL) {
open_failure_alert_box(capfile_name_.toUtf8().constData(), err, TRUE);

View File

@ -134,7 +134,7 @@ QString SummaryDialog::SummaryToString()
out << "\t" << tr("Name:\t\t%1\n").arg(summary_.filename);
out << "\t" << tr("Length:\t\t%1 bytes\n").arg(summary_.file_length);
out << "\t" << tr("Format:\t\t%1%2\n")
.arg(wtap_file_type_string(summary_.file_type))
.arg(wtap_file_type_subtype_string(summary_.file_type))
.arg(summary_.iscompressed? tr(" (gzip compressed)") : "");
out << "\t" << tr("Encapsulation:\t\t%1\n").arg(ui->lEncapsulation->text());
@ -281,7 +281,7 @@ void SummaryDialog::UpdateValues()
ui->lLength->setText(QString(tr("%1 bytes (%2 Mbytes)")).arg((ulong)summary_.file_length).arg((float)summary_.file_length/1048576));
/* format */
ui->lFormat->setText(QString("%1%2").arg(wtap_file_type_string(summary_.file_type), summary_.iscompressed? tr(" (gzip compressed)") : ""));
ui->lFormat->setText(QString("%1%2").arg(wtap_file_type_subtype_string(summary_.file_type), summary_.iscompressed? tr(" (gzip compressed)") : ""));
/* encapsulation */
if (summary_.file_encap_type == WTAP_ENCAP_PER_PACKET)

View File

@ -183,7 +183,7 @@ int _5views_open(wtap *wth, int *err, gchar **err_info)
}
/* This is a 5views capture file */
wth->file_type = WTAP_FILE_5VIEWS;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_5VIEWS;
wth->subtype_read = _5views_read;
wth->subtype_seek_read = _5views_seek_read;
wth->file_encap = encap;

View File

@ -152,7 +152,7 @@ int aethra_open(wtap *wth, int *err, gchar **err_info)
*err = WTAP_ERR_SHORT_READ;
return -1;
}
wth->file_type = WTAP_FILE_AETHRA;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_AETHRA;
aethra = (aethra_t *)g_malloc(sizeof(aethra_t));
wth->priv = (void *)aethra;
wth->subtype_read = aethra_read;

View File

@ -182,7 +182,7 @@ int ascend_open(wtap *wth, int *err, gchar **err_info)
return 0;
}
wth->file_type = WTAP_FILE_ASCEND;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ASCEND;
switch(wth->phdr.pseudo_header.ascend.type) {
case ASCEND_PFX_ISDN_X:

View File

@ -176,7 +176,7 @@ int ber_open(wtap *wth, int *err, gchar **err_info)
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
wth->file_type = WTAP_FILE_BER;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BER;
wth->file_encap = WTAP_ENCAP_BER;
wth->snapshot_length = 0;

View File

@ -148,7 +148,7 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info)
wth->file_encap = file_encap;
wth->snapshot_length = 0; /* not available in header */
wth->tsprecision = WTAP_FILE_TSPREC_USEC;
wth->file_type = WTAP_FILE_BTSNOOP;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BTSNOOP;
return 1;
}
@ -381,9 +381,9 @@ gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
wdh->subtype_close = NULL;
/* Write the file header. */
switch (wdh->file_type) {
switch (wdh->file_type_subtype) {
case WTAP_FILE_BTSNOOP:
case WTAP_FILE_TYPE_SUBTYPE_BTSNOOP:
wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
@ -423,9 +423,9 @@ gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err)
wdh->subtype_close = NULL;
/* Write the file header. */
switch (wdh->file_type) {
switch (wdh->file_type_subtype) {
case WTAP_FILE_BTSNOOP:
case WTAP_FILE_TYPE_SUBTYPE_BTSNOOP:
wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
break;

View File

@ -356,7 +356,7 @@ int camins_open(wtap *wth, int *err, gchar **err_info _U_)
wth->subtype_read = camins_read;
wth->subtype_seek_read = camins_seek_read;
wth->file_type = WTAP_FILE_CAMINS;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CAMINS;
*err = 0;
return 1;

View File

@ -252,7 +252,7 @@ catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
/* File is for us. Fill in details so packets can be read */
/* Set our file type */
wth->file_type = WTAP_FILE_CATAPULT_DCT2000;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000;
/* Use our own encapsulation to send all packets to our stub dissector */
wth->file_encap = WTAP_ENCAP_CATAPULT_DCT2000;

View File

@ -124,7 +124,7 @@ int commview_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_read = commview_read;
wth->subtype_seek_read = commview_seek_read;
wth->file_type = WTAP_FILE_COMMVIEW;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COMMVIEW;
wth->file_encap = WTAP_ENCAP_PER_PACKET;
wth->tsprecision = WTAP_FILE_TSPREC_USEC;

View File

@ -279,7 +279,7 @@ int cosine_open(wtap *wth, int *err, gchar **err_info)
return -1;
wth->file_encap = WTAP_ENCAP_COSINE;
wth->file_type = WTAP_FILE_COSINE;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COSINE;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = cosine_read;
wth->subtype_seek_read = cosine_seek_read;

View File

@ -137,7 +137,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info)
wth->priv = (void *)csids;
csids->byteswapped = byteswap;
wth->file_encap = WTAP_ENCAP_RAW_IP;
wth->file_type = WTAP_FILE_CSIDS;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CSIDS;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = csids_read;
wth->subtype_seek_read = csids_seek_read;

View File

@ -127,7 +127,7 @@ int daintree_sna_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_seek_read = daintree_sna_seek_read;
/* set up for file type */
wth->file_type = WTAP_FILE_DAINTREE_SNA;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DAINTREE_SNA;
wth->file_encap = WTAP_ENCAP_IEEE802_15_4_NOFCS;
wth->tsprecision = WTAP_FILE_TSPREC_USEC;
wth->snapshot_length = 0; /* not available in header */

View File

@ -189,7 +189,7 @@ int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info)
}
wth->file_encap = WTAP_ENCAP_ETHERNET;
wth->file_type = WTAP_FILE_DBS_ETHERWATCH;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DBS_ETHERWATCH;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = dbs_etherwatch_read;
wth->subtype_seek_read = dbs_etherwatch_seek_read;

View File

@ -180,7 +180,7 @@ int dct3trace_open(wtap *wth, int *err, gchar **err_info)
}
wth->file_encap = WTAP_ENCAP_GSM_UM;
wth->file_type = WTAP_FILE_DCT3TRACE;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = dct3trace_read;
wth->subtype_seek_read = dct3trace_seek_read;

View File

@ -265,7 +265,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
}
/* This is an ERF file */
wth->file_type = WTAP_FILE_ERF;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ERF;
wth->snapshot_length = 0; /* not available in header, only in frame */
/*
@ -702,8 +702,8 @@ int erf_dump_open(wtap_dumper *wdh, int *err)
wdh->subtype_write = erf_dump;
wdh->subtype_close = NULL;
switch(wdh->file_type){
case WTAP_FILE_ERF:
switch(wdh->file_type_subtype){
case WTAP_FILE_TYPE_SUBTYPE_ERF:
wdh->tsprecision = WTAP_FILE_TSPREC_NSEC;
break;
default:

View File

@ -142,7 +142,7 @@ int eyesdn_open(wtap *wth, int *err, gchar **err_info)
return 0;
wth->file_encap = WTAP_ENCAP_PER_PACKET;
wth->file_type = WTAP_FILE_EYESDN;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_EYESDN;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = eyesdn_read;
wth->subtype_seek_read = eyesdn_seek_read;

View File

@ -603,7 +603,7 @@ success:
wth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
buffer_init(wth->frame_buffer, 1500);
if(wth->file_type == WTAP_FILE_PCAP){
if(wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
wtapng_if_descr_t descr;
@ -694,300 +694,300 @@ wtap_fdreopen(wtap *wth, const char *filename, int *err)
}
/* Table of the file types we know about.
Entries must be sorted by WTAP_FILE_xxx values in ascending order */
static const struct file_type_info dump_open_table_base[] = {
/* WTAP_FILE_UNKNOWN (only used internally for initialization) */
Entries must be sorted by WTAP_FILE_TYPE_SUBTYPE_xxx values in ascending order */
static const struct file_type_subtype_info dump_open_table_base[] = {
/* WTAP_FILE_TYPE_SUBTYPE_UNKNOWN (only used internally for initialization) */
{ NULL, NULL, NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_PCAP */
/* WTAP_FILE_TYPE_SUBTYPE_PCAP */
/* Gianluca Varenni suggests that we add "deprecated" to the description. */
{ "Wireshark/tcpdump/... - pcap", "pcap", "pcap", "cap;dmp",
FALSE, FALSE, 0,
libpcap_dump_can_write_encap, libpcap_dump_open },
/* WTAP_FILE_PCAPNG */
/* WTAP_FILE_TYPE_SUBTYPE_PCAPNG */
{ "Wireshark/... - pcapng", "pcapng", "pcapng", "ntar",
FALSE, TRUE, WTAP_COMMENT_PER_SECTION|WTAP_COMMENT_PER_INTERFACE|WTAP_COMMENT_PER_PACKET,
pcapng_dump_can_write_encap, pcapng_dump_open },
/* WTAP_FILE_PCAP_NSEC */
/* WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC */
{ "Wireshark - nanosecond libpcap", "nseclibpcap", "pcap", "cap;dmp",
FALSE, FALSE, 0,
libpcap_dump_can_write_encap, libpcap_dump_open },
/* WTAP_FILE_PCAP_AIX */
/* WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX */
{ "AIX tcpdump - libpcap", "aixlibpcap", "pcap", "cap;dmp",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_PCAP_SS991029 */
/* WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029 */
{ "Modified tcpdump - libpcap", "modlibpcap", "pcap", "cap;dmp",
FALSE, FALSE, 0,
libpcap_dump_can_write_encap, libpcap_dump_open },
/* WTAP_FILE_PCAP_NOKIA */
/* WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA */
{ "Nokia tcpdump - libpcap ", "nokialibpcap", "pcap", "cap;dmp",
FALSE, FALSE, 0,
libpcap_dump_can_write_encap, libpcap_dump_open },
/* WTAP_FILE_PCAP_SS990417 */
/* WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417 */
{ "RedHat 6.1 tcpdump - libpcap", "rh6_1libpcap", "pcap", "cap;dmp",
FALSE, FALSE, 0,
libpcap_dump_can_write_encap, libpcap_dump_open },
/* WTAP_FILE_PCAP_SS990915 */
/* WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915 */
{ "SuSE 6.3 tcpdump - libpcap", "suse6_3libpcap", "pcap", "cap;dmp",
FALSE, FALSE, 0,
libpcap_dump_can_write_encap, libpcap_dump_open },
/* WTAP_FILE_5VIEWS */
/* WTAP_FILE_TYPE_SUBTYPE_5VIEWS */
{ "InfoVista 5View capture", "5views", "5vw", NULL,
TRUE, FALSE, 0,
_5views_dump_can_write_encap, _5views_dump_open },
/* WTAP_FILE_IPTRACE_1_0 */
/* WTAP_FILE_TYPE_SUBTYPE_IPTRACE_1_0 */
{ "AIX iptrace 1.0", "iptrace_1", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_IPTRACE_2_0 */
/* WTAP_FILE_TYPE_SUBTYPE_IPTRACE_2_0 */
{ "AIX iptrace 2.0", "iptrace_2", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_BER */
/* WTAP_FILE_TYPE_SUBTYPE_BER */
{ "ASN.1 Basic Encoding Rules", "ber", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_HCIDUMP */
/* WTAP_FILE_TYPE_SUBTYPE_HCIDUMP */
{ "Bluetooth HCI dump", "hcidump", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_CATAPULT_DCT2000 */
/* WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000 */
{ "Catapult DCT2000 trace (.out format)", "dct2000", "out", NULL,
FALSE, FALSE, 0,
catapult_dct2000_dump_can_write_encap, catapult_dct2000_dump_open },
/* WTAP_FILE_NETXRAY_OLD */
/* WTAP_FILE_TYPE_SUBTYPE_NETXRAY_OLD */
{ "Cinco Networks NetXRay 1.x", "netxray1", "cap", NULL,
TRUE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_NETXRAY_1_0 */
/* WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_0 */
{ "Cinco Networks NetXRay 2.0 or later", "netxray2", "cap", NULL,
TRUE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_COSINE */
/* WTAP_FILE_TYPE_SUBTYPE_COSINE */
{ "CoSine IPSX L2 capture", "cosine", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_CSIDS */
/* WTAP_FILE_TYPE_SUBTYPE_CSIDS */
{ "CSIDS IPLog", "csids", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_DBS_ETHERWATCH */
/* WTAP_FILE_TYPE_SUBTYPE_DBS_ETHERWATCH */
{ "DBS Etherwatch (VMS)", "etherwatch", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL},
/* WTAP_FILE_ERF */
/* WTAP_FILE_TYPE_SUBTYPE_ERF */
{ "Endace ERF capture", "erf", "erf", NULL,
FALSE, FALSE, 0,
erf_dump_can_write_encap, erf_dump_open },
/* WTAP_FILE_EYESDN */
/* WTAP_FILE_TYPE_SUBTYPE_EYESDN */
{ "EyeSDN USB S0/E1 ISDN trace format", "eyesdn", "trc", NULL,
FALSE, FALSE, 0,
eyesdn_dump_can_write_encap, eyesdn_dump_open },
/* WTAP_FILE_NETTL */
/* WTAP_FILE_TYPE_SUBTYPE_NETTL */
{ "HP-UX nettl trace", "nettl", "trc0", "trc1",
FALSE, FALSE, 0,
nettl_dump_can_write_encap, nettl_dump_open },
/* WTAP_FILE_ISERIES */
/* WTAP_FILE_TYPE_SUBTYPE_ISERIES */
{ "IBM iSeries comm. trace (ASCII)", "iseries_ascii", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_ISERIES_UNICODE */
/* WTAP_FILE_TYPE_SUBTYPE_ISERIES_UNICODE */
{ "IBM iSeries comm. trace (UNICODE)", "iseries_unicode", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_I4BTRACE */
/* WTAP_FILE_TYPE_SUBTYPE_I4BTRACE */
{ "I4B ISDN trace", "i4btrace", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_ASCEND */
/* WTAP_FILE_TYPE_SUBTYPE_ASCEND */
{ "Lucent/Ascend access server trace", "ascend", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_NETMON_1_x */
/* WTAP_FILE_TYPE_SUBTYPE_NETMON_1_x */
{ "Microsoft NetMon 1.x", "netmon1", "cap", NULL,
TRUE, FALSE, 0,
netmon_dump_can_write_encap_1_x, netmon_dump_open },
/* WTAP_FILE_NETMON_2_x */
/* WTAP_FILE_TYPE_SUBTYPE_NETMON_2_x */
{ "Microsoft NetMon 2.x", "netmon2", "cap", NULL,
TRUE, FALSE, 0,
netmon_dump_can_write_encap_2_x, netmon_dump_open },
/* WTAP_FILE_NGSNIFFER_UNCOMPRESSED */
/* WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED */
{ "Sniffer (DOS)", "ngsniffer", "cap", "enc;trc;fdc;syc",
FALSE, FALSE, 0,
ngsniffer_dump_can_write_encap, ngsniffer_dump_open },
/* WTAP_FILE_NGSNIFFER_COMPRESSED */
/* WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_COMPRESSED */
{ "Sniffer (DOS), compressed", "ngsniffer_comp", "cap", "enc;trc;fdc;syc",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_NETXRAY_1_1 */
/* WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_1 */
{ "NetXray, Sniffer (Windows) 1.1", "ngwsniffer_1_1", "cap", NULL,
TRUE, FALSE, 0,
netxray_dump_can_write_encap_1_1, netxray_dump_open_1_1 },
/* WTAP_FILE_NETXRAY_2_00x */
/* WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x */
{ "Sniffer (Windows) 2.00x", "ngwsniffer_2_0", "cap", "caz",
TRUE, FALSE, 0,
netxray_dump_can_write_encap_2_0, netxray_dump_open_2_0 },
/* WTAP_FILE_NETWORK_INSTRUMENTS */
/* WTAP_FILE_TYPE_SUBTYPE_NETWORK_INSTRUMENTS */
{ "Network Instruments Observer", "niobserver", "bfr", NULL,
FALSE, FALSE, 0,
network_instruments_dump_can_write_encap, network_instruments_dump_open },
/* WTAP_FILE_LANALYZER */
/* WTAP_FILE_TYPE_SUBTYPE_LANALYZER */
{ "Novell LANalyzer","lanalyzer", "tr1", NULL,
TRUE, FALSE, 0,
lanalyzer_dump_can_write_encap, lanalyzer_dump_open },
/* WTAP_FILE_PPPDUMP */
/* WTAP_FILE_TYPE_SUBTYPE_PPPDUMP */
{ "pppd log (pppdump format)", "pppd", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_RADCOM */
/* WTAP_FILE_TYPE_SUBTYPE_RADCOM */
{ "RADCOM WAN/LAN analyzer", "radcom", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_SNOOP */
/* WTAP_FILE_TYPE_SUBTYPE_SNOOP */
{ "Sun snoop", "snoop", "snoop", "cap",
FALSE, FALSE, 0,
snoop_dump_can_write_encap, snoop_dump_open },
/* WTAP_FILE_SHOMITI */
/* WTAP_FILE_TYPE_SUBTYPE_SHOMITI */
{ "Shomiti/Finisar Surveyor", "shomiti", "cap", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_VMS */
/* WTAP_FILE_TYPE_SUBTYPE_VMS */
{ "TCPIPtrace (VMS)", "tcpiptrace", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL},
/* WTAP_FILE_K12 */
/* WTAP_FILE_TYPE_SUBTYPE_K12 */
{ "Tektronix K12xx 32-bit .rf5 format", "rf5", "rf5", NULL,
TRUE, FALSE, 0,
k12_dump_can_write_encap, k12_dump_open },
/* WTAP_FILE_TOSHIBA */
/* WTAP_FILE_TYPE_SUBTYPE_TOSHIBA */
{ "Toshiba Compact ISDN Router snoop", "toshiba", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_VISUAL_NETWORKS */
/* WTAP_FILE_TYPE_SUBTYPE_VISUAL_NETWORKS */
{ "Visual Networks traffic capture", "visual", NULL, NULL,
TRUE, FALSE, 0,
visual_dump_can_write_encap, visual_dump_open },
/* WTAP_FILE_PEEKCLASSIC_V56 */
/* WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V56 */
{ "WildPackets classic (V5 and V6)", "peekclassic56", "pkt", "tpc;apc;wpz",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_PEEKCLASSIC_V7 */
/* WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V7 */
{ "WildPackets classic (V7)", "peekclassic7", "pkt", "tpc;apc;wpz",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_PEEKTAGGED */
/* WTAP_FILE_TYPE_SUBTYPE_PEEKTAGGED */
{ "WildPackets tagged", "peektagged", "pkt", "tpc;apc;wpz",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_MPEG */
/* WTAP_FILE_TYPE_SUBTYPE_MPEG */
{ "MPEG", "mpeg", "mpeg", "mpg;mp3",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_K12TEXT */
/* WTAP_FILE_TYPE_SUBTYPE_K12TEXT */
{ "K12 text file", "k12text", "txt", NULL,
FALSE, FALSE, 0,
k12text_dump_can_write_encap, k12text_dump_open },
/* WTAP_FILE_NETSCREEN */
/* WTAP_FILE_TYPE_SUBTYPE_NETSCREEN */
{ "NetScreen snoop text file", "netscreen", "txt", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_COMMVIEW */
/* WTAP_FILE_TYPE_SUBTYPE_COMMVIEW */
{ "TamoSoft CommView", "commview", "ncf", NULL,
FALSE, FALSE, 0,
commview_dump_can_write_encap, commview_dump_open },
/* WTAP_FILE_BTSNOOP */
/* WTAP_FILE_TYPE_SUBTYPE_BTSNOOP */
{ "Symbian OS btsnoop", "btsnoop", "log", NULL,
FALSE, FALSE, 0,
btsnoop_dump_can_write_encap, btsnoop_dump_open_h4 },
/* WTAP_FILE_TNEF */
/* WTAP_FILE_TYPE_SUBTYPE_TNEF */
{ "Transport-Neutral Encapsulation Format", "tnef", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_DCT3TRACE */
/* WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE */
{ "Gammu DCT3 trace", "dct3trace", "xml", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_PACKETLOGGER */
/* WTAP_FILE_TYPE_SUBTYPE_PACKETLOGGER */
{ "PacketLogger", "pklg", "pklg", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_DAINTREE_SNA */
/* WTAP_FILE_TYPE_SUBTYPE_DAINTREE_SNA */
{ "Daintree SNA", "dsna", "dcf", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_NETSCALER_1_0 */
/* WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0 */
{ "NetScaler Trace (Version 1.0)", "nstrace10", NULL, NULL,
TRUE, FALSE, 0,
nstrace_10_dump_can_write_encap, nstrace_dump_open },
/* WTAP_FILE_NETSCALER_2_0 */
/* WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0 */
{ "NetScaler Trace (Version 2.0)", "nstrace20", "cap", NULL,
TRUE, FALSE, 0,
nstrace_20_dump_can_write_encap, nstrace_dump_open },
/* WTAP_FILE_JPEG_JFIF */
/* WTAP_FILE_TYPE_SUBTYPE_JPEG_JFIF */
{ "JPEG/JFIF", "jpeg", "jpg", "jpeg;jfif",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_IPFIX */
/* WTAP_FILE_TYPE_SUBTYPE_IPFIX */
{ "IPFIX File Format", "ipfix", "pfx", "ipfix",
FALSE, FALSE, 0,
NULL, NULL },
@ -997,68 +997,68 @@ static const struct file_type_info dump_open_table_base[] = {
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_AETHRA */
/* WTAP_FILE_TYPE_SUBTYPE_AETHRA */
{ "Aethra .aps file", "aethra", "aps", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_MPEG_2_TS */
/* WTAP_FILE_TYPE_SUBTYPE_MPEG_2_TS */
{ "MPEG2 transport stream", "mp2t", "mp2t", "ts;mpg",
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_VWR_80211 */
/* WTAP_FILE_TYPE_SUBTYPE_VWR_80211 */
{ "Ixia IxVeriWave .vwr Raw 802.11 Capture", "vwr80211", "vwr", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_VWR_ETH */
/* WTAP_FILE_TYPE_SUBTYPE_VWR_ETH */
{ "Ixia IxVeriWave .vwr Raw Ethernet Capture", "vwreth", "vwr", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_CAMINS */
/* WTAP_FILE_TYPE_SUBTYPE_CAMINS */
{ "CAM Inspector file", "camins", "camins", NULL,
FALSE, FALSE, 0,
NULL, NULL },
/* WTAP_FILE_STANAG_4607 */
/* WTAP_FILE_TYPE_SUBTYPE_STANAG_4607 */
{ "STANAG 4607 Format", "stanag4607", NULL, NULL,
FALSE, FALSE, 0,
NULL, NULL }
};
gint wtap_num_file_types = sizeof(dump_open_table_base) / sizeof(struct file_type_info);
gint wtap_num_file_types_subtypes = sizeof(dump_open_table_base) / sizeof(struct file_type_subtype_info);
static GArray* dump_open_table_arr = NULL;
static const struct file_type_info* dump_open_table = dump_open_table_base;
static const struct file_type_subtype_info* dump_open_table = dump_open_table_base;
/* initialize the file types array if it has not being initialized yet */
static void init_file_types(void) {
static void init_file_types_subtypes(void) {
if (dump_open_table_arr) return;
dump_open_table_arr = g_array_new(FALSE,TRUE,sizeof(struct file_type_info));
dump_open_table_arr = g_array_new(FALSE,TRUE,sizeof(struct file_type_subtype_info));
g_array_append_vals(dump_open_table_arr,dump_open_table_base,wtap_num_file_types);
g_array_append_vals(dump_open_table_arr,dump_open_table_base,wtap_num_file_types_subtypes);
dump_open_table = (const struct file_type_info*)(void *)dump_open_table_arr->data;
dump_open_table = (const struct file_type_subtype_info*)(void *)dump_open_table_arr->data;
}
int wtap_register_file_type(const struct file_type_info* fi) {
init_file_types();
int wtap_register_file_type_subtypes(const struct file_type_subtype_info* fi) {
init_file_types_subtypes();
g_array_append_val(dump_open_table_arr,*fi);
dump_open_table = (const struct file_type_info*)(void *)dump_open_table_arr->data;
dump_open_table = (const struct file_type_subtype_info*)(void *)dump_open_table_arr->data;
return wtap_num_file_types++;
return wtap_num_file_types_subtypes++;
}
int wtap_get_num_file_types(void)
int wtap_get_num_file_types_subtypes(void)
{
return wtap_num_file_types;
return wtap_num_file_types_subtypes;
}
/*
@ -1083,7 +1083,7 @@ wtap_dump_file_encap_type(const GArray *file_encaps)
static gboolean
wtap_dump_can_write_encap(int filetype, int encap)
{
if (filetype < 0 || filetype >= wtap_num_file_types
if (filetype < 0 || filetype >= wtap_num_file_types_subtypes
|| dump_open_table[filetype].can_write_encap == NULL)
return FALSE;
@ -1154,7 +1154,7 @@ wtap_dump_can_write(const GArray *file_encaps, guint32 required_comment_types)
{
int ft;
for (ft = 0; ft < WTAP_NUM_FILE_TYPES; ft++) {
for (ft = 0; ft < WTAP_NUM_FILE_TYPES_SUBTYPES; ft++) {
/* To save a file with Wiretap, Wiretap has to handle that format,
and its code to handle that format must be able to write a file
with this file's encapsulation types. */
@ -1169,108 +1169,108 @@ wtap_dump_can_write(const GArray *file_encaps, guint32 required_comment_types)
}
/**
* Get a GArray of WTAP_FILE_ values for file types that can be used
* to save a file of a given type with a given GArray of encapsulation
* types and the given bitmask of comment types.
* Get a GArray of WTAP_FILE_TYPE_SUBTYPE_ values for file types/subtypes
* that can be used to save a file of a given type/subtype with a given
* GArray of encapsulation types and the given bitmask of comment types.
*/
GArray *
wtap_get_savable_file_types(int file_type, const GArray *file_encaps,
guint32 required_comment_types)
wtap_get_savable_file_types_subtypes(int file_type_subtype,
const GArray *file_encaps, guint32 required_comment_types)
{
GArray *savable_file_types;
GArray *savable_file_types_subtypes;
int ft;
int default_file_type = -1;
int other_file_type = -1;
int default_file_type_subtype = -1;
int other_file_type_subtype = -1;
/* Can we save this file in its own file type? */
if (wtap_dump_can_write_format(file_type, file_encaps,
/* Can we save this file in its own file type/subtype? */
if (wtap_dump_can_write_format(file_type_subtype, file_encaps,
required_comment_types)) {
/* Yes - make that the default file type. */
default_file_type = file_type;
/* Yes - make that the default file type/subtype. */
default_file_type_subtype = file_type_subtype;
} else {
/* OK, find the first file type we *can* save it as. */
default_file_type = -1;
for (ft = 0; ft < WTAP_NUM_FILE_TYPES; ft++) {
/* OK, find the first file type/subtype we *can* save it as. */
default_file_type_subtype = -1;
for (ft = 0; ft < WTAP_NUM_FILE_TYPES_SUBTYPES; ft++) {
if (wtap_dump_can_write_format(ft, file_encaps,
required_comment_types)) {
/* OK, got it. */
default_file_type = ft;
default_file_type_subtype = ft;
}
}
}
if (default_file_type == -1) {
/* We don't support writing this file as any file type. */
if (default_file_type_subtype == -1) {
/* We don't support writing this file as any file type/subtype. */
return NULL;
}
/* Allocate the array. */
savable_file_types = g_array_new(FALSE, FALSE, (guint)sizeof (int));
savable_file_types_subtypes = g_array_new(FALSE, FALSE, (guint)sizeof (int));
/* Put the default file format first in the list. */
g_array_append_val(savable_file_types, default_file_type);
/* Put the default file type/subtype first in the list. */
g_array_append_val(savable_file_types_subtypes, default_file_type_subtype);
/* If the default is pcap, put pcap-NG right after it if we can
also write it in pcap-NG format; otherwise, if the default is
pcap-NG, put pcap right after it if we can also write it in
pcap format. */
if (default_file_type == WTAP_FILE_PCAP) {
if (wtap_dump_can_write_format(WTAP_FILE_PCAPNG, file_encaps,
if (default_file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP) {
if (wtap_dump_can_write_format(WTAP_FILE_TYPE_SUBTYPE_PCAPNG, file_encaps,
required_comment_types))
other_file_type = WTAP_FILE_PCAPNG;
} else if (default_file_type == WTAP_FILE_PCAPNG) {
if (wtap_dump_can_write_format(WTAP_FILE_PCAP, file_encaps,
other_file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
} else if (default_file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAPNG) {
if (wtap_dump_can_write_format(WTAP_FILE_TYPE_SUBTYPE_PCAP, file_encaps,
required_comment_types))
other_file_type = WTAP_FILE_PCAP;
other_file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP;
}
if (other_file_type != -1)
g_array_append_val(savable_file_types, other_file_type);
if (other_file_type_subtype != -1)
g_array_append_val(savable_file_types_subtypes, other_file_type_subtype);
/* Add all the other file types that work. */
for (ft = 0; ft < WTAP_NUM_FILE_TYPES; ft++) {
if (ft == WTAP_FILE_UNKNOWN)
/* Add all the other file types/subtypes that work. */
for (ft = 0; ft < WTAP_NUM_FILE_TYPES_SUBTYPES; ft++) {
if (ft == WTAP_FILE_TYPE_SUBTYPE_UNKNOWN)
continue; /* not a real file type */
if (ft == default_file_type || ft == other_file_type)
if (ft == default_file_type_subtype || ft == other_file_type_subtype)
continue; /* we've already done this one */
if (wtap_dump_can_write_format(ft, file_encaps,
required_comment_types)) {
/* OK, we can write it out in this type. */
g_array_append_val(savable_file_types, ft);
g_array_append_val(savable_file_types_subtypes, ft);
}
}
return savable_file_types;
return savable_file_types_subtypes;
}
/* Name that should be somewhat descriptive. */
const char *wtap_file_type_string(int filetype)
const char *wtap_file_type_subtype_string(int file_type_subtype)
{
if (filetype < 0 || filetype >= wtap_num_file_types) {
g_error("Unknown capture file type %d", filetype);
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes) {
g_error("Unknown capture file type %d", file_type_subtype);
/** g_error() does an abort() and thus never returns **/
return "";
} else
return dump_open_table[filetype].name;
return dump_open_table[file_type_subtype].name;
}
/* Name to use in, say, a command-line flag specifying the type. */
const char *wtap_file_type_short_string(int filetype)
/* Name to use in, say, a command-line flag specifying the type/subtype. */
const char *wtap_file_type_subtype_short_string(int file_type_subtype)
{
if (filetype < 0 || filetype >= wtap_num_file_types)
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes)
return NULL;
else
return dump_open_table[filetype].short_name;
return dump_open_table[file_type_subtype].short_name;
}
/* Translate a short name to a capture file type. */
int wtap_short_string_to_file_type(const char *short_name)
/* Translate a short name to a capture file type/subtype. */
int wtap_short_string_to_file_type_subtype(const char *short_name)
{
int filetype;
int file_type_subtype;
for (filetype = 0; filetype < wtap_num_file_types; filetype++) {
if (dump_open_table[filetype].short_name != NULL &&
strcmp(short_name, dump_open_table[filetype].short_name) == 0)
return filetype;
for (file_type_subtype = 0; file_type_subtype < wtap_num_file_types_subtypes; file_type_subtype++) {
if (dump_open_table[file_type_subtype].short_name != NULL &&
strcmp(short_name, dump_open_table[file_type_subtype].short_name) == 0)
return file_type_subtype;
}
/*
@ -1279,13 +1279,13 @@ int wtap_short_string_to_file_type(const char *short_name)
* backwards compatibility.
*/
if (strcmp(short_name, "libpcap") == 0)
return WTAP_FILE_PCAP;
return WTAP_FILE_TYPE_SUBTYPE_PCAP;
return -1; /* no such file type, or we can't write it */
}
static GSList *
add_extensions_for_filetype(int filetype, GSList *extensions,
add_extensions_for_file_type_subtype(int file_type_subtype, GSList *extensions,
GSList *compressed_file_extensions)
{
gchar **extensions_set, **extensionp;
@ -1296,17 +1296,17 @@ add_extensions_for_filetype(int filetype, GSList *extensions,
* it.
*/
extensions = add_extensions(extensions,
dump_open_table[filetype].default_file_extension,
dump_open_table[file_type_subtype].default_file_extension,
compressed_file_extensions);
if (dump_open_table[filetype].additional_file_extensions != NULL) {
if (dump_open_table[file_type_subtype].additional_file_extensions != NULL) {
/*
* We have additional extensions; add them.
*
* First, split the extension-list string into a set of
* extensions.
*/
extensions_set = g_strsplit(dump_open_table[filetype].additional_file_extensions,
extensions_set = g_strsplit(dump_open_table[file_type_subtype].additional_file_extensions,
";", 0);
/*
@ -1337,15 +1337,15 @@ add_extensions_for_filetype(int filetype, GSList *extensions,
All strings in the list are allocated with g_malloc() and must be freed
with g_free(). */
GSList *wtap_get_file_extensions_list(int filetype, gboolean include_compressed)
GSList *wtap_get_file_extensions_list(int file_type_subtype, gboolean include_compressed)
{
GSList *compressed_file_extensions;
GSList *extensions;
if (filetype < 0 || filetype >= wtap_num_file_types)
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes)
return NULL; /* not a valid file type */
if (dump_open_table[filetype].default_file_extension == NULL)
if (dump_open_table[file_type_subtype].default_file_extension == NULL)
return NULL; /* valid, but no extensions known */
extensions = NULL; /* empty list, to start with */
@ -1363,7 +1363,7 @@ GSList *wtap_get_file_extensions_list(int filetype, gboolean include_compressed)
* Add all this file type's extensions, with compressed
* variants.
*/
extensions = add_extensions_for_filetype(filetype, extensions,
extensions = add_extensions_for_file_type_subtype(file_type_subtype, extensions,
compressed_file_extensions);
g_slist_free(compressed_file_extensions);
@ -1387,90 +1387,90 @@ void wtap_free_extensions_list(GSList *extensions)
/* Return the default file extension to use with the specified file type;
that's just the extension, without any ".". */
const char *wtap_default_file_extension(int filetype)
const char *wtap_default_file_extension(int file_type_subtype)
{
if (filetype < 0 || filetype >= wtap_num_file_types)
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes)
return NULL;
else
return dump_open_table[filetype].default_file_extension;
return dump_open_table[file_type_subtype].default_file_extension;
}
gboolean wtap_dump_can_open(int filetype)
gboolean wtap_dump_can_open(int file_type_subtype)
{
if (filetype < 0 || filetype >= wtap_num_file_types
|| dump_open_table[filetype].dump_open == NULL)
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes
|| dump_open_table[file_type_subtype].dump_open == NULL)
return FALSE;
return TRUE;
}
#ifdef HAVE_LIBZ
gboolean wtap_dump_can_compress(int filetype)
gboolean wtap_dump_can_compress(int file_type_subtype)
{
/*
* If this is an unknown file type, or if we have to
* seek when writing out a file with this file type,
* return FALSE.
*/
if (filetype < 0 || filetype >= wtap_num_file_types
|| dump_open_table[filetype].writing_must_seek)
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes
|| dump_open_table[file_type_subtype].writing_must_seek)
return FALSE;
return TRUE;
}
#else
gboolean wtap_dump_can_compress(int filetype _U_)
gboolean wtap_dump_can_compress(int file_type_subtype _U_)
{
return FALSE;
}
#endif
gboolean wtap_dump_has_name_resolution(int filetype)
gboolean wtap_dump_has_name_resolution(int file_type_subtype)
{
if (filetype < 0 || filetype >= wtap_num_file_types
|| dump_open_table[filetype].has_name_resolution == FALSE)
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes
|| dump_open_table[file_type_subtype].has_name_resolution == FALSE)
return FALSE;
return TRUE;
}
gboolean wtap_dump_supports_comment_types(int filetype, guint32 comment_types)
gboolean wtap_dump_supports_comment_types(int file_type_subtype, guint32 comment_types)
{
guint32 supported_comment_types;
if (filetype < 0 || filetype >= wtap_num_file_types)
if (file_type_subtype < 0 || file_type_subtype >= wtap_num_file_types_subtypes)
return FALSE;
supported_comment_types = dump_open_table[filetype].supported_comment_types;
supported_comment_types = dump_open_table[file_type_subtype].supported_comment_types;
if ((comment_types & supported_comment_types) == comment_types)
return TRUE;
return FALSE;
}
static gboolean wtap_dump_open_check(int filetype, int encap, gboolean comressed, int *err);
static wtap_dumper* wtap_dump_alloc_wdh(int filetype, int encap, int snaplen,
static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean comressed, int *err);
static wtap_dumper* wtap_dump_alloc_wdh(int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err);
static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int filetype, gboolean compressed, int *err);
static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err);
static WFILE_T wtap_dump_file_open(wtap_dumper *wdh, const char *filename);
static WFILE_T wtap_dump_file_fdopen(wtap_dumper *wdh, int fd);
static int wtap_dump_file_close(wtap_dumper *wdh);
wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
wtap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int encap,
int snaplen, gboolean compressed, int *err)
{
return wtap_dump_open_ng(filename, filetype, encap,snaplen, compressed, NULL, NULL, err);
return wtap_dump_open_ng(filename, file_type_subtype, encap,snaplen, compressed, NULL, NULL, err);
}
static wtap_dumper *
wtap_dump_init_dumper(int filetype, int encap, int snaplen, gboolean compressed,
wtap_dump_init_dumper(int file_type_subtype, int encap, int snaplen, gboolean compressed,
wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
{
wtap_dumper *wdh;
/* Allocate a data structure for the output stream. */
wdh = wtap_dump_alloc_wdh(filetype, encap, snaplen, compressed, err);
wdh = wtap_dump_alloc_wdh(file_type_subtype, encap, snaplen, compressed, err);
if (wdh == NULL)
return NULL; /* couldn't allocate it */
@ -1506,7 +1506,7 @@ wtap_dump_init_dumper(int filetype, int encap, int snaplen, gboolean compressed,
return wdh;
}
wtap_dumper* wtap_dump_open_ng(const char *filename, int filetype, int encap,
wtap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap,
int snaplen, gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
{
wtap_dumper *wdh;
@ -1514,11 +1514,11 @@ wtap_dumper* wtap_dump_open_ng(const char *filename, int filetype, int encap,
/* Check whether we can open a capture file with that file type
and that encapsulation. */
if (!wtap_dump_open_check(filetype, encap, compressed, err))
if (!wtap_dump_open_check(file_type_subtype, encap, compressed, err))
return NULL;
/* Allocate and initialize a data structure for the output stream. */
wdh = wtap_dump_init_dumper(filetype, encap, snaplen, compressed,
wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
shb_hdr, idb_inf, err);
if (wdh == NULL)
return NULL;
@ -1552,7 +1552,7 @@ wtap_dumper* wtap_dump_open_ng(const char *filename, int filetype, int encap,
wdh->fh = fh;
}
if (!wtap_dump_open_finish(wdh, filetype, compressed, err)) {
if (!wtap_dump_open_finish(wdh, file_type_subtype, compressed, err)) {
/* Get rid of the file we created; we couldn't finish
opening it. */
if (wdh->fh != stdout) {
@ -1565,13 +1565,13 @@ wtap_dumper* wtap_dump_open_ng(const char *filename, int filetype, int encap,
return wdh;
}
wtap_dumper* wtap_dump_fdopen(int fd, int filetype, int encap, int snaplen,
wtap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err)
{
return wtap_dump_fdopen_ng(fd, filetype, encap, snaplen, compressed, NULL, NULL, err);
return wtap_dump_fdopen_ng(fd, file_type_subtype, encap, snaplen, compressed, NULL, NULL, err);
}
wtap_dumper* wtap_dump_fdopen_ng(int fd, int filetype, int encap, int snaplen,
wtap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen,
gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
{
wtap_dumper *wdh;
@ -1579,11 +1579,11 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int filetype, int encap, int snaplen,
/* Check whether we can open a capture file with that file type
and that encapsulation. */
if (!wtap_dump_open_check(filetype, encap, compressed, err))
if (!wtap_dump_open_check(file_type_subtype, encap, compressed, err))
return NULL;
/* Allocate and initialize a data structure for the output stream. */
wdh = wtap_dump_init_dumper(filetype, encap, snaplen, compressed,
wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
shb_hdr, idb_inf, err);
if (wdh == NULL)
return NULL;
@ -1610,7 +1610,7 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int filetype, int encap, int snaplen,
}
wdh->fh = fh;
if (!wtap_dump_open_finish(wdh, filetype, compressed, err)) {
if (!wtap_dump_open_finish(wdh, file_type_subtype, compressed, err)) {
wtap_dump_file_close(wdh);
g_free(wdh);
return NULL;
@ -1618,9 +1618,9 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int filetype, int encap, int snaplen,
return wdh;
}
static gboolean wtap_dump_open_check(int filetype, int encap, gboolean compressed, int *err)
static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean compressed, int *err)
{
if (!wtap_dump_can_open(filetype)) {
if (!wtap_dump_can_open(file_type_subtype)) {
/* Invalid type, or type we don't know how to write. */
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
return FALSE;
@ -1628,17 +1628,17 @@ static gboolean wtap_dump_open_check(int filetype, int encap, gboolean compresse
/* OK, we know how to write that type; can we write the specified
encapsulation type? */
*err = (*dump_open_table[filetype].can_write_encap)(encap);
*err = (*dump_open_table[file_type_subtype].can_write_encap)(encap);
if (*err != 0)
return FALSE;
/* if compression is wanted, do we support this for this filetype? */
if(compressed && !wtap_dump_can_compress(filetype)) {
/* if compression is wanted, do we support this for this file_type_subtype? */
if(compressed && !wtap_dump_can_compress(file_type_subtype)) {
*err = WTAP_ERR_COMPRESSION_NOT_SUPPORTED;
return FALSE;
}
*err = (*dump_open_table[filetype].can_write_encap)(encap);
*err = (*dump_open_table[file_type_subtype].can_write_encap)(encap);
if (*err != 0)
return FALSE;
@ -1646,7 +1646,7 @@ static gboolean wtap_dump_open_check(int filetype, int encap, gboolean compresse
return TRUE;
}
static wtap_dumper* wtap_dump_alloc_wdh(int filetype, int encap, int snaplen,
static wtap_dumper* wtap_dump_alloc_wdh(int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err)
{
wtap_dumper *wdh;
@ -1657,14 +1657,14 @@ static wtap_dumper* wtap_dump_alloc_wdh(int filetype, int encap, int snaplen,
return NULL;
}
wdh->file_type = filetype;
wdh->file_type_subtype = file_type_subtype;
wdh->snaplen = snaplen;
wdh->encap = encap;
wdh->compressed = compressed;
return wdh;
}
static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int filetype, gboolean compressed, int *err)
static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err)
{
int fd;
gboolean cant_seek;
@ -1685,13 +1685,13 @@ static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int filetype, gboolean c
}
/* If this file type requires seeking, and we can't seek, fail. */
if (dump_open_table[filetype].writing_must_seek && cant_seek) {
if (dump_open_table[file_type_subtype].writing_must_seek && cant_seek) {
*err = WTAP_ERR_CANT_WRITE_TO_PIPE;
return FALSE;
}
/* Now try to open the file for writing. */
if (!(*dump_open_table[filetype].dump_open)(wdh, err)) {
if (!(*dump_open_table[file_type_subtype].dump_open)(wdh, err)) {
return FALSE;
}
@ -1760,8 +1760,8 @@ void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped)
gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, addrinfo_lists_t *addrinfo_lists)
{
if (!wdh || wdh->file_type < 0 || wdh->file_type >= wtap_num_file_types
|| dump_open_table[wdh->file_type].has_name_resolution == FALSE)
if (!wdh || wdh->file_type_subtype < 0 || wdh->file_type_subtype >= wtap_num_file_types_subtypes
|| dump_open_table[wdh->file_type_subtype].has_name_resolution == FALSE)
return FALSE;
wdh->addrinfo_lists = addrinfo_lists;
return TRUE;

View File

@ -124,7 +124,7 @@ int hcidump_open(wtap *wth, int *err, gchar **err_info)
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
wth->file_type = WTAP_FILE_HCIDUMP;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_HCIDUMP;
wth->file_encap = WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
wth->snapshot_length = 0;

View File

@ -97,7 +97,7 @@ int i4btrace_open(wtap *wth, int *err, gchar **err_info)
/* Get capture start time */
wth->file_type = WTAP_FILE_I4BTRACE;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_I4BTRACE;
i4btrace = (i4btrace_t *)g_malloc(sizeof(i4btrace_t));
wth->priv = (void *)i4btrace;
wth->subtype_read = i4btrace_read;

View File

@ -271,7 +271,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_read = ipfix_read;
wth->subtype_seek_read = ipfix_seek_read;
wth->subtype_close = ipfix_close;
wth->file_type = WTAP_FILE_IPFIX;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPFIX;
/* go back to beginning of file */
if (file_seek (wth->fh, 0, SEEK_SET, err) != 0)

View File

@ -69,13 +69,13 @@ int iptrace_open(wtap *wth, int *err, gchar **err_info)
name[11] = '\0';
if (strcmp(name, "iptrace 1.0") == 0) {
wth->file_type = WTAP_FILE_IPTRACE_1_0;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPTRACE_1_0;
wth->subtype_read = iptrace_read_1_0;
wth->subtype_seek_read = iptrace_seek_read_1_0;
wth->tsprecision = WTAP_FILE_TSPREC_SEC;
}
else if (strcmp(name, "iptrace 2.0") == 0) {
wth->file_type = WTAP_FILE_IPTRACE_2_0;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPTRACE_2_0;
wth->subtype_read = iptrace_read_2_0;
wth->subtype_seek_read = iptrace_seek_read_2_0;
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;

View File

@ -247,7 +247,7 @@ iseries_open (wtap * wth, int *err, gchar ** err_info)
}
wth->file_encap = WTAP_ENCAP_ETHERNET;
wth->file_type = WTAP_FILE_ISERIES;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ISERIES;
wth->snapshot_length = 0;
wth->subtype_read = iseries_read;
wth->subtype_seek_read = iseries_seek_read;
@ -287,7 +287,7 @@ iseries_open (wtap * wth, int *err, gchar ** err_info)
}
wth->file_encap = WTAP_ENCAP_ETHERNET;
wth->file_type = WTAP_FILE_ISERIES;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ISERIES;
wth->snapshot_length = 0;
wth->subtype_read = iseries_read;
wth->subtype_seek_read = iseries_seek_read;

View File

@ -754,7 +754,7 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
}
} while(1);
wth->file_type = WTAP_FILE_K12;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_K12;
wth->file_encap = WTAP_ENCAP_K12;
wth->snapshot_length = 0;
wth->subtype_read = k12_read;

View File

@ -347,12 +347,12 @@ k12text_open(wtap *wth, int *err, gchar **err_info _U_)
k12text = (k12text_t *)g_malloc(sizeof(k12text_t));
wth->priv = (void *)k12text;
k12text->next_frame_offset = 0;
wth->file_type = WTAP_FILE_K12TEXT;
wth->file_type = WTAP_FILE_TYPE_SUBTYPE_K12TEXT;
wth->file_encap = WTAP_ENCAP_PER_PACKET;
wth->snapshot_length = 0;
wth->subtype_read = k12text_read;
wth->subtype_seek_read = k12text_seek_read;
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
wth->tsprecision = WTAP_FILE_TYPE_SUBTYPE_TSPREC_NSEC;
return 1;
}

View File

@ -342,7 +342,7 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
/* If we made it this far, then the file is a LANAlyzer file.
* Let's get some info from it. Note that we get wth->snapshot_length
* from a record later in the file. */
wth->file_type = WTAP_FILE_LANALYZER;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_LANALYZER;
lanalyzer = (lanalyzer_t *)g_malloc(sizeof(lanalyzer_t));
wth->priv = (void *)lanalyzer;
wth->subtype_read = lanalyzer_read;

View File

@ -310,7 +310,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
* and for the ERF link-layer header type, and set the
* precision to nanosecond precision.
*/
wth->file_type = WTAP_FILE_PCAP_AIX;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX;
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
return 1;
}
@ -355,7 +355,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
*
* Try ss991029, the last of his patches, first.
*/
wth->file_type = WTAP_FILE_PCAP_SS991029;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029;
first_packet_offset = file_tell(wth->fh);
switch (libpcap_try(wth, err)) {
@ -390,7 +390,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
* so we put the seek pointer back and treat
* it as 990915.
*/
wth->file_type = WTAP_FILE_PCAP_SS990915;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915;
if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
@ -401,9 +401,9 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
* Try the standard format first.
*/
if(wth->tsprecision == WTAP_FILE_TSPREC_NSEC) {
wth->file_type = WTAP_FILE_PCAP_NSEC;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC;
} else {
wth->file_type = WTAP_FILE_PCAP;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP;
}
first_packet_offset = file_tell(wth->fh);
switch (libpcap_try(wth, err)) {
@ -438,7 +438,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
* a standard file. Put the seek pointer back and try
* ss990417.
*/
wth->file_type = WTAP_FILE_PCAP_SS990417;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417;
if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
@ -475,7 +475,7 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
* to try after that, so we put the seek pointer back
* and treat it as a Nokia file.
*/
wth->file_type = WTAP_FILE_PCAP_NOKIA;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA;
if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
@ -491,7 +491,7 @@ done:
* If this is a Nokia capture, treat 13 as WTAP_ENCAP_ATM_PDUS,
* rather than as what we normally treat it.
*/
if (wth->file_type == WTAP_FILE_PCAP_NOKIA && hdr.network == 13)
if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA && hdr.network == 13)
wth->file_encap = WTAP_ENCAP_ATM_PDUS;
if (wth->file_encap == WTAP_ENCAP_ERF) {
@ -644,7 +644,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
* AIX appears to put 3 bytes of padding in front of FDDI
* frames; strip that crap off.
*/
if (wth->file_type == WTAP_FILE_PCAP_AIX &&
if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX &&
(wth->file_encap == WTAP_ENCAP_FDDI ||
wth->file_encap == WTAP_ENCAP_FDDI_BITSWAPPED)) {
/*
@ -661,7 +661,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
return FALSE;
}
phdr_len = pcap_process_pseudo_header(fh, wth->file_type,
phdr_len = pcap_process_pseudo_header(fh, wth->file_type_subtype,
wth->file_encap, packet_size, TRUE, phdr, err, err_info);
if (phdr_len < 0)
return FALSE; /* error */
@ -696,7 +696,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
return FALSE; /* failed */
libpcap = (libpcap_t *)wth->priv;
pcap_read_post_process(wth->file_type, wth->file_encap,
pcap_read_post_process(wth->file_type_subtype, wth->file_encap,
&phdr->pseudo_header, buffer_start_ptr(buf), packet_size,
libpcap->byte_swapped, -1);
return TRUE;
@ -712,24 +712,24 @@ static int libpcap_read_header(wtap *wth, FILE_T fh, int *err, gchar **err_info,
/* Read record header. */
errno = WTAP_ERR_CANT_READ;
switch (wth->file_type) {
switch (wth->file_type_subtype) {
case WTAP_FILE_PCAP:
case WTAP_FILE_PCAP_AIX:
case WTAP_FILE_PCAP_NSEC:
case WTAP_FILE_TYPE_SUBTYPE_PCAP:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC:
bytes_to_read = sizeof (struct pcaprec_hdr);
break;
case WTAP_FILE_PCAP_SS990417:
case WTAP_FILE_PCAP_SS991029:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029:
bytes_to_read = sizeof (struct pcaprec_modified_hdr);
break;
case WTAP_FILE_PCAP_SS990915:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915:
bytes_to_read = sizeof (struct pcaprec_ss990915_hdr);
break;
case WTAP_FILE_PCAP_NOKIA:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA:
bytes_to_read = sizeof (struct pcaprec_nokia_hdr);
break;
@ -848,22 +848,22 @@ gboolean libpcap_dump_open(wtap_dumper *wdh, int *err)
wdh->subtype_close = NULL;
/* Write the file header. */
switch (wdh->file_type) {
switch (wdh->file_type_subtype) {
case WTAP_FILE_PCAP:
case WTAP_FILE_PCAP_SS990417: /* modified, but with the old magic, sigh */
case WTAP_FILE_PCAP_NOKIA: /* Nokia libpcap of some sort */
case WTAP_FILE_TYPE_SUBTYPE_PCAP:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417: /* modified, but with the old magic, sigh */
case WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA: /* Nokia libpcap of some sort */
magic = PCAP_MAGIC;
wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case WTAP_FILE_PCAP_SS990915: /* new magic, extra crap */
case WTAP_FILE_PCAP_SS991029:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915: /* new magic, extra crap */
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029:
magic = PCAP_MODIFIED_MAGIC;
wdh->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case WTAP_FILE_PCAP_NSEC: /* same as WTAP_FILE_PCAP, but nsec precision */
case WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC: /* same as WTAP_FILE_TYPE_SUBTYPE_PCAP, but nsec precision */
magic = PCAP_NSEC_MAGIC;
wdh->tsprecision = WTAP_FILE_TSPREC_NSEC;
break;
@ -932,15 +932,15 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
return FALSE;
}
switch (wdh->file_type) {
switch (wdh->file_type_subtype) {
case WTAP_FILE_PCAP:
case WTAP_FILE_PCAP_NSEC:
case WTAP_FILE_TYPE_SUBTYPE_PCAP:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC:
hdr_size = sizeof (struct pcaprec_hdr);
break;
case WTAP_FILE_PCAP_SS990417: /* modified, but with the old magic, sigh */
case WTAP_FILE_PCAP_SS991029:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417: /* modified, but with the old magic, sigh */
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029:
/* XXX - what should we supply here?
Alexey's "libpcap" looks up the interface in the system's
@ -966,7 +966,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
hdr_size = sizeof (struct pcaprec_modified_hdr);
break;
case WTAP_FILE_PCAP_SS990915: /* new magic, extra crap at the end */
case WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915: /* new magic, extra crap at the end */
rec_hdr.ifindex = 0;
rec_hdr.protocol = 0;
rec_hdr.pkt_type = 0;
@ -975,7 +975,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
hdr_size = sizeof (struct pcaprec_ss990915_hdr);
break;
case WTAP_FILE_PCAP_NOKIA: /* old magic, extra crap at the end */
case WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA: /* old magic, extra crap at the end */
/* restore the "mysterious stuff" that came with the packet */
memcpy(&rec_hdr.ifindex, pseudo_header->nokia.stuff, 4);
/* not written */

View File

@ -193,7 +193,7 @@ mime_file_open(wtap *wth, int *err, gchar **err_info)
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
wth->file_type = WTAP_FILE_MIME;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MIME;
wth->file_encap = WTAP_ENCAP_MIME;
wth->tsprecision = WTAP_FILE_TSPREC_SEC;
wth->subtype_read = mime_read;

View File

@ -229,7 +229,7 @@ mp2t_open(wtap *wth, int *err, gchar **err_info)
return -1;
}
wth->file_type = WTAP_FILE_MPEG_2_TS;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MPEG_2_TS;
wth->file_encap = WTAP_ENCAP_MPEG_2_TS;
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
wth->subtype_read = mp2t_read;

View File

@ -268,7 +268,7 @@ good_magic:
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
wth->file_type = WTAP_FILE_MPEG;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MPEG;
wth->file_encap = WTAP_ENCAP_MPEG;
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
wth->subtype_read = mpeg_read;

View File

@ -236,11 +236,11 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
switch (hdr.ver_major) {
case 1:
file_type = WTAP_FILE_NETMON_1_x;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETMON_1_x;
break;
case 2:
file_type = WTAP_FILE_NETMON_2_x;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETMON_2_x;
break;
default:
@ -259,7 +259,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
}
/* This is a netmon file */
wth->file_type = file_type;
wth->file_type_subtype = file_type;
netmon = (netmon_t *)g_malloc(sizeof(netmon_t));
wth->priv = (void *)netmon;
wth->subtype_read = netmon_read;
@ -1108,9 +1108,9 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
nsecs += 1000000000;
secs--;
}
switch (wdh->file_type) {
switch (wdh->file_type_subtype) {
case WTAP_FILE_NETMON_1_x:
case WTAP_FILE_TYPE_SUBTYPE_NETMON_1_x:
rec_1_x_hdr.ts_delta = htolel(secs*1000 + (nsecs + 500000)/1000000);
rec_1_x_hdr.orig_len = htoles(phdr->len + atm_hdrsize);
rec_1_x_hdr.incl_len = htoles(phdr->caplen + atm_hdrsize);
@ -1118,7 +1118,7 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
hdr_size = sizeof rec_1_x_hdr;
break;
case WTAP_FILE_NETMON_2_x:
case WTAP_FILE_TYPE_SUBTYPE_NETMON_2_x:
rec_2_x_hdr.ts_delta = htolell(secs*1000000 + (nsecs + 500)/1000);
rec_2_x_hdr.orig_len = htolel(phdr->len + atm_hdrsize);
rec_2_x_hdr.incl_len = htolel(phdr->caplen + atm_hdrsize);
@ -1244,9 +1244,9 @@ static gboolean netmon_dump_close(wtap_dumper *wdh, int *err)
if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
return FALSE;
memset(&file_hdr, '\0', sizeof file_hdr);
switch (wdh->file_type) {
switch (wdh->file_type_subtype) {
case WTAP_FILE_NETMON_1_x:
case WTAP_FILE_TYPE_SUBTYPE_NETMON_1_x:
magicp = netmon_1_x_magic;
magic_size = sizeof netmon_1_x_magic;
/* NetMon file version, for 1.x, is 1.1 */
@ -1254,7 +1254,7 @@ static gboolean netmon_dump_close(wtap_dumper *wdh, int *err)
file_hdr.ver_minor = 1;
break;
case WTAP_FILE_NETMON_2_x:
case WTAP_FILE_TYPE_SUBTYPE_NETMON_2_x:
magicp = netmon_2_x_magic;
magic_size = sizeof netmon_2_x_magic;
/*

View File

@ -634,19 +634,19 @@ int nstrace_open(wtap *wth, int *err, gchar **err_info)
nstrace_buf = (gchar *)g_malloc(NSPR_PAGESIZE);
page_size = GET_READ_PAGE_SIZE(file_size);
switch ((wth->file_type = nspm_signature_version(wth, nstrace_buf, page_size)))
switch ((wth->file_type_subtype = nspm_signature_version(wth, nstrace_buf, page_size)))
{
case WTAP_FILE_NETSCALER_1_0:
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0:
wth->file_encap = WTAP_ENCAP_NSTRACE_1_0;
break;
case WTAP_FILE_NETSCALER_2_0:
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0:
wth->file_encap = WTAP_ENCAP_NSTRACE_2_0;
break;
default:
*err = WTAP_ERR_UNSUPPORTED;
*err_info = g_strdup_printf("nstrace: file type %d unsupported", wth->file_type);
*err_info = g_strdup_printf("nstrace: file type %d unsupported", wth->file_type_subtype);
g_free(nstrace_buf);
return 0;
}
@ -668,14 +668,14 @@ int nstrace_open(wtap *wth, int *err, gchar **err_info)
return 0;
}
switch (wth->file_type)
switch (wth->file_type_subtype)
{
case WTAP_FILE_NETSCALER_1_0:
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0:
wth->subtype_read = nstrace_read_v10;
wth->subtype_seek_read = nstrace_seek_read_v10;
break;
case WTAP_FILE_NETSCALER_2_0:
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0:
wth->subtype_read = nstrace_read_v20;
wth->subtype_seek_read = nstrace_seek_read_v20;
break;
@ -760,7 +760,7 @@ nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len)
(pletohs(&sigv10p->nsprRecordSize) <= len) &&
((gint32)sizeof(NSPR_SIGSTR_V10) <= len) &&
(!nspm_signature_isv10(sigv10p->sig_Signature)))
return WTAP_FILE_NETSCALER_1_0;
return WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0;
#undef sigv10p
#define sigv20p ((nspr_signature_v20_t*)dp)
@ -768,7 +768,7 @@ nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len)
(sigv20p->sig_RecordSize <= len) &&
((gint32)sizeof(NSPR_SIGSTR_V20) <= len) &&
(!nspm_signature_isv20(sigv20p->sig_Signature)))
return WTAP_FILE_NETSCALER_2_0;
return WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0;
#undef sigv20p
}
}
@ -835,9 +835,9 @@ nstrace_set_start_time_ver(20)
*/
static gboolean nstrace_set_start_time(wtap *wth)
{
if (wth->file_type == WTAP_FILE_NETSCALER_1_0)
if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
return nstrace_set_start_time_v10(wth);
else if (wth->file_type == WTAP_FILE_NETSCALER_2_0)
else if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
return nstrace_set_start_time_v20(wth);
return FALSE;
@ -1346,7 +1346,7 @@ static gboolean nstrace_add_signature(wtap_dumper *wdh, int *err)
{
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
if (wdh->file_type == WTAP_FILE_NETSCALER_1_0)
if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
{
guint16 val16b;
nspr_signature_v10_t sig10;
@ -1367,7 +1367,7 @@ static gboolean nstrace_add_signature(wtap_dumper *wdh, int *err)
/* Move forward the page offset */
nstrace->page_offset += (guint16) nspr_signature_v10_s;
} else if (wdh->file_type == WTAP_FILE_NETSCALER_2_0)
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
nspr_signature_v20_t sig20;
@ -1400,7 +1400,7 @@ nstrace_add_abstime(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
guint64 nsg_creltime;
if (wdh->file_type == WTAP_FILE_NETSCALER_1_0)
if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
{
guint16 val16;
guint32 reltime;
@ -1427,7 +1427,7 @@ nstrace_add_abstime(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
/* Move forward the page offset */
nstrace->page_offset += nspr_abstime_v10_s;
} else if (wdh->file_type == WTAP_FILE_NETSCALER_2_0)
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
guint32 reltime;
guint64 abstime;
@ -1470,12 +1470,12 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
if (nstrace->page_offset == 0)
{
/* Add the signature record and abs time record */
if (wdh->file_type == WTAP_FILE_NETSCALER_1_0)
if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
{
if (!nstrace_add_signature(wdh, err) ||
!nstrace_add_abstime(wdh, phdr, pd, err))
return FALSE;
} else if (wdh->file_type == WTAP_FILE_NETSCALER_2_0)
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
if (!nstrace_add_signature(wdh, err) ||
!nstrace_add_abstime(wdh, phdr, pd, err))
@ -1491,7 +1491,7 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
{
case NSPR_HEADER_VERSION100:
if (wdh->file_type == WTAP_FILE_NETSCALER_1_0)
if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
{
if (nstrace->page_offset + phdr->caplen >= nstrace->page_len)
{
@ -1511,7 +1511,7 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
return FALSE;
nstrace->page_offset += (guint16) phdr->caplen;
} else if (wdh->file_type == WTAP_FILE_NETSCALER_2_0)
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
return FALSE;
@ -1526,11 +1526,11 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
case NSPR_HEADER_VERSION204:
case NSPR_HEADER_VERSION205:
case NSPR_HEADER_VERSION206:
if (wdh->file_type == WTAP_FILE_NETSCALER_1_0)
if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
{
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
return FALSE;
} else if (wdh->file_type == WTAP_FILE_NETSCALER_2_0)
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
if (nstrace->page_offset + phdr->caplen >= nstrace->page_len)
{

View File

@ -182,7 +182,7 @@ int netscreen_open(wtap *wth, int *err, gchar **err_info)
return -1;
wth->file_encap = WTAP_ENCAP_UNKNOWN;
wth->file_type = WTAP_FILE_NETSCREEN;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETSCREEN;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = netscreen_read;
wth->subtype_seek_read = netscreen_seek_read;

View File

@ -223,7 +223,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info)
}
/* This is an nettl file */
wth->file_type = WTAP_FILE_NETTL;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETTL;
nettl = g_new(nettl_t,1);
wth->priv = (void *)nettl;
if (file_hdr.os_vers[2] == '1' && file_hdr.os_vers[3] == '1')

View File

@ -251,7 +251,7 @@ int network_instruments_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_sequential_close = NULL;
wth->snapshot_length = 0; /* not available in header */
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
wth->file_type = WTAP_FILE_NETWORK_INSTRUMENTS;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETWORK_INSTRUMENTS;
/* reset the pointer to the first packet */
if (file_seek(wth->fh, header_offset, SEEK_SET, err) == -1)

View File

@ -408,7 +408,7 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
if (is_old) {
version_major = 0;
version_minor = 0;
file_type = WTAP_FILE_NETXRAY_OLD;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETXRAY_OLD;
} else {
/* It appears that version 1.1 files (as produced by Windows
* Sniffer Pro 2.0.01) have the time stamp in microseconds,
@ -420,27 +420,27 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
if (memcmp(hdr.version, vers_1_0, sizeof vers_1_0) == 0) {
version_major = 1;
version_minor = 0;
file_type = WTAP_FILE_NETXRAY_1_0;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_0;
} else if (memcmp(hdr.version, vers_1_1, sizeof vers_1_1) == 0) {
version_major = 1;
version_minor = 1;
file_type = WTAP_FILE_NETXRAY_1_1;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_1;
} else if (memcmp(hdr.version, vers_2_000, sizeof vers_2_000) == 0) {
version_major = 2;
version_minor = 0;
file_type = WTAP_FILE_NETXRAY_2_00x;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x;
} else if (memcmp(hdr.version, vers_2_001, sizeof vers_2_001) == 0) {
version_major = 2;
version_minor = 1;
file_type = WTAP_FILE_NETXRAY_2_00x;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x;
} else if (memcmp(hdr.version, vers_2_002, sizeof vers_2_002) == 0) {
version_major = 2;
version_minor = 2;
file_type = WTAP_FILE_NETXRAY_2_00x;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x;
} else if (memcmp(hdr.version, vers_2_003, sizeof vers_2_003) == 0) {
version_major = 2;
version_minor = 3;
file_type = WTAP_FILE_NETXRAY_2_00x;
file_type = WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x;
} else {
*err = WTAP_ERR_UNSUPPORTED;
*err_info = g_strdup_printf("netxray: version \"%.8s\" unsupported", hdr.version);
@ -491,17 +491,17 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
+ (double)pletohl(&hdr.timehi)*4294967296.0;
switch (file_type) {
case WTAP_FILE_NETXRAY_OLD:
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_OLD:
ticks_per_sec = 1000.0;
wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
break;
case WTAP_FILE_NETXRAY_1_0:
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_0:
ticks_per_sec = 1000.0;
wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
break;
case WTAP_FILE_NETXRAY_1_1:
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_1:
/*
* In version 1.1 files (as produced by Windows Sniffer
* Pro 2.0.01), the time stamp is in microseconds,
@ -512,7 +512,7 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case WTAP_FILE_NETXRAY_2_00x:
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x:
/*
* Get the time stamp units from the appropriate TpS
* table or from the file header.
@ -773,7 +773,7 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
file_encap = netxray_encap[network_type];
/* This is a netxray file */
wth->file_type = file_type;
wth->file_type_subtype = file_type;
netxray = (netxray_t *)g_malloc(sizeof(netxray_t));
wth->priv = (void *)netxray;
wth->subtype_read = netxray_read;

View File

@ -653,9 +653,9 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
/* compressed or uncompressed Sniffer file? */
if (version.format != 1) {
wth->file_type = WTAP_FILE_NGSNIFFER_COMPRESSED;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_COMPRESSED;
} else {
wth->file_type = WTAP_FILE_NGSNIFFER_UNCOMPRESSED;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED;
}
/* Set encap type before reading header records because the
@ -2487,7 +2487,7 @@ ng_file_read(void *buffer, unsigned int nbytes, wtap *wth, gboolean is_random,
comp_stream = &ngsniffer->seq;
}
if (wth->file_type == WTAP_FILE_NGSNIFFER_UNCOMPRESSED) {
if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
errno = WTAP_ERR_CANT_READ;
copied_bytes = file_read(buffer, copybytes, infile);
if ((unsigned int) copied_bytes != copybytes)
@ -2655,7 +2655,7 @@ ng_file_skip_seq(wtap *wth, gint64 delta, int *err, gchar **err_info)
ngsniffer = (ngsniffer_t *)wth->priv;
if (wth->file_type == WTAP_FILE_NGSNIFFER_UNCOMPRESSED) {
if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
ngsniffer->seq.uncomp_offset += delta;
return file_skip(wth->fh, delta, err);
}
@ -2700,7 +2700,7 @@ ng_file_seek_rand(wtap *wth, gint64 offset, int *err, gchar **err_info)
ngsniffer = (ngsniffer_t *)wth->priv;
if (wth->file_type == WTAP_FILE_NGSNIFFER_UNCOMPRESSED) {
if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
if (file_seek(wth->random_fh, offset, SEEK_SET, err) == -1)
return FALSE;
return TRUE;

View File

@ -89,7 +89,7 @@ int packetlogger_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_read = packetlogger_read;
wth->subtype_seek_read = packetlogger_seek_read;
wth->file_type = WTAP_FILE_PACKETLOGGER;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PACKETLOGGER;
wth->file_encap = WTAP_ENCAP_PACKETLOGGER;
wth->tsprecision = WTAP_FILE_TSPREC_USEC;

View File

@ -1513,7 +1513,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
switch (wtap_encap) {
case WTAP_ENCAP_ATM_PDUS:
if (file_type == WTAP_FILE_PCAP_NOKIA) {
if (file_type == WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA) {
/*
* Nokia IPSO ATM.
*/
@ -1555,7 +1555,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
break;
case WTAP_ENCAP_ETHERNET:
if (file_type == WTAP_FILE_PCAP_NOKIA) {
if (file_type == WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA) {
/*
* Nokia IPSO. Psuedo header has already been read, but it's not considered
* part of the packet size, so reread it to store the data for later (when saving)
@ -1792,7 +1792,7 @@ pcap_read_post_process(int file_type, int wtap_encap,
switch (wtap_encap) {
case WTAP_ENCAP_ATM_PDUS:
if (file_type == WTAP_FILE_PCAP_NOKIA) {
if (file_type == WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA) {
/*
* Nokia IPSO ATM.
*

View File

@ -1130,7 +1130,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
memset((void *)&wblock->packet_header->pseudo_header, 0, sizeof(union wtap_pseudo_header));
pseudo_header_len = pcap_process_pseudo_header(fh,
WTAP_FILE_PCAPNG,
WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
int_data.wtap_encap,
packet.cap_len,
TRUE,
@ -1272,7 +1272,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
g_free(option_content);
pcap_read_post_process(WTAP_FILE_PCAPNG, int_data.wtap_encap,
pcap_read_post_process(WTAP_FILE_TYPE_SUBTYPE_PCAPNG, int_data.wtap_encap,
(union wtap_pseudo_header *)&wblock->packet_header->pseudo_header,
buffer_start_ptr(wblock->frame_buffer),
(int) (packet.cap_len - pseudo_header_len),
@ -1412,7 +1412,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
memset((void *)&wblock->packet_header->pseudo_header, 0, sizeof(union wtap_pseudo_header));
pseudo_header_len = pcap_process_pseudo_header(fh,
WTAP_FILE_PCAPNG,
WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
int_data.wtap_encap,
simple_packet.cap_len,
TRUE,
@ -1450,7 +1450,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
block_read += 4 - (simple_packet.cap_len % 4);
}
pcap_read_post_process(WTAP_FILE_PCAPNG, int_data.wtap_encap,
pcap_read_post_process(WTAP_FILE_TYPE_SUBTYPE_PCAPNG, int_data.wtap_encap,
(union wtap_pseudo_header *)&wblock->packet_header->pseudo_header,
buffer_start_ptr(wblock->frame_buffer),
(int) simple_packet.cap_len,
@ -2220,7 +2220,7 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_read = pcapng_read;
wth->subtype_seek_read = pcapng_seek_read;
wth->subtype_close = pcapng_close;
wth->file_type = WTAP_FILE_PCAPNG;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
/* Read IDBs */
wth->interface_data = g_array_new(FALSE, FALSE, sizeof(wtapng_if_descr_t));

View File

@ -334,7 +334,7 @@ int peekclassic_open(wtap *wth, int *err, gchar **err_info)
case 5:
case 6:
wth->file_type = WTAP_FILE_PEEKCLASSIC_V56;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V56;
/*
* XXX - can we get the file encapsulation from the
* header in the same way we do for V7 files?
@ -345,7 +345,7 @@ int peekclassic_open(wtap *wth, int *err, gchar **err_info)
break;
case 7:
wth->file_type = WTAP_FILE_PEEKCLASSIC_V7;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V7;
wth->file_encap = file_encap;
wth->subtype_read = peekclassic_read_v7;
wth->subtype_seek_read = peekclassic_seek_read_v7;

View File

@ -334,7 +334,7 @@ int peektagged_open(wtap *wth, int *err, gchar **err_info)
*/
file_encap = peektagged_encap[mediaSubType];
wth->file_type = WTAP_FILE_PEEKTAGGED;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKTAGGED;
wth->file_encap = file_encap;
wth->subtype_read = peektagged_read;
wth->subtype_seek_read = peektagged_seek_read;

View File

@ -295,7 +295,7 @@ pppdump_open(wtap *wth, int *err, gchar **err_info)
state->offset = 5;
wth->file_encap = WTAP_ENCAP_PPP_WITH_PHDR;
wth->file_type = WTAP_FILE_PPPDUMP;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PPPDUMP;
wth->snapshot_length = PPPD_BUF_SIZE; /* just guessing */
wth->subtype_read = pppdump_read;

View File

@ -163,7 +163,7 @@ int radcom_open(wtap *wth, int *err, gchar **err_info)
}
/* This is a radcom file */
wth->file_type = WTAP_FILE_RADCOM;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_RADCOM;
wth->subtype_read = radcom_read;
wth->subtype_seek_read = radcom_seek_read;
wth->snapshot_length = 0; /* not available in header, only in frame */

View File

@ -397,7 +397,7 @@ int snoop_open(wtap *wth, int *err, gchar **err_info)
file_encap = shomiti_encap[hdr.network];
/* This is a Shomiti file */
wth->file_type = WTAP_FILE_SHOMITI;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_SHOMITI;
} else if (hdr.network & SNOOP_PRIVATE_BIT) {
if ((hdr.network^SNOOP_PRIVATE_BIT) >= NUM_SNOOP_PRIVATE_ENCAPS
|| snoop_private_encap[hdr.network^SNOOP_PRIVATE_BIT] == WTAP_ENCAP_UNKNOWN) {
@ -409,7 +409,7 @@ int snoop_open(wtap *wth, int *err, gchar **err_info)
file_encap = snoop_private_encap[hdr.network^SNOOP_PRIVATE_BIT];
/* This is a snoop file */
wth->file_type = WTAP_FILE_SNOOP;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_SNOOP;
} else {
if (hdr.network >= NUM_SNOOP_ENCAPS
|| snoop_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) {
@ -421,7 +421,7 @@ int snoop_open(wtap *wth, int *err, gchar **err_info)
file_encap = snoop_encap[hdr.network];
/* This is a snoop file */
wth->file_type = WTAP_FILE_SNOOP;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_SNOOP;
}
/*
@ -600,7 +600,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
* this frame; if this is a Shomit file, we assume there
* is. (XXX - or should we treat it a "maybe"?)
*/
if (wth->file_type == WTAP_FILE_SHOMITI)
if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_SHOMITI)
phdr->pseudo_header.eth.fcs_len = 4;
else
phdr->pseudo_header.eth.fcs_len = 0;

View File

@ -187,7 +187,7 @@ int stanag4607_open(wtap *wth, int *err, gchar **err_info)
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
wth->file_type = WTAP_FILE_STANAG_4607;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_STANAG_4607;
wth->file_encap = WTAP_ENCAP_STANAG_4607;
wth->snapshot_length = 0; /* not known */

View File

@ -116,7 +116,7 @@ int tnef_open(wtap *wth, int *err, gchar **err_info)
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
wth->file_type = WTAP_FILE_TNEF;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_TNEF;
wth->file_encap = WTAP_ENCAP_TNEF;
wth->snapshot_length = 0;

View File

@ -207,7 +207,7 @@ int toshiba_open(wtap *wth, int *err, gchar **err_info)
}
wth->file_encap = WTAP_ENCAP_PER_PACKET;
wth->file_type = WTAP_FILE_TOSHIBA;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_TOSHIBA;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = toshiba_read;
wth->subtype_seek_read = toshiba_seek_read;

View File

@ -260,7 +260,7 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
}
/* Fill in the wiretap struct with data from the file header */
wth->file_type = WTAP_FILE_VISUAL_NETWORKS;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_VISUAL_NETWORKS;
wth->file_encap = encap;
wth->snapshot_length = pletohs(&vfile_hdr.max_length);

View File

@ -248,7 +248,7 @@ int vms_open(wtap *wth, int *err, gchar **err_info)
}
wth->file_encap = WTAP_ENCAP_RAW_IP;
wth->file_type = WTAP_FILE_VMS;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_VMS;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = vms_read;
wth->subtype_seek_read = vms_seek_read;

View File

@ -678,9 +678,9 @@ int vwr_open(wtap *wth, int *err, gchar **err_info)
wth->file_encap = WTAP_ENCAP_IXVERIWAVE;
if (fpgaVer == S2_W_FPGA || fpgaVer == S1_W_FPGA || fpgaVer == S3_W_FPGA)
wth->file_type = WTAP_FILE_VWR_80211;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_VWR_80211;
else if (fpgaVer == vVW510012_E_FPGA || fpgaVer == vVW510024_E_FPGA)
wth->file_type = WTAP_FILE_VWR_ETH;
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_VWR_ETH;
return 1;
}

View File

@ -52,7 +52,7 @@ typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64,
struct wtap {
FILE_T fh;
FILE_T random_fh; /**< Secondary FILE_T for random access */
int file_type;
int file_type_subtype;
guint snapshot_length;
struct Buffer *frame_buffer;
struct wtap_pkthdr phdr;
@ -93,7 +93,7 @@ typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*);
struct wtap_dumper {
WFILE_T fh;
int file_type;
int file_type_subtype;
int snaplen;
int encap;
gboolean compressed;

View File

@ -71,9 +71,9 @@ wtap_fstat(wtap *wth, ws_statb64 *statb, int *err)
}
int
wtap_file_type(wtap *wth)
wtap_file_type_subtype(wtap *wth)
{
return wth->file_type;
return wth->file_type_subtype;
}
gboolean

View File

@ -252,77 +252,79 @@ extern "C" {
#define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types()
/* File types that can be read by wiretap.
/* File types/subtypes that can be read by wiretap.
We support writing many of these file types, too, so we
distinguish between different versions of them. */
#define WTAP_FILE_UNKNOWN 0
#define WTAP_FILE_PCAP 1
#define WTAP_FILE_PCAPNG 2
#define WTAP_FILE_PCAP_NSEC 3
#define WTAP_FILE_PCAP_AIX 4
#define WTAP_FILE_PCAP_SS991029 5
#define WTAP_FILE_PCAP_NOKIA 6
#define WTAP_FILE_PCAP_SS990417 7
#define WTAP_FILE_PCAP_SS990915 8
#define WTAP_FILE_5VIEWS 9
#define WTAP_FILE_IPTRACE_1_0 10
#define WTAP_FILE_IPTRACE_2_0 11
#define WTAP_FILE_BER 12
#define WTAP_FILE_HCIDUMP 13
#define WTAP_FILE_CATAPULT_DCT2000 14
#define WTAP_FILE_NETXRAY_OLD 15
#define WTAP_FILE_NETXRAY_1_0 16
#define WTAP_FILE_COSINE 17
#define WTAP_FILE_CSIDS 18
#define WTAP_FILE_DBS_ETHERWATCH 19
#define WTAP_FILE_ERF 20
#define WTAP_FILE_EYESDN 21
#define WTAP_FILE_NETTL 22
#define WTAP_FILE_ISERIES 23
#define WTAP_FILE_ISERIES_UNICODE 24
#define WTAP_FILE_I4BTRACE 25
#define WTAP_FILE_ASCEND 26
#define WTAP_FILE_NETMON_1_x 27
#define WTAP_FILE_NETMON_2_x 28
#define WTAP_FILE_NGSNIFFER_UNCOMPRESSED 29
#define WTAP_FILE_NGSNIFFER_COMPRESSED 30
#define WTAP_FILE_NETXRAY_1_1 31
#define WTAP_FILE_NETXRAY_2_00x 32
#define WTAP_FILE_NETWORK_INSTRUMENTS 33
#define WTAP_FILE_LANALYZER 34
#define WTAP_FILE_PPPDUMP 35
#define WTAP_FILE_RADCOM 36
#define WTAP_FILE_SNOOP 37
#define WTAP_FILE_SHOMITI 38
#define WTAP_FILE_VMS 39
#define WTAP_FILE_K12 40
#define WTAP_FILE_TOSHIBA 41
#define WTAP_FILE_VISUAL_NETWORKS 42
#define WTAP_FILE_PEEKCLASSIC_V56 43
#define WTAP_FILE_PEEKCLASSIC_V7 44
#define WTAP_FILE_PEEKTAGGED 45
#define WTAP_FILE_MPEG 46
#define WTAP_FILE_K12TEXT 47
#define WTAP_FILE_NETSCREEN 48
#define WTAP_FILE_COMMVIEW 49
#define WTAP_FILE_BTSNOOP 50
#define WTAP_FILE_TNEF 51
#define WTAP_FILE_DCT3TRACE 52
#define WTAP_FILE_PACKETLOGGER 53
#define WTAP_FILE_DAINTREE_SNA 54
#define WTAP_FILE_NETSCALER_1_0 55
#define WTAP_FILE_NETSCALER_2_0 56
#define WTAP_FILE_JPEG_JFIF 57 /* obsoleted by WTAP_FILE_MIME */
#define WTAP_FILE_IPFIX 58
#define WTAP_FILE_MIME 59
#define WTAP_FILE_AETHRA 60
#define WTAP_FILE_MPEG_2_TS 61
#define WTAP_FILE_VWR_80211 62
#define WTAP_FILE_VWR_ETH 63
#define WTAP_FILE_CAMINS 64
#define WTAP_FILE_STANAG_4607 65
distinguish between different subtypes of them, as
different subtypes need to be written in a different
fashion. */
#define WTAP_FILE_TYPE_SUBTYPE_UNKNOWN 0
#define WTAP_FILE_TYPE_SUBTYPE_PCAP 1
#define WTAP_FILE_TYPE_SUBTYPE_PCAPNG 2
#define WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC 3
#define WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX 4
#define WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029 5
#define WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA 6
#define WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417 7
#define WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915 8
#define WTAP_FILE_TYPE_SUBTYPE_5VIEWS 9
#define WTAP_FILE_TYPE_SUBTYPE_IPTRACE_1_0 10
#define WTAP_FILE_TYPE_SUBTYPE_IPTRACE_2_0 11
#define WTAP_FILE_TYPE_SUBTYPE_BER 12
#define WTAP_FILE_TYPE_SUBTYPE_HCIDUMP 13
#define WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000 14
#define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_OLD 15
#define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_0 16
#define WTAP_FILE_TYPE_SUBTYPE_COSINE 17
#define WTAP_FILE_TYPE_SUBTYPE_CSIDS 18
#define WTAP_FILE_TYPE_SUBTYPE_DBS_ETHERWATCH 19
#define WTAP_FILE_TYPE_SUBTYPE_ERF 20
#define WTAP_FILE_TYPE_SUBTYPE_EYESDN 21
#define WTAP_FILE_TYPE_SUBTYPE_NETTL 22
#define WTAP_FILE_TYPE_SUBTYPE_ISERIES 23
#define WTAP_FILE_TYPE_SUBTYPE_ISERIES_UNICODE 24
#define WTAP_FILE_TYPE_SUBTYPE_I4BTRACE 25
#define WTAP_FILE_TYPE_SUBTYPE_ASCEND 26
#define WTAP_FILE_TYPE_SUBTYPE_NETMON_1_x 27
#define WTAP_FILE_TYPE_SUBTYPE_NETMON_2_x 28
#define WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED 29
#define WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_COMPRESSED 30
#define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_1 31
#define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x 32
#define WTAP_FILE_TYPE_SUBTYPE_NETWORK_INSTRUMENTS 33
#define WTAP_FILE_TYPE_SUBTYPE_LANALYZER 34
#define WTAP_FILE_TYPE_SUBTYPE_PPPDUMP 35
#define WTAP_FILE_TYPE_SUBTYPE_RADCOM 36
#define WTAP_FILE_TYPE_SUBTYPE_SNOOP 37
#define WTAP_FILE_TYPE_SUBTYPE_SHOMITI 38
#define WTAP_FILE_TYPE_SUBTYPE_VMS 39
#define WTAP_FILE_TYPE_SUBTYPE_K12 40
#define WTAP_FILE_TYPE_SUBTYPE_TOSHIBA 41
#define WTAP_FILE_TYPE_SUBTYPE_VISUAL_NETWORKS 42
#define WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V56 43
#define WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V7 44
#define WTAP_FILE_TYPE_SUBTYPE_PEEKTAGGED 45
#define WTAP_FILE_TYPE_SUBTYPE_MPEG 46
#define WTAP_FILE_TYPE_SUBTYPE_K12TEXT 47
#define WTAP_FILE_TYPE_SUBTYPE_NETSCREEN 48
#define WTAP_FILE_TYPE_SUBTYPE_COMMVIEW 49
#define WTAP_FILE_TYPE_SUBTYPE_BTSNOOP 50
#define WTAP_FILE_TYPE_SUBTYPE_TNEF 51
#define WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE 52
#define WTAP_FILE_TYPE_SUBTYPE_PACKETLOGGER 53
#define WTAP_FILE_TYPE_SUBTYPE_DAINTREE_SNA 54
#define WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0 55
#define WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0 56
#define WTAP_FILE_TYPE_SUBTYPE_JPEG_JFIF 57 /* obsoleted by WTAP_FILE_TYPE_SUBTYPE_MIME */
#define WTAP_FILE_TYPE_SUBTYPE_IPFIX 58
#define WTAP_FILE_TYPE_SUBTYPE_MIME 59
#define WTAP_FILE_TYPE_SUBTYPE_AETHRA 60
#define WTAP_FILE_TYPE_SUBTYPE_MPEG_2_TS 61
#define WTAP_FILE_TYPE_SUBTYPE_VWR_80211 62
#define WTAP_FILE_TYPE_SUBTYPE_VWR_ETH 63
#define WTAP_FILE_TYPE_SUBTYPE_CAMINS 64
#define WTAP_FILE_TYPE_SUBTYPE_STANAG_4607 65
#define WTAP_NUM_FILE_TYPES wtap_get_num_file_types()
#define WTAP_NUM_FILE_TYPES_SUBTYPES wtap_get_num_file_types_subtypes()
/* timestamp precision (currently only these values are supported) */
#define WTAP_FILE_TSPREC_SEC 0
@ -1141,7 +1143,7 @@ typedef int (*wtap_open_routine_t)(struct wtap*, int *, char **);
#define WTAP_COMMENT_PER_INTERFACE 0x00000002 /* per-interface */
#define WTAP_COMMENT_PER_PACKET 0x00000004 /* per-packet */
struct file_type_info {
struct file_type_subtype_info {
/* the file type name */
/* should be NULL for all "pseudo" types that are only internally used and not read/writeable */
const char *name;
@ -1246,7 +1248,7 @@ gboolean wtap_iscompressed(wtap *wth);
WS_DLL_PUBLIC
guint wtap_snapshot_length(wtap *wth); /* per file */
WS_DLL_PUBLIC
int wtap_file_type(wtap *wth);
int wtap_file_type_subtype(wtap *wth);
WS_DLL_PUBLIC
int wtap_file_encap(wtap *wth);
WS_DLL_PUBLIC
@ -1343,21 +1345,21 @@ WS_DLL_PUBLIC
gboolean wtap_dump_can_write(const GArray *file_encaps, guint32 required_comment_types);
/**
* Get a GArray of WTAP_FILE_ values for file types that can be used
* to save a file of a given type with a given GArray of WTAP_ENCAP_
* types and the given bitmask of comment types.
* Get a GArray of WTAP_FILE_TYPE_SUBTYPE_ values for file types/subtypes
* that can be used to save a file of a given type with a given GArray of
* WTAP_ENCAP_ types and the given bitmask of comment types.
*/
WS_DLL_PUBLIC
GArray *wtap_get_savable_file_types(int file_type, const GArray *file_encaps,
guint32 required_comment_types);
GArray *wtap_get_savable_file_types_subtypes(int file_type,
const GArray *file_encaps, guint32 required_comment_types);
/*** various string converter functions ***/
WS_DLL_PUBLIC
const char *wtap_file_type_string(int filetype);
const char *wtap_file_type_subtype_string(int file_type_subtype);
WS_DLL_PUBLIC
const char *wtap_file_type_short_string(int filetype);
const char *wtap_file_type_subtype_short_string(int file_type_subtype);
WS_DLL_PUBLIC
int wtap_short_string_to_file_type(const char *short_name);
int wtap_short_string_to_file_type_subtype(const char *short_name);
/*** various file extension functions ***/
WS_DLL_PUBLIC
@ -1385,7 +1387,7 @@ int wtap_get_num_file_type_extensions(void);
WS_DLL_PUBLIC
int wtap_get_num_encap_types(void);
WS_DLL_PUBLIC
int wtap_get_num_file_types(void);
int wtap_get_num_file_types_subtypes(void);
/*** get information for file type extension ***/
WS_DLL_PUBLIC
@ -1399,7 +1401,7 @@ void wtap_register_file_type_extension(const struct file_extension_info *ei);
WS_DLL_PUBLIC
void wtap_register_open_routine(wtap_open_routine_t, gboolean has_magic);
WS_DLL_PUBLIC
int wtap_register_file_type(const struct file_type_info* fi);
int wtap_register_file_type(const struct file_type_subtype_info* fi);
WS_DLL_PUBLIC
int wtap_register_encap_type(const char* name, const char* short_name);