aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authordarkjames <darkjames@f5534014-38df-0310-8fa8-9805f1628bb7>2011-05-12 19:47:49 +0000
committerdarkjames <darkjames@f5534014-38df-0310-8fa8-9805f1628bb7>2011-05-12 19:47:49 +0000
commit5730f31306231e7aaa4e98cf5058fef7798ee4e9 (patch)
treef1276c3240d08dea99062b1ea6c3a52892a6f6ee /file.c
parentef539ea4516c16968fae620a9a31d48c0ed29ed3 (diff)
Packet editor: support for saving changed frames.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37099 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'file.c')
-rw-r--r--file.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/file.c b/file.c
index e9d9b23be8..b114844a6c 100644
--- a/file.c
+++ b/file.c
@@ -396,6 +396,12 @@ cf_reset_state(capture_file *cf)
free_frame_data_sequence(cf->frames);
cf->frames = NULL;
}
+#ifdef WANT_PACKET_EDITOR
+ if (cf->edited_frames) {
+ g_tree_destroy(cf->edited_frames);
+ cf->edited_frames = NULL;
+ }
+#endif
cf_unselect_packet(cf); /* nothing to select */
cf->first_displayed = 0;
cf->last_displayed = 0;
@@ -1517,6 +1523,22 @@ cf_read_frame_r(capture_file *cf, frame_data *fdata,
gchar *err_info;
char errmsg_errno[1024+1];
+#ifdef WANT_PACKET_EDITOR
+ /* if fdata->file_off == -1 it means packet was edited, and we must find data inside edited_frames tree */
+ if (G_UNLIKELY(fdata->file_off == -1)) {
+ const modified_frame_data *frame = (const modified_frame_data *) g_tree_lookup(cf->edited_frames, GINT_TO_POINTER(fdata->num));
+
+ if (!frame) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "fdata->file_off == -1, but can't find modified frame!");
+ return FALSE;
+ }
+
+ *pseudo_header = frame->ph;
+ memcpy(pd, frame->pd, fdata->cap_len);
+ return TRUE;
+ }
+#endif
+
if (!wtap_seek_read(cf->wth, fdata->file_off, pseudo_header, pd,
fdata->cap_len, &err, &err_info)) {
switch (err) {