diff options
author | Michael Mann <mmann78@netscape.net> | 2017-10-27 16:39:50 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-10-27 21:51:49 +0000 |
commit | 3a6552744f2e44954a9e378dd076c8758bb5f1bb (patch) | |
tree | fb1bff1b6b0c74a5f6f012a15dabaf0741d50419 /epan/conversation.c | |
parent | f24651493d04b974722b0b70179bcb6b9150a605 (diff) |
Add find_conversation_pinfo
Convenience function to add the same parameters to find_conversation as
find_or_create_conversation.
Change-Id: I3a92541cb9c1e827a9de8248825636debbd989cd
Reviewed-on: https://code.wireshark.org/review/24118
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/conversation.c')
-rw-r--r-- | epan/conversation.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/epan/conversation.c b/epan/conversation.c index 5d32c11721..4480788b61 100644 --- a/epan/conversation.c +++ b/epan/conversation.c @@ -1231,6 +1231,33 @@ try_conversation_dissector(const address *addr_a, const address *addr_b, const p return FALSE; } +/** A helper function that calls find_conversation() using data from pinfo + * The frame number and addresses are taken from pinfo. + */ +conversation_t * +find_conversation_pinfo(packet_info *pinfo, const guint options) +{ + conversation_t *conv=NULL; + + DPRINT(("called for frame #%d: %s:%d -> %s:%d (ptype=%d)", + pinfo->num, address_to_str(wmem_packet_scope(), &pinfo->src), pinfo->srcport, + address_to_str(wmem_packet_scope(), &pinfo->dst), pinfo->destport, pinfo->ptype)); + DINDENT(); + + /* Have we seen this conversation before? */ + if((conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst, + pinfo->ptype, pinfo->srcport, + pinfo->destport, options)) != NULL) { + DPRINT(("found previous conversation for frame #%d (last_frame=%d)", + pinfo->num, conv->last_frame)); + if (pinfo->num > conv->last_frame) { + conv->last_frame = pinfo->num; + } + } + + return conv; +} + /* A helper function that calls find_conversation() and, if a conversation is * not found, calls conversation_new(). * The frame number and addresses are taken from pinfo. |