In a dump_open routine, you don't need to seek to the beginning of the

file before doing any writes - it starts out at the beginning of the
file.  This means that you *can* write a Network Instruments capture
file to a pipe, or write it out in compressed form, now that its
dump_open routine no longer seeks.

NetXRay format and K12 binary format, however, *do* require a seek when
writing them.

svn path=/trunk/; revision=36776
This commit is contained in:
Guy Harris 2011-04-21 18:33:20 +00:00
parent 14232048bc
commit 3edd2b5b0d
2 changed files with 4 additions and 8 deletions

View File

@ -464,11 +464,11 @@ static const struct file_type_info dump_open_table_base[] = {
catapult_dct2000_dump_can_write_encap, catapult_dct2000_dump_open },
/* WTAP_FILE_NETXRAY_OLD */
{ "Cinco Networks NetXRay 1.x", "netxray1", "*.cap", ".cap", FALSE, FALSE,
{ "Cinco Networks NetXRay 1.x", "netxray1", "*.cap", ".cap", TRUE, FALSE,
NULL, NULL },
/* WTAP_FILE_NETXRAY_1_0 */
{ "Cinco Networks NetXRay 2.0 or later", "netxray2", "*.cap", ".cap", FALSE, FALSE,
{ "Cinco Networks NetXRay 2.0 or later", "netxray2", "*.cap", ".cap", TRUE, FALSE,
NULL, NULL },
/* WTAP_FILE_COSINE */
@ -536,7 +536,7 @@ static const struct file_type_info dump_open_table_base[] = {
netxray_dump_can_write_encap_2_0, netxray_dump_open_2_0 },
/* WTAP_FILE_NETWORK_INSTRUMENTS_V9 */
{ "Network Instruments Observer (V9)", "niobserverv9", "*.bfr", ".bfr", TRUE, FALSE,
{ "Network Instruments Observer (V9)", "niobserverv9", "*.bfr", ".bfr", FALSE, FALSE,
network_instruments_dump_can_write_encap, network_instruments_dump_open },
/* WTAP_FILE_LANALYZER */
@ -564,7 +564,7 @@ static const struct file_type_info dump_open_table_base[] = {
NULL, NULL},
/* WTAP_FILE_K12 */
{ "Tektronix K12xx 32-bit .rf5 format", "rf5", "*.rf5", ".rf5", FALSE, FALSE,
{ "Tektronix K12xx 32-bit .rf5 format", "rf5", "*.rf5", ".rf5", TRUE, FALSE,
k12_dump_can_write_encap, k12_dump_open },
/* WTAP_FILE_TOSHIBA */

View File

@ -514,10 +514,6 @@ gboolean network_instruments_dump_open(wtap_dumper *wdh, int *err)
g_snprintf(comment, 64, "This capture was saved from Wireshark on %s", asctime(current_time));
/* create the file header */
if (fseek(wdh->fh, 0, SEEK_SET) == -1) {
*err = errno;
return FALSE;
}
memset(&file_header, 0x00, sizeof(capture_file_header));
g_strlcpy(file_header.observer_version, network_instruments_magic, 32);
file_header.offset_to_first_packet = (guint16) (sizeof(capture_file_header) + sizeof(tlv_header) + strlen(comment));