Use new color_dissector_filters.[ch] to refactor (color) conversation generation in GTK menus.
Change-Id: I5868a40b71a989a3a1522cb091064bb0aaec6daf Reviewed-on: https://code.wireshark.org/review/5828 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
792c01ab1a
commit
1f031808e1
|
@ -516,6 +516,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
|
||||||
filter_expression_new@Base 1.9.1
|
filter_expression_new@Base 1.9.1
|
||||||
find_and_mark_frame_depended_upon@Base 1.12.0~rc1
|
find_and_mark_frame_depended_upon@Base 1.12.0~rc1
|
||||||
find_circuit@Base 1.9.1
|
find_circuit@Base 1.9.1
|
||||||
|
find_color_conversation_filter@Base 1.99.2
|
||||||
find_conversation@Base 1.9.1
|
find_conversation@Base 1.9.1
|
||||||
find_dissector@Base 1.9.1
|
find_dissector@Base 1.9.1
|
||||||
find_dissector_table@Base 1.9.1
|
find_dissector_table@Base 1.9.1
|
||||||
|
|
|
@ -31,18 +31,36 @@
|
||||||
GList *color_conv_filter_list = NULL;
|
GList *color_conv_filter_list = NULL;
|
||||||
|
|
||||||
|
|
||||||
void register_color_conversation_filter(const char *name, is_color_conv_valid_func is_filter_valid, build_color_conv_string_func build_filter_string) {
|
void register_color_conversation_filter(const char *proto_name, const char *display_name,
|
||||||
|
is_color_conv_valid_func is_filter_valid, build_color_conv_string_func build_filter_string) {
|
||||||
color_conversation_filter_t *entry;
|
color_conversation_filter_t *entry;
|
||||||
|
|
||||||
entry = (color_conversation_filter_t *)g_malloc(sizeof(color_conversation_filter_t));
|
entry = (color_conversation_filter_t *)g_malloc(sizeof(color_conversation_filter_t));
|
||||||
|
|
||||||
entry->name = name;
|
entry->proto_name = proto_name;
|
||||||
|
entry->display_name = display_name;
|
||||||
entry->is_filter_valid = is_filter_valid;
|
entry->is_filter_valid = is_filter_valid;
|
||||||
entry->build_filter_string = build_filter_string;
|
entry->build_filter_string = build_filter_string;
|
||||||
|
|
||||||
color_conv_filter_list = g_list_append(color_conv_filter_list, entry);
|
color_conv_filter_list = g_list_append(color_conv_filter_list, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct color_conversation_filter_s* find_color_conversation_filter(const char *name)
|
||||||
|
{
|
||||||
|
GList *list_entry = color_conv_filter_list;
|
||||||
|
color_conversation_filter_t* color_filter;
|
||||||
|
|
||||||
|
while (list_entry != NULL) {
|
||||||
|
color_filter = (color_conversation_filter_t*)list_entry->data;
|
||||||
|
if (!strcmp(color_filter->proto_name, name))
|
||||||
|
return color_filter;
|
||||||
|
|
||||||
|
list_entry = g_list_next(list_entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||||
*
|
*
|
||||||
|
|
|
@ -39,16 +39,19 @@ typedef gboolean (*is_color_conv_valid_func)(packet_info *pinfo);
|
||||||
Filter needs to be freed after use */
|
Filter needs to be freed after use */
|
||||||
typedef gchar* (*build_color_conv_string_func)(packet_info *pinfo);
|
typedef gchar* (*build_color_conv_string_func)(packet_info *pinfo);
|
||||||
|
|
||||||
|
#define MAX_NUM_COLOR_CONVERSATION_COLORS 10
|
||||||
|
|
||||||
/** register a dissector filter */
|
/** register a dissector filter */
|
||||||
WS_DLL_PUBLIC void register_color_conversation_filter(const char *name, is_color_conv_valid_func is_filter_valid, build_color_conv_string_func build_filter_string);
|
WS_DLL_PUBLIC void register_color_conversation_filter(const char *proto_name, const char *display_name,
|
||||||
|
is_color_conv_valid_func is_filter_valid, build_color_conv_string_func build_filter_string);
|
||||||
|
|
||||||
|
WS_DLL_PUBLIC struct color_conversation_filter_s* find_color_conversation_filter(const char *proto_name);
|
||||||
|
|
||||||
/*** THE FOLLOWING SHOULD NOT BE USED BY ANY DISSECTORS!!! ***/
|
/*** THE FOLLOWING SHOULD NOT BE USED BY ANY DISSECTORS!!! ***/
|
||||||
|
|
||||||
typedef struct color_conversation_filter_s {
|
typedef struct color_conversation_filter_s {
|
||||||
const char * name;
|
const char * proto_name;
|
||||||
|
const char * display_name;
|
||||||
is_color_conv_valid_func is_filter_valid;
|
is_color_conv_valid_func is_filter_valid;
|
||||||
build_color_conv_string_func build_filter_string;
|
build_color_conv_string_func build_filter_string;
|
||||||
} color_conversation_filter_t;
|
} color_conversation_filter_t;
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ proto_register_eth(void)
|
||||||
eth_tap = register_tap("eth");
|
eth_tap = register_tap("eth");
|
||||||
|
|
||||||
register_conversation_table(proto_eth, TRUE, eth_conversation_packet, eth_hostlist_packet, NULL);
|
register_conversation_table(proto_eth, TRUE, eth_conversation_packet, eth_hostlist_packet, NULL);
|
||||||
register_color_conversation_filter("Ethernet", eth_color_filter_valid, eth_build_color_filter);
|
register_color_conversation_filter("eth", "Ethernet", eth_color_filter_valid, eth_build_color_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -3094,7 +3094,7 @@ proto_register_ip(void)
|
||||||
|
|
||||||
register_decode_as(&ip_da);
|
register_decode_as(&ip_da);
|
||||||
register_conversation_table(proto_ip, TRUE, ip_conversation_packet, ip_hostlist_packet, NULL);
|
register_conversation_table(proto_ip, TRUE, ip_conversation_packet, ip_hostlist_packet, NULL);
|
||||||
register_color_conversation_filter("IPv4", ip_color_filter_valid, ip_build_color_filter);
|
register_color_conversation_filter("ip", "IPv4", ip_color_filter_valid, ip_build_color_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -3031,7 +3031,7 @@ proto_register_ipv6(void)
|
||||||
register_decode_as(&ipv6_next_header_da);
|
register_decode_as(&ipv6_next_header_da);
|
||||||
|
|
||||||
register_conversation_table(proto_ipv6, TRUE, ipv6_conversation_packet, ipv6_hostlist_packet, NULL);
|
register_conversation_table(proto_ipv6, TRUE, ipv6_conversation_packet, ipv6_hostlist_packet, NULL);
|
||||||
register_color_conversation_filter("IPv6", ipv6_color_filter_valid, ipv6_build_color_filter);
|
register_color_conversation_filter("ipv6", "IPv6", ipv6_color_filter_valid, ipv6_build_color_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -5977,7 +5977,7 @@ proto_register_tcp(void)
|
||||||
register_decode_as(&tcp_da);
|
register_decode_as(&tcp_da);
|
||||||
|
|
||||||
register_conversation_table(proto_tcp, FALSE, tcpip_conversation_packet, tcpip_hostlist_packet, tcpip_hostlist_prefix);
|
register_conversation_table(proto_tcp, FALSE, tcpip_conversation_packet, tcpip_hostlist_packet, tcpip_hostlist_prefix);
|
||||||
register_color_conversation_filter("TCP", tcp_color_filter_valid, tcp_build_color_filter);
|
register_color_conversation_filter("tcp", "TCP", tcp_color_filter_valid, tcp_build_color_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ proto_register_udp(void)
|
||||||
|
|
||||||
register_decode_as(&udp_da);
|
register_decode_as(&udp_da);
|
||||||
register_conversation_table(proto_udp, FALSE, udpip_conversation_packet, udpip_hostlist_packet, udpip_hostlist_prefix);
|
register_conversation_table(proto_udp, FALSE, udpip_conversation_packet, udpip_hostlist_packet, udpip_hostlist_prefix);
|
||||||
register_color_conversation_filter("UDP", udp_color_filter_valid, udp_build_color_filter);
|
register_color_conversation_filter("udp", "UDP", udp_color_filter_valid, udp_build_color_filter);
|
||||||
|
|
||||||
register_init_routine(udp_init);
|
register_init_routine(udp_init);
|
||||||
|
|
||||||
|
|
|
@ -5107,7 +5107,7 @@ proto_register_dcom_cba_acco (void)
|
||||||
proto_ICBAAccoSync = proto_register_protocol ("ICBAAccoSync", "ICBAAccoSync", "cba_acco_sync");
|
proto_ICBAAccoSync = proto_register_protocol ("ICBAAccoSync", "ICBAAccoSync", "cba_acco_sync");
|
||||||
proto_register_subtree_array (ett5, array_length (ett5));
|
proto_register_subtree_array (ett5, array_length (ett5));
|
||||||
|
|
||||||
register_color_conversation_filter("PN-CBA", cba_color_filter_valid, cba_build_color_filter);
|
register_color_conversation_filter("cba", "PN-CBA", cba_color_filter_valid, cba_build_color_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue