Ethereal-dev: [Ethereal-dev] [patch] packet-pcnfsd.c
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Mike Frisch <mfrisch@xxxxxxxxxx>
Date: Tue, 14 May 2002 16:25:32 -0400
Enclosed is the patch that implements "MAPID" (proc 12) in pcnfsd v2. Mike.
Index: packet-pcnfsd.c =================================================================== RCS file: /cvsroot/ethereal/packet-pcnfsd.c,v retrieving revision 1.7 diff -u -r1.7 packet-pcnfsd.c --- packet-pcnfsd.c 2002/04/14 23:04:03 1.7 +++ packet-pcnfsd.c 2002/05/14 20:23:39 @@ -58,6 +58,7 @@ static int hf_pcnfsd_gids_count = -1; static int hf_pcnfsd_homedir = -1; static int hf_pcnfsd_def_umask = -1; +static int hf_pcnfsd_username = -1; static gint ett_pcnfsd = -1; @@ -65,6 +66,114 @@ static gint ett_pcnfsd_auth_password = -1; static gint ett_pcnfsd_gids = -1; +int +dissect_pcnfsd_username(tvbuff_t *tvb, int offset, proto_tree *tree) +{ + return dissect_rpc_string(tvb, tree, hf_pcnfsd_username, offset, NULL); +} + +#define MAP_REQ_UID 0 +#define MAP_REQ_GID 1 +#define MAP_REQ_UNAME 2 +#define MAP_REQ_GNAME 3 + +static const value_string names_mapreq[] = +{ + { MAP_REQ_UID, "MAP_REQ_UID" }, + { MAP_REQ_GID, "MAP_REQ_GID" }, + { MAP_REQ_UNAME, "MAP_REQ_UNAME" }, + { MAP_REQ_GNAME, "MAP_REQ_GNAME" }, + { 0, NULL } +}; + +int +dissect_pcnfsd_mapreq(tvbuff_t *tvb, int offset, proto_tree *tree) +{ + guint32 mapreq; + + mapreq = tvb_get_ntohl(tvb, offset + 0); + + if (tree) + proto_tree_add_text(tree, tvb, offset, 4, "Request: %s (%u)", + val_to_str(mapreq, names_mapreq, "%u"), mapreq); + + offset += 4; + + return offset; +} + +int +dissect_pcnfsd2_dissect_mapreq_arg_item(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree) +{ + offset = dissect_pcnfsd_mapreq(tvb, offset, tree); + + offset = dissect_rpc_uint32(tvb, tree, hf_pcnfsd_uid, offset); + + offset = dissect_pcnfsd_username(tvb, offset, tree); + + return offset; +} + +int +dissect_pcnfsd2_mapid_call(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *tree) +{ + offset = dissect_rpc_string(tvb, tree, hf_pcnfsd_comment, offset, NULL); + + offset = dissect_rpc_list(tvb, pinfo, tree, offset, + dissect_pcnfsd2_dissect_mapreq_arg_item); + + return offset; +} + +#define MAP_RES_OK 0 +#define MAP_RES_UNKNOWN 1 +#define MAP_RES_DENIED 2 + +static const value_string names_maprstat[] = +{ + { MAP_RES_OK, "MAP_RES_OK" }, + { MAP_RES_UNKNOWN, "MAP_RES_UNKNOWN" }, + { MAP_RES_DENIED, "MAP_RES_DENIED" }, + { 0, NULL } +}; + +int +dissect_pcnfsd2_dissect_mapreq_res_item(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree) +{ + guint32 maprstat; + + offset = dissect_pcnfsd_mapreq(tvb, offset, tree); + + maprstat = tvb_get_ntohl(tvb, offset + 0); + + if (tree) + proto_tree_add_text(tree, tvb, offset, 4, "Status: %s (%u)", + val_to_str(maprstat, names_maprstat, "%u"), maprstat); + + offset += 4; + + offset = dissect_rpc_uint32(tvb, tree, hf_pcnfsd_uid, offset); + + offset = dissect_pcnfsd_username(tvb, offset, tree); + + return offset; +} + +int +dissect_pcnfsd2_mapid_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *tree) +{ + offset = dissect_rpc_string(tvb, tree, hf_pcnfsd_comment, offset, NULL); + + offset = dissect_rpc_list(tvb, pinfo, tree, offset, + dissect_pcnfsd2_dissect_mapreq_res_item); + + return offset; +} + /* "NFS Illustrated 14.7.13 */ static void pcnfsd_decode_obscure(char* data, int len) @@ -225,7 +334,8 @@ { 9, "PR_REQUEUE", NULL, NULL }, { 10, "PR_HOLD", NULL, NULL }, { 11, "PR_RELEASE", NULL, NULL }, - { 12, "MAPID", NULL, NULL }, + { 12, "MAPID", + dissect_pcnfsd2_mapid_call, dissect_pcnfsd2_mapid_reply }, { 13, "AUTH", dissect_pcnfsd2_auth_call, dissect_pcnfsd2_auth_reply }, { 14, "ALERT", NULL, NULL }, @@ -274,6 +384,9 @@ { &hf_pcnfsd_def_umask, { "def_umask", "pcnfsd.def_umask", FT_INT32, BASE_OCT, NULL, 0, "def_umask", HFILL }}, + { &hf_pcnfsd_username, { + "User name", "pcnfsd.username", FT_STRING, BASE_DEC, + NULL, 0, "pcnfsd.username", HFILL }}, }; static gint *ett[] = {
- Follow-Ups:
- Re: [Ethereal-dev] [patch] packet-pcnfsd.c
- From: Guy Harris
- Re: [Ethereal-dev] [patch] packet-pcnfsd.c
- Prev by Date: Re: [Ethereal-dev] howto for writing plugins
- Next by Date: [Ethereal-dev] packet-iscsi.c patch (preference support for iscsi protocol version)
- Previous by thread: Re: [Ethereal-dev] OT: Managing builds across UNIX and Windows (inc CYGWIN)
- Next by thread: Re: [Ethereal-dev] [patch] packet-pcnfsd.c
- Index(es):