diff options
author | Michael Mann <mmann78@netscape.net> | 2013-11-09 17:46:28 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-11-09 17:46:28 +0000 |
commit | 8081cf1d90397cbbb4404f9720595e1537ed5e14 (patch) | |
tree | 353220f46e08be1f0020603538f501b65bea8f3b /epan/dissectors/packet-lsc.c | |
parent | c9b2ee3768abb730b49fc4fc779e77578a1c4971 (diff) | |
download | wireshark-8081cf1d90397cbbb4404f9720595e1537ed5e14.tar.gz |
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-lsc.c')
-rw-r--r-- | epan/dissectors/packet-lsc.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/epan/dissectors/packet-lsc.c b/epan/dissectors/packet-lsc.c index 4b6bf2d8d1..464ec8fe1c 100644 --- a/epan/dissectors/packet-lsc.c +++ b/epan/dissectors/packet-lsc.c @@ -134,8 +134,8 @@ static guint global_lsc_port = 0; static gint ett_lsc = -1; /* Code to actually dissect the packets */ -static void -dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *lsc_tree; @@ -151,7 +151,7 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_length(tvb) < LSC_MIN_LEN) { col_set_str(pinfo->cinfo, COL_INFO, "[Too short]"); - return; + return 0; } /* Get the op code */ @@ -272,13 +272,15 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + + return tvb_length(tvb); } /* Decode LSC over UDP */ -static void -dissect_lsc_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lsc_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { - dissect_lsc_common(tvb, pinfo, tree); + return dissect_lsc_common(tvb, pinfo, tree, data); } /* Determine length of LSC message */ @@ -330,11 +332,12 @@ get_lsc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) } /* Decode LSC over TCP */ -static void -dissect_lsc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lsc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, TRUE, LSC_OPCODE_LEN, get_lsc_pdu_len, - dissect_lsc_common); + dissect_lsc_common, data); + return tvb_length(tvb); } /* Register the protocol with Wireshark */ @@ -434,8 +437,8 @@ proto_reg_handoff_lsc(void) static guint saved_lsc_port; if (!initialized) { - lsc_udp_handle = create_dissector_handle(dissect_lsc_udp, proto_lsc); - lsc_tcp_handle = create_dissector_handle(dissect_lsc_tcp, proto_lsc); + lsc_udp_handle = new_create_dissector_handle(dissect_lsc_udp, proto_lsc); + lsc_tcp_handle = new_create_dissector_handle(dissect_lsc_tcp, proto_lsc); dissector_add_handle("udp.port", lsc_udp_handle); /* for 'decode-as' */ dissector_add_handle("tcp.port", lsc_tcp_handle); /* ... */ initialized = TRUE; |