diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-12-03 21:01:18 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-12-04 05:02:18 +0000 |
commit | 1834dca3654ccec238bae130715871be3d8fa344 (patch) | |
tree | 5f1de666575b16f58be5a2f7b4e40cc5b93c02dc /ui | |
parent | 02944c412b4d9d7661c0a2b3eb9df44d632878ee (diff) |
Move the parts of a capture_file used by libwireshark to a new structure.
Embed one of those structures in a capture_file, and have a struct
epan_session point to that structure rather than to a capture_file.
Pass that structure to the routines that fetch data that libwireshark
uses when dissecting.
That separates the stuff that libwireshark expects from the stuff that
it doesn't look at.
Change-Id: Ia3cd28efb9622476437a2ce32204597fae720877
Reviewed-on: https://code.wireshark.org/review/24692
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/packet_list.c | 14 | ||||
-rw-r--r-- | ui/gtk/packet_win.c | 2 | ||||
-rw-r--r-- | ui/gtk/summary_dlg.c | 6 | ||||
-rw-r--r-- | ui/packet_range.c | 10 | ||||
-rw-r--r-- | ui/proto_hier_stats.c | 2 | ||||
-rw-r--r-- | ui/qt/capture_file.cpp | 4 | ||||
-rw-r--r-- | ui/qt/capture_file_properties_dialog.cpp | 4 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 2 | ||||
-rw-r--r-- | ui/qt/packet_list.cpp | 4 | ||||
-rw-r--r-- | ui/qt/resolved_addresses_dialog.cpp | 2 | ||||
-rw-r--r-- | ui/qt/wireless_timeline.cpp | 4 | ||||
-rw-r--r-- | ui/time_shift.c | 22 |
12 files changed, 38 insertions, 38 deletions
diff --git a/ui/gtk/packet_list.c b/ui/gtk/packet_list.c index fca31ca2fe..09c32525c4 100644 --- a/ui/gtk/packet_list.c +++ b/ui/gtk/packet_list.c @@ -1344,7 +1344,7 @@ mark_all_displayed_frames(gboolean set) guint32 framenum; frame_data *fdata; for (framenum = 1; framenum <= cfile.count; framenum++) { - fdata = frame_data_sequence_find(cfile.frames, framenum); + fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum); if( fdata->flags.passed_dfilter ) set_frame_mark(set, fdata); } @@ -1371,7 +1371,7 @@ toggle_mark_all_displayed_frames(void) guint32 framenum; frame_data *fdata; for (framenum = 1; framenum <= cfile.count; framenum++) { - fdata = frame_data_sequence_find(cfile.frames, framenum); + fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum); if( fdata->flags.passed_dfilter ) set_frame_mark(!fdata->flags.marked, fdata); } @@ -1420,7 +1420,7 @@ ignore_all_displayed_frames(gboolean set) /* XXX: we might need a progressbar here */ for (framenum = 1; framenum <= cfile.count; framenum++) { - fdata = frame_data_sequence_find(cfile.frames, framenum); + fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum); if( fdata->flags.passed_dfilter ) set_frame_ignore(set, fdata); } @@ -1435,7 +1435,7 @@ packet_list_ignore_all_displayed_frames_cb(GtkWidget *w _U_, gpointer data _U_) /* Due to performance impact with large captures, don't check the filtered list for an ignored frame; just check the first. If a ignored frame exists but isn't first and the user wants to unignore all the displayed frames, they will just re-exec the shortcut. */ - fdata = frame_data_sequence_find(cfile.frames, cfile.first_displayed); + fdata = frame_data_sequence_find(cfile.frame_set_info.frames, cfile.first_displayed); if (fdata->flags.ignored==TRUE) { ignore_all_displayed_frames(FALSE); } else { @@ -1452,7 +1452,7 @@ unignore_all_frames(void) /* XXX: we might need a progressbar here */ for (framenum = 1; framenum <= cfile.count; framenum++) { - fdata = frame_data_sequence_find(cfile.frames, framenum); + fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum); set_frame_ignore(FALSE, fdata); } redissect_packets(); @@ -1472,7 +1472,7 @@ untime_reference_all_frames(void) guint32 framenum; frame_data *fdata; for (framenum = 1; framenum <= cfile.count && cfile.ref_time_count > 0; framenum++) { - fdata = frame_data_sequence_find(cfile.frames, framenum); + fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum); if (fdata->flags.ref_time == 1) { set_frame_reftime(FALSE, fdata, cfile.current_row); } @@ -1570,7 +1570,7 @@ packet_list_return_all_comments(GtkTextBuffer *buffer) for (framenum = 1; framenum <= cfile.count ; framenum++) { char *pkt_comment; - fdata = frame_data_sequence_find(cfile.frames, framenum); + fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum); pkt_comment = cf_get_packet_comment(&cfile, fdata); if (pkt_comment) { buf_str = g_strdup_printf("Frame %u: %s \n\n",framenum, pkt_comment); diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c index 4a602b094c..29362f1632 100644 --- a/ui/gtk/packet_win.c +++ b/ui/gtk/packet_win.c @@ -198,7 +198,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _ return; } - fd = frame_data_sequence_find(cfile.frames, framenum); + fd = frame_data_sequence_find(cfile.frame_set_info.frames, framenum); } else { fd = cfile.current_frame; diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c index 8d37d857f4..13ec853b4e 100644 --- a/ui/gtk/summary_dlg.c +++ b/ui/gtk/summary_dlg.c @@ -274,7 +274,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) add_string_to_grid(grid, &row, "Packet size limit:", string_buff); } - shb_inf = wtap_file_get_shb(cfile.wth); + shb_inf = wtap_file_get_shb(cfile.frame_set_info.wth); /* Capture file comment area */ if (wtap_dump_can_write(cfile.linktypes, WTAP_COMMENT_PER_SECTION)) { @@ -761,7 +761,7 @@ summary_to_texbuff(GtkTextBuffer *buffer) g_snprintf(string_buff, SUM_STR_MAX, "Capture:\n"); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); - shb_inf = wtap_file_get_shb(cfile.wth); + shb_inf = wtap_file_get_shb(cfile.frame_set_info.wth); if (shb_inf != NULL) { char *str; @@ -896,7 +896,7 @@ summary_to_texbuff(GtkTextBuffer *buffer) gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); /* Trace file comments from SHB */ - shb_inf = wtap_file_get_shb(cfile.wth); + shb_inf = wtap_file_get_shb(cfile.frame_set_info.wth); if (shb_inf != NULL) { char *opt_comment; diff --git a/ui/packet_range.c b/ui/packet_range.c index c6b9335e5f..a39af2ced1 100644 --- a/ui/packet_range.c +++ b/ui/packet_range.c @@ -80,7 +80,7 @@ static void packet_range_calc(packet_range_t *range) { * the capture_file structure, updating them whenever we * filter the display, etc.. */ - if (range->cf->frames != NULL) { + if (range->cf->frame_set_info.frames != NULL) { /* The next for-loop is used to obtain the amount of packets * to be processed and is used to present the information in * the Save/Print As widget. @@ -91,7 +91,7 @@ static void packet_range_calc(packet_range_t *range) { */ for(framenum = 1; framenum <= range->cf->count; framenum++) { - packet = frame_data_sequence_find(range->cf->frames, framenum); + packet = frame_data_sequence_find(range->cf->frame_set_info.frames, framenum); if (range->cf->current_frame == packet) { range->selected_packet = framenum; @@ -136,7 +136,7 @@ static void packet_range_calc(packet_range_t *range) { } for(framenum = 1; framenum <= range->cf->count; framenum++) { - packet = frame_data_sequence_find(range->cf->frames, framenum); + packet = frame_data_sequence_find(range->cf->frame_set_info.frames, framenum); if (framenum >= mark_low && framenum <= mark_high) @@ -205,9 +205,9 @@ static void packet_range_calc_user(packet_range_t *range) { * help, but if the user specified about *half* the packets in * the range, that won't help, either. */ - if (range->cf->frames != NULL) { + if (range->cf->frame_set_info.frames != NULL) { for(framenum = 1; framenum <= range->cf->count; framenum++) { - packet = frame_data_sequence_find(range->cf->frames, framenum); + packet = frame_data_sequence_find(range->cf->frame_set_info.frames, framenum); if (value_is_in_range(range->user_range, framenum)) { range->user_range_cnt++; diff --git a/ui/proto_hier_stats.c b/ui/proto_hier_stats.c index 73ad201a24..f4ee190a4d 100644 --- a/ui/proto_hier_stats.c +++ b/ui/proto_hier_stats.c @@ -233,7 +233,7 @@ ph_stats_new(capture_file *cf) tot_bytes = 0; for (framenum = 1; framenum <= cf->count; framenum++) { - frame = frame_data_sequence_find(cf->frames, framenum); + frame = frame_data_sequence_find(cf->frame_set_info.frames, framenum); /* Create the progress bar if necessary. We check on every iteration of the loop, so that diff --git a/ui/qt/capture_file.cpp b/ui/qt/capture_file.cpp index 791e875ca1..aa14f7e1bf 100644 --- a/ui/qt/capture_file.cpp +++ b/ui/qt/capture_file.cpp @@ -101,8 +101,8 @@ struct _packet_info *CaptureFile::packetInfo() int CaptureFile::timestampPrecision() { - if (capFile() && capFile()->wth) { - return wtap_file_tsprec(capFile()->wth); + if (capFile() && capFile()->frame_set_info.wth) { + return wtap_file_tsprec(capFile()->frame_set_info.wth); } return WTAP_TSPREC_UNKNOWN; } diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp index da9a49fc8e..21de728505 100644 --- a/ui/qt/capture_file_properties_dialog.cpp +++ b/ui/qt/capture_file_properties_dialog.cpp @@ -250,7 +250,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml() out << section_tmpl_.arg(tr("Capture")); out << table_begin; - wtap_block_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->wth); + wtap_block_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->frame_set_info.wth); char *str; if (shb_inf != NULL) { @@ -531,7 +531,7 @@ void CaptureFilePropertiesDialog::fillDetails() cursor.insertHtml(section_tmpl_.arg(tr("Packet Comments"))); for (guint32 framenum = 1; framenum <= cap_file_.capFile()->count ; framenum++) { - frame_data *fdata = frame_data_sequence_find(cap_file_.capFile()->frames, framenum); + frame_data *fdata = frame_data_sequence_find(cap_file_.capFile()->frame_set_info.frames, framenum); char *pkt_comment = cf_get_packet_comment(cap_file_.capFile(), fdata); if (pkt_comment) { diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 077362beb4..851411d9c5 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -2635,7 +2635,7 @@ void MainWindow::openPacketDialog(bool from_reference) if (framenum == 0) return; - fdata = frame_data_sequence_find(capture_file_.capFile()->frames, framenum); + fdata = frame_data_sequence_find(capture_file_.capFile()->frame_set_info.frames, framenum); } else { fdata = capture_file_.capFile()->current_frame; } diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 37f9b89029..ffa4de730a 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -1125,7 +1125,7 @@ QString PacketList::allPacketComments() if (!cap_file_) return buf_str; for (framenum = 1; framenum <= cap_file_->count ; framenum++) { - fdata = frame_data_sequence_find(cap_file_->frames, framenum); + fdata = frame_data_sequence_find(cap_file_->frame_set_info.frames, framenum); char *pkt_comment = cf_get_packet_comment(cap_file_, fdata); @@ -1152,7 +1152,7 @@ void PacketList::deleteAllPacketComments() return; for (framenum = 1; framenum <= cap_file_->count ; framenum++) { - fdata = frame_data_sequence_find(cap_file_->frames, framenum); + fdata = frame_data_sequence_find(cap_file_->frame_set_info.frames, framenum); cf_set_user_packet_comment(cap_file_, fdata, NULL); } diff --git a/ui/qt/resolved_addresses_dialog.cpp b/ui/qt/resolved_addresses_dialog.cpp index 3da7f40e08..4f9c4642e5 100644 --- a/ui/qt/resolved_addresses_dialog.cpp +++ b/ui/qt/resolved_addresses_dialog.cpp @@ -195,7 +195,7 @@ ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, CaptureFile *c ui->plainTextEdit->setTabStopWidth(ui->plainTextEdit->fontMetrics().averageCharWidth() * 8); if (capture_file->isValid()) { - wtap* wth = capture_file->capFile()->wth; + wtap* wth = capture_file->capFile()->frame_set_info.wth; if (wth) { // might return null wtap_block_t nrb_hdr; diff --git a/ui/qt/wireless_timeline.cpp b/ui/qt/wireless_timeline.cpp index d440e84f83..cb8451da19 100644 --- a/ui/qt/wireless_timeline.cpp +++ b/ui/qt/wireless_timeline.cpp @@ -174,7 +174,7 @@ void WirelessTimeline::mouseReleaseEvent(QMouseEvent *event) if (num == 0) return; - frame_data *fdata = frame_data_sequence_find(cfile.frames, num); + frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, num); if (!fdata->flags.passed_dfilter && fdata->prev_dis_num > 0) num = fdata->prev_dis_num; @@ -528,7 +528,7 @@ WirelessTimeline::paintEvent(QPaintEvent *qpe) QGraphicsScene qs; for (packet = find_packet_tsf(start_tsf + left/zoom - RENDER_EARLY); packet <= cfile.count; packet++) { - frame_data *fdata = frame_data_sequence_find(cfile.frames, packet); + frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, packet); struct wlan_radio *ri = get_wlan_radio(fdata->num); float x, width, red, green, blue; diff --git a/ui/time_shift.c b/ui/time_shift.c index dbfcd33955..47e9cb031b 100644 --- a/ui/time_shift.c +++ b/ui/time_shift.c @@ -298,11 +298,11 @@ time_shift_all(capture_file *cf, const gchar *offset_text) offset_float -= offset.secs; offset.nsecs = (int)(offset_float * 1000000000); - if (!frame_data_sequence_find(cf->frames, 1)) + if (!frame_data_sequence_find(cf->frame_set_info.frames, 1)) return "No frames found."; /* Shouldn't happen */ for (i = 1; i <= cf->count; i++) { - if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL) + if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL) continue; /* Shouldn't happen */ modify_time_perform(fd, neg ? SHIFT_NEG : SHIFT_POS, &offset, SHIFT_KEEPOFFSET); } @@ -329,7 +329,7 @@ time_shift_settime(capture_file *cf, guint packet_num, const gchar *time_text) * Get a copy of the real time (abs_ts - shift_offset) do we can find out the * difference between the specified time and the original packet */ - if ((packetfd = frame_data_sequence_find(cf->frames, packet_num)) == NULL) + if ((packetfd = frame_data_sequence_find(cf->frame_set_info.frames, packet_num)) == NULL) return "No packets found."; nstime_delta(&packet_time, &(packetfd->abs_ts), &(packetfd->shift_offset)); @@ -341,12 +341,12 @@ time_shift_settime(capture_file *cf, guint packet_num, const gchar *time_text) /* Up to here nothing is changed */ - if (!frame_data_sequence_find(cf->frames, 1)) + if (!frame_data_sequence_find(cf->frame_set_info.frames, 1)) return "No frames found."; /* Shouldn't happen */ /* Set everything back to the original time */ for (i = 1; i <= cf->count; i++) { - if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL) + if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL) continue; /* Shouldn't happen */ modify_time_perform(fd, SHIFT_POS, &diff_time, SHIFT_SETTOZERO); } @@ -387,7 +387,7 @@ time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text, * Get a copy of the real time (abs_ts - shift_offset) do we can find out the * difference between the specified time and the original packet */ - if ((packet1fd = frame_data_sequence_find(cf->frames, packet1_num)) == NULL) + if ((packet1fd = frame_data_sequence_find(cf->frame_set_info.frames, packet1_num)) == NULL) return "No frames found."; nstime_copy(&ot1, &(packet1fd->abs_ts)); nstime_subtract(&ot1, &(packet1fd->shift_offset)); @@ -399,7 +399,7 @@ time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text, * Get a copy of the real time (abs_ts - shift_offset) do we can find out the * difference between the specified time and the original packet */ - if ((packet2fd = frame_data_sequence_find(cf->frames, packet2_num)) == NULL) + if ((packet2fd = frame_data_sequence_find(cf->frame_set_info.frames, packet2_num)) == NULL) return "No frames found."; nstime_copy(&ot2, &(packet2fd->abs_ts)); nstime_subtract(&ot2, &(packet2fd->shift_offset)); @@ -414,11 +414,11 @@ time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text, nstime_subtract(&dnt, &nt1); /* Up to here nothing is changed */ - if (!frame_data_sequence_find(cf->frames, 1)) + if (!frame_data_sequence_find(cf->frame_set_info.frames, 1)) return "No frames found."; /* Shouldn't happen */ for (i = 1; i <= cf->count; i++) { - if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL) + if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL) continue; /* Shouldn't happen */ /* Set everything back to the original time */ @@ -450,11 +450,11 @@ time_shift_undo(capture_file *cf) nulltime.secs = nulltime.nsecs = 0; - if (!frame_data_sequence_find(cf->frames, 1)) + if (!frame_data_sequence_find(cf->frame_set_info.frames, 1)) return "No frames found."; /* Shouldn't happen */ for (i = 1; i <= cf->count; i++) { - if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL) + if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL) continue; /* Shouldn't happen */ modify_time_perform(fd, SHIFT_NEG, &nulltime, SHIFT_SETTOZERO); } |