summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-fc.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-07-23 13:38:55 -0400
committerGerald Combs <gerald@wireshark.org>2014-07-26 20:59:42 +0000
commit31ecdf5b06bff3bb2e706e840c28c519698e6f67 (patch)
tree71b3e59889e862560412d317df71113f66b094b6 /epan/dissectors/packet-fc.c
parent507d07eda6ad562d4567cf0ee83aa9b03997beca (diff)
downloadwireshark-31ecdf5b06bff3bb2e706e840c28c519698e6f67.tar.gz
Refactor "common" Conversation table functionality.
Refactor (non-GUI) conversation table functionality from gtk/Qt to epan. Also refactor "common GUI" conversation table functionality. The idea is to not have to modify the GUI when a dissector adds a new "conversation type" Change-Id: I11f08d0d7edd631218663ba4b902c4a4c849acda Reviewed-on: https://code.wireshark.org/review/3113 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/dissectors/packet-fc.c')
-rw-r--r--epan/dissectors/packet-fc.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c
index 737c7d1162..2ca116f2b5 100644
--- a/epan/dissectors/packet-fc.c
+++ b/epan/dissectors/packet-fc.c
@@ -34,6 +34,7 @@
#include <wiretap/wtap.h>
#include <epan/reassemble.h>
#include <epan/conversation.h>
+#include <epan/conversation_table.h>
#include <epan/etypes.h>
#include "packet-fc.h"
#include "packet-fclctl.h"
@@ -205,6 +206,32 @@ fc_exchange_init_protocol(void)
fcseq_req_hash = g_hash_table_new(fcseq_hash, fcseq_equal);
}
+static const char* fc_conv_get_filter_type(conv_item_t* conv, conv_filter_type_e filter)
+{
+ if ((filter == CONV_FT_SRC_ADDRESS) && (conv->src_address.type == AT_FC))
+ return "fc.s_id";
+
+ if ((filter == CONV_FT_DST_ADDRESS) && (conv->dst_address.type == AT_FC))
+ return "fc.d_id";
+
+ if ((filter == CONV_FT_ANY_ADDRESS) && (conv->src_address.type == AT_FC))
+ return "fc.id";
+
+ return CONV_FILTER_INVALID;
+}
+
+static ct_dissector_info_t fc_ct_dissector_info = {&fc_conv_get_filter_type};
+
+static int
+fc_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
+{
+ conv_hash_t *hash = (conv_hash_t*) pct;
+ const fc_hdr *fchdr=(const fc_hdr *)vip;
+
+ add_conversation_table_data(hash, &fchdr->s_id, &fchdr->d_id, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &fc_ct_dissector_info, PT_NONE);
+
+ return 1;
+}
const value_string fc_fc4_val[] = {
{FC_TYPE_BLS, "Basic Link Svc"},
@@ -1579,6 +1606,8 @@ proto_register_fc(void)
proto_register_subtree_array(sof_ett, array_length(sof_ett));
fcsof_handle = register_dissector("fcsof", dissect_fcsof, proto_fcsof);
+
+ register_conversation_table(proto_fc, TRUE, fc_conversation_packet);
}