diff options
author | Michael Mann <mmann78@netscape.net> | 2014-12-18 16:31:43 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-12-19 18:00:20 +0000 |
commit | 962fa218ef44593d29f12cab6faf0db02b861ebc (patch) | |
tree | 12432894a593292886dd4b19e68be950fa07eb43 | |
parent | 398c2cee9c34c5432586ccdea0c8f235242f6ebf (diff) | |
download | wireshark-962fa218ef44593d29f12cab6faf0db02b861ebc.tar.gz |
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>
-rw-r--r-- | epan/dissectors/packet-http.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-mysql.c | 6 | ||||
-rw-r--r-- | ui/gtk/follow_tcp.c | 2 | ||||
-rw-r--r-- | ui/gtk/follow_udp.c | 2 | ||||
-rw-r--r-- | ui/gtk/main_menubar.c | 34 |
5 files changed, 8 insertions, 38 deletions
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index ea8d8c2ee5..ef7a90cf06 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -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; diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c index 1087767558..6c812cfe0e 100644 --- a/epan/dissectors/packet-mysql.c +++ b/epan/dissectors/packet-mysql.c @@ -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); diff --git a/ui/gtk/follow_tcp.c b/ui/gtk/follow_tcp.c index 00fd773351..3396ba85d8 100644 --- a/ui/gtk/follow_tcp.c +++ b/ui/gtk/follow_tcp.c @@ -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, diff --git a/ui/gtk/follow_udp.c b/ui/gtk/follow_udp.c index 544dc6d097..5f911a04e2 100644 --- a/ui/gtk/follow_udp.c +++ b/ui/gtk/follow_udp.c @@ -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, diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c index e8fa23396e..38ebe304c6 100644 --- a/ui/gtk/main_menubar.c +++ b/ui/gtk/main_menubar.c @@ -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; |