aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-paltalk.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-paltalk.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-paltalk.c')
-rw-r--r--epan/dissectors/packet-paltalk.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/epan/dissectors/packet-paltalk.c b/epan/dissectors/packet-paltalk.c
index 8a88f197aa..e784b54609 100644
--- a/epan/dissectors/packet-paltalk.c
+++ b/epan/dissectors/packet-paltalk.c
@@ -40,10 +40,6 @@
#define PALTALK_HEADER_LENGTH 6
-/* forward reference */
-static guint dissect_paltalk_get_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset);
-static void dissect_paltalk_desegmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
static int proto_paltalk = -1;
static int hf_paltalk_pdu_type = -1;
@@ -53,6 +49,34 @@ static int hf_paltalk_content = -1;
static gint ett_paltalk = -1;
+static guint
+dissect_paltalk_get_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+ return tvb_get_ntohs(tvb, offset + 4) + PALTALK_HEADER_LENGTH;
+}
+
+static int
+dissect_paltalk_desegmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti = NULL;
+ proto_tree *pt_tree = NULL;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Paltalk");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ if (tree) /* we are being asked for details */
+ {
+ ti = proto_tree_add_item(tree, proto_paltalk, tvb, 0, -1, ENC_NA);
+ pt_tree = proto_item_add_subtree(ti, ett_paltalk);
+ proto_tree_add_item(pt_tree, hf_paltalk_pdu_type, tvb, 0, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(pt_tree, hf_paltalk_version, tvb, 2, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(pt_tree, hf_paltalk_length, tvb, 4, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(pt_tree, hf_paltalk_content, tvb, 6, tvb_get_ntohs(tvb, 4), ENC_NA);
+ }
+
+ return tvb_length(tvb);
+}
+
static gboolean
dissect_paltalk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@@ -78,37 +102,11 @@ dissect_paltalk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return FALSE;
/* Dissect result of desegmented TCP data */
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, PALTALK_HEADER_LENGTH
- , dissect_paltalk_get_len, dissect_paltalk_desegmented);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, PALTALK_HEADER_LENGTH,
+ dissect_paltalk_get_len, dissect_paltalk_desegmented, data);
return TRUE;
}
-static guint
-dissect_paltalk_get_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
-{
- return tvb_get_ntohs(tvb, offset + 4) + PALTALK_HEADER_LENGTH;
-}
-
-static void
-dissect_paltalk_desegmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- proto_item *ti = NULL;
- proto_tree *pt_tree = NULL;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "Paltalk");
- col_clear(pinfo->cinfo, COL_INFO);
-
- if (tree) /* we are being asked for details */
- {
- ti = proto_tree_add_item(tree, proto_paltalk, tvb, 0, -1, ENC_NA);
- pt_tree = proto_item_add_subtree(ti, ett_paltalk);
- proto_tree_add_item(pt_tree, hf_paltalk_pdu_type, tvb, 0, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(pt_tree, hf_paltalk_version, tvb, 2, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(pt_tree, hf_paltalk_length, tvb, 4, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(pt_tree, hf_paltalk_content, tvb, 6, tvb_get_ntohs(tvb, 4), ENC_NA);
- }
-}
-
void
proto_register_paltalk(void)
{