fix #148: (win32 only) use command line parameter -B to set capture buffer size

svn path=/trunk/; revision=14484
This commit is contained in:
Ulf Lamping 2005-05-30 04:46:25 +00:00
parent 047cdd0f2a
commit ec246cae54
4 changed files with 23 additions and 2 deletions

View File

@ -301,6 +301,11 @@ capture_opts_add_opt(capture_options *capture_opts, const char *appname, int opt
exit(1);
}
break;
#ifdef _WIN32
case 'B': /* Buffer size */
capture_opts->buffer_size = get_positive_int(appname, optarg, "buffer size");
break;
#endif
case 'c': /* Capture xxx packets */
capture_opts->has_autostop_packets = TRUE;
capture_opts->autostop_packets = get_positive_int(appname, optarg, "packet count");

View File

@ -333,6 +333,7 @@ sync_pipe_start(capture_options *capture_opts) {
char sautostop_filesize[ARGV_NUMBER_LEN];
char sautostop_duration[ARGV_NUMBER_LEN];
#ifdef _WIN32
char buffer_size[ARGV_NUMBER_LEN];
char sync_pipe_fd[ARGV_NUMBER_LEN];
char signal_pipe_fd[ARGV_NUMBER_LEN];
char *fontstring;
@ -459,6 +460,10 @@ sync_pipe_start(capture_options *capture_opts) {
capture_opts->signal_pipe_fd = signal_pipe[PIPE_WRITE];
argv = sync_pipe_add_arg(argv, &argc, "-B");
sprintf(buffer_size,"%d",capture_opts->buffer_size);
argv = sync_pipe_add_arg(argv, &argc, buffer_size);
/* Convert font name to a quote-encapsulated string and pass to child */
argv = sync_pipe_add_arg(argv, &argc, "-m");
fontstring = sync_pipe_quote_encapsulate(prefs.PREFS_GUI_FONT_NAME);

View File

@ -8,6 +8,7 @@ ethereal - Interactively browse network traffic
B<ethereal>
S<[ B<-a> capture autostop condition ] ...>
S<[ B<-b> ring buffer options] ...>
S<[ B<-B> capture buffer size (Win32 only) ] ...>
S<[ B<-c> count ]>
S<[ B<-f> capture filter expression ]>
S<[ B<-h> ]>
@ -207,6 +208,12 @@ I<value> kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes).
B<files>:I<value> begin again with the first file after I<value> number of
files were written (form a ring buffer).
=item -B
Win32 only: set capture buffer size (in MB, default is 1MB). This is used by the
the capture driver to buffer packet data until that data can be written to
disk. If you encounter packet drops while capturing, try to increase this size.
=item -c
Set the default number of packets to read when capturing live

View File

@ -1610,15 +1610,18 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
#ifdef _WIN32
#define OPTSTRING_CHILD "W:Z:"
#define OPTSTRING_WIN32 "B:"
#else
#define OPTSTRING_CHILD "W:"
#define OPTSTRING_WIN32 ""
#endif /* _WIN32 */
#else
#define OPTSTRING_CHILD ""
#define OPTSTRING_WIN32 ""
#endif /* HAVE_LIBPCAP */
char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_CHILD) - 1] =
OPTSTRING_INIT;
char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_CHILD) + sizeof(OPTSTRING_WIN32) - 2] =
OPTSTRING_INIT OPTSTRING_WIN32;
/* Set the current locale according to the program environment.
@ -1946,6 +1949,7 @@ main(int argc, char *argv[])
case 'w': /* Write to capture file xxx */
case 'y': /* Set the pcap data link type */
#ifdef _WIN32
case 'B': /* Buffer size */
/* Hidden option supporting Sync mode */
case 'Z': /* Write to pipe FD XXX */
#endif /* _WIN32 */