In a dump_open routine, you don't need to seek to the beginning of the
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 21 Apr 2011 18:33:20 +0000 (18:33 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 21 Apr 2011 18:33:20 +0000 (18:33 +0000)
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.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36776 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/file_access.c
wiretap/network_instruments.c

index 810a6ca5cc6bae30113da3abc9d11a38ff81ac50..b975cae0a8218bf56503ce15312975e6cefd3036 100644 (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 */
index c6c1fa93fb832d995f0b625eabfc16b7ed7cbac7..0a7850bc12d0a778613e5a5961bdbdf145708221 100644 (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));