diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-02-07 02:09:30 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-02-07 02:09:30 +0000 |
commit | 79a39eddbcafe32d8c7f4b6964fbad8e7956a48c (patch) | |
tree | 7b7ebbb6ffea413265f3b492fc53d91089d95242 /file.c | |
parent | 641106f21de7c2bb6e83ea9ba62ea2f8d69c04fa (diff) |
Move the code to set the title on a window when a capture is in progress
to the "start live capture" callback, and call that from "do_capture()".
When opening a capture file, don't pop up the "What do you want to do?"
pane when closing any existing file you have open, as we're just going
to put the regular view up right after that.
svn path=/trunk/; revision=13332
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 39 |
1 files changed, 24 insertions, 15 deletions
@@ -100,6 +100,8 @@ static guint32 firstsec, firstusec; static guint32 prevsec, prevusec; static guint32 cum_bytes = 0; +static void cf_reset_state(capture_file *cf); + static void read_packet(capture_file *cf, long offset); static void rescan_packets(capture_file *cf, const char *action, const char *action_item, @@ -141,8 +143,8 @@ static gboolean copy_binary_file(const char *from_filename, const char *to_fil /* one callback for now, we could have a list later */ -cf_callback_t cf_cb = NULL; -gpointer cf_cb_user_data = NULL; +static cf_callback_t cf_cb = NULL; +static gpointer cf_cb_user_data = NULL; void cf_callback_invoke(int event, gpointer data) @@ -193,7 +195,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) /* The open succeeded. Close whatever capture file we had open, and fill in the information for this file. */ - cf_close(cf); + cf_reset_state(cf); /* Initialize all data structures used for dissection. */ init_dissection(); @@ -247,9 +249,15 @@ fail: return CF_ERROR; } -/* Reset everything to a pristine state */ -void -cf_close(capture_file *cf) +/* + * Reset the state for the currently closed file, but don't do the + * UI callbacks; this is for use in "cf_open()", where we don't + * want the UI to go from "file open" to "file closed" back to + * "file open", we want it to go from "old file open" to "new file + * open and being read". + */ +static void +cf_reset_state(capture_file *cf) { /* Die if we're in the middle of reading a file. */ g_assert(cf->state != FILE_READ_IN_PROGRESS); @@ -297,14 +305,21 @@ cf_close(capture_file *cf) cf->esec = 0; cf->eusec = 0; - cf_callback_invoke(cf_cb_file_closed, cf); - reset_tap_listeners(); /* We have no file open. */ cf->state = FILE_CLOSED; } +/* Reset everything to a pristine state */ +void +cf_close(capture_file *cf) +{ + cf_reset_state(cf); + + cf_callback_invoke(cf_cb_file_closed, cf); +} + cf_read_status_t cf_read(capture_file *cf) { @@ -487,13 +502,7 @@ cf_read(capture_file *cf) cf_status_t cf_start_tail(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) { - cf_status_t cf_status; - - cf_status = cf_open(cf, fname, is_tempfile, err); - if (cf_status == CF_OK) { - cf_callback_invoke(cf_cb_live_capture_started, cf); - } - return cf_status; + return cf_open(cf, fname, is_tempfile, err); } cf_read_status_t |