diff options
author | Laurent Deniel <laurent.deniel@free.fr> | 2000-08-13 14:09:15 +0000 |
---|---|---|
committer | Laurent Deniel <laurent.deniel@free.fr> | 2000-08-13 14:09:15 +0000 |
commit | cc36f0b9312fc36778bf227cbaaf02c89baf09b3 (patch) | |
tree | 0aff9b70a00a628a713030dc9000f3b5492d492b /packet-portmap.c | |
parent | db31ba13c8b9f82c1b96b5444fe3b7e8ff109ce1 (diff) |
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
Diffstat (limited to 'packet-portmap.c')
-rw-r--r-- | packet-portmap.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/packet-portmap.c b/packet-portmap.c index 84c4dfcc54..d256bd9124 100644 --- a/packet-portmap.c +++ b/packet-portmap.c @@ -1,7 +1,7 @@ /* packet-portmap.c * Routines for portmap dissection * - * $Id: packet-portmap.c,v 1.17 2000/06/12 08:47:34 guy Exp $ + * $Id: packet-portmap.c,v 1.18 2000/08/13 14:07:55 deniel Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -65,6 +65,10 @@ int dissect_getport_call(const u_char *pd, int offset, frame_data *fd, { guint32 proto; guint32 prog; + + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) @@ -90,6 +94,9 @@ int dissect_getport_call(const u_char *pd, int offset, frame_data *fd, int dissect_getport_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; if ( tree ) { @@ -105,6 +112,10 @@ int dissect_set_call(const u_char *pd, int offset, frame_data *fd, { guint32 proto; guint32 prog; + + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) @@ -133,6 +144,10 @@ int dissect_unset_call(const u_char *pd, int offset, frame_data *fd, { guint32 proto; guint32 prog; + + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) @@ -158,6 +173,9 @@ int dissect_unset_call(const u_char *pd, int offset, frame_data *fd, int dissect_set_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + if ( tree ) { if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; @@ -175,6 +193,9 @@ dissect_dump_entry(const u_char* pd, int offset, frame_data* fd, proto_tree* tre int prog, version, proto, port; proto_item *ti, *subtree; + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + if ( ! BYTES_ARE_IN_FRAME(offset, 16) ) { if ( tree ) @@ -211,6 +232,9 @@ dissect_dump_entry(const u_char* pd, int offset, frame_data* fd, proto_tree* tre int dissect_dump_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + offset = dissect_rpc_list(pd, offset, fd, tree, dissect_dump_entry); return offset; } @@ -296,6 +320,9 @@ dissect_rpcb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) int dissect_rpcb3_getaddr_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + offset = dissect_rpcb(pd, offset, fd, tree); return offset; @@ -306,6 +333,9 @@ int dissect_rpcb3_getaddr_call(const u_char *pd, int offset, frame_data *fd, int dissect_rpcb3_getaddr_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + offset = dissect_rpc_string(pd, offset, fd, tree, hf_portmap_uaddr,NULL); return offset; @@ -316,6 +346,9 @@ int dissect_rpcb3_getaddr_reply(const u_char *pd, int offset, frame_data *fd, int dissect_rpcb3_dump_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if (!proto_is_protocol_enabled(proto_portmap)) + return offset; + offset = dissect_rpc_list(pd, offset, fd, tree, dissect_rpcb); return offset; } |