Move a lot of includes from follow_stream_dialog.h to
authorGerald Combs <gerald@wireshark.org>
Wed, 11 Sep 2013 17:39:49 +0000 (17:39 -0000)
committerGerald Combs <gerald@wireshark.org>
Wed, 11 Sep 2013 17:39:49 +0000 (17:39 -0000)
follow_stream_dialog.cpp. Remove the ones that we don't use. Use
QMessageBox in place of simple_dialog.

Move IP6OPT_HOME_ADDRESS and related definitions to packet-ipv6.c. It
looks like we only use it there and it conflicts with WinPcap.

Mark some items unused.

svn path=/trunk/; revision=51951

epan/dissectors/packet-ipv6.c
epan/dissectors/packet-ipv6.h
ui/qt/follow_stream_dialog.cpp
ui/qt/follow_stream_dialog.h
ui/qt/main_window.cpp

index f50be8302cba660910780a8e4e670b29a7262659..4fac14aab3d5766f58c24cb779f73d6f32f40640 100644 (file)
 #include <epan/geoip_db.h>
 #endif /* HAVE_GEOIP_V6 */
 
+/* Option types and related macros */
+#define IP6OPT_PAD1                    0x00    /* 00 0 00000 */
+#define IP6OPT_PADN                    0x01    /* 00 0 00001 */
+#define IP6OPT_TEL                     0x04    /* 00 0 00100 */
+#define IP6OPT_RTALERT                 0x05    /* 00 0 00101 */
+#define IP6OPT_CALIPSO                 0x07    /* 00 0 00111 */
+#define IP6OPT_QUICKSTART              0x26    /* 00 1 00110 */
+#define IP6OPT_ENDI                    0x8A    /* 10 0 01010 */
+#define IP6OPT_EXP_1E                  0x1E    /* 00 0 11110 */
+#define IP6OPT_EXP_3E                  0x3E    /* 00 1 11110 */
+#define IP6OPT_EXP_5E                  0x5E    /* 01 0 11110 */
+#define IP6OPT_RPL                     0x63    /* 01 1 00011 */
+#define IP6OPT_EXP_7E                  0x7E    /* 01 1 11110 */
+#define IP6OPT_EXP_9E                  0x9E    /* 10 0 11110 */
+#define IP6OPT_EXP_BE                  0xBE    /* 10 1 11110 */
+#define IP6OPT_JUMBO                   0xC2    /* 11 0 00010 = 194 */
+#define IP6OPT_HOME_ADDRESS            0xC9    /* 11 0 01001 */
+#define IP6OPT_EXP_DE                  0xDE    /* 11 0 11110 */
+#define IP6OPT_EXP_FE                  0xFE    /* 11 1 11110 */
+
+#define IP6OPT_RTALERT_MLD             0       /* Datagram contains MLD msg */
+#define IP6OPT_RTALERT_RSVP            1       /* Datagram contains RSVP msg */
+#define IP6OPT_RTALERT_ACTNET          2       /* Datagram contains ACTNET msg */
+
 /* Differentiated Services Field. See RFCs 2474, 2597 and 2598. */
 #define IPDSFIELD_DSCP_MASK     0xFC
 #define IPDSFIELD_ECN_MASK      0x03
index 699a4e763bbf1a8b989583e8473e698c20f919a3..8226d1b2bf543382cf4d53498c5d75a366a102b2 100644 (file)
@@ -78,32 +78,6 @@ struct       ip6_ext {
        guchar  ip6e_len;
 };
 
