aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fc.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-21 19:51:17 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-21 19:51:17 +0000
commit9fa6c9fb800199967b5ec44a93fcfaeeed405085 (patch)
tree862cb08f36e01a1f34506898ceac858dcab653bf /epan/dissectors/packet-fc.c
parent82f7344f453783255228971b90a6bdb8243e0eaa (diff)
Create new dissectors when a protocol goes across ethernet and "something else" instead a single dissector that uses pinfo->ethertype to determine if it's the "ethernet" or the "something else" case.
svn path=/trunk/; revision=53488
Diffstat (limited to 'epan/dissectors/packet-fc.c')
-rw-r--r--epan/dissectors/packet-fc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c
index de4fa4a41a..5a60f14dc5 100644
--- a/epan/dissectors/packet-fc.c
+++ b/epan/dissectors/packet-fc.c
@@ -686,7 +686,7 @@ static const value_string fc_els_proto_val[] = {
/* Code to actually dissect the packets */
static void
-dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp)
+dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp, guint ethertype)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti=NULL, *hidden_item;
@@ -1087,13 +1087,13 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
* and are never fragmented and so we ignore the frag_size assertion for
* these frames.
*/
- if ((pinfo->ethertype == ETHERTYPE_UNK) || (pinfo->ethertype == ETHERTYPE_FCFT)) {
+ if ((ethertype == ETHERTYPE_UNK) || (ethertype == ETHERTYPE_FCFT)) {
if ((frag_size < MDSHDR_TRAILER_SIZE) ||
((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) &&
(ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS)))
THROW(ReportedBoundsError);
frag_size -= MDSHDR_TRAILER_SIZE;
- } else if (pinfo->ethertype == ETHERTYPE_BRDWALK) {
+ } else if (ethertype == ETHERTYPE_BRDWALK) {
if ((frag_size <= 8) ||
((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) &&
(ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS)))
@@ -1229,15 +1229,17 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
tap_queue_packet(fc_tap, pinfo, &fchdr);
}
-static void
-dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- dissect_fc_helper (tvb, pinfo, tree, FALSE);
+ dissect_fc_helper (tvb, pinfo, tree, FALSE, GPOINTER_TO_UINT(data));
+ return tvb_length(tvb);
}
+
static void
dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- dissect_fc_helper (tvb, pinfo, tree, TRUE);
+ dissect_fc_helper (tvb, pinfo, tree, TRUE, 0);
}
static void
@@ -1526,7 +1528,7 @@ proto_register_fc(void)
/* Register the protocol name and description */
proto_fc = proto_register_protocol ("Fibre Channel", "FC", "fc");
- fc_handle = register_dissector ("fc", dissect_fc, proto_fc);
+ fc_handle = new_register_dissector ("fc", dissect_fc, proto_fc);
register_dissector ("fc_ifcp", dissect_fc_ifcp, proto_fc);
fc_tap = register_tap("fc");