diff options
author | Michael Mann <mmann78@netscape.net> | 2014-07-25 11:34:51 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-18 04:24:39 +0000 |
commit | 018b84de84343306f731ca04b3d20dd07064cdef (patch) | |
tree | e240d07f614c2a910745351f9cf9c1602d2d5da3 /epan/dissectors/packet-tcp.c | |
parent | a76c888cd981bbe77dd8306871791578cd6ba9ca (diff) |
Refactor "common" hostlist/endpoint table functionality.
This is very similar in architecture to the changes made to the Conversation table functionality. Since all conversations have endpoints/hostlists, the "registered" list is shared for both.
Change-Id: Ie8c6910a68a1b3f27c5b18c4494f49b9404a7b31
Reviewed-on: https://code.wireshark.org/review/3214
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>
Diffstat (limited to 'epan/dissectors/packet-tcp.c')
-rw-r--r-- | epan/dissectors/packet-tcp.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 47cef7aa2d..1c993b9ba3 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -574,6 +574,34 @@ tcpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_ return 1; } +static const char* tcp_host_get_filter_type(hostlist_talker_t* host _U_, conv_filter_type_e filter) +{ + return tcp_conv_get_filter_type(NULL, filter); +} + +static hostlist_dissector_info_t tcp_host_dissector_info = {&tcp_host_get_filter_type}; + +static int +tcpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) +{ + conv_hash_t *hash = (conv_hash_t*) pit; + const struct tcpheader *tcphdr=(const struct tcpheader *)vip; + + /* Take two "add" passes per packet, adding for each direction, ensures that all + packets are counted properly (even if address is sending to itself) + XXX - this could probably be done more efficiently inside hostlist_table */ + add_hostlist_table_data(hash, &tcphdr->ip_src, tcphdr->th_sport, TRUE, 1, pinfo->fd->pkt_len, &tcp_host_dissector_info, PT_TCP); + add_hostlist_table_data(hash, &tcphdr->ip_dst, tcphdr->th_dport, FALSE, 1, pinfo->fd->pkt_len, &tcp_host_dissector_info, PT_TCP); + + return 1; +} + +static const char* +tcpip_hostlist_prefix(void) +{ + return "endpoints"; +} + /* TCP structs and definitions */ /* ************************************************************************** @@ -5874,7 +5902,7 @@ proto_register_tcp(void) register_decode_as(&tcp_da); - register_conversation_table(proto_tcp, FALSE, tcpip_conversation_packet); + register_conversation_table(proto_tcp, FALSE, tcpip_conversation_packet, tcpip_hostlist_packet, tcpip_hostlist_prefix); } void |