aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mongo.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-09 17:46:28 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-09 17:46:28 +0000
commit8081cf1d90397cbbb4404f9720595e1537ed5e14 (patch)
tree353220f46e08be1f0020603538f501b65bea8f3b /epan/dissectors/packet-mongo.c
parentc9b2ee3768abb730b49fc4fc779e77578a1c4971 (diff)
Add data parameter to tcp_dissect_pdus() as well as convert it to using "new" style dissectors.
Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that? Should tcp_dissect_pdus return length (bytes consumed)? There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb). Seems like that could all be rolled into one. svn path=/trunk/; revision=53198
Diffstat (limited to 'epan/dissectors/packet-mongo.c')
-rw-r--r--epan/dissectors/packet-mongo.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/epan/dissectors/packet-mongo.c b/epan/dissectors/packet-mongo.c
index 68fc45c644..2ae5e19935 100644
--- a/epan/dissectors/packet-mongo.c
+++ b/epan/dissectors/packet-mongo.c
@@ -578,17 +578,14 @@ dissect_mongo_kill_cursors(tvbuff_t *tvb, guint offset, proto_tree *tree)
}
return offset;
}
-static void
-dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
+ proto_item *ti;
+ proto_tree *mongo_tree;
+ guint offset = 0, opcode;
- proto_item *ti;
- proto_tree *mongo_tree;
- guint offset = 0, opcode;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "MONGO");
-
- if (tree) {
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MONGO");
ti = proto_tree_add_item(tree, proto_mongo, tvb, 0, -1, ENC_NA);
@@ -652,8 +649,8 @@ dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(mongo_tree, hf_mongo_unknown, tvb, offset, -1, ENC_NA);
expert_add_info(pinfo, ti, &ei_mongo_unknown);
}
- }
+ return tvb_length(tvb);
}
static guint
get_mongo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
@@ -668,10 +665,11 @@ get_mongo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen;
}
-static void
-dissect_mongo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mongo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, 1, 4, get_mongo_pdu_len, dissect_mongo_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, 1, 4, get_mongo_pdu_len, dissect_mongo_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -1059,7 +1057,7 @@ proto_reg_handoff_mongo(void)
if (!initialized) {
- mongo_handle = create_dissector_handle(dissect_mongo, proto_mongo);
+ mongo_handle = new_create_dissector_handle(dissect_mongo, proto_mongo);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", currentPort, mongo_handle);