aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-jxta.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-07-25 11:34:51 -0400
committerAnders Broman <a.broman58@gmail.com>2014-08-18 04:24:39 +0000
commit018b84de84343306f731ca04b3d20dd07064cdef (patch)
treee240d07f614c2a910745351f9cf9c1602d2d5da3 /epan/dissectors/packet-jxta.c
parenta76c888cd981bbe77dd8306871791578cd6ba9ca (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-jxta.c')
-rw-r--r--epan/dissectors/packet-jxta.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index 3cefa18000..c89ba42bcc 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -223,6 +223,30 @@ jxta_conversation_packet(void *pct, packet_info *pinfo _U_, epan_dissect_t *edt
return 1;
}
+static const char* jxta_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
+{
+ if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_URI))
+ return "jxta.message.address";
+
+ return CONV_FILTER_INVALID;
+}
+
+static hostlist_dissector_info_t jxta_host_dissector_info = {&jxta_host_get_filter_type};
+
+static int
+jxta_hostlist_packet(void *pit, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *vip)
+{
+ conv_hash_t *hash = (conv_hash_t*) pit;
+ const jxta_tap_header *jxtahdr = (const jxta_tap_header *)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, &jxtahdr->src_address, 0, TRUE, 1, jxtahdr->size, &jxta_host_dissector_info, PT_NONE);
+ add_hostlist_table_data(hash, &jxtahdr->dest_address, 0, FALSE, 1, jxtahdr->size, &jxta_host_dissector_info, PT_NONE);
+ return 1;
+}
+
/**
* Prototypes
**/
@@ -2352,7 +2376,7 @@ void proto_register_jxta(void)
prefs_register_bool_preference(jxta_module, "sctp.heuristic", "Try to discover JXTA in SCTP connections",
"Enable to inspect SCTP connections for JXTA conversations.", &gSCTP_HEUR);
- register_conversation_table(proto_jxta, TRUE, jxta_conversation_packet);
+ register_conversation_table(proto_jxta, TRUE, jxta_conversation_packet, jxta_hostlist_packet, NULL);
}