forked from osmocom/wireshark
prevent ringbuffer from having to know about capture_file type at all (decoupling dependencies)
svn path=/trunk/; revision=13266
This commit is contained in:
parent
915e63ae18
commit
be0e6a0631
|
@ -840,7 +840,7 @@ static int capture_loop_open_wiretap_output(capture_options *capture_opts, loop_
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
|
|||
}
|
||||
|
||||
/* 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) {
|
||||
|
@ -1175,7 +1175,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
|
|||
}
|
||||
|
||||
/* 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)
|
||||
|
|
10
ringbuffer.c
10
ringbuffer.c
|
@ -252,7 +252,7 @@ ringbuf_init_wtap_dump_fdopen(int filetype, int linktype, int snaplen, int *err)
|
|||
* 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;
|
||||
|
@ -285,8 +285,8 @@ ringbuf_switch_file(capture_file *cf, wtap_dumper **pdh, int *err)
|
|||
|
||||
/* 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;
|
||||
|
@ -296,7 +296,7 @@ ringbuf_switch_file(capture_file *cf, wtap_dumper **pdh, int *err)
|
|||
* 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;
|
||||
|
||||
|
@ -312,7 +312,7 @@ ringbuf_wtap_dump_close(capture_file *cf, int *err)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
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);
|
||||
|
||||
|
|
|
@ -2034,7 +2034,7 @@ capture(int out_file_type)
|
|||
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) {
|
||||
|
@ -2103,7 +2103,7 @@ capture(int out_file_type)
|
|||
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);
|
||||
}
|
||||
|
@ -2193,7 +2193,7 @@ capture_pcap_cb(guchar *user, const struct pcap_pkthdr *phdr,
|
|||
*/
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue