diff options
-rw-r--r-- | capture_session.h | 6 | ||||
-rw-r--r-- | ui/qt/capture_filter_edit.cpp | 4 | ||||
-rw-r--r-- | ui/qt/interface_tree.cpp | 30 | ||||
-rw-r--r-- | ui/qt/interface_tree.h | 2 | ||||
-rw-r--r-- | ui/qt/main.cpp | 2 | ||||
-rw-r--r-- | ui/qt/main_status_bar.cpp | 5 | ||||
-rw-r--r-- | ui/qt/main_window.cpp | 6 | ||||
-rw-r--r-- | ui/qt/main_window.h | 4 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 29 | ||||
-rw-r--r-- | ui/qt/wireshark_application.cpp | 2 | ||||
-rw-r--r-- | ui/qt/wireshark_application.h | 2 |
11 files changed, 76 insertions, 16 deletions
diff --git a/capture_session.h b/capture_session.h index cbd287314b..758e98eb98 100644 --- a/capture_session.h +++ b/capture_session.h @@ -29,6 +29,7 @@ extern "C" { #endif /* __cplusplus */ +#ifdef HAVE_LIBPCAP /* Current state of capture engine. XXX - differentiate states */ typedef enum { CAPTURE_STOPPED, /**< stopped */ @@ -57,6 +58,11 @@ typedef struct { extern void capture_session_init(capture_session *cap_session, void *cf); +#else + +typedef struct {} capture_session; + +#endif /* HAVE_LIBPCAP */ #ifdef __cplusplus } diff --git a/ui/qt/capture_filter_edit.cpp b/ui/qt/capture_filter_edit.cpp index 338fc3b06a..c75839a839 100644 --- a/ui/qt/capture_filter_edit.cpp +++ b/ui/qt/capture_filter_edit.cpp @@ -281,7 +281,9 @@ void CaptureFilterEdit::checkFilter() void CaptureFilterEdit::initCaptureFilter() { +#ifdef HAVE_LIBPCAP setText(global_capture_opts.default_options.cfilter); +#endif // HAVE_LIBPCAP } void CaptureFilterEdit::setFilterSyntaxState(QString filter, bool valid, QString err_msg) @@ -295,6 +297,7 @@ void CaptureFilterEdit::setFilterSyntaxState(QString filter, bool valid, QString } } +#ifdef HAVE_LIBPCAP if (syntaxState() != Invalid) { bookmark_button_->setEnabled(true); if (apply_button_) { @@ -327,6 +330,7 @@ void CaptureFilterEdit::setFilterSyntaxState(QString filter, bool valid, QString } } } +#endif // HAVE_LIBPCAP emit captureFilterSyntaxChanged(valid); } diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp index 6674ad2ddb..70d8b8d764 100644 --- a/ui/qt/interface_tree.cpp +++ b/ui/qt/interface_tree.cpp @@ -23,7 +23,9 @@ #include "interface_tree.h" +#ifdef HAVE_LIBPCAP #include "ui/capture_globals.h" +#endif #include "ui/iface_lists.h" #include "ui/utf8_entities.h" #include "ui/ui_util.h" @@ -39,9 +41,11 @@ const int stat_update_interval_ = 1000; // ms InterfaceTree::InterfaceTree(QWidget *parent) : - QTreeWidget(parent), - stat_cache_(NULL), - stat_timer_(NULL) + QTreeWidget(parent) +#ifdef HAVE_LIBPCAP + ,stat_cache_(NULL) + ,stat_timer_(NULL) +#endif // HAVE_LIBPCAP { QTreeWidgetItem *ti; @@ -65,6 +69,7 @@ InterfaceTree::InterfaceTree(QWidget *parent) : } InterfaceTree::~InterfaceTree() { +#ifdef HAVE_LIBPCAP QTreeWidgetItemIterator iter(this); if (stat_cache_) { @@ -79,22 +84,27 @@ InterfaceTree::~InterfaceTree() { delete(points); ++iter; } +#endif // HAVE_LIBPCAP } void InterfaceTree::hideEvent(QHideEvent *evt) { Q_UNUSED(evt); +#ifdef HAVE_LIBPCAP if (stat_timer_) stat_timer_->stop(); if (stat_cache_) { capture_stat_stop(stat_cache_); stat_cache_ = NULL; } +#endif // HAVE_LIBPCAP } void InterfaceTree::showEvent(QShowEvent *evt) { Q_UNUSED(evt); +#ifdef HAVE_LIBPCAP if (stat_timer_) stat_timer_->start(stat_update_interval_); +#endif // HAVE_LIBPCAP } void InterfaceTree::resizeEvent(QResizeEvent *evt) @@ -112,6 +122,7 @@ void InterfaceTree::resizeEvent(QResizeEvent *evt) void InterfaceTree::getInterfaceList() { +#ifdef HAVE_LIBPCAP GList *if_list; int err; gchar *err_str = NULL; @@ -178,9 +189,19 @@ void InterfaceTree::getInterfaceList() connect(stat_timer_, SIGNAL(timeout()), this, SLOT(updateStatistics())); stat_timer_->start(stat_update_interval_); } +#else + QTreeWidgetItem *ti = new QTreeWidgetItem(); + + clear(); + setColumnCount(1); + ti->setText(0, tr("Interface information not available")); + addTopLevelItem(ti); + resizeColumnToContents(0); +#endif // HAVE_LIBPCAP } void InterfaceTree::updateStatistics(void) { +#ifdef HAVE_LIBPCAP interface_t device; guint diff, if_idx; struct pcap_stat stats; @@ -218,10 +239,12 @@ void InterfaceTree::updateStatistics(void) { } iter++; } +#endif // HAVE_LIBPCAP } void InterfaceTree::updateSelectedInterfaces() { +#ifdef HAVE_LIBPCAP QTreeWidgetItemIterator iter(this); global_capture_opts.num_selected = 0; @@ -253,6 +276,7 @@ void InterfaceTree::updateSelectedInterfaces() } iter++; } +#endif // HAVE_LIBPCAP } /* diff --git a/ui/qt/interface_tree.h b/ui/qt/interface_tree.h index 188b21e1d9..4fb7a14d6a 100644 --- a/ui/qt/interface_tree.h +++ b/ui/qt/interface_tree.h @@ -50,8 +50,10 @@ protected: void resizeEvent(QResizeEvent *evt); private: +#ifdef HAVE_LIBPCAP if_stat_cache_t *stat_cache_; QTimer *stat_timer_; +#endif // HAVE_LIBPCAP signals: void interfaceUpdated(const char *device_name, bool selected); diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 6d11b4d805..8aafd5b0ed 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -147,7 +147,6 @@ static void console_log_handler(const char *log_domain, #ifdef HAVE_LIBPCAP extern capture_options global_capture_opts; -#endif static void main_capture_callback(gint event, capture_session *cap_session, gpointer user_data ) @@ -155,6 +154,7 @@ main_capture_callback(gint event, capture_session *cap_session, gpointer user_da Q_UNUSED(user_data); wsApp->captureCallback(event, cap_session); } +#endif // HAVE_LIBPCAP static void main_cf_callback(gint event, gpointer data, gpointer user_data ) diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp index 4db1a6d0bc..f7cc48eb8b 100644 --- a/ui/qt/main_status_bar.cpp +++ b/ui/qt/main_status_bar.cpp @@ -299,6 +299,7 @@ void MainStatusBar::updateCaptureStatistics(capture_session *cap_session) { QString packets_str; +#ifdef HAVE_LIBPCAP /* Do we have any packets? */ if ((!cap_session || cap_session->cf == cap_file_) && cap_file_ && cap_file_->count) { packets_str.append(QString(tr("Packets: %1 %4 Displayed: %2 %4 Marked: %3")) @@ -322,8 +323,12 @@ void MainStatusBar::updateCaptureStatistics(capture_session *cap_session) .arg(computed_elapsed%1000)); } } else { +#else packets_str = tr("No Packets"); +#endif // HAVE_LIBPCAP +#ifdef HAVE_LIBPCAP } +#endif // HAVE_LIBPCAP popPacketStatus(); pushPacketStatus(packets_str); diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 2d7d01b96b..f2019dcd37 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -147,6 +147,10 @@ MainWindow::MainWindow(QWidget *parent) : connect(main_ui_->searchFrame, SIGNAL(pushFilterSyntaxStatus(QString&)), main_ui_->statusBar, SLOT(pushTemporaryStatus(QString&))); +#ifndef HAVE_LIBPCAP + main_ui_->menuCapture->setEnabled(false); +#endif + #if defined(Q_OS_MAC) #ifdef QT_MACEXTRAS_LIB QMacNativeToolBar *ntb = QtMacExtras::setNativeToolBar(main_ui_->mainToolBar); @@ -198,7 +202,6 @@ MainWindow::MainWindow(QWidget *parent) : main_welcome_ = main_ui_->welcomePage; -#ifdef HAVE_LIBPCAP connect(wsApp, SIGNAL(captureCapturePrepared(capture_session *)), this, SLOT(captureCapturePrepared(capture_session *))); connect(wsApp, SIGNAL(captureCaptureUpdateStarted(capture_session *)), @@ -213,7 +216,6 @@ MainWindow::MainWindow(QWidget *parent) : this, SLOT(captureCaptureStopping(capture_session *))); connect(wsApp, SIGNAL(captureCaptureFailed(capture_session *)), this, SLOT(captureCaptureFailed(capture_session *))); -#endif connect(wsApp, SIGNAL(captureFileOpened(const capture_file*)), this, SLOT(captureFileOpened(const capture_file*))); diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index c18168c582..e1cf78b10e 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -38,8 +38,8 @@ #ifdef HAVE_LIBPCAP #include "capture_opts.h" -#include "capture_session.h" #endif +#include "capture_session.h" #include <QMainWindow> #include <QSplitter> @@ -165,7 +165,6 @@ public slots: void updateForUnsavedChanges(); void layoutPanes(); -#ifdef HAVE_LIBPCAP void captureCapturePrepared(capture_session *cap_session); void captureCaptureUpdateStarted(capture_session *cap_session); void captureCaptureUpdateFinished(capture_session *cap_session); @@ -173,7 +172,6 @@ public slots: void captureCaptureFixedFinished(capture_session *cap_session); void captureCaptureStopping(capture_session *cap_session); void captureCaptureFailed(capture_session *cap_session); -#endif void captureFileOpened(const capture_file *cf); void captureFileReadStarted(const capture_file *cf); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 1ee7340e9d..c19763fb5b 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -48,7 +48,6 @@ #include "capture.h" #include "capture-pcap-util.h" #include "capture_ui_utils.h" -#include "capture_session.h" #endif #include "wsutil/file_util.h" @@ -290,8 +289,8 @@ void MainWindow::layoutPanes() // Capture callbacks -#ifdef HAVE_LIBPCAP void MainWindow::captureCapturePrepared(capture_session *cap_session) { +#ifdef HAVE_LIBPCAP qDebug() << "FIX captureCapturePrepared"; setTitlebarForCaptureInProgress(); @@ -309,9 +308,13 @@ void MainWindow::captureCapturePrepared(capture_session *cap_session) { // main_set_for_capture_file(FALSE); main_ui_->mainStack->setCurrentWidget(&master_split_); cap_file_ = (capture_file *) cap_session->cf; +#else + Q_UNUSED(cap_session) +#endif // HAVE_LIBPCAP } void MainWindow::captureCaptureUpdateStarted(capture_session *cap_session) { Q_UNUSED(cap_session); +#ifdef HAVE_LIBPCAP /* We've done this in "prepared" above, but it will be cleared while switching to the next multiple file. */ @@ -320,9 +323,11 @@ void MainWindow::captureCaptureUpdateStarted(capture_session *cap_session) { setForCaptureInProgress(true); setForCapturedPackets(true); +#endif // HAVE_LIBPCAP } void MainWindow::captureCaptureUpdateFinished(capture_session *cap_session) { Q_UNUSED(cap_session); +#ifdef HAVE_LIBPCAP /* The capture isn't stopping any more - it's stopped. */ capture_stopping_ = false; @@ -333,14 +338,17 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *cap_session) { /* Enable menu items that make sense if you're not currently running a capture. */ setForCaptureInProgress(false); - +#endif // HAVE_LIBPCAP } void MainWindow::captureCaptureFixedStarted(capture_session *cap_session) { Q_UNUSED(cap_session); +#ifdef HAVE_LIBPCAP qDebug() << "captureCaptureFixedStarted"; +#endif // HAVE_LIBPCAP } void MainWindow::captureCaptureFixedFinished(capture_session *cap_session) { Q_UNUSED(cap_session); +#ifdef HAVE_LIBPCAP qDebug() << "captureCaptureFixedFinished"; /* The capture isn't stopping any more - it's stopped. */ @@ -349,23 +357,26 @@ void MainWindow::captureCaptureFixedFinished(capture_session *cap_session) { /* Enable menu items that make sense if you're not currently running a capture. */ setForCaptureInProgress(false); - +#endif // HAVE_LIBPCAP } void MainWindow::captureCaptureStopping(capture_session *cap_session) { Q_UNUSED(cap_session); +#ifdef HAVE_LIBPCAP capture_stopping_ = true; setMenusForCaptureStopping(); +#endif // HAVE_LIBPCAP } void MainWindow::captureCaptureFailed(capture_session *cap_session) { Q_UNUSED(cap_session); +#ifdef HAVE_LIBPCAP qDebug() << "captureCaptureFailed"; /* Capture isn't stopping any more. */ capture_stopping_ = false; setForCaptureInProgress(false); -} #endif // HAVE_LIBPCAP +} // Callbacks from cfile.c via WiresharkApplication::captureFileCallback @@ -507,6 +518,7 @@ void MainWindow::filterExpressionsChanged() // ui/gtk/capture_dlg.c:start_capture_confirmed void MainWindow::startCapture() { +#ifdef HAVE_LIBPCAP interface_options interface_opts; guint i; @@ -553,6 +565,7 @@ void MainWindow::startCapture() { } else { cfile.window = NULL; } +#endif // HAVE_LIBPCAP } // Copied from ui/gtk/gui_utils.c @@ -633,7 +646,9 @@ void MainWindow::stopCapture() { // airpcap_set_toolbar_stop_capture(airpcap_if_active); //#endif +#ifdef HAVE_LIBPCAP capture_stop(&global_capture_session); +#endif // HAVE_LIBPCAP } // XXX - Copied from ui/gtk/menus.c @@ -1054,6 +1069,7 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { void MainWindow::interfaceSelectionChanged() { +#ifdef HAVE_LIBPCAP // XXX This doesn't disable the toolbar button when using // QtMacExtras. if (global_capture_opts.num_selected > 0 && capture_filter_valid_) { @@ -1061,6 +1077,7 @@ void MainWindow::interfaceSelectionChanged() } else { main_ui_->actionStartCapture->setEnabled(false); } +#endif // HAVE_LIBPCAP } void MainWindow::captureFilterSyntaxChanged(bool valid) @@ -1938,6 +1955,7 @@ void MainWindow::on_actionStartCapture_triggered() main_ui_->mainStack->setCurrentWidget(&master_split_); +#ifdef HAVE_LIBPCAP if (global_capture_opts.num_selected == 0) { QString err_msg = tr("No Interface Selected"); main_ui_->statusBar->pushTemporaryStatus(err_msg); @@ -1947,6 +1965,7 @@ void MainWindow::on_actionStartCapture_triggered() /* XXX - will closing this remove a temporary file? */ if (testCaptureFileClose(FALSE, *new QString(" before starting a new capture"))) startCapture(); +#endif // HAVE_LIBPCAP } void MainWindow::on_actionStopCapture_triggered() diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index a5b899deb8..6e979f3f97 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -189,6 +189,7 @@ void WiresharkApplication::refreshRecentFiles(void) { void WiresharkApplication::captureCallback(int event, capture_session * cap_session) { +#ifdef HAVE_LIBPCAP switch(event) { case(capture_cb_capture_prepared): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture prepared"); @@ -231,6 +232,7 @@ void WiresharkApplication::captureCallback(int event, capture_session * cap_sess g_warning("main_capture_callback: event %u unknown", event); g_assert_not_reached(); } +#endif // HAVE_LIBPCAP } void WiresharkApplication::captureFileCallback(int event, void * data) diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h index 610101cbed..71c4c5fa81 100644 --- a/ui/qt/wireshark_application.h +++ b/ui/qt/wireshark_application.h @@ -75,9 +75,7 @@ public: e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path); QList<recent_item_status *> recentItems() const; void addRecentItem(const QString &filename, qint64 size, bool accessible); -#ifdef HAVE_LIBPCAP void captureCallback(int event, capture_session * cap_session); -#endif void captureFileCallback(int event, void * data); QDir lastOpenDir(); void setLastOpenDir(const char *dir_name); |