aboutsummaryrefslogtreecommitdiffstats
path: root/epan/conversation.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-10-30 15:57:34 -0400
committerMichael Mann <mmann78@netscape.net>2017-11-01 02:41:45 +0000
commit66b441f3d63e21949530d672bf1406dea94ed254 (patch)
tree82fef0bb973e0907d9333e980a95f4c2531baba0 /epan/conversation.c
parentd518f28b395a7d1c8588c8f321ad5ade194fb423 (diff)
Add ability to create endpoints through conversations
Add endpoint information to the packet_info structure for dissectors to potentially use as their data to create conversations. This patch includes a simple "example" of using conversation_create_endpoint with TDMoP. The assignment of the PT_TDMOP "port type" has been replaced by setting ENDPOINT_TDMOP within the endpoint structure. Then when subdissectors of TDMoP call find_or_create_conversation(), it implicitly picks up the conversation information set by TDMoP Change-Id: I11dc29989cccd3b0f0349ee901babb455ca02d19 Reviewed-on: https://code.wireshark.org/review/24190 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Andrew Chernyh <andrew.chernyh@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/conversation.c')
-rw-r--r--epan/conversation.c56
1 files changed, 47 insertions, 9 deletions
diff --git a/epan/conversation.c b/epan/conversation.c
index b473511ed4..d337a94b44 100644
--- a/epan/conversation.c
+++ b/epan/conversation.c
@@ -36,6 +36,15 @@
int _debug_conversation_indent = 0;
#endif
+struct endpoint {
+ address addr1;
+ address addr2;
+ endpoint_type etype;
+ guint32 port1;
+ guint32 port2;
+ guint options;
+};
+
struct conversation_key {
struct conversation_key *next;
address addr1;
@@ -1254,13 +1263,26 @@ find_conversation_pinfo(packet_info *pinfo, const guint options)
DINDENT();
/* Have we seen this conversation before? */
- if((conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
- conversation_pt_to_endpoint_type(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;
+ if (pinfo->use_endpoint) {
+ DISSECTOR_ASSERT(pinfo->conv_endpoint);
+ if((conv = find_conversation(pinfo->num, &pinfo->conv_endpoint->addr1, &pinfo->conv_endpoint->addr2,
+ pinfo->conv_endpoint->etype, pinfo->conv_endpoint->port1,
+ pinfo->conv_endpoint->port2, 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;
+ }
+ }
+ } else {
+ if((conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
+ conversation_pt_to_endpoint_type(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;
+ }
}
}
@@ -1295,6 +1317,24 @@ find_or_create_conversation(packet_info *pinfo)
return conv;
}
+void conversation_create_endpoint(struct _packet_info *pinfo, address* addr1, address* addr2,
+ endpoint_type etype, guint32 port1, guint32 port2, const guint options)
+{
+ pinfo->conv_endpoint = wmem_new0(pinfo->pool, struct endpoint);
+ pinfo->use_endpoint = TRUE;
+
+ if (addr1 != NULL)
+ copy_address_wmem(pinfo->pool, &pinfo->conv_endpoint->addr1, addr1);
+
+ if (addr2 != NULL)
+ copy_address_wmem(pinfo->pool, &pinfo->conv_endpoint->addr2, addr2);
+
+ pinfo->conv_endpoint->etype = etype;
+ pinfo->conv_endpoint->port1 = port1;
+ pinfo->conv_endpoint->port2 = port2;
+ pinfo->conv_endpoint->options = options;
+}
+
wmem_map_t *
get_conversation_hashtable_exact(void)
{
@@ -1376,8 +1416,6 @@ endpoint_type conversation_pt_to_endpoint_type(port_type pt)
return ENDPOINT_IBQP;
case PT_BLUETOOTH:
return ENDPOINT_BLUETOOTH;
- case PT_TDMOP:
- return ENDPOINT_TDMOP;
}
DISSECTOR_ASSERT(FALSE);