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 /plugins/opcua/opcua.c | |
parent | c9b2ee3768abb730b49fc4fc779e77578a1c4971 (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 'plugins/opcua/opcua.c')
-rw-r--r-- | plugins/opcua/opcua.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/opcua/opcua.c b/plugins/opcua/opcua.c index ddd32e5a4e..8432bf417a 100644 --- a/plugins/opcua/opcua.c +++ b/plugins/opcua/opcua.c @@ -41,10 +41,7 @@ extern const value_string g_requesttypes[]; extern const int g_NumServices; /* forward reference */ -static void dissect_opcua(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); -static void dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); void proto_reg_handoff_opcua(void); - /* declare parse function pointer */ typedef int (*FctParse)(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); @@ -230,22 +227,12 @@ static guint get_opcua_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int of return plen; } -/** The main OpcUa dissector functions. - * It uses tcp_dissect_pdus from packet-tcp.h - * to reassemble the TCP data. - */ -static void dissect_opcua(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN, - get_opcua_message_len, dissect_opcua_message); -} - /** The OpcUa message dissector. * This method dissects full OpcUa messages. * It gets only called with reassembled data * from tcp_dissect_pdus. */ -static void dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { FctParse pfctParse = NULL; enum MessageType msgtype = MSG_INVALID; @@ -447,6 +434,19 @@ static void dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree } } } + + return tvb_length(tvb); +} + +/** The main OpcUa dissector functions. + * It uses tcp_dissect_pdus from packet-tcp.h + * to reassemble the TCP data. + */ +static int dissect_opcua(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) +{ + tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN, + get_opcua_message_len, dissect_opcua_message, data); + return tvb_length(tvb); } static void register_tcp_port(guint32 port) @@ -468,7 +468,7 @@ void proto_reg_handoff_opcua(void) if(!opcua_initialized) { - opcua_handle = create_dissector_handle(dissect_opcua, proto_opcua); + opcua_handle = new_create_dissector_handle(dissect_opcua, proto_opcua); opcua_initialized = TRUE; } else |