aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-24 11:28:30 -0700
committerGuy Harris <guy@alum.mit.edu>2014-05-24 18:31:25 +0000
commit6db77b000fe58173eeed23b91b32c92c681feda2 (patch)
tree5113821a7f5e1b43734eccf94783d37962b37712 /ui/gtk
parent33ae4cb024e36192ff7c6fa1d3d6bdcce9b25b7a (diff)
Allow wtap_read() and wtap_seek_read() to return records other than packets.
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be REC_TYPE_PACKET, for a record containing a packet, or REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific data. Modify code that reads packets to be able to handle non-packet records, even if that just means ignoring them. Rename some routines to indicate that they handle more than just packets. We don't yet have any libwiretap code that supplies records other than REC_TYPE_PACKET or that supporting writing records other than REC_TYPE_PACKET, or any code to support plugins for handling REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug 8590. Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813 Reviewed-on: https://code.wireshark.org/review/1773 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk')
-rw-r--r--ui/gtk/capture_file_dlg.c6
-rw-r--r--ui/gtk/iax2_analysis.c12
-rw-r--r--ui/gtk/main.c6
-rw-r--r--ui/gtk/packet_list_store.c6
-rw-r--r--ui/gtk/packet_win.c6
-rw-r--r--ui/gtk/rlc_lte_graph.c6
-rw-r--r--ui/gtk/rtp_analysis.c12
-rw-r--r--ui/gtk/sctp_assoc_analyse.c14
8 files changed, 31 insertions, 37 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index baef2baed9..672ab91975 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -1454,11 +1454,11 @@ do_file_save(capture_file *cf, gboolean dont_reopen)
}
/* XXX - cf->filename might get freed out from under us, because
- the code path through which cf_save_packets() goes currently
+ the code path through which cf_save_records() goes currently
closes the current file and then opens and reloads the saved file,
so make a copy and free it later. */
fname = g_strdup(cf->filename);
- status = cf_save_packets(cf, fname, cf->cd_t, cf->iscompressed,
+ status = cf_save_records(cf, fname, cf->cd_t, cf->iscompressed,
discard_comments, dont_reopen);
switch (status) {
@@ -1896,7 +1896,7 @@ file_save_as_cmd(capture_file *cf, gboolean must_support_all_comments,
#endif
/* Attempt to save the file */
- status = cf_save_packets(&cfile, file_name->str, file_type, compressed,
+ status = cf_save_records(&cfile, file_name->str, file_type, compressed,
discard_comments, dont_reopen);
switch (status) {
diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c
index 6f7fe77c73..d132bf35e8 100644
--- a/ui/gtk/iax2_analysis.c
+++ b/ui/gtk/iax2_analysis.c
@@ -3688,7 +3688,6 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
gchar filter_text[256];
dfilter_t *sfcode;
capture_file *cf;
- gboolean frame_matched;
frame_data *fdata;
GList *strinfo_list;
GList *filtered_list = NULL;
@@ -3710,17 +3709,16 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
if (fdata == NULL)
return; /* if we exit here it's an error */
- /* dissect the current frame */
- if (!cf_read_frame(cf, fdata))
- return; /* error reading the frame */
+ /* dissect the current record */
+ if (!cf_read_record(cf, fdata))
+ return; /* error reading the record */
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf),
fdata, NULL);
- /* if it is not an iax2 frame, show an error dialog */
- frame_matched = dfilter_apply_edt(sfcode, &edt);
- if (frame_matched != 1) {
+ /* if it is not an iax2 packet, show an error dialog */
+ if (!dfilter_apply_edt(sfcode, &edt)) {
epan_dissect_cleanup(&edt);
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Please select an IAX2 packet.");
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index e49e0531a0..69f9aa88c5 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -543,7 +543,7 @@ get_ip_address_list_from_packet_list_row(gpointer data)
if (fdata != NULL) {
epan_dissect_t edt;
- if (!cf_read_frame (&cfile, fdata))
+ if (!cf_read_record(&cfile, fdata))
return NULL; /* error reading the frame */
epan_dissect_init(&edt, cfile.epan, FALSE, FALSE);
@@ -584,8 +584,8 @@ get_filter_from_packet_list_row_and_column(gpointer data)
if (fdata != NULL) {
epan_dissect_t edt;
- if (!cf_read_frame(&cfile, fdata))
- return NULL; /* error reading the frame */
+ if (!cf_read_record(&cfile, fdata))
+ return NULL; /* error reading the record */
/* proto tree, visible. We need a proto tree if there's custom columns */
epan_dissect_init(&edt, cfile.epan, have_custom_cols(&cfile.cinfo), FALSE);
col_custom_prime_edt(&edt, &cfile.cinfo);
diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c
index dd904b58be..195cab70c4 100644
--- a/ui/gtk/packet_list_store.c
+++ b/ui/gtk/packet_list_store.c
@@ -1117,9 +1117,9 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
cinfo = NULL;
buffer_init(&buf, 1500);
- if (!cf_read_frame_r(&cfile, fdata, &phdr, &buf)) {
+ if (!cf_read_record_r(&cfile, fdata, &phdr, &buf)) {
/*
- * Error reading the frame.
+ * Error reading the record.
*
* Don't set the color filter for now (we might want
* to colorize it in some fashion to warn that the
@@ -1139,7 +1139,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
record->colorized = TRUE;
}
buffer_free(&buf);
- return; /* error reading the frame */
+ return; /* error reading the record */
}
create_proto_tree = (dissect_color && color_filters_used()) ||
diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c
index c25d62b48a..55a82d3a39 100644
--- a/ui/gtk/packet_win.c
+++ b/ui/gtk/packet_win.c
@@ -960,9 +960,9 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
return;
}
- /* With the new packetlists "lazy columns" it's necessary to reread the frame */
- if (!cf_read_frame(&cfile, fd)) {
- /* error reading the frame */
+ /* With the new packetlists "lazy columns" it's necessary to reread the record */
+ if (!cf_read_record(&cfile, fd)) {
+ /* error reading the record */
return;
}
diff --git a/ui/gtk/rlc_lte_graph.c b/ui/gtk/rlc_lte_graph.c
index aeb5b9996b..4862b79858 100644
--- a/ui/gtk/rlc_lte_graph.c
+++ b/ui/gtk/rlc_lte_graph.c
@@ -902,9 +902,9 @@ static rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, struct segment
return NULL;
}
- /* dissect the current frame */
- if (!cf_read_frame(cf, fdata)) {
- return NULL; /* error reading the frame */
+ /* dissect the current record */
+ if (!cf_read_record(cf, fdata)) {
+ return NULL; /* error reading the record */
}
error_string = register_tap_listener("rlc-lte", &th, NULL, 0, NULL, tap_lte_rlc_packet, NULL);
diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c
index 0305b0a26a..729b8e7992 100644
--- a/ui/gtk/rtp_analysis.c
+++ b/ui/gtk/rtp_analysis.c
@@ -3923,7 +3923,6 @@ rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
gchar filter_text[256];
dfilter_t *sfcode;
capture_file *cf;
- gboolean frame_matched;
frame_data *fdata;
GList *strinfo_list;
GList *filtered_list = NULL;
@@ -3945,16 +3944,15 @@ rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
if (fdata == NULL)
return; /* if we exit here it's an error */
- /* dissect the current frame */
- if (!cf_read_frame(cf, fdata))
- return; /* error reading the frame */
+ /* dissect the current record */
+ if (!cf_read_record(cf, fdata))
+ return; /* error reading the record */
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
- /* if it is not an rtp frame, show the rtpstream dialog */
- frame_matched = dfilter_apply_edt(sfcode, &edt);
- if (frame_matched != TRUE) {
+ /* if it is not an rtp packet, show the rtpstream dialog */
+ if (!dfilter_apply_edt(sfcode, &edt)) {
epan_dissect_cleanup(&edt);
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Please select an RTP packet.");
diff --git a/ui/gtk/sctp_assoc_analyse.c b/ui/gtk/sctp_assoc_analyse.c
index 2b751f7135..32b80b9787 100644
--- a/ui/gtk/sctp_assoc_analyse.c
+++ b/ui/gtk/sctp_assoc_analyse.c
@@ -957,7 +957,7 @@ sctp_analyse_cb(struct sctp_analyse *u_data, gboolean ext)
dfilter_t *sfcode;
capture_file *cf;
epan_dissect_t edt;
- gboolean frame_matched, frame_found = FALSE;
+ gboolean frame_found = FALSE;
frame_data *fdata;
gchar filter_text[256];
@@ -974,18 +974,16 @@ sctp_analyse_cb(struct sctp_analyse *u_data, gboolean ext)
if (fdata == NULL)
return; /* if we exit here it's an error */
- /* dissect the current frame */
- if (!cf_read_frame(cf, fdata))
- return; /* error reading the frame */
+ /* dissect the current record */
+ if (!cf_read_record(cf, fdata))
+ return; /* error reading the record */
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
- frame_matched = dfilter_apply_edt(sfcode, &edt);
- /* if it is not an sctp frame, show the dialog */
-
- if (frame_matched != 1) {
+ /* if it is not an sctp packet, show the dialog */
+ if (!dfilter_apply_edt(sfcode, &edt)) {
epan_dissect_cleanup(&edt);
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Please choose an SCTP packet.");