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-mount.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-mount.c')
-rw-r--r-- | packet-mount.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/packet-mount.c b/packet-mount.c index 97d05ce9c4..7a5596ab17 100644 --- a/packet-mount.c +++ b/packet-mount.c @@ -1,7 +1,7 @@ /* packet-mount.c * Routines for mount dissection * - * $Id: packet-mount.c,v 1.15 2000/05/31 05:07:18 guy Exp $ + * $Id: packet-mount.c,v 1.16 2000/08/13 14:08:29 deniel Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -83,6 +83,9 @@ dissect_fhstatus(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint32 status; + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + if (!BYTES_ARE_IN_FRAME(offset,4)) return offset; status = EXTRACT_UINT(pd, offset+0); if (tree) { @@ -107,6 +110,10 @@ static int dissect_mount_dirpath_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + if ( tree ) { offset = dissect_rpc_string(pd,offset,fd,tree,hf_mount_path,NULL); @@ -121,6 +128,10 @@ static int dissect_mount_mnt_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + offset = dissect_fhstatus(pd, offset, fd, tree); return offset; @@ -138,6 +149,9 @@ dissect_mountlist(const u_char *pd, int offset, frame_data *fd, proto_tree *tree char* hostname; char* directory; + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + if (tree) { mountlist_item = proto_tree_add_item(tree, hf_mount_mountlist, NullTVB, offset+0, END_OF_FRAME, FALSE); @@ -167,6 +181,10 @@ static int dissect_mount_dump_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + offset = dissect_rpc_list(pd,offset,fd,tree,dissect_mountlist); return offset; @@ -178,6 +196,10 @@ dissect_mount_dump_reply(const u_char *pd, int offset, frame_data *fd, static int dissect_group(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + offset = dissect_rpc_string(pd, offset, fd, tree, hf_mount_groups_group,NULL); return offset; @@ -197,6 +219,9 @@ dissect_exportlist(const u_char *pd, int offset, frame_data *fd, proto_tree *tre proto_item* groups_tree = NULL; char* directory; + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + if (tree) { exportlist_item = proto_tree_add_item(tree, hf_mount_exportlist, NullTVB, offset+0, END_OF_FRAME, FALSE); @@ -241,6 +266,10 @@ static int dissect_mount_export_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + offset = dissect_rpc_list(pd,offset,fd,tree,dissect_exportlist); return offset; @@ -318,6 +347,9 @@ dissect_mount_pathconf_reply(const u_char *pd, int offset, frame_data *fd, proto_item *ti; proto_tree *mask_tree; + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + /* * Extract the mask first, so we know which other fields the * server was able to return to us. @@ -506,6 +538,9 @@ dissect_mountstat3(const u_char *pd, int offset, frame_data *fd, proto_tree *tre { guint32 mountstat3; + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + if (!BYTES_ARE_IN_FRAME(offset,4)) return offset; mountstat3 = EXTRACT_UINT(pd, offset+0); @@ -528,7 +563,10 @@ dissect_mount3_mnt_reply(const u_char *pd, int offset, frame_data *fd, guint32 auth_flavors; guint32 auth_flavor; guint32 auth_flavor_i; - + + if (!proto_is_protocol_enabled(proto_mount)) + return offset; + offset = dissect_mountstat3(pd, offset, fd, tree, hf_mount_status, &status); switch (status) { case 0: |