diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-12-05 21:26:01 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-12-05 21:26:01 +0000 |
commit | e1ee12bc718ac5ad506cd4504d2cede1bfde9809 (patch) | |
tree | e76a77d89ea92bedaaa38546939a37af4ddc09c8 /capture_opts.c | |
parent | 7e5f31b6a03c9c94d2c2f2308c86a0ee948ab0f4 (diff) |
add capture_opts_trim(), as this sequence is used three times now (will replace the other appearances later) ...
svn path=/trunk/; revision=16683
Diffstat (limited to 'capture_opts.c')
-rw-r--r-- | capture_opts.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/capture_opts.c b/capture_opts.c index 38da616b64..85b175ee23 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -368,4 +368,21 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, } } + +void capture_opts_trim(capture_options *capture_opts, int snaplen_min) +{ + if (capture_opts->snaplen < 1) + capture_opts->snaplen = WTAP_MAX_PACKET_SIZE; + else if (capture_opts->snaplen < snaplen_min) + capture_opts->snaplen = snaplen_min; + + /* Check the value range of the ring_num_files parameter */ + if (capture_opts->ring_num_files > RINGBUFFER_MAX_NUM_FILES) + capture_opts->ring_num_files = RINGBUFFER_MAX_NUM_FILES; +#if RINGBUFFER_MIN_NUM_FILES > 0 + else if (capture_opts->ring_num_files < RINGBUFFER_MIN_NUM_FILES) + capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES; +#endif +} + #endif /* HAVE_LIBPCAP */ |