Move a lot of includes from follow_stream_dialog.h to

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
This commit is contained in:
Gerald Combs 2013-09-11 17:39:49 +00:00
parent 2d132d3a38
commit 6986eb4866
5 changed files with 88 additions and 80 deletions

View File

@ -56,6 +56,30 @@
#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

View 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__ */

View File

@ -27,12 +27,41 @@
#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;

View File

@ -24,51 +24,21 @@
#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;

View 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>