From Graeme Lunt
[obnox/wireshark/wip.git] / tethereal.c
index 8ca77a2d336adf8be3cbce3e1d3f8ba01873918e..da4c3dff6d59594acc60d0f52ea85344568dc1a3 100644 (file)
@@ -170,8 +170,8 @@ static gboolean infoprint;  /* if TRUE, print capture info after clearing infodel
 
 
 static int capture(char *, int);
-static void capture_pcap_cb(guchar *, const struct pcap_pkthdr *,
-  const guchar *);
+static void capture_pcap_cb(u_char *, const struct pcap_pkthdr *,
+  const u_char *);
 static void report_counts(void);
 #ifdef _WIN32
 static BOOL WINAPI capture_cleanup(DWORD);
@@ -219,7 +219,7 @@ print_usage(gboolean print_ver)
 
   if (print_ver) {
     output = stdout;
-    fprintf(output, "This is GNU t" PACKAGE " " VERSION "%s"
+    fprintf(output, "This is t" PACKAGE " " VERSION "%s"
         "\n (C) 1998-2005 Gerald Combs <gerald@ethereal.com>"
        "\n%s\n%s\n",
 
@@ -232,18 +232,19 @@ print_usage(gboolean print_ver)
          PACKAGE);
   fprintf(output, "\t[ -b <capture ring buffer option> ] ... [ -c <capture packet count> ]\n");
   fprintf(output, "\t[ -d %s ] ...\n", decode_as_arg_template);
-  fprintf(output, "\t[ -f <capture filter> ] [ -F <output file type> ] [ -i <capture interface> ]\n");
-  fprintf(output, "\t[ -N <name resolving flags> ] [ -o <preference setting> ] ... [ -r <infile> ]\n");
-  fprintf(output, "\t[ -R <read (display) filter> ] [ -s <capture snaplen> ] [ -t <time stamp format> ]\n");
-  fprintf(output, "\t[ -T pdml|ps|psml|text ] [ -w <savefile> ] [ -y <capture link type> ]\n");
-  fprintf(output, "\t[ -z <statistics ]\n");
+  fprintf(output, "\t[ -f <capture filter> ] [ -F <output file type> ]\n");
+  fprintf(output, "\t[ -i <capture interface> ] [ -N <name resolving flags> ]\n");
+  fprintf(output, "\t[ -o <preference setting> ] ... [ -r <infile> ]\n");
+  fprintf(output, "\t[ -R <read (display) filter> ] [ -s <capture snaplen> ]\n");
+  fprintf(output, "\t[ -t <time stamp format> ] [ -T pdml|ps|psml|text ]\n");
+  fprintf(output, "\t[ -w <savefile> ] [ -y <capture link type> ] [ -z <statistics> ]\n");
 #else
   fprintf(output, "\nt%s [ -vh ] [ -lnVx ]\n", PACKAGE);
   fprintf(output, "\t[ -d %s ] ...\n", decode_as_arg_template);
   fprintf(output, "\t[ -F <output file type> ] [ -N <name resolving flags> ]\n");
-  fprintf(output, "\t[ -o <preference setting> ] ... [ -r <infile> ] [ -R <read (display) filter> ]\n");
-  fprintf(output, "\t[ -t <time stamp format> ] [ -T pdml|ps|psml|text ] [ -w <savefile> ]\n");
-  fprintf(output, "\t[ -z <statistics ]\n");
+  fprintf(output, "\t[ -o <preference setting> ] ... [ -r <infile> ]\n");
+  fprintf(output, "\t[ -R <read (display) filter> ] \t[ -t <time stamp format> ]\n");
+  fprintf(output, "\t[ -T pdml|ps|psml|text ] [ -w <savefile> ] [ -z <statistics ]\n");
 #endif
   fprintf(output, "Valid file type arguments to the \"-F\" flag:\n");
   for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
@@ -1537,13 +1538,14 @@ capture(char *save_file, int out_file_type)
 
        Do, however, warn that WAN devices aren't supported. */
     g_snprintf(errmsg, sizeof errmsg,
-       "The capture session could not be initiated (%s).\n"
-       "Please check that you have the proper interface specified.\n"
-       "\n"
-       "Note that the WinPcap 2.x version of the driver Ethereal uses for packet\n"
-       "capture on Windows doesn't support capturing on PPP/WAN interfaces in\n"
-       "Windows NT/2000/XP/2003 Server, and that the WinPcap 3.0 and later versions\n"
-       "don't support capturing on PPP/WAN interfaces at all.\n",
+"The capture session could not be initiated (%s).\n"
+"Please check that you have the proper interface specified.\n"
+"\n"
+"Note that version 3.0 of WinPcap, and earlier versions of WinPcap, don't\n"
+"support capturing on PPP/WAN interfaces on Windows NT 4.0 / 2000 / XP /\n"
+"Server 2003.\n"
+"WinPcap 3.1 has support for it on Windows 2000 / XP / Server 2003, but has no\n"
+"support for it on Windows NT 4.0 or Windows Vista (Beta 1).\n",
        open_err_str);
     goto error;
 #else
@@ -1680,7 +1682,7 @@ capture(char *save_file, int out_file_type)
       }
     } else {
       ld.pdh = wtap_dump_open(save_file, out_file_type,
-                ld.linktype, file_snaplen, &err);
+                ld.linktype, file_snaplen, FALSE /* compress */, &err);
     }
 
     if (ld.pdh == NULL) {
@@ -1805,7 +1807,7 @@ capture(char *save_file, int out_file_type)
         errmsg, sizeof errmsg);
     } else
 #endif
-      inpkts = pcap_dispatch(ld.pch, pcap_cnt, capture_pcap_cb, (guchar *) &ld);
+      inpkts = pcap_dispatch(ld.pch, pcap_cnt, capture_pcap_cb, (u_char *) &ld);
     if (inpkts < 0) {
       /* Error from "pcap_dispatch()", or error or "no more packets" from
          "pipe_dispatch(). */
@@ -1845,10 +1847,7 @@ capture(char *save_file, int out_file_type)
       }
       if (ld.output_to_pipe) {
         if (ld.packet_count > packet_count_prev) {
-          if (fflush(wtap_dump_file(ld.pdh))) {
-            volatile_err = errno;
-            ld.go = FALSE;
-          }
+          wtap_dump_flush(ld.pdh);
           packet_count_prev = ld.packet_count;
         }
       }
@@ -1952,8 +1951,8 @@ error:
 }
 
 static void
-capture_pcap_cb(guchar *user, const struct pcap_pkthdr *phdr,
-  const guchar *pd)
+capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr,
+  const u_char *pd)
 {
   struct wtap_pkthdr whdr;
   union wtap_pseudo_header pseudo_header;
@@ -2120,7 +2119,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type)
       snapshot_length = WTAP_MAX_PACKET_SIZE;
     }
     pdh = wtap_dump_open(save_file, out_file_type,
-               linktype, snapshot_length, &err);
+               linktype, snapshot_length, FALSE /* compressed */, &err);
 
     if (pdh == NULL) {
       /* We couldn't set up to write to the capture file. */
@@ -3294,7 +3293,7 @@ pipe_dispatch(int fd, loop_data *ldat, struct pcap_hdr *hdr,
     phdr.caplen = rechdr->hdr.incl_len;
     phdr.len = rechdr->hdr.orig_len;
 
-    capture_pcap_cb((guchar *)ldat, &phdr, data);
+    capture_pcap_cb((u_char *)ldat, &phdr, data);
 
     ldat->pipe_state = STATE_EXPECT_REC_HDR;
     return 1;