static gboolean capture_loop_close_output(capture_options *capture_opts, loop_data *ld, int *err_close) {
if (capture_opts->multi_files_on) {
static gboolean capture_loop_close_output(capture_options *capture_opts, loop_data *ld, int *err_close) {
if (capture_opts->multi_files_on) {
- return ringbuf_wtap_dump_close(&cfile, err_close);
+ return ringbuf_wtap_dump_close(&cfile.save_file, err_close);
} else {
return wtap_dump_close(ld->wtap_pdh, err_close);
}
} else {
return wtap_dump_close(ld->wtap_pdh, err_close);
}
}
/* Switch to the next ringbuffer file */
}
/* Switch to the next ringbuffer file */
- if (ringbuf_switch_file(&cfile, &ld.wtap_pdh, &ld.err)) {
+ if (ringbuf_switch_file(&ld.wtap_pdh, &cfile.save_file, &cfile.save_file_fd, &ld.err)) {
/* File switch succeeded: reset the conditions */
cnd_reset(cnd_autostop_size);
if (cnd_file_duration) {
/* File switch succeeded: reset the conditions */
cnd_reset(cnd_autostop_size);
if (cnd_file_duration) {
}
/* Switch to the next ringbuffer file */
}
/* Switch to the next ringbuffer file */
- if (ringbuf_switch_file(&cfile, &ld.wtap_pdh, &ld.err)) {
+ if (ringbuf_switch_file(&ld.wtap_pdh, &cfile.save_file, &cfile.save_file_fd, &ld.err)) {
/* file switch succeeded: reset the conditions */
cnd_reset(cnd_file_duration);
if(cnd_autostop_size)
/* file switch succeeded: reset the conditions */
cnd_reset(cnd_file_duration);
if(cnd_autostop_size)
* Switches to the next ringbuffer file
*/
gboolean
* Switches to the next ringbuffer file
*/
gboolean
-ringbuf_switch_file(capture_file *cf, wtap_dumper **pdh, int *err)
+ringbuf_switch_file(wtap_dumper **pdh, gchar **save_file, int *save_file_fd, int *err)
{
int next_file_num;
rb_file *next_rfile = NULL;
{
int next_file_num;
rb_file *next_rfile = NULL;
/* switch to the new file */
rb_data.curr_file_num = next_file_num;
/* switch to the new file */
rb_data.curr_file_num = next_file_num;
- cf->save_file = next_rfile->name;
- cf->save_file_fd = rb_data.fd;
+ *save_file = next_rfile->name;
+ *save_file_fd = rb_data.fd;
(*pdh) = rb_data.pdh;
return TRUE;
(*pdh) = rb_data.pdh;
return TRUE;
* Calls wtap_dump_close() for the current ringbuffer file
*/
gboolean
* Calls wtap_dump_close() for the current ringbuffer file
*/
gboolean
-ringbuf_wtap_dump_close(capture_file *cf, int *err)
+ringbuf_wtap_dump_close(gchar **save_file, int *err)
{
gboolean ret_val = TRUE;
{
gboolean ret_val = TRUE;
}
/* set the save file name to the current file */
}
/* set the save file name to the current file */
- cf->save_file = rb_data.files[rb_data.curr_file_num].name;
+ *save_file = rb_data.files[rb_data.curr_file_num].name;
int ringbuf_init(const char *capture_name, guint num_files);
wtap_dumper* ringbuf_init_wtap_dump_fdopen(int filetype, int linktype,
int snaplen, int *err);
int ringbuf_init(const char *capture_name, guint num_files);
wtap_dumper* ringbuf_init_wtap_dump_fdopen(int filetype, int linktype,
int snaplen, int *err);
-gboolean ringbuf_switch_file(capture_file *cf, wtap_dumper **pdh, int *err);
-gboolean ringbuf_wtap_dump_close(capture_file *cf, int *err);
+gboolean ringbuf_switch_file(wtap_dumper **pdh, gchar **save_file, int *save_file_fd, int *err);
+gboolean ringbuf_wtap_dump_close(gchar **save_file, int *err);
void ringbuf_free(void);
void ringbuf_error_cleanup(void);
void ringbuf_free(void);
void ringbuf_error_cleanup(void);
its maximum size. */
if (capture_opts.ringbuffer_on) {
/* Switch to the next ringbuffer file */
its maximum size. */
if (capture_opts.ringbuffer_on) {
/* Switch to the next ringbuffer file */
- if (ringbuf_switch_file(&cfile, &ld.pdh, &loop_err)) {
+ if (ringbuf_switch_file(&ld.pdh, &cfile.save_file, &cfile.save_file_fd, &loop_err)) {
/* File switch succeeded: reset the condition */
cnd_reset(cnd_stop_capturesize);
if (cnd_ring_timeout) {
/* File switch succeeded: reset the condition */
cnd_reset(cnd_stop_capturesize);
if (cnd_ring_timeout) {
if (cfile.save_file != NULL) {
/* We're saving to a file or files; close all files. */
if (capture_opts.ringbuffer_on) {
if (cfile.save_file != NULL) {
/* We're saving to a file or files; close all files. */
if (capture_opts.ringbuffer_on) {
- dump_ok = ringbuf_wtap_dump_close(&cfile, &err);
+ dump_ok = ringbuf_wtap_dump_close(&cfile.save_file, &err);
} else {
dump_ok = wtap_dump_close(ld.pdh, &err);
}
} else {
dump_ok = wtap_dump_close(ld.pdh, &err);
}
*/
if (cnd_ring_timeout != NULL && cnd_eval(cnd_ring_timeout)) {
/* time elapsed for this ring file, switch to the next */
*/
if (cnd_ring_timeout != NULL && cnd_eval(cnd_ring_timeout)) {
/* time elapsed for this ring file, switch to the next */
- if (ringbuf_switch_file(&cfile, &ldat->pdh, &loop_err)) {
+ if (ringbuf_switch_file(&ldat->pdh, &cfile.save_file, &cfile.save_file_fd, &loop_err)) {
/* File switch succeeded: reset the condition */
cnd_reset(cnd_ring_timeout);
} else {
/* File switch succeeded: reset the condition */
cnd_reset(cnd_ring_timeout);
} else {