-
-/* Option types and related macros */
-#define IP6OPT_PAD1                    0x00    /* 00 0 00000 */
-#define IP6OPT_PADN                    0x01    /* 00 0 00001 */
-#define IP6OPT_TEL                     0x04    /* 00 0 00100 */
-#define IP6OPT_RTALERT                 0x05    /* 00 0 00101 */
-#define IP6OPT_CALIPSO                 0x07    /* 00 0 00111 */
-#define IP6OPT_QUICKSTART              0x26    /* 00 1 00110 */
-#define IP6OPT_ENDI                    0x8A    /* 10 0 01010 */
-#define IP6OPT_EXP_1E                  0x1E    /* 00 0 11110 */
-#define IP6OPT_EXP_3E                  0x3E    /* 00 1 11110 */
-#define IP6OPT_EXP_5E                  0x5E    /* 01 0 11110 */
-#define IP6OPT_RPL                     0x63    /* 01 1 00011 */
-#define IP6OPT_EXP_7E                  0x7E    /* 01 1 11110 */
-#define IP6OPT_EXP_9E                  0x9E    /* 10 0 11110 */
-#define IP6OPT_EXP_BE                  0xBE    /* 10 1 11110 */
-#define IP6OPT_JUMBO                   0xC2    /* 11 0 00010 = 194 */
-#define IP6OPT_HOME_ADDRESS            0xC9    /* 11 0 01001 */
-#define IP6OPT_EXP_DE                  0xDE    /* 11 0 11110 */
-#define IP6OPT_EXP_FE                  0xFE    /* 11 1 11110 */
-
-#define IP6OPT_RTALERT_MLD             0       /* Datagram contains MLD msg */
-#define IP6OPT_RTALERT_RSVP            1       /* Datagram contains RSVP msg */
-#define IP6OPT_RTALERT_ACTNET          2       /* Datagram contains ACTNET msg */
-
-
 /* Routing header */
 struct ip6_rthdr {
        guint8  ip6r_nxt;       /* next header */
@@ -192,7 +166,14 @@ struct ip6_shim {
 #define IP6F_RESERVED_MASK     0x0006  /* reserved bits in ip6f_offlg */
 #define IP6F_MORE_FRAG         0x0001  /* more-fragments flag */
 
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 void capture_ipv6(const guchar *, int, int, packet_counts *);
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
 
 #endif /* __PACKET_IPV6_H_DEFINED__ */
index 92a6723cadd45a89c3e03f0165000b71c028621f..aeaeaf3b54af57933279d1a0ff24052810f96df7 100644 (file)
 #include "main_window.h"
 #include "wireshark_application.h"
 
+#include "epan/follow.h"
+#include "epan/dissectors/packet-ipv6.h"
+#include "epan/prefs.h"
+#include "epan/charsets.h"
+#include "epan/epan_dissect.h"
+#include "epan/ipproto.h"
+#include "epan/tap.h"
+
+#include "file.h"
+#include "ui/alert_box.h"
+#include "ui/simple_dialog.h"
+#include "ui/utf8_entities.h"
+#include "wsutil/tempfile.h"
+#include "wsutil/file_util.h"
+#include "ws_symbol_export.h"
+
+#include "qt_ui_utils.h"
+
+#include "globals.h"
+#include "file.h"
+
+#include "version_info.h"
+
 #include "ui/follow.h"
 
 #ifdef HAVE_LIBZ
 #include <zlib.h>
 #endif
 
+#include <QInputDialog>
+#include <QMessageBox>
+#include <QPrintDialog>
+#include <QPrinter>
+#include <QTextStream>
+
 FollowStreamDialog::FollowStreamDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::FollowStreamDialog)
@@ -197,8 +226,9 @@ FollowStreamDialog::follow_read_stream()
 //Copy from ui/gtk/follow_udp.c
 static int
 udp_queue_packet_data(void *tapdata, packet_info *pinfo,
-                      epan_dissect_t *edt _U_, const void *data)
+                      epan_dissect_t *edt, const void *data)
 {
+    Q_UNUSED(edt)
 
     follow_record_t *follow_record;
     follow_info_t *follow_info = (follow_info_t *)tapdata;
@@ -230,8 +260,10 @@ udp_queue_packet_data(void *tapdata, packet_info *pinfo,
 
 //Copy from ui/gtk/follow_ssl.c
 static int
-ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *ssl)
+ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *ssl)
 {
+    Q_UNUSED(edt)
+
     follow_info_t *      follow_info = (follow_info_t*) tapdata;
     SslDecryptedRecord * rec = NULL;
     SslDataInfo *        appl_data = NULL;
@@ -599,9 +631,8 @@ bool FollowStreamDialog::Follow(QString previous_filter_, follow_type_t type)
     case FOLLOW_SSL:
         /* we got ssl so we can follow */
         if (!epan_dissect_packet_contains_field(cfile.edt, "ssl")) {
-            simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                          "Error following stream.  Please make\n"
-                          "sure you have an SSL packet selected.");
+            QMessageBox::critical(this, tr("Error following stream"),
+                               tr("Please make sure you have an SSL packet selected."));
             return false;
         }
         break;
