Remove packet_info->ipproto and packet_info->ethertype uses in the GUI. Convert to walking packet protocol list looking for desired protocols.

I may eventually switch this to use proto_* values instead of strings, but just the addition of the loop is more jarring as compared to the simple comparing of ip or ethernet values.  But it should lead to a smaller (less protocol specific) packet_info structure.

svn path=/trunk/; revision=53476
This commit is contained in:
Michael Mann 2013-11-21 16:42:10 +00:00
parent d5433fd9b6
commit 64c687346b
7 changed files with 233 additions and 69 deletions

View File

@ -43,7 +43,6 @@
#include <epan/charsets.h>
#include <epan/epan_dissect.h>
#include <wsutil/filesystem.h>
#include <epan/ipproto.h>
#include <epan/charsets.h>
#include "../file.h"
@ -106,9 +105,27 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
size_t nchars;
gchar *data_out_filename;
char stream_window_title[256];
wmem_list_frame_t* protos;
int proto_id;
const char* proto_name;
gboolean is_tcp = FALSE;
/* we got tcp so we can follow */
if (cfile.edt->pi.ipproto != IP_PROTO_TCP) {
/* we got tcp so we can follow (should really be protected by menu sensitivity) */
protos = wmem_list_head(cfile.edt->pi.layers);
/* walk the list of a available protocols in the packet to see if we have TCP */
while (protos != NULL) {
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if (!strcmp(proto_name, "tcp")) {
is_tcp = TRUE;
break;
}
protos = wmem_list_frame_next(protos);
}
if (!is_tcp) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Error following stream. Please make\n"
"sure you have a TCP packet selected.");

View File

@ -31,7 +31,6 @@
#include <epan/addr_resolv.h>
#include <epan/epan_dissect.h>
#include <epan/follow.h>
#include <epan/ipproto.h>
#include <epan/strutil.h>
#include <epan/tap.h>
@ -95,9 +94,27 @@ follow_udp_stream_cb(GtkWidget *w _U_, gpointer data _U_)
follow_stats_t stats;
follow_info_t *follow_info;
GString *msg;
wmem_list_frame_t* protos;
int proto_id;
const char* proto_name;
gboolean is_udp = FALSE;
/* we got udp so we can follow */
if(cfile.edt->pi.ipproto != IP_PROTO_UDP) {
/* we got udp so we can follow (should really be protected by menu sensitivity) */
protos = wmem_list_head(cfile.edt->pi.layers);
/* walk the list of a available protocols in the packet to see if we have UDP */
while (protos != NULL) {
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if (!strcmp(proto_name, "udp")) {
is_udp = TRUE;
break;
}
protos = wmem_list_frame_next(protos);
}
if (!is_udp) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Error following stream. Please make\n"
"sure you have a UDP packet selected.");

View File

