diff options
author | Michael Mann <mmann78@netscape.net> | 2015-07-01 07:33:02 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-07-02 08:54:10 +0000 |
commit | b68a0ed42e26aaa7f30b47657311c187c8e02114 (patch) | |
tree | 0731ab045fd6d7a43c2a9a8d280d0c4a9e2ac3e7 /epan/dissectors/packet-portmap.c | |
parent | 9d8b81012700bda095418dd7f1f7d15b94809cab (diff) |
Replace RPC "dissect_function_t" function signature with "new style" dissector function signature.
This paves the way for using dissector tables.
Change-Id: I88ac165ef9aa5bf5c05e1115f7321e18e734d683
Reviewed-on: https://code.wireshark.org/review/9453
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-portmap.c')
-rw-r--r-- | epan/dissectors/packet-portmap.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/epan/dissectors/packet-portmap.c b/epan/dissectors/packet-portmap.c index 6a385b5bb2..86d5c2f78b 100644 --- a/epan/dissectors/packet-portmap.c +++ b/epan/dissectors/packet-portmap.c @@ -68,13 +68,14 @@ static dissector_handle_t rpc_handle; /* Dissect a getport call */ static int -dissect_getport_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, +dissect_getport_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data) { guint32 proto, version; guint32 prog; const char *prog_name; const char *proto_name; + int offset = 0; /* make sure we remember protocol type until the reply packet */ if(!pinfo->fd->flags.visited){ @@ -124,10 +125,11 @@ dissect_getport_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, } static int -dissect_getport_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, +dissect_getport_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data) { guint32 portx; + int offset = 0; /* we might have learnt a <ipaddr><protocol><port> mapping for ONC-RPC*/ if(!pinfo->fd->flags.visited){ @@ -164,11 +166,12 @@ dissect_getport_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, /* Dissect a 'set' call */ static int -dissect_set_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, +dissect_set_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { guint32 proto; guint32 prog; + int offset = 0; if ( tree ) { @@ -192,11 +195,12 @@ dissect_set_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, /* Dissect a 'unset' call */ static int -dissect_unset_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, +dissect_unset_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { guint32 proto; guint32 prog; + int offset = 0; if ( tree ) { @@ -219,12 +223,10 @@ dissect_unset_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, } static int -dissect_set_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, +dissect_set_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { - offset = dissect_rpc_bool(tvb, tree, hf_portmap_answer, - offset); - return offset; + return dissect_rpc_bool(tvb, tree, hf_portmap_answer, 0); } static int @@ -260,20 +262,19 @@ dissect_dump_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, } static int -dissect_dump_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, +dissect_dump_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - offset = dissect_rpc_list(tvb, pinfo, tree, offset, - dissect_dump_entry, NULL); - return offset; + return dissect_rpc_list(tvb, pinfo, tree, 0, dissect_dump_entry, NULL); } /* Dissect a callit call */ static int -dissect_callit_call(tvbuff_t *tvb, int offset, packet_info *pinfo, +dissect_callit_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 prog, vers, proc; + int offset = 0; prog = tvb_get_ntohl(tvb, offset+0); if ( tree ) @@ -312,14 +313,13 @@ dissect_callit_call(tvbuff_t *tvb, int offset, packet_info *pinfo, /* Dissect a callit reply */ static int -dissect_callit_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, +dissect_callit_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - if ( tree ) - { - proto_tree_add_item(tree, hf_portmap_port, tvb, + int offset = 0; + + proto_tree_add_item(tree, hf_portmap_port, tvb, offset, 4, ENC_BIG_ENDIAN); - } offset += 4; /* Dissect the result of this procedure. @@ -423,42 +423,37 @@ dissect_rpcb(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree /* RFC 1833, Page 7 */ static int -dissect_rpcb3_getaddr_call(tvbuff_t *tvb, int offset, packet_info *pinfo, +dissect_rpcb3_getaddr_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - offset = dissect_rpcb(tvb, offset, pinfo, tree, data); - - return offset; + return dissect_rpcb(tvb, 0, pinfo, tree, data); } /* RFC 1833, Page 7 */ static int -dissect_rpcb3_getaddr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, +dissect_rpcb3_getaddr_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { - offset = dissect_rpc_string(tvb, tree, - hf_portmap_uaddr, offset, NULL); - - return offset; + return dissect_rpc_string(tvb, tree, hf_portmap_uaddr, 0, NULL); } /* RFC 1833, Page 7 */ static int -dissect_rpcb3_dump_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, +dissect_rpcb3_dump_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - offset = dissect_rpc_list(tvb, pinfo, tree, offset, - dissect_rpcb, NULL); - return offset; + return dissect_rpc_list(tvb, pinfo, tree, 0, dissect_rpcb, NULL); } /* RFC 1833, page 4 */ static int -dissect_rpcb_rmtcallres(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, +dissect_rpcb_rmtcallres(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { + int offset = 0; + /* Dissect the remote universal address. */ offset = dissect_rpc_string(tvb, tree, hf_portmap_rpcb_addr, offset, NULL); |