}
}
+
+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 */
extern void
capture_opts_init(capture_options *capture_opts, void *cfile);
+/* set a command line option value */
extern void
capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, gboolean *start_capture);
+/* trim values after command line finished */
+extern void
+capture_opts_trim(capture_options *capture_opts, int snaplen_min);
+
/* log content of capture_opts */
extern void
capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_options *capture_opts);
exit(0);
}
- if (capture_opts->has_snaplen) {
- if (capture_opts->snaplen < 1)
- capture_opts->snaplen = WTAP_MAX_PACKET_SIZE;
- else if (capture_opts->snaplen < MIN_PACKET_SIZE)
- capture_opts->snaplen = MIN_PACKET_SIZE;
- }
-
- /* Check the value range of the ringbuffer_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->num_files < RINGBUFFER_MIN_NUM_FILES)
- capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES;
-#endif
+ capture_opts_trim(capture_opts, MIN_PACKET_SIZE);
#endif /* HAVE_LIBPCAP */
/* Notify all registered modules that have had any of their preferences