@@ -691,9 +722,9 @@ bool FollowStreamDialog::Follow(QString previous_filter_, follow_type_t type)
         msg = register_tap_listener("udp_follow", follow_info, follow_filter,
                                     0, NULL, udp_queue_packet_data, NULL);
         if (msg) {
-            simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                          "Can't register udp_follow tap: %s\n",
-                          msg->str);
+            QMessageBox::critical(this, "Error",
+                               "Can't register udp_follow tap: %1",
+                               msg->str);
             g_free(follow_info->filter_out_filter);
             g_free(follow_info);
             g_free(follow_filter);
@@ -706,8 +737,8 @@ bool FollowStreamDialog::Follow(QString previous_filter_, follow_type_t type)
                                     NULL, ssl_queue_packet_data, NULL);
         if (msg)
         {
-            simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                          "Can't register ssl tap: %s\n",msg->str);
+            QMessageBox::critical(this, "Error",
+                          "Can't register ssl tap: %1", msg->str);
             g_free(follow_info->filter_out_filter);
             g_free(follow_info);
             g_free(follow_filter);
@@ -959,19 +990,19 @@ FollowStreamDialog::follow_read_tcp_stream()
 
     data_out_file = ws_fopen(follow_info->data_out_filename, "rb");
     if (data_out_file == NULL) {
-        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                      "Could not open temporary file %s: %s", follow_info->data_out_filename,
+        QMessageBox::critical(this, "Error",
+                      "Could not open temporary file %1: %2", follow_info->data_out_filename,
                       g_strerror(errno));
         return FRS_OPEN_ERROR;
     }
 
     while ((nchars=fread(&sc, 1, sizeof(sc), data_out_file))) {
         if (nchars != sizeof(sc)) {
-            simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                          "Short read from temporary file %s: expected %lu, got %lu",
-                          follow_info->data_out_filename,
-                          (unsigned long)sizeof(sc),
-                          (unsigned long)nchars);
+            QMessageBox::critical(this, "Error",
+                          QString(tr("Short read from temporary file %1: expected %2, got %3"))
+                          .arg(follow_info->data_out_filename)
+                          .arg(sizeof(sc))
+                          .arg(nchars));
             fclose(data_out_file);
             data_out_file = NULL;
             return FRS_READ_ERROR;
index 18571f826d08ca5583a79d9f16db53847281b309..fdd943134a0a2692444b9077374fa58dd429eb6b 100644 (file)
 #ifndef FOLLOW_STREAM_DIALOG_H
 #define FOLLOW_STREAM_DIALOG_H
 
-#include <QDialog>
-#include <QMessageBox>
-#include <QPushButton>
-#include <QPrinter>
-#include <QPrintDialog>
-#include <QInputDialog>
-
 #include "config.h"
 
+#include <glib.h>
+
+#include <stdio.h>
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#include "qt_ui_utils.h"
-
-#include <epan/follow.h>
-#include <epan/dissectors/packet-ipv6.h>
-#include <epan/dissectors/packet-tcp.h>
-#include <epan/prefs.h>
-#include <epan/addr_resolv.h>
-#include <epan/charsets.h>
-#include <epan/epan_dissect.h>
-#include <epan/filesystem.h>
-#include <epan/ipproto.h>
-#include <epan/charsets.h>
-#include <epan/plugins.h>
-#include <epan/tap.h>
-
-#include "../file.h"
-#include "ui/alert_box.h"
 #include "ui/follow.h"
-#include "ui/simple_dialog.h"
-#include "ui/utf8_entities.h"
-#include "wsutil/tempfile.h"
-#include <wsutil/file_util.h>
-#include "ws_symbol_export.h"
-
 
-#include "globals.h"
-#include "file.h"
-
-#include "version_info.h"
-
-
-#include <QtGui>
+#include <QDialog>
+#include <QFile>
+#include <QPushButton>
 
 extern "C" {
 WS_DLL_PUBLIC FILE *data_out_file;
index 94a4b41d2b46083ec8cc00ebaae1a0829416a6f7..29580234d0d313f32f873a44d82fd4331787ec05 100644 (file)
@@ -26,7 +26,9 @@
 
 #include "globals.h"
 
+#include <epan/epan_dissect.h>
 #include <epan/filesystem.h>
+#include <epan/ipproto.h>
 #include <epan/prefs.h>
 
 //#include <wiretap/wtap.h>