Replace uses of proto_get_frame_protocols with proto_is_frame_protocol when only one protocol is desired.

Also use proto_get_frame_protocols in main_menubar.c instead of doing it "manually".

Change-Id: Ie7a365c538700f2cebdd1e3d253f2fd9b189f5cf
Reviewed-on: https://code.wireshark.org/review/5851
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2014-12-18 16:31:43 -05:00
parent 398c2cee9c
commit 962fa218ef
5 changed files with 8 additions and 38 deletions

View File

@ -809,7 +809,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
}
proto_get_frame_protocols(pinfo->layers, NULL, NULL, NULL, NULL, &is_ssl);
is_ssl = proto_is_frame_protocol(pinfo->layers, "ssl");
stat_info = wmem_new(wmem_packet_scope(), http_info_value_t);
stat_info->framenum = pinfo->fd->num;

View File

@ -2222,7 +2222,7 @@ dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
}
#endif
proto_get_frame_protocols(pinfo->layers, NULL, NULL, NULL, NULL, &is_ssl);
is_ssl = proto_is_frame_protocol(pinfo->layers, "ssl");
if (is_response) {
if (packet_number == 0 ) {
@ -2264,11 +2264,11 @@ dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
static int
dissect_mysql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
gboolean is_ssl = FALSE;
gboolean is_ssl;
conversation_t *conversation;
mysql_conn_data_t *conn_data;
proto_get_frame_protocols(pinfo->layers, NULL, NULL, NULL, NULL, &is_ssl);
is_ssl = proto_is_frame_protocol(pinfo->layers, "ssl");
/* Check there is already a conversation */
conversation = find_or_create_conversation(pinfo);

View File

@ -103,7 +103,7 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
char stream_window_title[256];
gboolean is_tcp = FALSE;
proto_get_frame_protocols(cfile.edt->pi.layers, NULL, &is_tcp, NULL, NULL, NULL);
is_tcp = proto_is_frame_protocol(cfile.edt->pi.layers, "tcp");
if (!is_tcp) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,

View File

@ -94,7 +94,7 @@ follow_udp_stream_cb(GtkWidget *w _U_, gpointer data _U_)
GString *msg;
gboolean is_udp = FALSE;
proto_get_frame_protocols(cfile.edt->pi.layers, NULL, NULL, &is_udp, NULL, NULL);
is_udp = proto_is_frame_protocol(cfile.edt->pi.layers, "udp");
if (!is_udp) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,

View File

@ -4602,23 +4602,18 @@ 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;
GList *color_list_entry = color_conv_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;
gboolean is_ip = FALSE, is_tcp = FALSE, is_udp = FALSE, is_sctp = FALSE, is_ssl = FALSE;
/* Making the menu context-sensitive allows for easier selection of the
desired item and has the added benefit, with large captures, of
avoiding needless looping through huge lists for marked, ignored,
or time-referenced packets. */
gboolean is_ssl = epan_dissect_packet_contains_field(cf->edt, "ssl");
gboolean frame_selected = cf->current_frame != NULL;
/* A frame is selected */
gboolean have_marked = frame_selected && cf->marked_count > 0;
@ -4635,33 +4630,8 @@ set_menus_for_selected_packet(capture_file *cf)
we have at least one time reference frame, and either there's more
than one time reference frame or the current frame isn't a
time reference frame). (XXX - why check frame_selected?) */
if (cf->edt)
{
pi = &cf->edt->pi;
protos = wmem_list_head(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);
}
}
proto_get_frame_protocols(cf->edt->pi.layers, &is_ip, &is_tcp, &is_udp, &is_sctp, &is_ssl);
if (cf->edt && cf->edt->tree) {
GPtrArray *ga;