@ -37,7 +37,6 @@
#include <epan/tap.h>
#include <epan/timestamp.h>
#include <epan/etypes.h>
#include <epan/ipproto.h>
#include <epan/dissector_filters.h>
#include <epan/strutil.h>
#include <epan/plugins.h>
@ -186,11 +185,40 @@ typedef enum {
CONV_CBA
} conv_values_e;
static gboolean is_ip_packet(packet_info* pinfo)
{
return FALSE;
}
static char *
build_conversation_filter(int action, gboolean show_dialog)
{
packet_info *pi = &cfile.edt->pi;
wmem_list_frame_t * protos = wmem_list_head(pi->layers);
int proto_id;
const char* proto_name;
char *buf;
gboolean is_ip = FALSE, is_tcp = FALSE, is_udp = FALSE;
/* walk the list of a available protocols in the packet to
figure out if any of them affect conversation filters */
while (protos != NULL)
{
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if ((!strcmp(proto_name, "ip")) ||
(!strcmp(proto_name, "ipv6"))) {
is_ip = TRUE;
} else if (!strcmp(proto_name, "tcp")) {
is_tcp = TRUE;
} else if (!strcmp(proto_name, "udp")) {
is_udp = TRUE;
}
protos = wmem_list_frame_next(protos);
}
switch(action) {
case(CONV_CBA):
@ -204,7 +232,7 @@ build_conversation_filter(int action, gboolean show_dialog)
}
if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
&& pi->ipproto == IP_PROTO_TCP ) {
&& is_tcp ) {
/* IPv4 */
switch(pi->profinet_type) {
case(1):
@ -243,7 +271,7 @@ build_conversation_filter(int action, gboolean show_dialog)
}
break;
case(CONV_TCP):
if (pi->ipproto != IP_PROTO_TCP) {
if (is_tcp == FALSE) {
if (show_dialog) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Error filtering conversation. Please make\n"
@ -269,7 +297,7 @@ build_conversation_filter(int action, gboolean show_dialog)
}
break;
case(CONV_UDP):
if (pi->ipproto != IP_PROTO_UDP) {
if (is_udp == FALSE) {
if (show_dialog) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Error filtering conversation. Please make\n"
@ -295,7 +323,7 @@ build_conversation_filter(int action, gboolean show_dialog)
}
break;
case(CONV_IP):
if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
if (is_ip == FALSE) {
if (show_dialog) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Error filtering conversation. Please make\n"
@ -4897,11 +4925,16 @@ set_menus_for_captured_packets(gboolean have_captured_packets)
void
set_menus_for_selected_packet(capture_file *cf)
{
packet_info *pi;
wmem_list_frame_t* protos;
GList *list_entry = dissector_filter_list;
guint i = 0;
gboolean properties = FALSE;
const char *abbrev = NULL;
char *prev_abbrev;
int proto_id;
const char* proto_name;
gboolean is_ip = FALSE, is_tcp = FALSE, is_udp = FALSE, is_sctp = FALSE;
/* Making the menu context-sensitive allows for easier selection of the
desired item and has the added benefit, with large captures, of
@ -4925,9 +4958,32 @@ set_menus_for_selected_packet(capture_file *cf)
than one time reference frame or the current frame isn't a
time reference frame). (XXX - why check frame_selected?) */
gboolean tcp_packet_selected = FALSE;
if (cf->edt)
{
pi = &cf->edt->pi;
protos = wmem_list_head(pi->layers);
tcp_packet_selected = frame_selected && (cf->edt->pi.ipproto == IP_PROTO_TCP);
/* walk the list of a available protocols in the packet to
figure out if any of them affect context sensitivity */
while (protos != NULL)
{
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if ((!strcmp(proto_name, "ip")) ||
(!strcmp(proto_name, "ipv6"))) {
is_ip = TRUE;
} else if (!strcmp(proto_name, "tcp")) {
is_tcp = TRUE;
} else if (!strcmp(proto_name, "udp")) {
is_udp = TRUE;
} else if (!strcmp(proto_name, "sctp")) {
is_sctp = TRUE;
}
protos = wmem_list_frame_next(protos);
}
}
if (cfile.edt && cfile.edt->tree) {
GPtrArray *ga;
@ -5021,15 +5077,15 @@ set_menus_for_selected_packet(capture_file *cf)
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
frame_selected);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
frame_selected ? is_ip : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
frame_selected ? is_sctp : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
tcp_packet_selected);
is_tcp);
set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
tcp_packet_selected);
is_tcp);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
frame_selected ? is_udp : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
frame_selected ? is_ssl : FALSE);
set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
@ -5039,13 +5095,13 @@ set_menus_for_selected_packet(capture_file *cf)
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
frame_selected ? is_ip : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
tcp_packet_selected);
is_tcp);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
frame_selected ? is_udp : FALSE);
set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
frame_selected ? is_udp : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
@ -5053,11 +5109,11 @@ set_menus_for_selected_packet(capture_file *cf)
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
frame_selected ? is_ip : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
tcp_packet_selected);
is_tcp);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
frame_selected ? is_udp : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
@ -5089,9 +5145,9 @@ set_menus_for_selected_packet(capture_file *cf)
frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns));
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
tcp_packet_selected);
is_tcp);
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream",
frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
frame_selected ? is_udp : FALSE);
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream",
frame_selected ? is_ssl : FALSE);
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
@ -5102,7 +5158,7 @@ set_menus_for_selected_packet(capture_file *cf)
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
frame_selected);
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/TCPStreamGraphMenu",
tcp_packet_selected);
is_tcp);
while (list_entry != NULL) {
dissector_filter_t *filter_entry;

View File

@ -32,7 +32,6 @@
#include "epan/prefs.h"
#include "epan/charsets.h"
#include "epan/epan_dissect.h"
#include "epan/ipproto.h"
#include "epan/tap.h"
#include "ui/alert_box.h"
@ -808,6 +807,10 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
tcp_stream_chunk sc;
size_t nchars;
GString * msg;
wmem_list_frame_t* protos;
int proto_id;
const char* proto_name;
gboolean is_tcp = FALSE, is_udp = FALSE;
resetStream();
@ -823,17 +826,33 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
return false;
}
/* walk the list of a available protocols in the packet to see what we have
Handles error conditions that should probably just be handled with menu sensitivity */
protos = wmem_list_head(cap_file_->edt->pi.layers);
while (protos != NULL) {
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if (!strcmp(proto_name, "tcp")) {
is_tcp = TRUE;
} else if (!strcmp(proto_name, "udp")) {
is_udp = TRUE;
}
protos = wmem_list_frame_next(protos);
}
switch (follow_type_)
{
case FOLLOW_TCP:
if (cap_file_->edt->pi.ipproto != IP_PROTO_TCP) {
if (!is_tcp) {
QMessageBox::warning(this, tr("Error following stream."), tr("Please make sure you have a TCP packet selected."));
return false;
}
break;
case FOLLOW_UDP:
removeStreamControls();
if (cap_file_->edt->pi.ipproto != IP_PROTO_UDP) {
if (!is_udp) {
QMessageBox::warning(this, tr("Error following stream."), tr("Please make sure you have a UDP packet selected."));
return false;
}

View File

@ -28,7 +28,6 @@
#include <epan/epan_dissect.h>
#include <wsutil/filesystem.h>
#include <epan/ipproto.h>
#include <epan/prefs.h>
//#include <wiretap/wtap.h>
@ -1367,6 +1366,11 @@ void MainWindow::setTitlebarForCaptureInProgress()
void MainWindow::setMenusForFollowStream()
{
wmem_list_frame_t* protos;
int proto_id;
const char* proto_name;
gboolean is_tcp = FALSE, is_udp = FALSE;
if (!cap_file_)
return;
@ -1377,12 +1381,30 @@ void MainWindow::setMenusForFollowStream()
main_ui_->actionAnalyzeFollowUDPStream->setEnabled(false);
main_ui_->actionAnalyzeFollowSSLStream->setEnabled(false);
if (cap_file_->edt->pi.ipproto == IP_PROTO_TCP)
protos = wmem_list_head(cap_file_->edt->pi.layers);
/* walk the list of a available protocols in the packet to
figure out if any of them affect context sensitivity */
while (protos != NULL)
{
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if (!strcmp(proto_name, "tcp")) {
is_tcp = TRUE;
} else if (!strcmp(proto_name, "udp")) {
is_udp = TRUE;
}
protos = wmem_list_frame_next(protos);
}
if (is_tcp)
{
main_ui_->actionAnalyzeFollowTCPStream->setEnabled(true);
}
if (cap_file_->edt->pi.ipproto == IP_PROTO_UDP)
if (is_udp)
{
main_ui_->actionAnalyzeFollowUDPStream->setEnabled(true);
}

View File

@ -56,7 +56,6 @@
#include <epan/epan_dissect.h>
#include "epan/filter_expressions.h"
#include <epan/value_string.h>
#include <epan/ipproto.h>
#include "ui/alert_box.h"
#include "ui/ui_util.h"
@ -726,6 +725,10 @@ void MainWindow::setMenusForSelectedPacket()
// gboolean properties = FALSE;
// const char *abbrev = NULL;
// char *prev_abbrev;
wmem_list_frame_t* protos;
int proto_id;
const char* proto_name;
gboolean is_ip = FALSE, is_tcp = FALSE, is_udp = FALSE, is_sctp = FALSE;
// /* Making the menu context-sensitive allows for easier selection of the
// desired item and has the added benefit, with large captures, of
@ -753,7 +756,6 @@ void MainWindow::setMenusForSelectedPacket()
than one time reference frame or the current frame isn't a
time reference frame). (XXX - why check frame_selected?) */
gboolean another_is_time_ref = FALSE;
gboolean tcp_packet_selected = FALSE;
if (cap_file_) {
frame_selected = cap_file_->current_frame != NULL;
@ -766,7 +768,32 @@ void MainWindow::setMenusForSelectedPacket()
have_time_ref = cap_file_->ref_time_count > 0;
another_is_time_ref = frame_selected && have_time_ref &&
!(cap_file_->ref_time_count == 1 && cap_file_->current_frame->flags.ref_time);
tcp_packet_selected = frame_selected && (cap_file_->edt->pi.ipproto == IP_PROTO_TCP);
if (cap_file_->edt)
{
protos = wmem_list_head(cap_file_->edt->pi.layers);
/* walk the list of a available protocols in the packet to
figure out if any of them affect context sensitivity */
while (protos != NULL)
{
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if ((!strcmp(proto_name, "ip")) ||
(!strcmp(proto_name, "ipv6"))) {
is_ip = TRUE;
} else if (!strcmp(proto_name, "tcp")) {
is_tcp = TRUE;
} else if (!strcmp(proto_name, "udp")) {
is_udp = TRUE;
} else if (!strcmp(proto_name, "sctp")) {
is_sctp = TRUE;
}
protos = wmem_list_frame_next(protos);
}
}
}
// if (cfile.edt && cfile.edt->tree) {
// GPtrArray *ga;
@ -839,15 +866,15 @@ void MainWindow::setMenusForSelectedPacket()
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
// frame_selected);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
// frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
// frame_selected ? is_ip : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
// frame_selected ? is_sctp : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
// frame_selected ? is_tcp : FALSE);
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
// frame_selected ? is_tcp : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
// frame_selected ? is_udp : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
// frame_selected ? is_ssl : FALSE);
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
@ -857,13 +884,13 @@ void MainWindow::setMenusForSelectedPacket()
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
// frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
// frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
// frame_selected ? is_ip : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
// frame_selected ? is_tcp : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
// frame_selected ? is_udp : FALSE);
// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
// frame_selected ? is_udp : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
// frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
@ -871,11 +898,11 @@ void MainWindow::setMenusForSelectedPacket()
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
// frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
// frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
// frame_selected ? is_ip : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
// frame_selected ? is_tcp : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
// frame_selected ? is_udp : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
// frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
@ -907,9 +934,9 @@ void MainWindow::setMenusForSelectedPacket()
// frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
// gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns));
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
// frame_selected ? is_tcp : FALSE);
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream",
// frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
// frame_selected ? is_udp : FALSE);
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream",
// frame_selected ? is_ssl : FALSE);
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
@ -919,7 +946,7 @@ void MainWindow::setMenusForSelectedPacket()
// gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns));
// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
// frame_selected);
main_ui_->menuTcpStreamGraphs->setEnabled(tcp_packet_selected);
main_ui_->menuTcpStreamGraphs->setEnabled(is_tcp);
// while (list_entry != NULL) {
// dissector_filter_t *filter_entry;

View File

@ -35,7 +35,6 @@
#include "packet_list.h"
#include "proto_tree.h"
#include "wireshark_application.h"
#include <epan/ipproto.h>
#include "qt_ui_utils.h"
@ -461,7 +460,28 @@ void PacketList::contextMenuEvent(QContextMenuEvent *event)
{
bool fa_enabled = filter_actions_[0]->isEnabled();
QAction *act;
wmem_list_frame_t* protos;
int proto_id;
const char* proto_name;
gboolean is_tcp = FALSE, is_udp = FALSE;
/* walk the list of a available protocols in the packet to see what we have */
if ((cap_file_ != NULL) && (cap_file_->edt != NULL))
{
protos = wmem_list_head(cap_file_->edt->pi.layers);
while (protos != NULL) {
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
proto_name = proto_get_protocol_filter_name(proto_id);
if (!strcmp(proto_name, "tcp")) {
is_tcp = TRUE;
} else if (!strcmp(proto_name, "udp")) {
is_udp = TRUE;
}
protos = wmem_list_frame_next(protos);
}
}
foreach (act, filter_actions_)
{
@ -471,27 +491,13 @@ void PacketList::contextMenuEvent(QContextMenuEvent *event)
// check follow stream
if (act->text().contains("TCP"))
{
if (cap_file_->edt->pi.ipproto == IP_PROTO_TCP)
{
act->setEnabled(true);
}
else
{
act->setEnabled(false);
}
act->setEnabled(is_tcp);
}
if (act->text().contains("UDP"))
{
if (cap_file_->edt->pi.ipproto == IP_PROTO_UDP)
{
act->setEnabled(true);
}
else
{
act->setEnabled(false);
}
act->setEnabled(is_udp);
}