diff options
author | Michael Mann <mmann78@netscape.net> | 2014-05-08 22:59:19 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-05-09 03:04:39 +0000 |
commit | 1abeb277f5e6bd27fbaebfecc8184e37ba9d008a (patch) | |
tree | 8cc6eaa5a6982454a00adc600fa4aab02bec3d73 /ui | |
parent | aa3a968eb6e85c47014a4cec4a2b955357b0e77f (diff) |
Refactor Wiretap
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality.
The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes.
bug:9607
Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae
Reviewed-on: https://code.wireshark.org/review/1485
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/capture_file_dlg.c | 12 | ||||
-rw-r--r-- | ui/gtk/file_import_dlg.c | 2 | ||||
-rw-r--r-- | ui/gtk/iax2_analysis.c | 2 | ||||
-rw-r--r-- | ui/gtk/main.c | 4 | ||||
-rw-r--r-- | ui/gtk/packet_win.c | 2 | ||||
-rw-r--r-- | ui/gtk/rlc_lte_graph.c | 2 | ||||
-rw-r--r-- | ui/gtk/rtp_analysis.c | 2 | ||||
-rw-r--r-- | ui/gtk/sctp_assoc_analyse.c | 2 | ||||
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 4 | ||||
-rw-r--r-- | ui/qt/import_text_dialog.cpp | 2 | ||||
-rw-r--r-- | ui/qt/packet_list.cpp | 2 | ||||
-rw-r--r-- | ui/tap-tcp-stream.c | 2 | ||||
-rw-r--r-- | ui/tap_export_pdu.c | 2 | ||||
-rw-r--r-- | ui/tap_export_pdu.h | 2 | ||||
-rw-r--r-- | ui/text_import.c | 2 | ||||
-rw-r--r-- | ui/text_import.h | 2 | ||||
-rw-r--r-- | ui/win32/file_dlg_win32.c | 6 |
17 files changed, 26 insertions, 26 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index baef2baed9..a2b2b7819b 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -105,11 +105,11 @@ static gboolean color_selected; /* set a new filename for the preview widget */ -static wtap * +static wftap * preview_set_filename(GtkWidget *prev, const gchar *cf_name) { GtkWidget *label; - wtap *wth; + wftap *wth; int err = 0; gchar *err_info; gchar string_buff[PREVIEW_STR_MAX]; @@ -150,7 +150,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name) } /* Find the size of the file. */ - filesize = wtap_file_size(wth, &err); + filesize = wftap_file_size(wth, &err); if (filesize == -1) { gtk_label_set_text(GTK_LABEL(label), "error getting file size"); wtap_close(wth); @@ -161,7 +161,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name) gtk_label_set_text(GTK_LABEL(label), string_buff); /* type */ - g_strlcpy(string_buff, wtap_file_type_subtype_string(wtap_file_type_subtype(wth)), PREVIEW_STR_MAX); + g_strlcpy(string_buff, wtap_file_type_subtype_string(wftap_file_type_subtype(wth)), PREVIEW_STR_MAX); label = (GtkWidget *)g_object_get_data(G_OBJECT(prev), PREVIEW_FORMAT_KEY); gtk_label_set_text(GTK_LABEL(label), string_buff); @@ -171,7 +171,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name) /* do a preview run on the currently selected capture file */ static void -preview_do(GtkWidget *prev, wtap *wth) +preview_do(GtkWidget *prev, wftap *wth) { GtkWidget *label; unsigned int elapsed_time; @@ -299,7 +299,7 @@ file_open_entry_changed(GtkWidget *w _U_, gpointer file_sel) GtkWidget *prev = (GtkWidget *)g_object_get_data(G_OBJECT(file_sel), PREVIEW_TABLE_KEY); gchar *cf_name; gboolean have_preview; - wtap *wth; + wftap *wth; /* get the filename */ cf_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_sel)); diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c index cd12985257..b3e5342b1d 100644 --- a/ui/gtk/file_import_dlg.c +++ b/ui/gtk/file_import_dlg.c @@ -535,7 +535,7 @@ file_import_open(text_import_info_t *info) read_failure_alert_box(info->import_text_filename, errno); } - if (!wtap_dump_close(info->wdh, &err)) { + if (!wftap_dump_close(info->wdh, &err)) { write_failure_alert_box(capfile_name, err); } diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c index 6f7fe77c73..da4996f5c5 100644 --- a/ui/gtk/iax2_analysis.c +++ b/ui/gtk/iax2_analysis.c @@ -3715,7 +3715,7 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_) return; /* error reading the frame */ 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), + epan_dissect_run(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL); /* if it is not an iax2 frame, show an error dialog */ diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 56264fb305..6635c69b2e 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -549,7 +549,7 @@ get_ip_address_list_from_packet_list_row(gpointer data) epan_dissect_init(&edt, cfile.epan, FALSE, FALSE); col_custom_prime_edt(&edt, &cfile.cinfo); - epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf), + epan_dissect_run(&edt, &cfile.hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cfile.buf), fdata, &cfile.cinfo); epan_dissect_fill_in_columns(&edt, TRUE, TRUE); @@ -590,7 +590,7 @@ get_filter_from_packet_list_row_and_column(gpointer data) epan_dissect_init(&edt, cfile.epan, have_custom_cols(&cfile.cinfo), FALSE); col_custom_prime_edt(&edt, &cfile.cinfo); - epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf), + epan_dissect_run(&edt, &cfile.hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cfile.buf), fdata, &cfile.cinfo); epan_dissect_fill_in_columns(&edt, TRUE, TRUE); diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c index c25d62b48a..47c637bfcd 100644 --- a/ui/gtk/packet_win.c +++ b/ui/gtk/packet_win.c @@ -972,7 +972,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _ /* XXX, protect cfile.epan from closing (ref counting?) */ DataPtr->epan = cfile.epan; DataPtr->frame = fd; - DataPtr->phdr = cfile.phdr; + DataPtr->phdr = cfile.hdr.wtap_hdr; DataPtr->pd = (guint8 *)g_malloc(DataPtr->frame->cap_len); memcpy(DataPtr->pd, buffer_start_ptr(&cfile.buf), DataPtr->frame->cap_len); diff --git a/ui/gtk/rlc_lte_graph.c b/ui/gtk/rlc_lte_graph.c index aeb5b9996b..ab238b8344 100644 --- a/ui/gtk/rlc_lte_graph.c +++ b/ui/gtk/rlc_lte_graph.c @@ -917,7 +917,7 @@ static rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, struct segment epan_dissect_init(&edt, cf->epan, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); - epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL); + epan_dissect_run_with_taps(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL); rel_ts = edt.pi.rel_ts; epan_dissect_cleanup(&edt); remove_tap_listener(&th); diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c index 0305b0a26a..578273d6bf 100644 --- a/ui/gtk/rtp_analysis.c +++ b/ui/gtk/rtp_analysis.c @@ -3950,7 +3950,7 @@ rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_) return; /* error reading the frame */ 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); + epan_dissect_run(&edt, &cf->hdr.wtap_hdr, 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); diff --git a/ui/gtk/sctp_assoc_analyse.c b/ui/gtk/sctp_assoc_analyse.c index 2b751f7135..84d37c3010 100644 --- a/ui/gtk/sctp_assoc_analyse.c +++ b/ui/gtk/sctp_assoc_analyse.c @@ -980,7 +980,7 @@ sctp_analyse_cb(struct sctp_analyse *u_data, gboolean ext) 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); + epan_dissect_run(&edt, &cf->hdr.wtap_hdr, 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 */ diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index 03d4892411..1fa58515d6 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -786,10 +786,10 @@ void CaptureFileDialog::preview(const QString & path) } // Format - preview_format_.setText(QString::fromUtf8(wtap_file_type_subtype_string(wtap_file_type_subtype(wth)))); + preview_format_.setText(QString::fromUtf8(wtap_file_type_subtype_string(wftap_file_type_subtype(wth)))); // Size - preview_size_.setText(QString(tr("%1 bytes")).arg(wtap_file_size(wth, &err))); + preview_size_.setText(QString(tr("%1 bytes")).arg(wftap_file_size(wth, &err))); time(&time_preview); while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) { diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp index 39cf304bcd..344c3e6faf 100644 --- a/ui/qt/import_text_dialog.cpp +++ b/ui/qt/import_text_dialog.cpp @@ -142,7 +142,7 @@ void ImportTextDialog::convertTextFile() { read_failure_alert_box(import_info_.import_text_filename, errno); } - if (!wtap_dump_close(import_info_.wdh, &err)) + if (!wftap_dump_close(import_info_.wdh, &err)) { write_failure_alert_box(capfile_name_.toUtf8().constData(), err); } diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 7e9ff94132..1a2c07e6b7 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -661,7 +661,7 @@ QString &PacketList::getFilterFromRowAndColumn() epan_dissect_init(&edt, cap_file_->epan, have_custom_cols(&cap_file_->cinfo), FALSE); col_custom_prime_edt(&edt, &cap_file_->cinfo); - epan_dissect_run(&edt, &cap_file_->phdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo); + epan_dissect_run(&edt, &cap_file_->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo); epan_dissect_fill_in_columns(&edt, TRUE, TRUE); if ((cap_file_->cinfo.col_custom_occurrence[ctx_column_]) || diff --git a/ui/tap-tcp-stream.c b/ui/tap-tcp-stream.c index 9dd1e46381..e91604bcbc 100644 --- a/ui/tap-tcp-stream.c +++ b/ui/tap-tcp-stream.c @@ -319,7 +319,7 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs) epan_dissect_init(&edt, cf->epan, TRUE, FALSE); epan_dissect_prime_dfilter(&edt, sfcode); - epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL); + epan_dissect_run_with_taps(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL); rel_ts = edt.pi.rel_ts; epan_dissect_cleanup(&edt); remove_tap_listener(&th); diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index ec8c78130f..c3a23fcc89 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -154,7 +154,7 @@ exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data) cf_retap_packets(&cfile); - if (!wtap_dump_close(exp_pdu_tap_data->wdh, &err)) { + if (!wftap_dump_close(exp_pdu_tap_data->wdh, &err)) { write_failure_alert_box(capfile_name, err); } diff --git a/ui/tap_export_pdu.h b/ui/tap_export_pdu.h index 25c39d733a..998959b9b7 100644 --- a/ui/tap_export_pdu.h +++ b/ui/tap_export_pdu.h @@ -29,7 +29,7 @@ extern "C" { typedef struct _exp_pdu_t { int pkt_encap; - wtap_dumper* wdh; + wftap_dumper* wdh; } exp_pdu_t; void exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data); diff --git a/ui/text_import.c b/ui/text_import.c index 05fcc25b8f..8a05da023c 100644 --- a/ui/text_import.c +++ b/ui/text_import.c @@ -191,7 +191,7 @@ static guint32 ts_usec = 0; static char *ts_fmt = NULL; static struct tm timecode_default; -static wtap_dumper* wdh; +static wftap_dumper* wdh; /* HDR_ETH Offset base to parse */ static guint32 offset_base = 16; diff --git a/ui/text_import.h b/ui/text_import.h index 9a92576f8e..64410d61c5 100644 --- a/ui/text_import.h +++ b/ui/text_import.h @@ -71,7 +71,7 @@ typedef struct /* Import info */ guint encapsulation; - wtap_dumper* wdh; + wftap_dumper* wdh; /* Dummy header info (if encapsulation == 1) */ enum dummy_header_type dummy_header_type; diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index a65aaf4d0f..21b1ed9dac 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -1114,7 +1114,7 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) { HWND cur_ctrl; int i; gboolean enable = FALSE; - wtap *wth; + wftap *wth; const struct wtap_pkthdr *phdr; int err = 0; gchar *err_info; @@ -1177,10 +1177,10 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) { /* Format */ cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_FORMAT); - SetWindowText(cur_ctrl, utf_8to16(wtap_file_type_subtype_string(wtap_file_type_subtype(wth)))); + SetWindowText(cur_ctrl, utf_8to16(wtap_file_type_subtype_string(wftap_file_type_subtype(wth)))); /* Size */ - filesize = wtap_file_size(wth, &err); + filesize = wftap_file_size(wth, &err); utf_8to16_snprintf(string_buff, PREVIEW_STR_MAX, "%" G_GINT64_FORMAT " bytes", filesize); cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_SIZE); SetWindowText(cur_ctrl, string_buff); |