2 * Routines for nfs dissection
3 * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
4 * Copyright 2000, Mike Frisch <frisch@hummingbird.com> (NFSv4 decoding)
6 * $Id: packet-nfs.c,v 1.44 2001/02/07 22:10:49 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@zing.org>
10 * Copyright 1998 Gerald Combs
12 * Copied from packet-smb.c
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #ifdef HAVE_SYS_TYPES_H
35 #include <sys/types.h>
41 #include "packet-rpc.h"
42 #include "packet-nfs.h"
45 static int proto_nfs = -1;
47 static int hf_nfs_fh_fsid_major = -1;
48 static int hf_nfs_fh_fsid_minor = -1;
49 static int hf_nfs_fh_xfsid_major = -1;
50 static int hf_nfs_fh_xfsid_minor = -1;
51 static int hf_nfs_fh_fstype = -1;
52 static int hf_nfs_fh_fn = -1;
53 static int hf_nfs_fh_fn_len = -1;
54 static int hf_nfs_fh_fn_inode = -1;
55 static int hf_nfs_fh_fn_generation = -1;
56 static int hf_nfs_fh_xfn = -1;
57 static int hf_nfs_fh_xfn_len = -1;
58 static int hf_nfs_fh_xfn_inode = -1;
59 static int hf_nfs_fh_xfn_generation = -1;
60 static int hf_nfs_fh_dentry = -1;
61 static int hf_nfs_fh_dev = -1;
62 static int hf_nfs_fh_xdev = -1;
63 static int hf_nfs_fh_dirinode = -1;
64 static int hf_nfs_fh_pinode = -1;
65 static int hf_nfs_fh_hp_len = -1;
66 static int hf_nfs_stat = -1;
67 static int hf_nfs_name = -1;
68 static int hf_nfs_readlink_data = -1;
69 static int hf_nfs_read_offset = -1;
70 static int hf_nfs_read_count = -1;
71 static int hf_nfs_read_totalcount = -1;
72 static int hf_nfs_data = -1;
73 static int hf_nfs_write_beginoffset = -1;
74 static int hf_nfs_write_offset = -1;
75 static int hf_nfs_write_totalcount = -1;
76 static int hf_nfs_symlink_to = -1;
77 static int hf_nfs_readdir_cookie = -1;
78 static int hf_nfs_readdir_count = -1;
79 static int hf_nfs_readdir_entry = -1;
80 static int hf_nfs_readdir_entry_fileid = -1;
81 static int hf_nfs_readdir_entry_name = -1;
82 static int hf_nfs_readdirplus_entry_name = -1;
83 static int hf_nfs_readdir_entry_cookie = -1;
84 static int hf_nfs_readdir_eof = -1;
85 static int hf_nfs_statfs_tsize = -1;
86 static int hf_nfs_statfs_bsize = -1;
87 static int hf_nfs_statfs_blocks = -1;
88 static int hf_nfs_statfs_bfree = -1;
89 static int hf_nfs_statfs_bavail = -1;
90 static int hf_nfs_ftype3 = -1;
91 static int hf_nfs_nfsstat3 = -1;
92 static int hf_nfs_read_eof = -1;
93 static int hf_nfs_write_stable = -1;
94 static int hf_nfs_write_committed = -1;
95 static int hf_nfs_createmode3 = -1;
96 static int hf_nfs_fsstat_invarsec = -1;
97 static int hf_nfs_fsinfo_rtmax = -1;
98 static int hf_nfs_fsinfo_rtpref = -1;
99 static int hf_nfs_fsinfo_rtmult = -1;
100 static int hf_nfs_fsinfo_wtmax = -1;
101 static int hf_nfs_fsinfo_wtpref = -1;
102 static int hf_nfs_fsinfo_wtmult = -1;
103 static int hf_nfs_fsinfo_dtpref = -1;
104 static int hf_nfs_fsinfo_properties = -1;
105 static int hf_nfs_pathconf_linkmax = -1;
106 static int hf_nfs_pathconf_name_max = -1;
107 static int hf_nfs_pathconf_no_trunc = -1;
108 static int hf_nfs_pathconf_chown_restricted = -1;
109 static int hf_nfs_pathconf_case_insensitive = -1;
110 static int hf_nfs_pathconf_case_preserving = -1;
113 static int hf_nfs_argop4 = -1;
114 static int hf_nfs_resop4 = -1;
115 static int hf_nfs_linktext4 = -1;
116 static int hf_nfs_tag4 = -1;
117 static int hf_nfs_component4 = -1;
118 static int hf_nfs_clientid4 = -1;
119 static int hf_nfs_ace4 = -1;
120 static int hf_nfs_recall = -1;
121 static int hf_nfs_open_claim_type4 = -1;
122 static int hf_nfs_opentype4 = -1;
123 static int hf_nfs_limit_by4 = -1;
124 static int hf_nfs_open_delegation_type4 = -1;
125 static int hf_nfs_ftype4 = -1;
126 static int hf_nfs_change_info4_atomic = -1;
127 static int hf_nfs_open4_share_access = -1;
128 static int hf_nfs_open4_share_deny = -1;
129 static int hf_nfs_open4_result_flags = -1;
130 static int hf_nfs_seqid4 = -1;
132 static gint ett_nfs = -1;
133 static gint ett_nfs_fh_fsid = -1;
134 static gint ett_nfs_fh_xfsid = -1;
135 static gint ett_nfs_fh_fn = -1;
136 static gint ett_nfs_fh_xfn = -1;
137 static gint ett_nfs_fh_hp = -1;
138 static gint ett_nfs_fhandle = -1;
139 static gint ett_nfs_timeval = -1;
140 static gint ett_nfs_mode = -1;
141 static gint ett_nfs_fattr = -1;
142 static gint ett_nfs_sattr = -1;
143 static gint ett_nfs_diropargs = -1;
144 static gint ett_nfs_readdir_entry = -1;
145 static gint ett_nfs_mode3 = -1;
146 static gint ett_nfs_specdata3 = -1;
147 static gint ett_nfs_fh3 = -1;
148 static gint ett_nfs_nfstime3 = -1;
149 static gint ett_nfs_fattr3 = -1;
150 static gint ett_nfs_post_op_fh3 = -1;
151 static gint ett_nfs_sattr3 = -1;
152 static gint ett_nfs_diropargs3 = -1;
153 static gint ett_nfs_sattrguard3 = -1;
154 static gint ett_nfs_set_mode3 = -1;
155 static gint ett_nfs_set_uid3 = -1;
156 static gint ett_nfs_set_gid3 = -1;
157 static gint ett_nfs_set_size3 = -1;
158 static gint ett_nfs_set_atime = -1;
159 static gint ett_nfs_set_mtime = -1;
160 static gint ett_nfs_pre_op_attr = -1;
161 static gint ett_nfs_post_op_attr = -1;
162 static gint ett_nfs_wcc_attr = -1;
163 static gint ett_nfs_wcc_data = -1;
164 static gint ett_nfs_access = -1;
165 static gint ett_nfs_fsinfo_properties = -1;
168 static gint ett_nfs_compound_call4 = -1;
169 static gint ett_nfs_utf8string = -1;
170 static gint ett_nfs_argop4 = -1;
171 static gint ett_nfs_resop4 = -1;
172 static gint ett_nfs_access4 = -1;
173 static gint ett_nfs_close4 = -1;
174 static gint ett_nfs_commit4 = -1;
175 static gint ett_nfs_create4 = -1;
176 static gint ett_nfs_delegpurge4 = -1;
177 static gint ett_nfs_delegreturn4 = -1;
178 static gint ett_nfs_getattr4 = -1;
179 static gint ett_nfs_getfh4 = -1;
180 static gint ett_nfs_link4 = -1;
181 static gint ett_nfs_lock4 = -1;
182 static gint ett_nfs_lockt4 = -1;
183 static gint ett_nfs_locku4 = -1;
184 static gint ett_nfs_lookup4 = -1;
185 static gint ett_nfs_lookupp4 = -1;
186 static gint ett_nfs_nverify4 = -1;
187 static gint ett_nfs_open4 = -1;
188 static gint ett_nfs_openattr4 = -1;
189 static gint ett_nfs_open_confirm4 = -1;
190 static gint ett_nfs_open_downgrade4 = -1;
191 static gint ett_nfs_putfh4 = -1;
192 static gint ett_nfs_putpubfh4 = -1;
193 static gint ett_nfs_putrootfh4 = -1;
194 static gint ett_nfs_read4 = -1;
195 static gint ett_nfs_readdir4 = -1;
196 static gint ett_nfs_readlink4 = -1;
197 static gint ett_nfs_remove4 = -1;
198 static gint ett_nfs_rename4 = -1;
199 static gint ett_nfs_renew4 = -1;
200 static gint ett_nfs_restorefh4 = -1;
201 static gint ett_nfs_savefh4 = -1;
202 static gint ett_nfs_secinfo4 = -1;
203 static gint ett_nfs_setattr4 = -1;
204 static gint ett_nfs_setclientid4 = -1;
205 static gint ett_nfs_setclientid_confirm4 = -1;
206 static gint ett_nfs_verify4 = -1;
207 static gint ett_nfs_write4 = -1;
208 static gint ett_nfs_verifier4 = -1;
209 static gint ett_nfs_opaque = -1;
210 static gint ett_nfs_dirlist4 = -1;
211 static gint ett_nfs_pathname4 = -1;
212 static gint ett_nfs_change_info4 = -1;
213 static gint ett_nfs_open_delegation4 = -1;
214 static gint ett_nfs_open_claim4 = -1;
215 static gint ett_nfs_opentype4 = -1;
216 static gint ett_nfs_lockowner4 = -1;
217 static gint ett_nfs_cb_client4 = -1;
218 static gint ett_nfs_client_id4 = -1;
219 static gint ett_nfs_bitmap4 = -1;
221 /* file handle dissection */
223 #define FHT_UNKNOWN 0
225 #define FHT_LINUX_KNFSD_LE 2
226 #define FHT_LINUX_NFSD_LE 3
228 const value_string names_fhtype[] =
230 { FHT_UNKNOWN, "unknown" },
231 { FHT_SVR4, "System V R4" },
232 { FHT_LINUX_KNFSD_LE, "Linux knfsd (little-endian)" },
233 { FHT_LINUX_NFSD_LE, "Linux user-land nfsd (little-endian)" },
238 /* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45) */
241 dissect_fhandle_data_SVR4(tvbuff_t* tvb, int offset, proto_tree *tree,
244 guint32 nof = offset;
256 temp = tvb_get_ntohl(tvb, fsid_O);
257 fsid_major = ( temp>>18 ) & 0x3fff; /* 14 bits */
258 fsid_minor = ( temp ) & 0x3ffff; /* 18 bits */
260 proto_item* fsid_item = NULL;
261 proto_tree* fsid_tree = NULL;
263 fsid_item = proto_tree_add_text(tree, tvb,
265 "file system ID: %d,%d", fsid_major, fsid_minor);
267 fsid_tree = proto_item_add_subtree(fsid_item,
269 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
270 tvb, fsid_O, 2, fsid_major);
271 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
272 tvb, fsid_O+1, 3, fsid_minor);
275 nof = fsid_O + fsid_L;
278 /* file system type */
286 fstype = tvb_get_ntohl(tvb, fstype_O);
288 proto_tree_add_uint(tree, hf_nfs_fh_fstype, tvb,
289 fstype_O, fstype_L, fstype);
291 nof = fstype_O + fstype_L;
301 guint32 fn_data_inode_O;
302 guint32 fn_data_inode_L;
304 guint32 fn_data_gen_O;
305 guint32 fn_data_gen_L;
312 fn_len = tvb_get_ntohs(tvb, fn_len_O);
313 fn_data_O = fn_O + fn_len_L;
314 fn_data_inode_O = fn_data_O + 2;
316 inode = tvb_get_ntohl(tvb, fn_data_inode_O);
317 fn_data_gen_O = fn_data_inode_O + fn_data_inode_L;
319 gen = tvb_get_ntohl(tvb, fn_data_gen_O);
320 fn_L = fn_len_L + fn_len;
322 proto_item* fn_item = NULL;
323 proto_tree* fn_tree = NULL;
325 fn_item = proto_tree_add_uint(tree, hf_nfs_fh_fn, tvb,
328 fn_tree = proto_item_add_subtree(fn_item,
330 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_len,
331 tvb, fn_len_O, fn_len_L, fn_len);
332 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_inode,
333 tvb, fn_data_inode_O, fn_data_inode_L, inode);
334 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_generation,
335 tvb, fn_data_gen_O, fn_data_gen_L, gen);
338 nof = fn_O + fn_len_L + fn_len;
341 /* exported file number */
348 guint32 xfn_data_inode_O;
349 guint32 xfn_data_inode_L;
351 guint32 xfn_data_gen_O;
352 guint32 xfn_data_gen_L;
359 xfn_len = tvb_get_ntohs(tvb, xfn_len_O);
360 xfn_data_O = xfn_O + xfn_len_L;
361 xfn_data_inode_O = xfn_data_O + 2;
362 xfn_data_inode_L = 4;
363 xinode = tvb_get_ntohl(tvb, xfn_data_inode_O);
364 xfn_data_gen_O = xfn_data_inode_O + xfn_data_inode_L;
366 xgen = tvb_get_ntohl(tvb, xfn_data_gen_O);
367 xfn_L = xfn_len_L + xfn_len;
369 proto_item* xfn_item = NULL;
370 proto_tree* xfn_tree = NULL;
372 xfn_item = proto_tree_add_uint(tree, hf_nfs_fh_xfn, tvb,
373 xfn_O, xfn_L, xinode);
375 xfn_tree = proto_item_add_subtree(xfn_item,
377 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_len,
378 tvb, xfn_len_O, xfn_len_L, xfn_len);
379 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_inode,
380 tvb, xfn_data_inode_O, xfn_data_inode_L, xinode);
381 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_generation,
382 tvb, xfn_data_gen_O, xfn_data_gen_L, xgen);
389 /* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
392 dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
406 dentry = tvb_get_letohl(tvb, offset+0);
407 inode = tvb_get_letohl(tvb, offset+4);
408 dirinode = tvb_get_letohl(tvb, offset+8);
409 temp = tvb_get_letohs (tvb,offset+12);
410 fsid_major = (temp >> 8) & 0xff;
411 fsid_minor = (temp ) & 0xff;
412 temp = tvb_get_letohs(tvb,offset+16);
413 xfsid_major = (temp >> 8) & 0xff;
414 xfsid_minor = (temp ) & 0xff;
415 xinode = tvb_get_letohl(tvb,offset+20);
416 gen = tvb_get_letohl(tvb,offset+24);
419 proto_tree_add_uint(tree, hf_nfs_fh_dentry,
420 tvb, offset+0, 4, dentry);
421 proto_tree_add_uint(tree, hf_nfs_fh_fn_inode,
422 tvb, offset+4, 4, inode);
423 proto_tree_add_uint(tree, hf_nfs_fh_dirinode,
424 tvb, offset+8, 4, dirinode);
426 /* file system id (device) */
428 proto_item* fsid_item = NULL;
429 proto_tree* fsid_tree = NULL;
431 fsid_item = proto_tree_add_text(tree, tvb,
433 "file system ID: %d,%d", fsid_major, fsid_minor);
435 fsid_tree = proto_item_add_subtree(fsid_item,
437 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
438 tvb, offset+13, 1, fsid_major);
439 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
440 tvb, offset+12, 1, fsid_minor);
444 /* exported file system id (device) */
446 proto_item* xfsid_item = NULL;
447 proto_tree* xfsid_tree = NULL;
449 xfsid_item = proto_tree_add_text(tree, tvb,
451 "exported file system ID: %d,%d", xfsid_major, xfsid_minor);
453 xfsid_tree = proto_item_add_subtree(xfsid_item,
455 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_major,
456 tvb, offset+17, 1, xfsid_major);
457 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_minor,
458 tvb, offset+16, 1, xfsid_minor);
462 proto_tree_add_uint(tree, hf_nfs_fh_xfn_inode,
463 tvb, offset+20, 4, xinode);
464 proto_tree_add_uint(tree, hf_nfs_fh_fn_generation,
465 tvb, offset+24, 4, gen);
470 /* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
473 dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
479 pinode = tvb_get_letohl(tvb, offset+0);
481 proto_tree_add_uint(tree, hf_nfs_fh_pinode,
482 tvb, offset+0, 4, pinode);
490 hashlen = tvb_get_guint8(tvb, offset+4);
492 proto_item* hash_item = NULL;
493 proto_tree* hash_tree = NULL;
495 hash_item = proto_tree_add_text(tree, tvb, offset+4,
498 tvb_bytes_to_str(tvb,offset+5,hashlen));
500 hash_tree = proto_item_add_subtree(hash_item,
503 proto_tree_add_uint(hash_tree,
504 hf_nfs_fh_hp_len, tvb, offset+4, 1,
506 proto_tree_add_text(hash_tree, tvb, offset+5,
509 tvb_bytes_to_str(tvb,offset+5,hashlen));
518 dissect_fhandle_data_unknown(tvbuff_t *tvb, int offset, proto_tree *tree,
527 while (bytes_left != 0) {
529 if (sublen > bytes_left)
531 proto_tree_add_text(tree, tvb, offset, sublen,
533 first_line ? "data: " :
535 tvb_bytes_to_str(tvb,offset,sublen));
536 bytes_left -= sublen;
544 dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
545 proto_tree *tree, int fhlen)
547 int fhtype = FHT_UNKNOWN;
549 /* filehandle too long */
550 if (fhlen>64) goto type_ready;
551 /* Not all bytes there. Any attempt to deduce the type would be
553 if (!tvb_bytes_exist(tvb,offset,fhlen)) goto type_ready;
555 /* calculate (heuristically) fhtype */
560 if (tvb_get_ntohs(tvb,offset+4) == 0) {
561 len1=tvb_get_ntohs(tvb,offset+8);
562 if (tvb_bytes_exist(tvb,offset+10+len1,2)) {
563 len2=tvb_get_ntohs(tvb,
565 if (fhlen==12+len1+len2) {
571 len1 = tvb_get_guint8(tvb,offset+4);
572 if (len1<28 && tvb_bytes_exist(tvb,offset+5,len1)) {
574 for (len2=5+len1;len2<32;len2++) {
575 if (tvb_get_guint8(tvb,offset+len2)) {
581 fhtype=FHT_LINUX_NFSD_LE;
585 if (tvb_get_ntohl(tvb,offset+28) == 0) {
586 if (tvb_get_ntohs(tvb,offset+14) == 0) {
587 if (tvb_get_ntohs(tvb,offset+18) == 0) {
588 fhtype=FHT_LINUX_KNFSD_LE;
598 proto_tree_add_text(tree, tvb, offset, 0,
599 "type: %s", val_to_str(fhtype, names_fhtype, "Unknown"));
603 dissect_fhandle_data_SVR4 (tvb, offset, tree,
606 case FHT_LINUX_KNFSD_LE:
607 dissect_fhandle_data_LINUX_KNFSD_LE(tvb, offset, tree,
610 case FHT_LINUX_NFSD_LE:
611 dissect_fhandle_data_LINUX_NFSD_LE (tvb, offset, tree,
616 dissect_fhandle_data_unknown(tvb, offset, tree, fhlen);
622 /***************************/
623 /* NFS Version 2, RFC 1094 */
624 /***************************/
627 /* base 32 bit type for NFS v2 */
629 dissect_unsigned_int(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
632 offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
637 /* RFC 1094, Page 12..14 */
638 const value_string names_nfs_stat[] =
647 { 18, "ERR_XDEV" }, /* not in spec, but can happen */
649 { 20, "ERR_NOTDIR" },
651 { 22, "ERR_INVAL" }, /* not in spec, but I think it can happen */
652 { 26, "ERR_TXTBSY" }, /* not in spec, but I think it can happen */
656 { 31, "ERR_MLINK" }, /* not in spec, but can happen */
657 { 45, "ERR_OPNOTSUPP" }, /* not in spec, but I think it can happen */
658 { 63, "ERR_NAMETOOLONG" },
659 { 66, "ERR_NOTEMPTY" },
662 { 99, "ERR_WFLUSH" },
666 /* NFSv4 Draft Specification, Page 198-199 */
667 const value_string names_nfs_stat4[] = {
669 { 1, "NFS4ERR_PERM" },
670 { 2, "NFS4ERR_NOENT" },
672 { 6, "NFS4ERR_NXIO" },
673 { 13, "NFS4ERR_ACCES" },
674 { 17, "NFS4ERR_EXIST" },
675 { 18, "NFS4ERR_XDEV" },
676 { 19, "NFS4ERR_NODEV" },
677 { 20, "NFS4ERR_NOTDIR" },
678 { 21, "NFS4ERR_ISDIR" },
679 { 22, "NFS4ERR_INVAL" },
680 { 27, "NFS4ERR_FBIG" },
681 { 28, "NFS4ERR_NOSPC" },
682 { 30, "NFS4ERR_ROFS" },
683 { 31, "NFS4ERR_MLINK" },
684 { 63, "NFS4ERR_NAMETOOLONG" },
685 { 66, "NFS4ERR_NOTEMPTY" },
686 { 69, "NFS4ERR_DQUOT" },
687 { 70, "NFS4ERR_STALE" },
688 { 10001, "NFS4ERR_BADHANDLE" },
689 { 10003, "NFS4ERR_BAD_COOKIE" },
690 { 10004, "NFS4ERR_NOTSUPP" },
691 { 10005, "NFS4ERR_TOOSMALL" },
692 { 10006, "NFS4ERR_SERVERFAULT" },
693 { 10007, "NFS4ERR_BADTYPE" },
694 { 10008, "NFS4ERR_DELAY" },
695 { 10009, "NFS4ERR_SAME" },
696 { 10010, "NFS4ERR_DENIED" },
697 { 10011, "NFS4ERR_EXPIRED" },
698 { 10012, "NFS4ERR_LOCKED" },
699 { 10013, "NFS4ERR_GRACE" },
700 { 10014, "NFS4ERR_FHEXPIRED" },
701 { 10015, "NFS4ERR_SHARE_DENIED" },
702 { 10016, "NFS4ERR_WRONGSEC" },
703 { 10017, "NFS4ERR_CLID_INUSE" },
704 { 10018, "NFS4ERR_RESOURCE" },
705 { 10019, "NFS4ERR_MOVED" },
706 { 10020, "NFS4ERR_NOFILEHANDLE" },
707 { 10021, "NFS4ERR_MINOR_VERS_MISMATCH" },
708 { 10022, "NFS4ERR_STALE_CLIENTID" },
709 { 10023, "NFS4ERR_STALE_STATEID" },
710 { 10024, "NFS4ERR_OLD_STATEID" },
711 { 10025, "NFS4ERR_BAD_STATEID" },
712 { 10026, "NFS4ERR_BAD_SEQID" },
713 { 10027, "NFS4ERR_NOT_SAME" },
714 { 10028, "NFS4ERR_LOCK_RANGE" },
715 { 10029, "NFS4ERR_SYMLINK" },
716 { 10030, "NFS4ERR_READDIR_NOSPC" },
717 { 10031, "NFS4ERR_LEASE_MOVED" },
722 /* This function has been modified to support NFSv4 style error codes as
723 * well as being backwards compatible with NFSv2 and NFSv3.
726 dissect_stat_internal(const u_char *pd, int offset, frame_data *fd,
727 proto_tree *tree, guint32* status, int nfsvers)
731 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
732 stat = EXTRACT_UINT(pd, offset+0);
735 /* this gives the right NFSv2 number<->message relation */
736 /* and makes it searchable via "nfs.status" */
737 proto_tree_add_uint_format(tree, hf_nfs_nfsstat3, NullTVB,
738 offset+0, 4, stat, "Status: %s (%u)",
740 (nfsvers != 4)? names_nfs_stat: names_nfs_stat4,"%u"), stat);
749 /* RFC 1094, Page 12..14 */
751 dissect_stat(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
754 return dissect_stat_internal(pd, offset, fd, tree, status, !4);
758 /* RFC 1094, Page 12..14 */
760 dissect_nfs2_stat_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
764 offset = dissect_stat(pd, offset, fd, tree, &status);
771 dissect_stat_nfs4(const u_char *pd, int offset, frame_data *fd,
772 proto_tree *tree, guint32 *status)
774 return dissect_stat_internal(pd, offset, fd, tree, status, 4);
778 /* RFC 1094, Page 15 */
780 dissect_ftype(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
784 char* ftype_name = NULL;
786 const value_string nfs2_ftype[] =
789 { 1, "Regular File" },
791 { 3, "Block Special Device" },
792 { 4, "Character Special Device" },
793 { 5, "Symbolic Link" },
797 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
798 ftype = EXTRACT_UINT(pd, offset+0);
799 ftype_name = val_to_str(ftype, nfs2_ftype, "%u");
802 proto_tree_add_text(tree, NullTVB, offset, 4,
803 "%s: %s (%u)", name, ftype_name, ftype);
811 /* RFC 1094, Page 15 */
813 old_dissect_fhandle(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
815 tvbuff_t *tvb = tvb_create_from_top(offset);
817 offset = dissect_fhandle(tvb, 0, &pi, tree, name);
818 return tvb_raw_offset(tvb) + offset;
822 dissect_fhandle(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
826 proto_tree* ftree = NULL;
829 fitem = proto_tree_add_text(tree, tvb, offset, FHSIZE,
832 ftree = proto_item_add_subtree(fitem, ett_nfs_fhandle);
836 dissect_fhandle_data(tvb, offset, pinfo, ftree, FHSIZE);
842 /* RFC 1094, Page 15 */
844 dissect_nfs2_fhandle_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
846 offset = old_dissect_fhandle(pd, offset, fd, tree, "object");
852 /* RFC 1094, Page 15 */
854 dissect_timeval(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
859 proto_item* time_item;
860 proto_tree* time_tree = NULL;
862 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
863 seconds = EXTRACT_UINT(pd, offset+0);
864 mseconds = EXTRACT_UINT(pd, offset+4);
867 time_item = proto_tree_add_text(tree, NullTVB, offset, 8,
868 "%s: %u.%06u", name, seconds, mseconds);
870 time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval);
874 proto_tree_add_text(time_tree, NullTVB,offset+0,4,
875 "seconds: %u", seconds);
876 proto_tree_add_text(time_tree, NullTVB,offset+4,4,
877 "micro seconds: %u", mseconds);
884 /* RFC 1094, Page 16 */
885 const value_string nfs2_mode_names[] = {
886 { 0040000, "Directory" },
887 { 0020000, "Character Special Device" },
888 { 0060000, "Block Special Device" },
889 { 0100000, "Regular File" },
890 { 0120000, "Symbolic Link" },
891 { 0140000, "Named Socket" },
896 dissect_mode(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
900 proto_item* mode_item = NULL;
901 proto_tree* mode_tree = NULL;
903 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
904 mode = EXTRACT_UINT(pd, offset+0);
907 mode_item = proto_tree_add_text(tree, NullTVB, offset, 4,
908 "%s: 0%o", name, mode);
910 mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode);
914 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
915 decode_enumerated_bitfield(mode, 0160000, 16,
916 nfs2_mode_names, "%s"));
917 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
918 decode_boolean_bitfield(mode, 04000, 16, "Set user id on exec", "not SUID"));
919 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
920 decode_boolean_bitfield(mode, 02000, 16, "Set group id on exec", "not SGID"));
921 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
922 decode_boolean_bitfield(mode, 01000, 16, "Save swapped text even after use", "not save swapped text"));
923 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
924 decode_boolean_bitfield(mode, 0400, 16, "Read permission for owner", "no Read permission for owner"));
925 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
926 decode_boolean_bitfield(mode, 0200, 16, "Write permission for owner", "no Write permission for owner"));
927 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
928 decode_boolean_bitfield(mode, 0100, 16, "Execute permission for owner", "no Execute permission for owner"));
929 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
930 decode_boolean_bitfield(mode, 040, 16, "Read permission for group", "no Read permission for group"));
931 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
932 decode_boolean_bitfield(mode, 020, 16, "Write permission for group", "no Write permission for group"));
933 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
934 decode_boolean_bitfield(mode, 010, 16, "Execute permission for group", "no Execute permission for group"));
935 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
936 decode_boolean_bitfield(mode, 04, 16, "Read permission for others", "no Read permission for others"));
937 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
938 decode_boolean_bitfield(mode, 02, 16, "Write permission for others", "no Write permission for others"));
939 proto_tree_add_text(mode_tree, NullTVB, offset, 4, "%s",
940 decode_boolean_bitfield(mode, 01, 16, "Execute permission for others", "no Execute permission for others"));
948 /* RFC 1094, Page 15 */
950 dissect_fattr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
952 proto_item* fattr_item = NULL;
953 proto_tree* fattr_tree = NULL;
954 int old_offset = offset;
957 fattr_item = proto_tree_add_text(tree, NullTVB, offset,
958 END_OF_FRAME, "%s", name);
960 fattr_tree = proto_item_add_subtree(fattr_item, ett_nfs_fattr);
963 offset = dissect_ftype (pd,offset,fd,fattr_tree,"type");
964 offset = dissect_mode (pd,offset,fd,fattr_tree,"mode");
965 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"nlink");
966 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"uid");
967 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"gid");
968 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"size");
969 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"blocksize");
970 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"rdev");
971 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"blocks");
972 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"fsid");
973 offset = dissect_unsigned_int (pd,offset,fd,fattr_tree,"fileid");
974 offset = dissect_timeval (pd,offset,fd,fattr_tree,"atime");
975 offset = dissect_timeval (pd,offset,fd,fattr_tree,"mtime");
976 offset = dissect_timeval (pd,offset,fd,fattr_tree,"ctime");
978 /* now we know, that fattr is shorter */
980 proto_item_set_len(fattr_item, offset - old_offset);
987 /* RFC 1094, Page 17 */
989 dissect_sattr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
991 proto_item* sattr_item = NULL;
992 proto_tree* sattr_tree = NULL;
993 int old_offset = offset;
996 sattr_item = proto_tree_add_text(tree, NullTVB, offset,
997 END_OF_FRAME, "%s", name);
999 sattr_tree = proto_item_add_subtree(sattr_item, ett_nfs_sattr);
1002 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1003 if (EXTRACT_UINT(pd, offset+0) != 0xffffffff)
1004 offset = dissect_mode (pd,offset,fd,sattr_tree,"mode");
1006 proto_tree_add_text(sattr_tree, NullTVB, offset, 4, "mode: no value");
1010 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1011 if (EXTRACT_UINT(pd, offset+0) != 0xffffffff)
1012 offset = dissect_unsigned_int (pd,offset,fd,sattr_tree,"uid");
1014 proto_tree_add_text(sattr_tree, NullTVB, offset, 4, "uid: no value");
1018 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1019 if (EXTRACT_UINT(pd, offset+0) != 0xffffffff)
1020 offset = dissect_unsigned_int (pd,offset,fd,sattr_tree,"gid");
1022 proto_tree_add_text(sattr_tree, NullTVB, offset, 4, "gid: no value");
1026 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1027 if (EXTRACT_UINT(pd, offset+0) != 0xffffffff)
1028 offset = dissect_unsigned_int (pd,offset,fd,sattr_tree,"size");
1030 proto_tree_add_text(sattr_tree, NullTVB, offset, 4, "size: no value");
1034 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1035 if (EXTRACT_UINT(pd, offset+0) != 0xffffffff)
1036 offset = dissect_timeval (pd,offset,fd,sattr_tree,"atime");
1038 proto_tree_add_text(sattr_tree, NullTVB, offset, 8, "atime: no value");
1042 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1043 if (EXTRACT_UINT(pd, offset+0) != 0xffffffff)
1044 offset = dissect_timeval (pd,offset,fd,sattr_tree,"mtime");
1046 proto_tree_add_text(sattr_tree, NullTVB, offset, 8, "mtime: no value");
1050 /* now we know, that sattr is shorter */
1052 proto_item_set_len(sattr_item, offset - old_offset);
1059 /* RFC 1094, Page 17 */
1061 dissect_filename(const u_char *pd, int offset, frame_data *fd,
1062 proto_tree *tree, int hf, char **string_ret)
1064 offset = dissect_rpc_string(pd,offset,fd,tree,hf,string_ret);
1069 /* RFC 1094, Page 17 */
1071 dissect_path(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hf)
1073 offset = dissect_rpc_string(pd,offset,fd,tree,hf,NULL);
1078 /* RFC 1094, Page 17,18 */
1080 dissect_attrstat(const u_char *pd, int offset, frame_data *fd, proto_tree *tree){
1083 offset = dissect_stat(pd, offset, fd, tree, &status);
1086 offset = dissect_fattr(pd, offset, fd, tree, "attributes");
1097 /* RFC 1094, Page 17,18 */
1099 dissect_nfs2_attrstat_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
1101 offset = dissect_attrstat(pd, offset, fd, tree);
1107 /* RFC 1094, Page 18 */
1109 dissect_diropargs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
1111 proto_item* diropargs_item = NULL;
1112 proto_tree* diropargs_tree = NULL;
1113 int old_offset = offset;
1116 diropargs_item = proto_tree_add_text(tree, NullTVB, offset,
1117 END_OF_FRAME, "%s", name);
1119 diropargs_tree = proto_item_add_subtree(diropargs_item, ett_nfs_diropargs);
1122 offset = old_dissect_fhandle (pd,offset,fd,diropargs_tree,"dir");
1123 offset = dissect_filename(pd,offset,fd,diropargs_tree,hf_nfs_name,NULL);
1125 /* now we know, that diropargs is shorter */
1126 if (diropargs_item) {
1127 proto_item_set_len(diropargs_item, offset - old_offset);
1134 /* RFC 1094, Page 18 */
1136 dissect_nfs2_diropargs_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1138 offset = dissect_diropargs(pd, offset, fd, tree, "where");
1144 /* RFC 1094, Page 18 */
1146 dissect_diropres(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1150 offset = dissect_stat(pd, offset, fd, tree, &status);
1153 offset = old_dissect_fhandle(pd, offset, fd, tree, "file");
1154 offset = dissect_fattr (pd, offset, fd, tree, "attributes");
1165 /* nfsdata is simply a RPC string (length, data, fill bytes) */
1167 dissect_nfsdata(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1170 offset = dissect_rpc_data(pd,offset,fd,tree,hf);
1176 /* RFC 1094, Page 18 */
1178 dissect_nfs2_diropres_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
1180 offset = dissect_diropres(pd, offset, fd, tree);
1186 /* RFC 1094, Page 6 */
1188 dissect_nfs2_setattr_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1190 offset = old_dissect_fhandle(pd, offset, fd, tree, "file" );
1191 offset = dissect_sattr (pd, offset, fd, tree, "attributes");
1197 /* RFC 1094, Page 6 */
1199 dissect_nfs2_readlink_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1203 offset = dissect_stat(pd, offset, fd, tree, &status);
1206 offset = dissect_path(pd, offset, fd, tree, hf_nfs_readlink_data);
1217 /* RFC 1094, Page 7 */
1219 dissect_nfs2_read_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1221 guint32 offset_value;
1225 offset = old_dissect_fhandle(pd, offset, fd, tree, "file" );
1226 if (!BYTES_ARE_IN_FRAME(offset,12)) return offset;
1227 offset_value = EXTRACT_UINT(pd, offset+0);
1228 count = EXTRACT_UINT(pd, offset+4);
1229 totalcount = EXTRACT_UINT(pd, offset+8);
1231 proto_tree_add_uint(tree, hf_nfs_read_offset, NullTVB,
1232 offset+0, 4, offset_value);
1233 proto_tree_add_uint(tree, hf_nfs_read_count, NullTVB,
1234 offset+4, 4, count);
1235 proto_tree_add_uint(tree, hf_nfs_read_totalcount, NullTVB,
1236 offset+8, 4, totalcount);
1244 /* RFC 1094, Page 7 */
1246 dissect_nfs2_read_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
1250 offset = dissect_stat(pd, offset, fd, tree, &status);
1253 offset = dissect_fattr(pd, offset, fd, tree, "attributes");
1254 offset = dissect_nfsdata(pd, offset, fd, tree, hf_nfs_data);
1265 /* RFC 1094, Page 8 */
1267 dissect_nfs2_write_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1269 guint32 beginoffset;
1270 guint32 offset_value;
1273 offset = old_dissect_fhandle(pd, offset, fd, tree, "file" );
1274 if (!BYTES_ARE_IN_FRAME(offset,12)) return offset;
1275 beginoffset = EXTRACT_UINT(pd, offset+0);
1276 offset_value = EXTRACT_UINT(pd, offset+4);
1277 totalcount = EXTRACT_UINT(pd, offset+8);
1279 proto_tree_add_uint(tree, hf_nfs_write_beginoffset, NullTVB,
1280 offset+0, 4, beginoffset);
1281 proto_tree_add_uint(tree, hf_nfs_write_offset, NullTVB,
1282 offset+4, 4, offset_value);
1283 proto_tree_add_uint(tree, hf_nfs_write_totalcount, NullTVB,
1284 offset+8, 4, totalcount);
1288 offset = dissect_nfsdata(pd, offset, fd, tree, hf_nfs_data);
1294 /* RFC 1094, Page 8 */
1296 dissect_nfs2_createargs_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1298 offset = dissect_diropargs(pd, offset, fd, tree, "where" );
1299 offset = dissect_sattr (pd, offset, fd, tree, "attributes");
1305 /* RFC 1094, Page 9 */
1307 dissect_nfs2_rename_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1309 offset = dissect_diropargs(pd, offset, fd, tree, "from");
1310 offset = dissect_diropargs(pd, offset, fd, tree, "to" );
1316 /* RFC 1094, Page 9 */
1318 dissect_nfs2_link_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1320 offset = old_dissect_fhandle (pd, offset, fd, tree, "from");
1321 offset = dissect_diropargs(pd, offset, fd, tree, "to" );
1327 /* RFC 1094, Page 10 */
1329 dissect_nfs2_symlink_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1331 offset = dissect_diropargs(pd, offset, fd, tree, "from" );
1332 offset = dissect_path (pd, offset, fd, tree, hf_nfs_symlink_to);
1333 offset = dissect_sattr (pd, offset, fd, tree, "attributes" );
1339 /* RFC 1094, Page 11 */
1341 dissect_nfs2_readdir_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1346 offset = old_dissect_fhandle (pd, offset, fd, tree, "dir");
1347 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1348 cookie = EXTRACT_UINT(pd, offset+ 0);
1349 count = EXTRACT_UINT(pd, offset+ 4);
1351 proto_tree_add_uint(tree, hf_nfs_readdir_cookie, NullTVB,
1352 offset+ 0, 4, cookie);
1353 proto_tree_add_uint(tree, hf_nfs_readdir_count, NullTVB,
1354 offset+ 4, 4, count);
1362 /* RFC 1094, Page 11 */
1364 dissect_readdir_entry(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
1366 proto_item* entry_item = NULL;
1367 proto_tree* entry_tree = NULL;
1368 int old_offset = offset;
1374 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, NullTVB,
1375 offset+0, END_OF_FRAME, FALSE);
1377 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
1380 if (!BYTES_ARE_IN_FRAME(offset, 4)) {
1382 proto_item_set_text(entry_item, "Entry: <TRUNCATED>");
1385 fileid = EXTRACT_UINT(pd, offset + 0);
1387 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_fileid, NullTVB,
1388 offset+0, 4, fileid);
1391 offset = dissect_filename(pd, offset, fd, entry_tree,
1392 hf_nfs_readdir_entry_name, &name);
1394 proto_item_set_text(entry_item, "Entry: file ID %u, name %s",
1398 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
1399 cookie = EXTRACT_UINT(pd, offset + 0);
1401 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_cookie, NullTVB,
1402 offset+0, 4, cookie);
1405 /* now we know, that a readdir entry is shorter */
1407 proto_item_set_len(entry_item, offset - old_offset);
1413 /* RFC 1094, Page 11 */
1415 dissect_nfs2_readdir_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
1420 offset = dissect_stat(pd, offset, fd, tree, &status);
1423 offset = dissect_rpc_list(pd, offset, fd, tree,
1424 dissect_readdir_entry);
1425 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1426 eof_value = EXTRACT_UINT(pd, offset+0);
1428 proto_tree_add_uint(tree, hf_nfs_readdir_eof, NullTVB,
1429 offset+ 0, 4, eof_value);
1441 /* RFC 1094, Page 12 */
1443 dissect_nfs2_statfs_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
1452 offset = dissect_stat(pd, offset, fd, tree, &status);
1455 if (!BYTES_ARE_IN_FRAME(offset,5 * 4)) return offset;
1456 tsize = EXTRACT_UINT(pd, offset+ 0);
1457 bsize = EXTRACT_UINT(pd, offset+ 4);
1458 blocks = EXTRACT_UINT(pd, offset+ 8);
1459 bfree = EXTRACT_UINT(pd, offset+12);
1460 bavail = EXTRACT_UINT(pd, offset+16);
1462 proto_tree_add_uint(tree, hf_nfs_statfs_tsize, NullTVB,
1463 offset+ 0, 4, tsize);
1464 proto_tree_add_uint(tree, hf_nfs_statfs_bsize, NullTVB,
1465 offset+ 4, 4, bsize);
1466 proto_tree_add_uint(tree, hf_nfs_statfs_blocks, NullTVB,
1467 offset+ 8, 4, blocks);
1468 proto_tree_add_uint(tree, hf_nfs_statfs_bfree, NullTVB,
1469 offset+12, 4, bfree);
1470 proto_tree_add_uint(tree, hf_nfs_statfs_bavail, NullTVB,
1471 offset+16, 4, bavail);
1484 /* proc number, "proc name", dissect_request, dissect_reply */
1485 /* NULL as function pointer means: type of arguments is "void". */
1486 static const old_vsff nfs2_proc[] = {
1487 { 0, "NULL", /* OK */
1489 { 1, "GETATTR", /* OK */
1490 dissect_nfs2_fhandle_call, dissect_nfs2_attrstat_reply },
1491 { 2, "SETATTR", /* OK */
1492 dissect_nfs2_setattr_call, dissect_nfs2_attrstat_reply },
1493 { 3, "ROOT", /* OK */
1495 { 4, "LOOKUP", /* OK */
1496 dissect_nfs2_diropargs_call, dissect_nfs2_diropres_reply },
1497 { 5, "READLINK", /* OK */
1498 dissect_nfs2_fhandle_call, dissect_nfs2_readlink_reply },
1499 { 6, "READ", /* OK */
1500 dissect_nfs2_read_call, dissect_nfs2_read_reply },
1501 { 7, "WRITECACHE", /* OK */
1503 { 8, "WRITE", /* OK */
1504 dissect_nfs2_write_call, dissect_nfs2_attrstat_reply },
1505 { 9, "CREATE", /* OK */
1506 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
1507 { 10, "REMOVE", /* OK */
1508 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
1509 { 11, "RENAME", /* OK */
1510 dissect_nfs2_rename_call, dissect_nfs2_stat_reply },
1511 { 12, "LINK", /* OK */
1512 dissect_nfs2_link_call, dissect_nfs2_stat_reply },
1513 { 13, "SYMLINK", /* OK */
1514 dissect_nfs2_symlink_call, dissect_nfs2_stat_reply },
1515 { 14, "MKDIR", /* OK */
1516 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
1517 { 15, "RMDIR", /* OK */
1518 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
1519 { 16, "READDIR", /* OK */
1520 dissect_nfs2_readdir_call, dissect_nfs2_readdir_reply },
1521 { 17, "STATFS", /* OK */
1522 dissect_nfs2_fhandle_call, dissect_nfs2_statfs_reply },
1523 { 0,NULL,NULL,NULL }
1525 /* end of NFS Version 2 */
1528 /***************************/
1529 /* NFS Version 3, RFC 1813 */
1530 /***************************/
1533 /* RFC 1813, Page 15 */
1535 dissect_uint64(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1538 offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
1543 /* RFC 1813, Page 15 */
1545 dissect_uint32(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1548 offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
1553 /* RFC 1813, Page 15 */
1555 dissect_filename3(const u_char *pd, int offset, frame_data *fd,
1556 proto_tree *tree, int hf, char **string_ret)
1558 offset = dissect_rpc_string(pd,offset,fd,tree,hf,string_ret);
1563 /* RFC 1813, Page 15 */
1565 dissect_nfspath3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hf)
1567 offset = dissect_rpc_string(pd,offset,fd,tree,hf,NULL);
1572 /* RFC 1813, Page 15 */
1574 dissect_fileid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1577 offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
1582 /* RFC 1813, Page 15 */
1584 dissect_cookie3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1587 offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
1592 /* RFC 1813, Page 15 */
1594 dissect_cookieverf3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1596 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1597 proto_tree_add_text(tree, NullTVB, offset, NFS3_COOKIEVERFSIZE,
1598 "Verifier: Opaque Data");
1599 offset += NFS3_COOKIEVERFSIZE;
1604 /* RFC 1813, Page 16 */
1606 dissect_createverf3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1608 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1609 proto_tree_add_text(tree, NullTVB, offset, NFS3_CREATEVERFSIZE,
1610 "Verifier: Opaque Data");
1611 offset += NFS3_CREATEVERFSIZE;
1616 /* RFC 1813, Page 16 */
1618 dissect_writeverf3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
1620 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1621 proto_tree_add_text(tree, NullTVB, offset, NFS3_WRITEVERFSIZE,
1622 "Verifier: Opaque Data");
1623 offset += NFS3_WRITEVERFSIZE;
1628 /* RFC 1813, Page 16 */
1630 dissect_uid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1633 offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
1638 /* RFC 1813, Page 16 */
1640 dissect_gid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1643 offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
1648 /* RFC 1813, Page 16 */
1650 dissect_size3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1653 offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
1658 /* RFC 1813, Page 16 */
1660 dissect_offset3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1663 offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
1668 /* RFC 1813, Page 16 */
1670 dissect_mode3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1674 proto_item* mode3_item = NULL;
1675 proto_tree* mode3_tree = NULL;
1677 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1678 mode3 = EXTRACT_UINT(pd, offset+0);
1681 mode3_item = proto_tree_add_text(tree, NullTVB, offset, 4,
1682 "%s: 0%o", name, mode3);
1684 mode3_tree = proto_item_add_subtree(mode3_item, ett_nfs_mode3);
1687 /* RFC 1813, Page 23 */
1689 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1690 decode_boolean_bitfield(mode3, 0x800, 12, "Set user id on exec", "not SUID"));
1691 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1692 decode_boolean_bitfield(mode3, 0x400, 12, "Set group id on exec", "not SGID"));
1693 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1694 decode_boolean_bitfield(mode3, 0x200, 12, "Save swapped text even after use", "not save swapped text"));
1695 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1696 decode_boolean_bitfield(mode3, 0x100, 12, "Read permission for owner", "no Read permission for owner"));
1697 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1698 decode_boolean_bitfield(mode3, 0x80, 12, "Write permission for owner", "no Write permission for owner"));
1699 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1700 decode_boolean_bitfield(mode3, 0x40, 12, "Execute permission for owner", "no Execute permission for owner"));
1701 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1702 decode_boolean_bitfield(mode3, 0x20, 12, "Read permission for group", "no Read permission for group"));
1703 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1704 decode_boolean_bitfield(mode3, 0x10, 12, "Write permission for group", "no Write permission for group"));
1705 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1706 decode_boolean_bitfield(mode3, 0x8, 12, "Execute permission for group", "no Execute permission for group"));
1707 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1708 decode_boolean_bitfield(mode3, 0x4, 12, "Read permission for others", "no Read permission for others"));
1709 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1710 decode_boolean_bitfield(mode3, 0x2, 12, "Write permission for others", "no Write permission for others"));
1711 proto_tree_add_text(mode3_tree, NullTVB, offset, 4, "%s",
1712 decode_boolean_bitfield(mode3, 0x1, 12, "Execute permission for others", "no Execute permission for others"));
1720 /* RFC 1813, Page 16 */
1722 dissect_count3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1725 offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
1730 /* RFC 1813, Page 16,17 */
1731 const value_string names_nfs_nfsstat3[] =
1738 { 13, "ERR_ACCES" },
1739 { 17, "ERR_EXIST" },
1741 { 19, "ERR_NODEV" },
1742 { 20, "ERR_NOTDIR" },
1743 { 21, "ERR_ISDIR" },
1744 { 22, "ERR_INVAL" },
1746 { 28, "ERR_NOSPC" },
1748 { 31, "ERR_MLINK" },
1749 { 63, "ERR_NAMETOOLONG" },
1750 { 66, "ERR_NOTEMPTY" },
1751 { 69, "ERR_DQUOT" },
1752 { 70, "ERR_STALE" },
1753 { 71, "ERR_REMOTE" },
1754 { 10001, "ERR_BADHANDLE" },
1755 { 10002, "ERR_NOT_SYNC" },
1756 { 10003, "ERR_BAD_COOKIE" },
1757 { 10004, "ERR_NOTSUPP" },
1758 { 10005, "ERR_TOOSMALL" },
1759 { 10006, "ERR_SERVERFAULT" },
1760 { 10007, "ERR_BADTYPE" },
1761 { 10008, "ERR_JUKEBOX" },
1766 /* RFC 1813, Page 16 */
1768 dissect_nfsstat3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,guint32 *status)
1772 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1773 nfsstat3 = EXTRACT_UINT(pd, offset+0);
1776 proto_tree_add_uint(tree, hf_nfs_nfsstat3, NullTVB,
1777 offset, 4, nfsstat3);
1786 const value_string names_nfs_ftype3[] =
1788 { NF3REG, "Regular File" },
1789 { NF3DIR, "Directory" },
1790 { NF3BLK, "Block Special Device" },
1791 { NF3CHR, "Character Special Device" },
1792 { NF3LNK, "Symbolic Link" },
1793 { NF3SOCK,"Socket" },
1794 { NF3FIFO,"Named Pipe" },
1799 /* RFC 1813, Page 20 */
1801 dissect_ftype3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
1802 int hf, guint32* ftype3)
1806 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1807 type = EXTRACT_UINT(pd, offset+0);
1810 proto_tree_add_uint(tree, hf, NullTVB, offset, 4, type);
1819 /* RFC 1813, Page 20 */
1821 dissect_specdata3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
1826 proto_item* specdata3_item;
1827 proto_tree* specdata3_tree = NULL;
1829 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1830 specdata1 = EXTRACT_UINT(pd, offset+0);
1831 specdata2 = EXTRACT_UINT(pd, offset+4);
1834 specdata3_item = proto_tree_add_text(tree, NullTVB, offset, 8,
1835 "%s: %u,%u", name, specdata1, specdata2);
1837 specdata3_tree = proto_item_add_subtree(specdata3_item,
1841 if (specdata3_tree) {
1842 proto_tree_add_text(specdata3_tree, NullTVB,offset+0,4,
1843 "specdata1: %u", specdata1);
1844 proto_tree_add_text(specdata3_tree, NullTVB,offset+4,4,
1845 "specdata2: %u", specdata2);
1853 /* RFC 1813, Page 21 */
1855 old_dissect_nfs_fh3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
1857 tvbuff_t *tvb = tvb_create_from_top(offset);
1859 offset = dissect_nfs_fh3(tvb, 0, &pi, tree, name);
1860 return tvb_raw_offset(tvb) + offset;
1864 dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1871 proto_tree* ftree = NULL;
1873 fh3_len = tvb_get_ntohl(tvb, offset+0);
1874 fh3_len_full = rpc_roundup(fh3_len);
1875 fh3_fill = fh3_len_full - fh3_len;
1878 fitem = proto_tree_add_text(tree, tvb, offset, 4+fh3_len_full,
1881 ftree = proto_item_add_subtree(fitem, ett_nfs_fh3);
1885 proto_tree_add_text(ftree, tvb, offset+0, 4,
1886 "length: %u", fh3_len);
1887 dissect_fhandle_data(tvb, offset+4, pinfo, ftree, fh3_len);
1889 offset += 4 + fh3_len_full;
1894 /* RFC 1813, Page 21 */
1896 dissect_nfstime3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,char* name)
1901 proto_item* time_item;
1902 proto_tree* time_tree = NULL;
1904 if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
1905 seconds = EXTRACT_UINT(pd, offset+0);
1906 nseconds = EXTRACT_UINT(pd, offset+4);
1909 time_item = proto_tree_add_text(tree, NullTVB, offset, 8,
1910 "%s: %u.%09u", name, seconds, nseconds);
1912 time_tree = proto_item_add_subtree(time_item, ett_nfs_nfstime3);
1916 proto_tree_add_text(time_tree, NullTVB,offset+0,4,
1917 "seconds: %u", seconds);
1918 proto_tree_add_text(time_tree, NullTVB,offset+4,4,
1919 "nano seconds: %u", nseconds);
1926 /* RFC 1813, Page 22 */
1928 dissect_fattr3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
1930 proto_item* fattr3_item = NULL;
1931 proto_tree* fattr3_tree = NULL;
1932 int old_offset = offset;
1936 fattr3_item = proto_tree_add_text(tree, NullTVB, offset,
1937 END_OF_FRAME, "%s", name);
1939 fattr3_tree = proto_item_add_subtree(fattr3_item, ett_nfs_fattr3);
1942 offset = dissect_ftype3 (pd,offset,fd,fattr3_tree,hf_nfs_ftype3,&type);
1943 offset = dissect_mode3 (pd,offset,fd,fattr3_tree,"mode");
1944 offset = dissect_uint32 (pd,offset,fd,fattr3_tree,"nlink");
1945 offset = dissect_uid3 (pd,offset,fd,fattr3_tree,"uid");
1946 offset = dissect_gid3 (pd,offset,fd,fattr3_tree,"gid");
1947 offset = dissect_size3 (pd,offset,fd,fattr3_tree,"size");
1948 offset = dissect_size3 (pd,offset,fd,fattr3_tree,"used");
1949 offset = dissect_specdata3(pd,offset,fd,fattr3_tree,"rdev");
1950 offset = dissect_uint64 (pd,offset,fd,fattr3_tree,"fsid");
1951 offset = dissect_fileid3 (pd,offset,fd,fattr3_tree,"fileid");
1952 offset = dissect_nfstime3 (pd,offset,fd,fattr3_tree,"atime");
1953 offset = dissect_nfstime3 (pd,offset,fd,fattr3_tree,"mtime");
1954 offset = dissect_nfstime3 (pd,offset,fd,fattr3_tree,"ctime");
1956 /* now we know, that fattr3 is shorter */
1958 proto_item_set_len(fattr3_item, offset - old_offset);
1965 const value_string value_follows[] =
1968 { 1, "value follows"},
1973 /* RFC 1813, Page 23 */
1975 dissect_post_op_attr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
1977 proto_item* post_op_attr_item = NULL;
1978 proto_tree* post_op_attr_tree = NULL;
1979 int old_offset = offset;
1980 guint32 attributes_follow;
1983 post_op_attr_item = proto_tree_add_text(tree, NullTVB, offset,
1984 END_OF_FRAME, "%s", name);
1985 if (post_op_attr_item)
1986 post_op_attr_tree = proto_item_add_subtree(post_op_attr_item, ett_nfs_post_op_attr);
1989 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
1990 attributes_follow = EXTRACT_UINT(pd, offset+0);
1991 proto_tree_add_text(post_op_attr_tree, NullTVB, offset, 4,
1992 "attributes_follow: %s (%u)",
1993 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
1995 switch (attributes_follow) {
1997 offset = dissect_fattr3(pd, offset, fd, post_op_attr_tree,
2005 /* now we know, that post_op_attr_tree is shorter */
2006 if (post_op_attr_item) {
2007 proto_item_set_len(post_op_attr_item, offset - old_offset);
2014 /* RFC 1813, Page 24 */
2016 dissect_wcc_attr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2018 proto_item* wcc_attr_item = NULL;
2019 proto_tree* wcc_attr_tree = NULL;
2020 int old_offset = offset;
2023 wcc_attr_item = proto_tree_add_text(tree, NullTVB, offset,
2024 END_OF_FRAME, "%s", name);
2026 wcc_attr_tree = proto_item_add_subtree(wcc_attr_item, ett_nfs_wcc_attr);
2029 offset = dissect_size3 (pd, offset, fd, wcc_attr_tree, "size" );
2030 offset = dissect_nfstime3(pd, offset, fd, wcc_attr_tree, "mtime");
2031 offset = dissect_nfstime3(pd, offset, fd, wcc_attr_tree, "ctime");
2033 /* now we know, that wcc_attr_tree is shorter */
2034 if (wcc_attr_item) {
2035 proto_item_set_len(wcc_attr_item, offset - old_offset);
2042 /* RFC 1813, Page 24 */
2044 dissect_pre_op_attr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2046 proto_item* pre_op_attr_item = NULL;
2047 proto_tree* pre_op_attr_tree = NULL;
2048 int old_offset = offset;
2049 guint32 attributes_follow;
2052 pre_op_attr_item = proto_tree_add_text(tree, NullTVB, offset,
2053 END_OF_FRAME, "%s", name);
2054 if (pre_op_attr_item)
2055 pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item, ett_nfs_pre_op_attr);
2058 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2059 attributes_follow = EXTRACT_UINT(pd, offset+0);
2060 proto_tree_add_text(pre_op_attr_tree, NullTVB, offset, 4,
2061 "attributes_follow: %s (%u)",
2062 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2064 switch (attributes_follow) {
2066 offset = dissect_wcc_attr(pd, offset, fd, pre_op_attr_tree,
2074 /* now we know, that pre_op_attr_tree is shorter */
2075 if (pre_op_attr_item) {
2076 proto_item_set_len(pre_op_attr_item, offset - old_offset);
2083 /* RFC 1813, Page 24 */
2085 dissect_wcc_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2087 proto_item* wcc_data_item = NULL;
2088 proto_tree* wcc_data_tree = NULL;
2089 int old_offset = offset;
2092 wcc_data_item = proto_tree_add_text(tree, NullTVB, offset,
2093 END_OF_FRAME, "%s", name);
2095 wcc_data_tree = proto_item_add_subtree(wcc_data_item, ett_nfs_wcc_data);
2098 offset = dissect_pre_op_attr (pd, offset, fd, wcc_data_tree, "before");
2099 offset = dissect_post_op_attr(pd, offset, fd, wcc_data_tree, "after" );
2101 /* now we know, that wcc_data is shorter */
2102 if (wcc_data_item) {
2103 proto_item_set_len(wcc_data_item, offset - old_offset);
2110 /* RFC 1813, Page 25 */
2112 dissect_post_op_fh3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2114 proto_item* post_op_fh3_item = NULL;
2115 proto_tree* post_op_fh3_tree = NULL;
2116 int old_offset = offset;
2117 guint32 handle_follows;
2120 post_op_fh3_item = proto_tree_add_text(tree, NullTVB, offset,
2121 END_OF_FRAME, "%s", name);
2122 if (post_op_fh3_item)
2123 post_op_fh3_tree = proto_item_add_subtree(post_op_fh3_item, ett_nfs_post_op_fh3);
2126 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2127 handle_follows = EXTRACT_UINT(pd, offset+0);
2128 proto_tree_add_text(post_op_fh3_tree, NullTVB, offset, 4,
2129 "handle_follows: %s (%u)",
2130 val_to_str(handle_follows,value_follows,"Unknown"), handle_follows);
2132 switch (handle_follows) {
2134 offset = old_dissect_nfs_fh3(pd, offset, fd, post_op_fh3_tree,
2142 /* now we know, that post_op_fh3_tree is shorter */
2143 if (post_op_fh3_item) {
2144 proto_item_set_len(post_op_fh3_item, offset - old_offset);
2151 /* RFC 1813, Page 25 */
2153 dissect_set_mode3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2155 proto_item* set_mode3_item = NULL;
2156 proto_tree* set_mode3_tree = NULL;
2157 int old_offset = offset;
2161 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2162 set_it = EXTRACT_UINT(pd, offset+0);
2163 set_it_name = val_to_str(set_it,value_follows,"Unknown");
2166 set_mode3_item = proto_tree_add_text(tree, NullTVB, offset,
2167 END_OF_FRAME, "%s: %s", name, set_it_name);
2169 set_mode3_tree = proto_item_add_subtree(set_mode3_item, ett_nfs_set_mode3);
2173 proto_tree_add_text(set_mode3_tree, NullTVB, offset, 4,
2174 "set_it: %s (%u)", set_it_name, set_it);
2180 offset = dissect_mode3(pd, offset, fd, set_mode3_tree,
2188 /* now we know, that set_mode3 is shorter */
2189 if (set_mode3_item) {
2190 proto_item_set_len(set_mode3_item, offset - old_offset);
2197 /* RFC 1813, Page 26 */
2199 dissect_set_uid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2201 proto_item* set_uid3_item = NULL;
2202 proto_tree* set_uid3_tree = NULL;
2203 int old_offset = offset;
2207 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2208 set_it = EXTRACT_UINT(pd, offset+0);
2209 set_it_name = val_to_str(set_it,value_follows,"Unknown");
2212 set_uid3_item = proto_tree_add_text(tree, NullTVB, offset,
2213 END_OF_FRAME, "%s: %s", name, set_it_name);
2215 set_uid3_tree = proto_item_add_subtree(set_uid3_item, ett_nfs_set_uid3);
2219 proto_tree_add_text(set_uid3_tree, NullTVB, offset, 4,
2220 "set_it: %s (%u)", set_it_name, set_it);
2226 offset = dissect_uid3(pd, offset, fd, set_uid3_tree,
2234 /* now we know, that set_uid3 is shorter */
2235 if (set_uid3_item) {
2236 proto_item_set_len(set_uid3_item, offset - old_offset);
2243 /* RFC 1813, Page 26 */
2245 dissect_set_gid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2247 proto_item* set_gid3_item = NULL;
2248 proto_tree* set_gid3_tree = NULL;
2249 int old_offset = offset;
2253 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2254 set_it = EXTRACT_UINT(pd, offset+0);
2255 set_it_name = val_to_str(set_it,value_follows,"Unknown");
2258 set_gid3_item = proto_tree_add_text(tree, NullTVB, offset,
2259 END_OF_FRAME, "%s: %s", name, set_it_name);
2261 set_gid3_tree = proto_item_add_subtree(set_gid3_item, ett_nfs_set_gid3);
2265 proto_tree_add_text(set_gid3_tree, NullTVB, offset, 4,
2266 "set_it: %s (%u)", set_it_name, set_it);
2272 offset = dissect_gid3(pd, offset, fd, set_gid3_tree,
2280 /* now we know, that set_gid3 is shorter */
2281 if (set_gid3_item) {
2282 proto_item_set_len(set_gid3_item, offset - old_offset);
2289 /* RFC 1813, Page 26 */
2291 dissect_set_size3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2293 proto_item* set_size3_item = NULL;
2294 proto_tree* set_size3_tree = NULL;
2295 int old_offset = offset;
2299 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2300 set_it = EXTRACT_UINT(pd, offset+0);
2301 set_it_name = val_to_str(set_it,value_follows,"Unknown");
2304 set_size3_item = proto_tree_add_text(tree, NullTVB, offset,
2305 END_OF_FRAME, "%s: %s", name, set_it_name);
2307 set_size3_tree = proto_item_add_subtree(set_size3_item, ett_nfs_set_size3);
2311 proto_tree_add_text(set_size3_tree, NullTVB, offset, 4,
2312 "set_it: %s (%u)", set_it_name, set_it);
2318 offset = dissect_size3(pd, offset, fd, set_size3_tree,
2326 /* now we know, that set_size3 is shorter */
2327 if (set_size3_item) {
2328 proto_item_set_len(set_size3_item, offset - old_offset);
2335 /* RFC 1813, Page 25 */
2336 #define DONT_CHANGE 0
2337 #define SET_TO_SERVER_TIME 1
2338 #define SET_TO_CLIENT_TIME 2
2340 const value_string time_how[] =
2342 { DONT_CHANGE, "don't change" },
2343 { SET_TO_SERVER_TIME, "set to server time" },
2344 { SET_TO_CLIENT_TIME, "set to client time" },
2349 /* RFC 1813, Page 26 */
2351 dissect_set_atime(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2353 proto_item* set_atime_item = NULL;
2354 proto_tree* set_atime_tree = NULL;
2355 int old_offset = offset;
2359 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2360 set_it = EXTRACT_UINT(pd, offset+0);
2361 set_it_name = val_to_str(set_it,time_how,"Unknown");
2364 set_atime_item = proto_tree_add_text(tree, NullTVB, offset,
2365 END_OF_FRAME, "%s: %s",
2368 set_atime_tree = proto_item_add_subtree(set_atime_item, ett_nfs_set_atime);
2372 proto_tree_add_text(set_atime_tree, NullTVB, offset, 4,
2373 "set_it: %s (%u)", set_it_name, set_it);
2378 case SET_TO_CLIENT_TIME:
2380 offset = dissect_nfstime3(pd, offset, fd, set_atime_tree,
2388 /* now we know, that set_atime is shorter */
2389 if (set_atime_item) {
2390 proto_item_set_len(set_atime_item, offset - old_offset);
2397 /* RFC 1813, Page 26 */
2399 dissect_set_mtime(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2401 proto_item* set_mtime_item = NULL;
2402 proto_tree* set_mtime_tree = NULL;
2403 int old_offset = offset;
2407 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2408 set_it = EXTRACT_UINT(pd, offset+0);
2409 set_it_name = val_to_str(set_it,time_how,"Unknown");
2412 set_mtime_item = proto_tree_add_text(tree, NullTVB, offset,
2413 END_OF_FRAME, "%s: %s",
2416 set_mtime_tree = proto_item_add_subtree(set_mtime_item, ett_nfs_set_mtime);
2420 proto_tree_add_text(set_mtime_tree, NullTVB, offset, 4,
2421 "set_it: %s (%u)", set_it_name, set_it);
2426 case SET_TO_CLIENT_TIME:
2428 offset = dissect_nfstime3(pd, offset, fd, set_mtime_tree,
2436 /* now we know, that set_mtime is shorter */
2437 if (set_mtime_item) {
2438 proto_item_set_len(set_mtime_item, offset - old_offset);
2445 /* RFC 1813, Page 25..27 */
2447 dissect_sattr3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2449 proto_item* sattr3_item = NULL;
2450 proto_tree* sattr3_tree = NULL;
2451 int old_offset = offset;
2454 sattr3_item = proto_tree_add_text(tree, NullTVB, offset,
2455 END_OF_FRAME, "%s", name);
2457 sattr3_tree = proto_item_add_subtree(sattr3_item, ett_nfs_sattr3);
2460 offset = dissect_set_mode3(pd, offset, fd, sattr3_tree, "mode");
2461 offset = dissect_set_uid3 (pd, offset, fd, sattr3_tree, "uid");
2462 offset = dissect_set_gid3 (pd, offset, fd, sattr3_tree, "gid");
2463 offset = dissect_set_size3(pd, offset, fd, sattr3_tree, "size");
2464 offset = dissect_set_atime(pd, offset, fd, sattr3_tree, "atime");
2465 offset = dissect_set_mtime(pd, offset, fd, sattr3_tree, "mtime");
2467 /* now we know, that sattr3 is shorter */
2469 proto_item_set_len(sattr3_item, offset - old_offset);
2476 /* RFC 1813, Page 27 */
2478 dissect_diropargs3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2480 proto_item* diropargs3_item = NULL;
2481 proto_tree* diropargs3_tree = NULL;
2482 int old_offset = offset;
2485 diropargs3_item = proto_tree_add_text(tree, NullTVB, offset,
2486 END_OF_FRAME, "%s", name);
2487 if (diropargs3_item)
2488 diropargs3_tree = proto_item_add_subtree(diropargs3_item, ett_nfs_diropargs3);
2491 offset = old_dissect_nfs_fh3 (pd, offset, fd, diropargs3_tree, "dir");
2492 offset = dissect_filename3(pd, offset, fd, diropargs3_tree, hf_nfs_name,NULL);
2494 /* now we know, that diropargs3 is shorter */
2495 if (diropargs3_item) {
2496 proto_item_set_len(diropargs3_item, offset - old_offset);
2503 /* RFC 1813, Page 27 */
2505 dissect_nfs3_diropargs3_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
2507 offset = dissect_diropargs3(pd, offset, fd, tree, "object");
2513 /* RFC 1813, Page 40 */
2515 dissect_access(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, char* name)
2518 proto_item* access_item = NULL;
2519 proto_tree* access_tree = NULL;
2521 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2522 access = EXTRACT_UINT(pd, offset+0);
2525 access_item = proto_tree_add_text(tree, NullTVB, offset, 4,
2526 "%s: 0x%02x", name, access);
2528 access_tree = proto_item_add_subtree(access_item, ett_nfs_access);
2532 proto_tree_add_text(access_tree, NullTVB, offset, 4, "%s READ",
2533 decode_boolean_bitfield(access, 0x001, 6, "allow", "not allow"));
2534 proto_tree_add_text(access_tree, NullTVB, offset, 4, "%s LOOKUP",
2535 decode_boolean_bitfield(access, 0x002, 6, "allow", "not allow"));
2536 proto_tree_add_text(access_tree, NullTVB, offset, 4, "%s MODIFY",
2537 decode_boolean_bitfield(access, 0x004, 6, "allow", "not allow"));
2538 proto_tree_add_text(access_tree, NullTVB, offset, 4, "%s EXTEND",
2539 decode_boolean_bitfield(access, 0x008, 6, "allow", "not allow"));
2540 proto_tree_add_text(access_tree, NullTVB, offset, 4, "%s DELETE",
2541 decode_boolean_bitfield(access, 0x010, 6, "allow", "not allow"));
2542 proto_tree_add_text(access_tree, NullTVB, offset, 4, "%s EXECUTE",
2543 decode_boolean_bitfield(access, 0x020, 6, "allow", "not allow"));
2551 /* NFS3 file handle dissector */
2553 dissect_nfs3_nfs_fh3_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2555 offset = old_dissect_nfs_fh3(pd, offset, fd, tree, "object");
2560 /* generic NFS3 reply dissector */
2562 dissect_nfs3_any_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2566 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2573 /* RFC 1813, Page 32,33 */
2575 dissect_nfs3_getattr_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2577 offset = old_dissect_nfs_fh3(pd, offset, fd, tree, "object");
2582 /* RFC 1813, Page 32,33 */
2584 dissect_nfs3_getattr_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2588 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2591 offset = dissect_fattr3(pd, offset, fd, tree, "obj_attributes");
2602 /* RFC 1813, Page 33 */
2604 dissect_sattrguard3(const u_char* pd, int offset, frame_data* fd, proto_tree* tree, char *name)
2606 proto_item* sattrguard3_item = NULL;
2607 proto_tree* sattrguard3_tree = NULL;
2608 int old_offset = offset;
2612 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2613 check = EXTRACT_UINT(pd, offset+0);
2614 check_name = val_to_str(check,value_follows,"Unknown");
2617 sattrguard3_item = proto_tree_add_text(tree, NullTVB, offset,
2618 END_OF_FRAME, "%s: %s", name, check_name);
2619 if (sattrguard3_item)
2620 sattrguard3_tree = proto_item_add_subtree(sattrguard3_item, ett_nfs_sattrguard3);
2623 if (sattrguard3_tree)
2624 proto_tree_add_text(sattrguard3_tree, NullTVB, offset, 4,
2625 "check: %s (%u)", check_name, check);
2631 offset = dissect_nfstime3(pd, offset, fd, sattrguard3_tree,
2639 /* now we know, that sattrguard3 is shorter */
2640 if (sattrguard3_item) {
2641 proto_item_set_len(sattrguard3_item, offset - old_offset);
2648 /* RFC 1813, Page 33..36 */
2650 dissect_nfs3_setattr_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2652 offset = old_dissect_nfs_fh3 (pd, offset, fd, tree, "object");
2653 offset = dissect_sattr3 (pd, offset, fd, tree, "new_attributes");
2654 offset = dissect_sattrguard3(pd, offset, fd, tree, "guard");
2659 /* RFC 1813, Page 33..36 */
2661 dissect_nfs3_setattr_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2665 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2668 offset = dissect_wcc_data(pd, offset, fd, tree, "obj_wcc");
2671 offset = dissect_wcc_data(pd, offset, fd, tree, "obj_wcc");
2679 /* RFC 1813, Page 37..39 */
2681 dissect_nfs3_lookup_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2683 offset = dissect_diropargs3 (pd, offset, fd, tree, "what");
2688 /* RFC 1813, Page 37..39 */
2690 dissect_nfs3_lookup_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2694 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2697 offset = old_dissect_nfs_fh3 (pd, offset, fd, tree, "object");
2698 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
2699 offset = dissect_post_op_attr(pd, offset, fd, tree, "dir_attributes");
2702 offset = dissect_post_op_attr(pd, offset, fd, tree, "dir_attributes");
2710 /* RFC 1813, Page 40..43 */
2712 dissect_nfs3_access_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2714 offset = old_dissect_nfs_fh3(pd, offset, fd, tree, "object");
2715 offset = dissect_access (pd, offset, fd, tree, "access");
2721 /* RFC 1813, Page 40..43 */
2723 dissect_nfs3_access_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2727 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2730 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
2731 offset = dissect_access (pd, offset, fd, tree, "access");
2734 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
2742 /* RFC 1813, Page 44,45 */
2744 dissect_nfs3_readlink_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2748 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2751 offset = dissect_post_op_attr(pd, offset, fd, tree, "symlink_attributes");
2752 offset = dissect_nfspath3 (pd, offset, fd, tree, hf_nfs_readlink_data);
2755 offset = dissect_post_op_attr(pd, offset, fd, tree, "symlink_attributes");
2763 /* RFC 1813, Page 46..48 */
2765 dissect_nfs3_read_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2767 offset = old_dissect_nfs_fh3(pd, offset, fd, tree, "file");
2768 offset = dissect_offset3(pd, offset, fd, tree, "offset");
2769 offset = dissect_count3 (pd, offset, fd, tree, "count");
2775 /* RFC 1813, Page 46..48 */
2777 dissect_nfs3_read_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2781 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2784 offset = dissect_post_op_attr(pd, offset, fd, tree, "file_attributes");
2785 offset = dissect_count3 (pd, offset, fd, tree, "count");
2786 offset = dissect_rpc_bool (pd, offset, fd, tree, hf_nfs_read_eof);
2787 offset = dissect_nfsdata (pd, offset, fd, tree, hf_nfs_data);
2790 offset = dissect_post_op_attr(pd, offset, fd, tree, "file_attributes");
2798 /* RFC 1813, Page 49 */
2799 static const value_string names_stable_how[] = {
2800 { UNSTABLE, "UNSTABLE" },
2801 { DATA_SYNC, "DATA_SYNC" },
2802 { FILE_SYNC, "FILE_SYNC" },
2807 /* RFC 1813, Page 49 */
2809 dissect_stable_how(const u_char* pd, int offset, frame_data* fd, proto_tree* tree, int hfindex)
2813 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
2814 stable_how = EXTRACT_UINT(pd,offset+0);
2816 proto_tree_add_uint(tree, hfindex, NullTVB,
2817 offset, 4, stable_how);
2825 /* RFC 1813, Page 49..54 */
2827 dissect_nfs3_write_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2829 offset = old_dissect_nfs_fh3 (pd, offset, fd, tree, "file");
2830 offset = dissect_offset3 (pd, offset, fd, tree, "offset");
2831 offset = dissect_count3 (pd, offset, fd, tree, "count");
2832 offset = dissect_stable_how(pd, offset, fd, tree, hf_nfs_write_stable);
2833 offset = dissect_nfsdata (pd, offset, fd, tree, hf_nfs_data);
2839 /* RFC 1813, Page 49..54 */
2841 dissect_nfs3_write_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2845 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2848 offset = dissect_wcc_data (pd, offset, fd, tree, "file_wcc");
2849 offset = dissect_count3 (pd, offset, fd, tree, "count");
2850 offset = dissect_stable_how(pd, offset, fd, tree, hf_nfs_write_committed);
2851 offset = dissect_writeverf3(pd, offset, fd, tree);
2854 offset = dissect_wcc_data(pd, offset, fd, tree, "file_wcc");
2862 /* RFC 1813, Page 54 */
2863 static const value_string names_createmode3[] = {
2864 { UNCHECKED, "UNCHECKED" },
2865 { GUARDED, "GUARDED" },
2866 { EXCLUSIVE, "EXCLUSIVE" },
2871 /* RFC 1813, Page 54 */
2873 dissect_createmode3(const u_char* pd, int offset, frame_data* fd, proto_tree* tree, guint32* mode)
2877 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
2878 mode_value = EXTRACT_UINT(pd, offset + 0);
2880 proto_tree_add_uint(tree, hf_nfs_createmode3, NullTVB,
2881 offset+0, 4, mode_value);
2890 /* RFC 1813, Page 54..58 */
2892 dissect_nfs3_create_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2896 offset = dissect_diropargs3 (pd, offset, fd, tree, "where");
2897 offset = dissect_createmode3(pd, offset, fd, tree, &mode);
2901 offset = dissect_sattr3 (pd, offset, fd, tree, "obj_attributes");
2904 offset = dissect_createverf3(pd, offset, fd, tree);
2912 /* RFC 1813, Page 54..58 */
2914 dissect_nfs3_create_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2918 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2921 offset = dissect_post_op_fh3 (pd, offset, fd, tree, "obj");
2922 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
2923 offset = dissect_wcc_data (pd, offset, fd, tree, "dir_wcc");
2926 offset = dissect_wcc_data (pd, offset, fd, tree, "dir_wcc");
2934 /* RFC 1813, Page 58..60 */
2936 dissect_nfs3_mkdir_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2938 offset = dissect_diropargs3(pd, offset, fd, tree, "where");
2939 offset = dissect_sattr3 (pd, offset, fd, tree, "attributes");
2945 /* RFC 1813, Page 61..63 */
2947 dissect_nfs3_symlink_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2949 offset = dissect_diropargs3(pd, offset, fd, tree, "where");
2950 offset = dissect_sattr3 (pd, offset, fd, tree, "symlink_attributes");
2951 offset = dissect_nfspath3 (pd, offset, fd, tree, hf_nfs_symlink_to);
2957 /* RFC 1813, Page 63..66 */
2959 dissect_nfs3_mknod_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2963 offset = dissect_diropargs3(pd, offset, fd, tree, "where");
2964 offset = dissect_ftype3(pd, offset, fd, tree, hf_nfs_ftype3, &type);
2968 offset = dissect_sattr3(pd, offset, fd, tree, "dev_attributes");
2969 offset = dissect_specdata3(pd, offset, fd, tree, "spec");
2973 offset = dissect_sattr3(pd, offset, fd, tree, "pipe_attributes");
2984 /* RFC 1813, Page 67..69 */
2986 dissect_nfs3_remove_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
2990 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
2993 offset = dissect_wcc_data (pd, offset, fd, tree, "dir_wcc");
2996 offset = dissect_wcc_data (pd, offset, fd, tree, "dir_wcc");
3004 /* RFC 1813, Page 71..74 */
3006 dissect_nfs3_rename_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3008 offset = dissect_diropargs3(pd, offset, fd, tree, "from");
3009 offset = dissect_diropargs3(pd, offset, fd, tree, "to");
3015 /* RFC 1813, Page 71..74 */
3017 dissect_nfs3_rename_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3021 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
3024 offset = dissect_wcc_data(pd, offset, fd, tree, "fromdir_wcc");
3025 offset = dissect_wcc_data(pd, offset, fd, tree, "todir_wcc");
3028 offset = dissect_wcc_data(pd, offset, fd, tree, "fromdir_wcc");
3029 offset = dissect_wcc_data(pd, offset, fd, tree, "todir_wcc");
3037 /* RFC 1813, Page 74..76 */
3039 dissect_nfs3_link_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3041 offset = old_dissect_nfs_fh3 (pd, offset, fd, tree, "file");
3042 offset = dissect_diropargs3(pd, offset, fd, tree, "link");
3048 /* RFC 1813, Page 74..76 */
3050 dissect_nfs3_link_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3054 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
3057 offset = dissect_post_op_attr(pd, offset, fd, tree, "file_attributes");
3058 offset = dissect_wcc_data (pd, offset, fd, tree, "linkdir_wcc");
3061 offset = dissect_post_op_attr(pd, offset, fd, tree, "file_attributes");
3062 offset = dissect_wcc_data (pd, offset, fd, tree, "linkdir_wcc");
3070 /* RFC 1813, Page 76..80 */
3072 dissect_nfs3_readdir_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3074 offset = old_dissect_nfs_fh3 (pd, offset, fd, tree, "dir");
3075 offset = dissect_cookie3 (pd, offset, fd, tree, "cookie");
3076 offset = dissect_cookieverf3(pd, offset, fd, tree);
3077 offset = dissect_count3 (pd, offset, fd, tree, "count");
3083 /* RFC 1813, Page 76..80 */
3085 dissect_entry3(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3087 proto_item* entry_item = NULL;
3088 proto_tree* entry_tree = NULL;
3089 int old_offset = offset;
3093 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, NullTVB,
3094 offset+0, END_OF_FRAME, FALSE);
3096 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
3099 offset = dissect_fileid3(pd, offset, fd, entry_tree, "fileid");
3101 offset = dissect_filename3(pd, offset, fd, entry_tree,
3102 hf_nfs_readdir_entry_name, &name);
3104 proto_item_set_text(entry_item, "Entry: name %s", name);
3107 offset = dissect_cookie3(pd, offset, fd, entry_tree, "cookie");
3109 /* now we know, that a readdir entry is shorter */
3111 proto_item_set_len(entry_item, offset - old_offset);
3118 /* RFC 1813, Page 76..80 */
3120 dissect_nfs3_readdir_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3125 offset = dissect_stat(pd, offset, fd, tree, &status);
3128 offset = dissect_post_op_attr(pd, offset, fd, tree, "dir_attributes");
3129 offset = dissect_cookieverf3(pd, offset, fd, tree);
3130 offset = dissect_rpc_list(pd, offset, fd, tree,
3132 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3133 eof_value = EXTRACT_UINT(pd, offset+0);
3135 proto_tree_add_uint(tree, hf_nfs_readdir_eof, NullTVB,
3136 offset+ 0, 4, eof_value);
3140 offset = dissect_post_op_attr(pd, offset, fd, tree, "dir_attributes");
3148 /* RFC 1813, Page 80..83 */
3150 dissect_nfs3_readdirplus_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3152 offset = old_dissect_nfs_fh3 (pd, offset, fd, tree, "dir");
3153 offset = dissect_cookie3 (pd, offset, fd, tree, "cookie");
3154 offset = dissect_cookieverf3(pd, offset, fd, tree);
3155 offset = dissect_count3 (pd, offset, fd, tree, "dircount");
3156 offset = dissect_count3 (pd, offset, fd, tree, "maxcount");
3162 /* RFC 1813, Page 80..83 */
3164 dissect_entryplus3(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3166 proto_item* entry_item = NULL;
3167 proto_tree* entry_tree = NULL;
3168 int old_offset = offset;
3172 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, NullTVB,
3173 offset+0, END_OF_FRAME, FALSE);
3175 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
3178 offset = dissect_fileid3(pd, offset, fd, entry_tree, "fileid");
3180 offset = dissect_filename3(pd, offset, fd, entry_tree,
3181 hf_nfs_readdirplus_entry_name, &name);
3183 proto_item_set_text(entry_item, "Entry: name %s", name);
3186 offset = dissect_cookie3(pd, offset, fd, entry_tree, "cookie");
3188 offset = dissect_post_op_attr(pd, offset, fd, entry_tree, "name_attributes");
3189 offset = dissect_post_op_fh3(pd, offset, fd, entry_tree, "name_handle");
3191 /* now we know, that a readdirplus entry is shorter */
3193 proto_item_set_len(entry_item, offset - old_offset);
3200 /* RFC 1813, Page 80..83 */
3202 dissect_nfs3_readdirplus_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3207 offset = dissect_stat(pd, offset, fd, tree, &status);
3210 offset = dissect_post_op_attr(pd, offset, fd, tree, "dir_attributes");
3211 offset = dissect_cookieverf3(pd, offset, fd, tree);
3212 offset = dissect_rpc_list(pd, offset, fd, tree,
3213 dissect_entryplus3);
3214 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3215 eof_value = EXTRACT_UINT(pd, offset+0);
3217 proto_tree_add_uint(tree, hf_nfs_readdir_eof, NullTVB,
3218 offset+ 0, 4, eof_value);
3222 offset = dissect_post_op_attr(pd, offset, fd, tree, "dir_attributes");
3230 /* RFC 1813, Page 84..86 */
3232 dissect_nfs3_fsstat_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3237 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
3240 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
3241 offset = dissect_size3 (pd, offset, fd, tree, "tbytes");
3242 offset = dissect_size3 (pd, offset, fd, tree, "fbytes");
3243 offset = dissect_size3 (pd, offset, fd, tree, "abytes");
3244 offset = dissect_size3 (pd, offset, fd, tree, "tfiles");
3245 offset = dissect_size3 (pd, offset, fd, tree, "ffiles");
3246 offset = dissect_size3 (pd, offset, fd, tree, "afiles");
3247 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
3248 invarsec = EXTRACT_UINT(pd, offset + 0);
3250 proto_tree_add_uint(tree, hf_nfs_fsstat_invarsec, NullTVB,
3251 offset+0, 4, invarsec);
3255 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
3263 #define FSF3_LINK 0x0001
3264 #define FSF3_SYMLINK 0x0002
3265 #define FSF3_HOMOGENEOUS 0x0008
3266 #define FSF3_CANSETTIME 0x0010
3269 /* RFC 1813, Page 86..90 */
3271 dissect_nfs3_fsinfo_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3282 proto_item* properties_item = NULL;
3283 proto_tree* properties_tree = NULL;
3285 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
3288 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
3289 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3290 rtmax = EXTRACT_UINT(pd, offset+0);
3292 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmax, NullTVB,
3293 offset+0, 4, rtmax);
3295 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3296 rtpref = EXTRACT_UINT(pd, offset+0);
3298 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtpref, NullTVB,
3299 offset+0, 4, rtpref);
3301 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3302 rtmult = EXTRACT_UINT(pd, offset+0);
3304 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmult, NullTVB,
3305 offset+0, 4, rtmult);
3307 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3308 wtmax = EXTRACT_UINT(pd, offset+0);
3310 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmax, NullTVB,
3311 offset+0, 4, wtmax);
3313 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3314 wtpref = EXTRACT_UINT(pd, offset+0);
3316 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtpref, NullTVB,
3317 offset+0, 4, wtpref);
3319 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3320 wtmult = EXTRACT_UINT(pd, offset+0);
3322 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmult, NullTVB,
3323 offset+0, 4, wtmult);
3325 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3326 dtpref = EXTRACT_UINT(pd, offset+0);
3328 proto_tree_add_uint(tree, hf_nfs_fsinfo_dtpref, NullTVB,
3329 offset+0, 4, dtpref);
3332 offset = dissect_size3 (pd, offset, fd, tree, "maxfilesize");
3333 offset = dissect_nfstime3(pd, offset, fd, tree, "time_delta");
3334 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
3335 properties = EXTRACT_UINT(pd, offset+0);
3337 properties_item = proto_tree_add_uint(tree,
3338 hf_nfs_fsinfo_properties,
3339 NullTVB, offset+0, 4, properties);
3340 if (properties_item)
3341 properties_tree = proto_item_add_subtree(properties_item, ett_nfs_fsinfo_properties);
3342 if (properties_tree) {
3343 proto_tree_add_text(properties_tree, NullTVB,
3345 decode_boolean_bitfield(properties,
3347 "SETATTR can set time on server",
3348 "SETATTR can't set time on server"));
3350 proto_tree_add_text(properties_tree, NullTVB,
3352 decode_boolean_bitfield(properties,
3354 "PATHCONF is valid for all files",
3355 "PATHCONF should be get for every single file"));
3357 proto_tree_add_text(properties_tree, NullTVB,
3359 decode_boolean_bitfield(properties,
3361 "File System supports symbolic links",
3362 "File System does not symbolic hard links"));
3364 proto_tree_add_text(properties_tree, NullTVB,
3366 decode_boolean_bitfield(properties,
3368 "File System supports hard links",
3369 "File System does not support hard links"));
3375 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
3383 /* RFC 1813, Page 90..92 */
3385 dissect_nfs3_pathconf_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3391 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
3394 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
3395 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
3396 linkmax = EXTRACT_UINT(pd, offset + 0);
3398 proto_tree_add_uint(tree, hf_nfs_pathconf_linkmax, NullTVB,
3399 offset+0, 4, linkmax);
3401 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
3402 name_max = EXTRACT_UINT(pd, offset + 0);
3404 proto_tree_add_uint(tree, hf_nfs_pathconf_name_max, NullTVB,
3405 offset+0, 4, name_max);
3407 offset = dissect_rpc_bool(pd, offset, fd, tree, hf_nfs_pathconf_no_trunc);
3408 offset = dissect_rpc_bool(pd, offset, fd, tree, hf_nfs_pathconf_chown_restricted);
3409 offset = dissect_rpc_bool(pd, offset, fd, tree, hf_nfs_pathconf_case_insensitive);
3410 offset = dissect_rpc_bool(pd, offset, fd, tree, hf_nfs_pathconf_case_preserving);
3413 offset = dissect_post_op_attr(pd, offset, fd, tree, "obj_attributes");
3421 /* RFC 1813, Page 92..95 */
3423 dissect_nfs3_commit_call(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3425 offset = old_dissect_nfs_fh3(pd, offset, fd, tree, "file");
3426 offset = dissect_offset3(pd, offset, fd, tree, "offset");
3427 offset = dissect_count3 (pd, offset, fd, tree, "count");
3433 /* RFC 1813, Page 92..95 */
3435 dissect_nfs3_commit_reply(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
3439 offset = dissect_nfsstat3(pd, offset, fd, tree, &status);
3442 offset = dissect_wcc_data (pd, offset, fd, tree, "file_wcc");
3443 offset = dissect_writeverf3(pd, offset, fd, tree);
3446 offset = dissect_wcc_data(pd, offset, fd, tree, "file_wcc");
3453 /* 1 missing functions */
3455 /* NFS Version 4 Protocol Draft Specification 07 */
3458 dissect_nfs_utf8string(const u_char *pd, int offset, frame_data *fd,
3459 proto_tree *tree, int hf, char **string_ret)
3461 /* TODO: this needs to be fixed */
3462 return dissect_rpc_string(pd, offset, fd, tree, hf, string_ret);
3466 dissect_nfs_seqid4(const u_char *pd, int offset, frame_data *fd,
3471 seqid = EXTRACT_UINT(pd, offset);
3472 proto_tree_add_uint(tree, hf_nfs_seqid4, NullTVB, offset, 4, seqid);
3479 dissect_nfs_stateid4(const u_char *pd, int offset, frame_data *fd,
3480 proto_tree *tree, char *name)
3482 return dissect_rpc_uint64(pd, offset, fd, tree, name);
3486 dissect_nfs_offset4(const u_char *pd, int offset, frame_data *fd,
3487 proto_tree *tree, char *name)
3489 return dissect_rpc_uint64(pd, offset, fd, tree, name);
3493 dissect_nfs_count4(const u_char *pd, int offset, frame_data *fd,
3494 proto_tree *tree, char *name)
3496 return dissect_rpc_uint32(pd, offset, fd, tree, name);
3500 dissect_nfs_type4(const u_char *pd, int offset, frame_data *fd,
3501 proto_tree *tree, char *name)
3503 return dissect_rpc_uint32(pd, offset, fd, tree, name);
3507 dissect_nfs_linktext4(const u_char *pd, int offset, frame_data *fd,
3508 proto_tree *tree, char *name)
3510 return dissect_nfs_utf8string(pd, offset, fd, tree, hf_nfs_linktext4, NULL);
3514 dissect_nfs_specdata4(const u_char *pd, int offset, frame_data *fd,
3515 proto_tree *tree, char *name)
3517 offset = dissect_rpc_uint32(pd, offset, fd, tree, "specdata1");
3518 offset = dissect_rpc_uint32(pd, offset, fd, tree, "specdata2");
3524 dissect_nfs_clientid4(const u_char *pd, int offset, frame_data *fd,
3525 proto_tree *tree, char *name)
3527 return dissect_rpc_uint64(pd, offset, fd, tree, name);
3531 dissect_nfs_client_id4(const u_char *pd, int offset, frame_data *fd,
3532 proto_tree *tree, char *name)
3534 offset = dissect_nfs_clientid4(pd, offset, fd, tree, "Verifier");
3535 offset = dissect_nfsdata(pd, offset, fd, tree, hf_nfs_data);
3540 static const value_string names_ftype4[] = {
3541 { NF4LNK, "NF4LNK" },
3542 { NF4BLK, "NF4BLK" },
3543 { NF4CHR, "NF4CHR" },
3544 { NF4SOCK, "NF4SOCK" },
3545 { NF4FIFO, "NF4FIFO" },
3546 { NF4DIR, "NF4DIR" },
3551 dissect_nfs_ftype4(const u_char *pd, int offset, frame_data *fd,
3552 proto_tree *tree, char *name)
3556 ftype4 = EXTRACT_UINT(pd, offset);
3557 proto_tree_add_uint(tree, hf_nfs_ftype4, NullTVB, offset, 4, ftype4);
3564 dissect_nfs_component4(const u_char *pd, int offset, frame_data *fd,
3565 proto_tree *tree, char *name)
3567 return dissect_nfs_utf8string(pd, offset, fd, tree, hf_nfs_component4,
3572 dissect_nfs_lock_type4(const u_char *pd, int offset, frame_data *fd,
3573 proto_tree *tree, char *name)
3575 return dissect_rpc_uint32(pd, offset, fd, tree, name);
3579 dissect_nfs_reclaim4(const u_char *pd, int offset, frame_data *fd,
3580 proto_tree *tree, char *name)
3582 return dissect_rpc_uint32(pd, offset, fd, tree, name);
3586 dissect_nfs_length4(const u_char *pd, int offset, frame_data *fd,
3587 proto_tree *tree, char *name)
3589 return dissect_rpc_uint64(pd, offset, fd, tree, name);
3593 dissect_nfs_opaque4(const u_char *pd, int offset, frame_data *fd,
3594 proto_tree *tree, char *name);
3597 dissect_nfs_lockowner4(const u_char *pd, int offset, frame_data *fd,
3598 proto_tree *tree, char *name)
3600 proto_tree *newftree = NULL;
3601 proto_item *fitem = NULL;
3603 fitem = proto_tree_add_text(tree, NullTVB, offset, 4, "Owner");
3606 newftree = proto_item_add_subtree(fitem, ett_nfs_lockowner4);
3609 offset = dissect_rpc_uint64(pd, offset, fd, newftree, "Client ID");
3610 offset = dissect_nfs_opaque4(pd, offset, fd, newftree, "Owner");
3618 dissect_nfs_pathname4(const u_char *pd, int offset, frame_data *fd,
3619 proto_tree *tree, char *name)
3621 guint comp_count, i;
3622 proto_item *fitem = NULL;
3623 proto_tree *newftree = NULL;
3625 comp_count=EXTRACT_UINT(pd, offset);
3626 fitem = proto_tree_add_text(tree, NullTVB, offset, 4,
3627 "pathname components (%d)", comp_count);
3631 newftree = proto_item_add_subtree(fitem, ett_nfs_pathname4);
3634 for (i=0; i<comp_count; i++)
3635 offset=dissect_nfs_component4(pd, offset, fd, newftree, "comp");
3643 dissect_nfs_bitmap4(const u_char *pd, int offset, frame_data *fd,
3644 proto_tree *tree, char *name);
3647 dissect_nfs_fattr4(const u_char *pd, int offset, frame_data *fd,
3648 proto_tree *tree, char *name)
3650 offset = dissect_nfs_bitmap4(pd, offset, fd, tree, "attrmask");
3651 offset = dissect_nfs_opaque4(pd, offset, fd, tree, "attr_vals");
3656 static const value_string names_open4_share_access[] = {
3657 #define OPEN4_SHARE_ACCESS_READ 0x00000001
3658 { OPEN4_SHARE_ACCESS_READ, "OPEN4_SHARE_ACCESS_READ" },
3659 #define OPEN4_SHARE_ACCESS_WRITE 0x00000002
3660 { OPEN4_SHARE_ACCESS_WRITE, "OPEN4_SHARE_ACCESS_WRITE" },
3661 #define OPEN4_SHARE_ACCESS_BOTH 0x00000003
3662 { OPEN4_SHARE_ACCESS_BOTH, "OPEN4_SHARE_ACCESS_BOTH" },
3667 dissect_nfs_open4_share_access(const u_char *pd, int offset, frame_data *fd,
3672 share_access = EXTRACT_UINT(pd, offset);
3673 proto_tree_add_uint(tree, hf_nfs_open4_share_access, NullTVB, offset, 4,
3680 static const value_string names_open4_share_deny[] = {
3681 #define OPEN4_SHARE_DENY_NONE 0x00000000
3682 { OPEN4_SHARE_DENY_NONE, "OPEN4_SHARE_DENY_NONE" },
3683 #define OPEN4_SHARE_DENY_READ 0x00000001
3684 { OPEN4_SHARE_DENY_READ, "OPEN4_SHARE_DENY_READ" },
3685 #define OPEN4_SHARE_DENY_WRITE 0x00000002
3686 { OPEN4_SHARE_DENY_WRITE, "OPEN4_SHARE_DENY_WRITE" },
3687 #define OPEN4_SHARE_DENY_BOTH 0x00000003
3688 { OPEN4_SHARE_DENY_BOTH, "OPEN4_SHARE_DENY_BOTH" },
3693 dissect_nfs_open4_share_deny(const u_char *pd, int offset, frame_data *fd,
3698 deny_access = EXTRACT_UINT(pd, offset);
3699 proto_tree_add_uint(tree, hf_nfs_open4_share_deny, NullTVB, offset, 4,
3707 dissect_nfs_open_claim_delegate_cur4(const u_char *pd, int offset,
3708 frame_data *fd, proto_tree *tree, char *name)
3710 offset = dissect_nfs_pathname4(pd, offset, fd, tree, "file");
3711 offset = dissect_nfs_stateid4(pd, offset, fd, tree, "delegate_stateid");
3715 #define CLAIM_NULL 0
3716 #define CLAIM_PREVIOUS 1
3717 #define CLAIM_DELEGATE_CUR 2
3718 #define CLAIM_DELEGATE_PREV 3
3720 static const value_string names_claim_type4[] = {
3721 { CLAIM_NULL, "CLAIM_NULL" },
3722 { CLAIM_PREVIOUS, "CLAIM_PREVIOUS" },
3723 { CLAIM_DELEGATE_CUR, "CLAIM_DELEGATE_CUR" },
3724 { CLAIM_DELEGATE_PREV, "CLAIM_DELEGATE_PREV" },
3729 dissect_nfs_open_claim4(const u_char *pd, int offset, frame_data *fd,
3730 proto_tree *tree, char *name)
3732 guint open_claim_type4;
3733 proto_item *fitem = NULL;
3734 proto_tree *newftree = NULL;
3736 open_claim_type4 = EXTRACT_UINT(pd, offset);
3737 fitem = proto_tree_add_uint(tree, hf_nfs_open_claim_type4, NullTVB,
3738 offset+0, 4, open_claim_type4);
3742 newftree = proto_item_add_subtree(fitem, ett_nfs_open_claim4);
3746 switch(open_claim_type4)
3749 offset = dissect_nfs_pathname4(pd, offset, fd, newftree, "file");
3752 case CLAIM_PREVIOUS:
3753 offset = dissect_rpc_uint32(pd, offset, fd, newftree,
3757 case CLAIM_DELEGATE_CUR:
3758 offset = dissect_nfs_open_claim_delegate_cur4(pd, offset, fd,
3759 newftree, "delegate_cur_info");
3762 case CLAIM_DELEGATE_PREV:
3763 offset = dissect_nfs_pathname4(pd, offset, fd, newftree,
3764 "file_delegate_prev");
3777 dissect_nfs_verifier4(const u_char *pd, int offset, frame_data *fd,
3778 proto_tree *tree, char *name);
3781 dissect_nfs_createhow4(const u_char *pd, int offset, frame_data *fd,
3782 proto_tree *tree, char *name)
3786 /* This is intentional; we're using the same flags as NFSv3 */
3787 mode = EXTRACT_UINT(pd, offset);
3788 proto_tree_add_uint(tree, hf_nfs_createmode3, NullTVB, offset, 4, mode);
3793 case UNCHECKED: /* UNCHECKED4 */
3794 case GUARDED: /* GUARDED4 */
3795 offset = dissect_nfs_fattr4(pd, offset, fd, tree, "createattrs");
3798 case EXCLUSIVE: /* EXCLUSIVE4 */
3799 offset = dissect_nfs_verifier4(pd, offset, fd, tree, "createverf");
3809 #define OPEN4_NOCREATE 0
3810 #define OPEN4_CREATE 1
3811 static const value_string names_opentype4[] = {
3812 { OPEN4_NOCREATE, "OPEN4_NOCREATE" },
3813 { OPEN4_CREATE, "OPEN4_CREATE" },
3818 dissect_nfs_openflag4(const u_char *pd, int offset, frame_data *fd,
3822 proto_item *fitem = NULL;
3823 proto_tree *newftree = NULL;
3825 opentype4 = EXTRACT_UINT(pd, offset);
3826 fitem = proto_tree_add_uint(tree, hf_nfs_opentype4, NullTVB,
3827 offset+0, 4, opentype4);
3831 newftree = proto_item_add_subtree(fitem, ett_nfs_opentype4);
3838 offset = dissect_nfs_createhow4(pd, offset, fd, newftree, "how");
3851 dissect_nfs_verifier4(const u_char *pd, int offset, frame_data *fd,
3852 proto_tree *tree, char *name)
3854 return dissect_rpc_uint64(pd, offset, fd, tree, name);
3858 dissect_nfs_fh4(const u_char *pd, int offset, frame_data *fd,
3859 proto_tree *tree, char *name)
3861 return old_dissect_nfs_fh3(pd, offset, fd, tree, name);
3865 dissect_nfs_cookie4(const u_char *pd, int offset, frame_data *fd,
3866 proto_tree *tree, char *name)
3868 return dissect_rpc_uint64(pd, offset, fd, tree, name);
3872 dissect_nfs_cookieverf4(const u_char *pd, int offset, frame_data *fd,
3873 proto_tree *tree, char *name)
3875 return dissect_rpc_uint64(pd, offset, fd, tree, name);
3878 /* this function is terribly ugly */
3880 dissect_nfs_bitmap4(const u_char *pd, int offset, frame_data *fd,
3881 proto_tree *tree, char *name)
3883 guint bitmap_len, bitmap;
3885 proto_item *fitem = NULL;
3886 proto_tree *newftree = NULL;
3888 bitmap_len = EXTRACT_UINT(pd, offset);
3890 fitem = proto_tree_add_text(tree, NullTVB, offset, 4 + bitmap_len*4,
3895 if (fitem == NULL) return offset;
3897 newftree = proto_item_add_subtree(fitem, ett_nfs_bitmap4);
3899 if (newftree == NULL) return offset;
3901 bitmap = EXTRACT_UINT(pd, offset);
3906 if (bitmap & (1 << 0))
3907 strcat(flagtxt, "supp_attr ");
3909 if (bitmap & (1 << 1))
3910 strcat(flagtxt, "type ");
3912 if (bitmap & (1 << 2))
3913 strcat(flagtxt, "fh_expire_type ");
3915 if (bitmap & (1 << 3))
3916 strcat(flagtxt, "change ");
3918 if (flagtxt[0] == '\0')
3919 strcpy(flagtxt, "<none>");
3920 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 0-3: %s", flagtxt);
3923 if (bitmap & (1 << 4))
3924 strcat(flagtxt, "size ");
3926 if (bitmap & (1 << 5))
3927 strcat(flagtxt, "link_support ");
3929 if (bitmap & (1 << 6))
3930 strcat(flagtxt, "symlink_support ");
3932 if (bitmap & (1 << 7))
3933 strcat(flagtxt, "named_attr ");
3935 if (flagtxt[0] == '\0')
3936 strcpy(flagtxt, "<none>");
3937 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 4-7: %s", flagtxt);
3941 if (bitmap & (1 << 8))
3942 strcat(flagtxt, "fsid ");
3944 if (bitmap & (1 << 9))
3945 strcat(flagtxt, "unique_handles ");
3947 if (bitmap & (1 << 10))
3948 strcat(flagtxt, "lease_time ");
3950 if (bitmap & (1 << 11))
3951 strcat(flagtxt, "rdattr_error ");
3953 if (flagtxt[0] == '\0')
3954 strcpy(flagtxt, "<none>");
3955 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 8-11: %s", flagtxt);
3958 if (bitmap & (1 << 12))
3959 strcat(flagtxt, "ACL ");
3961 if (bitmap & (1 << 13))
3962 strcat(flagtxt, "aclsupport ");
3964 if (bitmap & (1 << 14))
3965 strcat(flagtxt, "archive ");
3967 if (bitmap & (1 << 15))
3968 strcat(flagtxt, "cansettime ");
3970 if (flagtxt[0] == '\0')
3971 strcpy(flagtxt, "<none>");
3972 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 12-15: %s", flagtxt);
3975 if (bitmap & (1 << 16))
3976 strcat(flagtxt, "case_insensitive ");
3978 if (bitmap & (1 << 17))
3979 strcat(flagtxt, "case_preserving ");
3981 if (bitmap & (1 << 18))
3982 strcat(flagtxt, "chown_restricted ");
3984 if (bitmap & (1 << 19))
3985 strcat(flagtxt, "filehandle ");
3987 if (flagtxt[0] == '\0')
3988 strcpy(flagtxt, "<none>");
3989 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 16-19: %s", flagtxt);
3992 if (bitmap & (1 << 20))
3993 strcat(flagtxt, "fileid ");
3995 if (bitmap & (1 << 21))
3996 strcat(flagtxt, "files_avail ");
3998 if (bitmap & (1 << 22))
3999 strcat(flagtxt, "files_free ");
4001 if (bitmap & (1 << 23))
4002 strcat(flagtxt, "files_total ");
4004 if (flagtxt[0] == '\0')
4005 strcpy(flagtxt, "<none>");
4006 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 20-23: %s", flagtxt);
4009 if (bitmap & (1 << 24))
4010 strcat(flagtxt, "fs_locations ");
4012 if (bitmap & (1 << 25))
4013 strcat(flagtxt, "hidden ");
4015 if (bitmap & (1 << 26))
4016 strcat(flagtxt, "homegeneous ");
4018 if (bitmap & (1 << 27))
4019 strcat(flagtxt, "maxfilesize ");
4021 if (flagtxt[0] == '\0')
4022 strcpy(flagtxt, "<none>");
4023 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 24-27: %s", flagtxt);
4026 if (bitmap & (1 << 28))
4027 strcat(flagtxt, "maxlink ");
4029 if (bitmap & (1 << 29))
4030 strcat(flagtxt, "maxname ");
4032 if (bitmap & (1 << 30))
4033 strcat(flagtxt, "maxread ");
4035 if (bitmap & (1 << 31))
4036 strcat(flagtxt, "maxwrite ");
4038 if (flagtxt[0] == '\0')
4039 strcpy(flagtxt, "<none>");
4040 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 28-31: %s", flagtxt);
4043 bitmap = EXTRACT_UINT(pd, offset);
4046 if (bitmap & (1 << 0))
4047 strcat(flagtxt, "mimetype ");
4049 if (bitmap & (1 << 1))
4050 strcat(flagtxt, "mode ");
4052 if (bitmap & (1 << 2))
4053 strcat(flagtxt, "no_trunc ");
4055 if (bitmap & (1 << 3))
4056 strcat(flagtxt, "numlinks ");
4058 if (flagtxt[0] == '\0')
4059 strcpy(flagtxt, "<none>");
4060 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 32-35: %s", flagtxt);
4063 if (bitmap & (1 << 4))
4064 strcat(flagtxt, "owner ");
4066 if (bitmap & (1 << 5))
4067 strcat(flagtxt, "owner_group ");
4069 if (bitmap & (1 << 6))
4070 strcat(flagtxt, "quota_hard ");
4072 if (bitmap & (1 << 7))
4073 strcat(flagtxt, "quota_soft ");
4075 if (flagtxt[0] == '\0')
4076 strcpy(flagtxt, "<none>");
4077 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 36-39: %s", flagtxt);
4080 if (bitmap & (1 << 8))
4081 strcat(flagtxt, "quota_used ");
4083 if (bitmap & (1 << 9))
4084 strcat(flagtxt, "rawdev ");
4086 if (bitmap & (1 << 10))
4087 strcat(flagtxt, "space_avail ");
4089 if (bitmap & (1 << 11))
4090 strcat(flagtxt, "space_free ");
4092 if (flagtxt[0] == '\0')
4093 strcpy(flagtxt, "<none>");
4094 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 40-43: %s", flagtxt);
4097 if (bitmap & (1 << 12))
4098 strcat(flagtxt, "space_total ");
4100 if (bitmap & (1 << 13))
4101 strcat(flagtxt, "space_used ");
4103 if (bitmap & (1 << 14))
4104 strcat(flagtxt, "system ");
4106 if (flagtxt[0] == '\0')
4107 strcpy(flagtxt, "<none>");
4108 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 44-47: %s", flagtxt);
4111 if (bitmap & (1 << 15))
4112 strcat(flagtxt, "time_access ");
4114 if (bitmap & (1 << 16))
4115 strcat(flagtxt, "time_access_set ");
4117 if (bitmap & (1 << 17))
4118 strcat(flagtxt, "time_backup ");
4120 if (bitmap & (1 << 18))
4121 strcat(flagtxt, "time_create ");
4123 if (flagtxt[0] == '\0')
4124 strcpy(flagtxt, "<none>");
4125 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 48-51: %s", flagtxt);
4128 if (bitmap & (1 << 19))
4129 strcat(flagtxt, "time_delta ");
4131 if (bitmap & (1 << 20))
4132 strcat(flagtxt, "time_metadata ");
4134 if (bitmap & (1 << 21))
4135 strcat(flagtxt, "time_modify ");
4137 if (bitmap & (1 << 22))
4138 strcat(flagtxt, "time_modify_set ");
4140 if (flagtxt[0] == '\0')
4141 strcpy(flagtxt, "<none>");
4142 proto_tree_add_text(newftree, NullTVB, offset, 0, "Bits 52-55: %s", flagtxt);
4145 * If there are any more bits in this bitfield, we don't know how to
4146 * handle them as per the NFSv4 draft spec 07
4152 for (i = 0; i < (bitmap_len-2); i++)
4160 dissect_nfs_clientaddr4(const u_char *pd, int offset, frame_data *fd,
4161 proto_tree *tree, char *name)
4163 offset = dissect_nfs_opaque4(pd, offset, fd, tree, "network id");
4164 offset = dissect_nfs_opaque4(pd, offset, fd, tree, "universal address");
4171 dissect_nfs_cb_client4(const u_char *pd, int offset, frame_data *fd,
4172 proto_tree *tree, char *name)
4174 offset = dissect_rpc_uint32(pd, offset, fd, tree, "cb_program");
4175 offset = dissect_nfs_clientaddr4(pd, offset, fd, tree, "cb_location");
4181 dissect_nfs_stable_how4(const u_char *pd, int offset, frame_data *fd,
4182 proto_tree *tree, char *name)
4184 return dissect_rpc_uint32(pd, offset, fd, tree, "stable_how4");
4188 dissect_nfs_opaque4(const u_char *pd, int offset, frame_data *fd,
4189 proto_tree *tree, char *name)
4191 return dissect_nfsdata(pd, offset, fd, tree, hf_nfs_data);
4194 /* There is probably a better (built-in?) way to do this, but this works
4198 static const value_string names_nfsv4_operation[] = {
4199 { NFS4_OP_ACCESS, "ACCESS" },
4200 { NFS4_OP_CLOSE, "CLOSE" },
4201 { NFS4_OP_COMMIT, "COMMIT" },
4202 { NFS4_OP_CREATE, "CREATE" },
4203 { NFS4_OP_DELEGPURGE, "DELEGPURGE" },
4204 { NFS4_OP_DELEGRETURN, "DELEGRETURN" },
4205 { NFS4_OP_GETATTR, "GETATTR" },
4206 { NFS4_OP_GETFH, "GETFH" },
4207 { NFS4_OP_LINK, "LINK" },
4208 { NFS4_OP_LOCK, "LOCK" },
4209 { NFS4_OP_LOCKT, "LOCKT" },
4210 { NFS4_OP_LOCKU, "LOCKU" },
4211 { NFS4_OP_LOOKUP, "LOOKUP" },
4212 { NFS4_OP_NVERIFY, "NVERIFY" },
4213 { NFS4_OP_OPEN, "OPEN" },
4214 { NFS4_OP_OPENATTR, "OPENATTR" },
4215 { NFS4_OP_OPEN_CONFIRM, "OPEN_CONFIRM" },
4216 { NFS4_OP_OPEN_DOWNGRADE, "OPEN_DOWNGRADE" },
4217 { NFS4_OP_PUTFH, "PUTFH" },
4218 { NFS4_OP_PUTPUBFH, "PUTPUBFH" },
4219 { NFS4_OP_PUTROOTFH, "PUTROOTFH" },
4220 { NFS4_OP_READ, "READ" },
4221 { NFS4_OP_READDIR, "READDIR" },
4222 { NFS4_OP_READLINK, "READLINK" },
4223 { NFS4_OP_REMOVE, "REMOVE" },
4224 { NFS4_OP_RENAME, "RENAME" },
4225 { NFS4_OP_RENEW, "RENEW" },
4226 { NFS4_OP_RESTOREFH, "RESTOREFH" },
4227 { NFS4_OP_SAVEFH, "SAVEFH" },
4228 { NFS4_OP_SECINFO, "SECINFO" },
4229 { NFS4_OP_SETATTR, "SETATTR" },
4230 { NFS4_OP_SETCLIENTID, "SETCLIENTID" },
4231 { NFS4_OP_SETCLIENTID_CONFIRM, "SETCLIENTID_CONFIRM" },
4232 { NFS4_OP_VERIFY, "VERIFY" },
4233 { NFS4_OP_WRITE, "WRITE" },
4237 guint *nfsv4_operation_ett[] =
4243 &ett_nfs_delegpurge4 ,
4244 &ett_nfs_delegreturn4 ,
4255 &ett_nfs_openattr4 ,
4256 &ett_nfs_open_confirm4 ,
4257 &ett_nfs_open_downgrade4 ,
4259 &ett_nfs_putpubfh4 ,
4260 &ett_nfs_putrootfh4 ,
4263 &ett_nfs_readlink4 ,
4267 &ett_nfs_restorefh4 ,
4271 &ett_nfs_setclientid4 ,
4272 &ett_nfs_setclientid_confirm4 ,
4278 dissect_nfs_dirlist4(const u_char *pd, int offset, frame_data *fd,
4279 proto_tree *tree, char *name)
4281 proto_tree *newftree = NULL;
4284 newftree = proto_item_add_subtree(tree, ett_nfs_dirlist4);
4285 if (newftree==NULL) return offset;
4287 nextentry = EXTRACT_UINT(pd, offset);
4288 offset = dissect_rpc_uint32(pd, offset, fd, newftree, "data follows?");
4292 offset = dissect_nfs_cookie4(pd, offset, fd, newftree, "cookie");
4293 offset = dissect_nfs_component4(pd, offset, fd, newftree, "name");
4294 offset = dissect_nfs_fattr4(pd, offset, fd, newftree, "attrs");
4295 nextentry = EXTRACT_UINT(pd, offset);
4299 return dissect_rpc_uint32(pd, offset, fd, newftree, "eof");
4303 dissect_nfs_changeid4(const u_char *pd, int offset, frame_data *fd,
4304 proto_tree *tree, char *name)
4306 return dissect_rpc_uint64(pd, offset, fd, tree, name);
4310 dissect_nfs_change_info4(const u_char *pd, int offset, frame_data *fd,
4311 proto_tree *tree, char *name)
4313 proto_tree *newftree = NULL;
4314 proto_tree *fitem = NULL;
4316 fitem = proto_tree_add_text(tree, NullTVB, offset, 0, "%s", name);
4319 newftree=proto_item_add_subtree(fitem, ett_nfs_change_info4);
4322 offset = dissect_rpc_bool(pd, offset, fd, newftree,
4323 hf_nfs_change_info4_atomic);
4324 offset = dissect_nfs_changeid4(pd, offset, fd, newftree, "before");
4325 offset = dissect_nfs_changeid4(pd, offset, fd, newftree, "after");
4333 dissect_nfs_lock4denied(const u_char *pd, int offset, frame_data *fd,
4334 proto_tree *tree, char *name)
4336 offset = dissect_nfs_lockowner4(pd, offset, fd, tree, "owner");
4337 offset = dissect_nfs_offset4(pd, offset, fd, tree, "offset");
4338 return dissect_nfs_length4(pd, offset, fd, tree, "length");
4342 dissect_nfs_acetype4(const u_char *pd, int offset, frame_data *fd,
4343 proto_tree *tree, char *name)
4345 return dissect_rpc_uint32(pd, offset, fd, tree, name);
4349 dissect_nfs_aceflag4(const u_char *pd, int offset, frame_data *fd,
4350 proto_tree *tree, char *name)
4352 return dissect_rpc_uint32(pd, offset, fd, tree, name);
4356 dissect_nfs_acemask4(const u_char *pd, int offset, frame_data *fd,
4357 proto_tree *tree, char *name)
4359 return dissect_rpc_uint32(pd, offset, fd, tree, name);
4363 dissect_nfs_ace4(const u_char *pd, int offset, frame_data *fd,
4364 proto_tree *tree, char *name)
4366 offset = dissect_nfs_acetype4(pd, offset, fd, tree, "type");
4367 offset = dissect_nfs_aceflag4(pd, offset, fd, tree, "flag");
4368 offset = dissect_nfs_acemask4(pd, offset, fd, tree, "access_mask");
4369 return dissect_nfs_utf8string(pd, offset, fd, tree, hf_nfs_ace4, NULL);
4372 static const value_string names_open4_result_flags[] = {
4373 #define OPEN4_RESULT_MLOCK 0x00000001
4374 { OPEN4_RESULT_MLOCK, "OPEN4_RESULT_MLOCK" },
4375 #define OPEN4_RESULT_CONFIRM 0x00000002
4376 { OPEN4_RESULT_CONFIRM, "OPEN4_RESULT_CONFIRM" },
4381 dissect_nfs_open4_rflags(const u_char *pd, int offset, frame_data *fd,
4386 rflags = EXTRACT_UINT(pd, offset);
4387 proto_tree_add_uint(tree, hf_nfs_open4_result_flags, NullTVB, offset, 4,
4395 dissect_nfs_open_read_delegation4(const u_char *pd, int offset, frame_data *fd,
4398 offset = dissect_nfs_stateid4(pd, offset, fd, tree, "stateid");
4399 offset = dissect_rpc_uint32(pd, offset, fd, tree, "recall?");
4400 return dissect_nfs_ace4(pd, offset, fd, tree, "permissions");
4404 dissect_nfs_modified_limit4(const u_char *pd, int offset, frame_data *fd,
4405 proto_tree *tree, char *name)
4407 offset = dissect_rpc_uint32(pd, offset, fd, tree, "num_blocks");
4408 return dissect_rpc_uint32(pd, offset, fd, tree, "bytes_per_block");
4411 #define NFS_LIMIT_SIZE 1
4412 #define NFS_LIMIT_BLOCKS 2
4413 static const value_string names_limit_by4[] = {
4414 { NFS_LIMIT_SIZE, "NFS_LIMIT_SIZE" },
4415 { NFS_LIMIT_BLOCKS, "NFS_LIMIT_BLOCKS" },
4420 dissect_nfs_space_limit4(const u_char *pd, int offset, frame_data *fd,
4421 proto_tree *tree, char *name)
4425 limitby = EXTRACT_UINT(pd, offset);
4426 proto_tree_add_uint(tree, hf_nfs_limit_by4, NullTVB, offset+0, 4, limitby);
4431 case NFS_LIMIT_SIZE:
4432 offset = dissect_rpc_uint64(pd, offset, fd, tree, "filesize");
4435 case NFS_LIMIT_BLOCKS:
4436 offset = dissect_nfs_modified_limit4(pd, offset, fd, tree, "mod_blocks");
4447 dissect_nfs_open_write_delegation4(const u_char *pd, int offset,
4448 frame_data *fd, proto_tree *tree)
4450 offset = dissect_nfs_stateid4(pd, offset, fd, tree, "stateid");
4451 offset = dissect_rpc_bool(pd, offset, fd, tree, hf_nfs_recall);
4452 offset = dissect_nfs_space_limit4(pd, offset, fd, tree, "space_limit");
4453 return dissect_nfs_ace4(pd, offset, fd, tree, "permissions");
4456 #define OPEN_DELEGATE_NONE 0
4457 #define OPEN_DELEGATE_READ 1
4458 #define OPEN_DELEGATE_WRITE 2
4459 static const value_string names_open_delegation_type4[] = {
4460 { OPEN_DELEGATE_NONE, "OPEN_DELEGATE_NONE" },
4461 { OPEN_DELEGATE_READ, "OPEN_DELEGATE_READ" },
4462 { OPEN_DELEGATE_WRITE, "OPEN_DELEGATE_WRITE" },
4467 dissect_nfs_open_delegation4(const u_char *pd, int offset, frame_data *fd,
4468 proto_tree *tree, char *name)
4470 guint delegation_type;
4471 proto_tree *newftree = NULL;
4472 proto_item *fitem = NULL;
4474 delegation_type = EXTRACT_UINT(pd, offset);
4475 proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, NullTVB, offset+0,
4476 4, delegation_type);
4480 newftree = proto_item_add_subtree(fitem, ett_nfs_open_delegation4);
4482 switch(delegation_type)
4484 case OPEN_DELEGATE_NONE:
4487 case OPEN_DELEGATE_READ:
4488 offset = dissect_nfs_open_read_delegation4(pd, offset, fd, newftree);
4491 case OPEN_DELEGATE_WRITE:
4492 offset = dissect_nfs_open_write_delegation4(pd, offset, fd, newftree);
4505 dissect_nfs_argop4(const u_char *pd, int offset, frame_data *fd,
4506 proto_tree *tree, char *name)
4508 guint ops, ops_counter;
4511 proto_tree *ftree = NULL;
4512 proto_tree *newftree = NULL;
4514 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
4516 ops = EXTRACT_UINT(pd, offset+0);
4518 fitem = proto_tree_add_text(tree, NullTVB, offset, 4,
4519 "Operations (count: %d)", ops);
4522 if (fitem == NULL) return offset;
4524 ftree = proto_item_add_subtree(fitem, ett_nfs_argop4);
4526 if (ftree == NULL) return offset;
4528 for (ops_counter=0; ops_counter<ops; ops_counter++)
4530 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
4532 opcode = EXTRACT_UINT(pd, offset);
4533 fitem = proto_tree_add_uint(ftree, hf_nfs_argop4, NullTVB, offset, 4,
4537 if (opcode < NFS4_OP_ACCESS || opcode >NFS4_OP_WRITE)
4540 if (fitem == NULL) break;
4542 /* printf("Opcode: %d\n", opcode);*/
4544 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
4546 if (newftree == NULL) break;
4551 case NFS4_OP_ACCESS:
4552 offset = dissect_access(pd, offset, fd, newftree, "access");
4556 offset = dissect_nfs_seqid4(pd, offset, fd, newftree);
4557 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4560 case NFS4_OP_COMMIT:
4561 offset = dissect_nfs_offset4(pd, offset, fd, newftree, "offset");
4562 offset = dissect_nfs_count4(pd, offset, fd, newftree, "count");
4565 case NFS4_OP_CREATE:
4569 offset = dissect_nfs_component4(pd, offset, fd, newftree,
4572 create_type = EXTRACT_UINT(pd, offset);
4573 offset = dissect_nfs_ftype4(pd, offset, fd, newftree, "type");
4578 offset = dissect_nfs_linktext4(pd, offset, fd, newftree,
4584 offset = dissect_nfs_specdata4(pd, offset, fd,
4585 newftree, "devdata");
4599 case NFS4_OP_DELEGPURGE:
4600 offset = dissect_nfs_clientid4(pd, offset, fd, newftree, "Client ID");
4603 case NFS4_OP_DELEGRETURN:
4604 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4607 case NFS4_OP_GETATTR:
4608 offset = dissect_nfs_bitmap4(pd, offset, fd, newftree, "attr_request");
4615 offset = dissect_nfs_component4(pd, offset, fd, newftree, "newname");
4619 offset = dissect_nfs_lock_type4(pd, offset, fd, newftree, "locktype");
4620 offset = dissect_nfs_seqid4(pd, offset, fd, newftree);
4621 offset = dissect_nfs_reclaim4(pd, offset, fd, newftree, "reclaim");
4622 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4623 offset = dissect_nfs_offset4(pd, offset, fd, newftree, "offset");
4624 offset = dissect_nfs_length4(pd, offset, fd, newftree, "length");
4628 offset = dissect_nfs_lock_type4(pd, offset, fd, newftree, "locktype");
4629 offset = dissect_nfs_lockowner4(pd, offset, fd, newftree, "owner");
4630 offset = dissect_nfs_offset4(pd, offset, fd, newftree, "offset");
4631 offset = dissect_nfs_length4(pd, offset, fd, newftree, "length");
4635 offset = dissect_nfs_lock_type4(pd, offset, fd, newftree, "type");
4636 offset = dissect_nfs_seqid4(pd, offset, fd, newftree);
4637 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4638 offset = dissect_nfs_offset4(pd, offset, fd, newftree, "offset");
4639 offset = dissect_nfs_length4(pd, offset, fd, newftree, "length");
4642 case NFS4_OP_LOOKUP:
4643 offset = dissect_nfs_pathname4(pd, offset, fd, newftree, "path");
4646 case NFS4_OP_LOOKUPP:
4649 case NFS4_OP_NVERIFY:
4650 offset = dissect_nfs_fattr4(pd, offset, fd, newftree,
4655 offset = dissect_nfs_open_claim4(pd, offset, fd, newftree, "claim");
4656 offset = dissect_nfs_openflag4(pd, offset, fd, newftree);
4657 offset = dissect_nfs_lockowner4(pd, offset, fd, newftree, "Owner");
4658 offset = dissect_nfs_seqid4(pd, offset, fd, newftree);
4659 offset = dissect_nfs_open4_share_access(pd, offset, fd, newftree);
4660 offset = dissect_nfs_open4_share_deny(pd, offset, fd, newftree);
4663 case NFS4_OP_OPENATTR:
4666 case NFS4_OP_OPEN_CONFIRM:
4667 offset = dissect_nfs_seqid4(pd, offset, fd, newftree);
4668 offset = dissect_nfs_verifier4(pd, offset, fd, newftree,
4672 case NFS4_OP_OPEN_DOWNGRADE:
4673 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4674 offset = dissect_nfs_seqid4(pd, offset, fd, newftree);
4675 offset = dissect_nfs_open4_share_access(pd, offset, fd, newftree);
4676 offset = dissect_nfs_open4_share_deny(pd, offset, fd, newftree);
4680 offset = dissect_nfs_fh4(pd, offset, fd, newftree, "filehandle");
4683 case NFS4_OP_PUTPUBFH:
4684 case NFS4_OP_PUTROOTFH:
4688 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4689 offset = dissect_nfs_offset4(pd, offset, fd, newftree, "offset");
4690 offset = dissect_nfs_count4(pd, offset, fd, newftree, "count");
4693 case NFS4_OP_READDIR:
4694 offset = dissect_nfs_cookie4(pd, offset, fd, newftree, "cookie");
4695 offset = dissect_nfs_cookieverf4(pd, offset, fd, newftree,
4697 offset = dissect_nfs_count4(pd, offset, fd, newftree, "dircount");
4698 offset = dissect_nfs_count4(pd, offset, fd, newftree, "maxcount");
4699 offset = dissect_nfs_bitmap4(pd, offset, fd, newftree, "attr");
4702 case NFS4_OP_READLINK:
4705 case NFS4_OP_REMOVE:
4706 offset = dissect_nfs_component4(pd, offset, fd, newftree, "target");
4709 case NFS4_OP_RENAME:
4710 offset = dissect_nfs_component4(pd, offset, fd, newftree, "oldname");
4711 offset = dissect_nfs_component4(pd, offset, fd, newftree, "newname");
4715 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4718 case NFS4_OP_RESTOREFH:
4719 case NFS4_OP_SAVEFH:
4722 case NFS4_OP_SECINFO:
4723 offset = dissect_nfs_component4(pd, offset, fd, newftree, "name");
4726 case NFS4_OP_SETATTR:
4727 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4728 offset = dissect_nfs_fattr4(pd, offset, fd, newftree,
4732 case NFS4_OP_SETCLIENTID:
4734 proto_tree *client_tree = NULL;
4736 fitem = proto_tree_add_text(newftree, NullTVB, offset, 0, "Client");
4739 client_tree = proto_item_add_subtree(fitem,
4740 ett_nfs_client_id4);
4743 offset = dissect_nfs_client_id4(pd, offset, fd,
4744 client_tree, "client");
4747 fitem = proto_tree_add_text(newftree, NullTVB, offset, 0,
4750 newftree = proto_item_add_subtree(fitem, ett_nfs_cb_client4);
4752 offset = dissect_nfs_cb_client4(pd, offset, fd, newftree,
4758 case NFS4_OP_SETCLIENTID_CONFIRM:
4759 offset = dissect_nfs_verifier4(pd, offset, fd, newftree,
4760 "setclientid_confirm");
4763 case NFS4_OP_VERIFY:
4764 offset = dissect_nfs_fattr4(pd, offset, fd, newftree,
4769 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4770 offset = dissect_nfs_offset4(pd, offset, fd, newftree, "offset");
4771 offset = dissect_nfs_stable_how4(pd, offset, fd, newftree, "stable");
4772 offset = dissect_nfs_opaque4(pd, offset, fd, newftree, "data");
4784 dissect_nfs4_compound_call(const u_char* pd, int offset, frame_data* fd,
4787 offset = dissect_nfs_utf8string(pd, offset, fd, tree, hf_nfs_tag4, NULL);
4788 offset = dissect_rpc_uint32(pd, offset, fd, tree, "minorversion");
4789 offset = dissect_nfs_argop4(pd, offset, fd, tree, "arguments");
4795 dissect_nfs_resop4(const u_char *pd, int offset, frame_data *fd,
4796 proto_tree *tree, char *name)
4798 guint ops, ops_counter;
4801 proto_tree *ftree = NULL;
4802 proto_tree *newftree = NULL;
4805 ops = EXTRACT_UINT(pd, offset+0);
4807 fitem = proto_tree_add_text(tree, NullTVB, offset, 4,
4808 "Operations (count: %d)", ops);
4811 if (fitem == NULL) return offset;
4813 ftree = proto_item_add_subtree(fitem, ett_nfs_resop4);
4815 if (ftree == NULL) return offset; /* error adding new subtree */
4817 for (ops_counter = 0; ops_counter < ops; ops_counter++)
4819 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
4821 opcode = EXTRACT_UINT(pd, offset);
4823 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE) break;
4825 if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
4827 fitem = proto_tree_add_uint(ftree, hf_nfs_resop4, NullTVB, offset, 4,
4831 if (fitem == NULL) break; /* error adding new item to tree */
4833 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
4835 if (newftree == NULL)
4836 break; /* error adding new subtree to operation item */
4838 offset = dissect_stat_nfs4(pd, offset, fd, newftree, &status);
4840 if (status != NFS4_OK &&
4841 (opcode != NFS4_OP_LOCK || opcode != NFS4_OP_LOCKT))
4844 /* These parsing routines are only executed if the status is NFS4_OK */
4847 case NFS4_OP_ACCESS:
4848 offset = dissect_access(pd, offset, fd, newftree, "Supported");
4849 offset = dissect_access(pd, offset, fd, newftree, "Access");
4853 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4856 case NFS4_OP_COMMIT:
4857 offset = dissect_nfs_verifier4(pd, offset, fd, newftree, "writeverf");
4860 case NFS4_OP_CREATE:
4861 offset = dissect_nfs_change_info4(pd, offset, fd, newftree,
4865 case NFS4_OP_DELEGPURGE:
4869 case NFS4_OP_DELEGRETURN:
4873 case NFS4_OP_GETATTR:
4874 offset = dissect_nfs_fattr4(pd, offset, fd, newftree,
4879 offset = dissect_nfs_fh4(pd, offset, fd, newftree, "Filehandle");
4883 offset = dissect_nfs_change_info4(pd, offset, fd, newftree,
4889 if (status==NFS4_OK)
4890 offset = dissect_nfs_stateid4(pd, offset, fd, newftree,
4893 if (status==NFS4ERR_DENIED)
4894 offset = dissect_nfs_lock4denied(pd, offset, fd, newftree,
4899 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4902 case NFS4_OP_LOOKUP:
4906 case NFS4_OP_LOOKUPP:
4910 case NFS4_OP_NVERIFY:
4915 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4916 offset = dissect_nfs_change_info4(pd, offset, fd, newftree,
4918 /* offset = dissect_rpc_uint32(pd, offset, fd, newftree, "rflags"); */
4919 offset = dissect_nfs_open4_rflags(pd, offset, fd, newftree);
4920 offset = dissect_nfs_verifier4(pd, offset, fd, newftree,
4922 offset = dissect_nfs_open_delegation4(pd, offset, fd, newftree,
4926 case NFS4_OP_OPENATTR:
4930 case NFS4_OP_OPEN_CONFIRM:
4931 case NFS4_OP_OPEN_DOWNGRADE:
4932 offset = dissect_nfs_stateid4(pd, offset, fd, newftree, "stateid");
4939 case NFS4_OP_PUTPUBFH:
4943 case NFS4_OP_PUTROOTFH:
4948 offset = dissect_rpc_uint32(pd, offset, fd, newftree, "eof?");
4949 offset = dissect_nfs_opaque4(pd, offset, fd, newftree, "data");
4952 case NFS4_OP_READDIR:
4953 offset = dissect_nfs_verifier4(pd, offset, fd, newftree,
4955 offset = dissect_nfs_dirlist4(pd, offset, fd, newftree, "reply");
4958 case NFS4_OP_READLINK:
4959 offset = dissect_nfs_linktext4(pd, offset, fd, newftree, "link");
4962 case NFS4_OP_REMOVE:
4963 offset = dissect_nfs_change_info4(pd, offset, fd, newftree,
4967 case NFS4_OP_RENAME:
4968 offset = dissect_nfs_change_info4(pd, offset, fd, newftree,
4970 offset = dissect_nfs_change_info4(pd, offset, fd, newftree,
4978 case NFS4_OP_RESTOREFH:
4982 case NFS4_OP_SAVEFH:
4986 case NFS4_OP_SECINFO:
4987 offset = dissect_rpc_uint32(pd, offset, fd, newftree, "flavor");
4988 offset = dissect_nfs_opaque4(pd, offset, fd, newftree, "flavor_info");
4991 case NFS4_OP_SETATTR:
4992 offset = dissect_nfs_bitmap4(pd, offset, fd, newftree, "attrsset");
4995 case NFS4_OP_SETCLIENTID:
4996 if (status == NFS4_OK)
4998 offset = dissect_nfs_clientid4(pd, offset, fd, newftree,
5000 offset = dissect_nfs_verifier4(pd, offset, fd, newftree,
5001 "setclientid_confirm");
5004 if (status == NFS4ERR_CLID_INUSE)
5006 offset = dissect_nfs_clientaddr4(pd, offset, fd, newftree,
5011 case NFS4_OP_SETCLIENTID_CONFIRM:
5015 case NFS4_OP_VERIFY:
5020 offset = dissect_nfs_count4(pd, offset, fd, newftree, "count");
5021 offset = dissect_nfs_stable_how4(pd, offset, fd, newftree,
5023 offset = dissect_nfs_verifier4(pd, offset, fd, newftree,
5036 dissect_nfs4_compound_reply(const u_char* pd, int offset, frame_data* fd,
5041 offset = dissect_stat_nfs4(pd, offset, fd, tree, &status);
5042 offset = dissect_nfs_utf8string(pd, offset, fd, tree, hf_nfs_tag4, NULL);
5043 offset = dissect_nfs_resop4(pd, offset, fd, tree, "arguments");
5049 /* proc number, "proc name", dissect_request, dissect_reply */
5050 /* NULL as function pointer means: type of arguments is "void". */
5051 static const old_vsff nfs3_proc[] = {
5052 { 0, "NULL", /* OK */
5054 { 1, "GETATTR", /* OK */
5055 dissect_nfs3_getattr_call, dissect_nfs3_getattr_reply },
5056 { 2, "SETATTR", /* OK */
5057 dissect_nfs3_setattr_call, dissect_nfs3_setattr_reply },
5058 { 3, "LOOKUP", /* OK */
5059 dissect_nfs3_lookup_call, dissect_nfs3_lookup_reply },
5060 { 4, "ACCESS", /* OK */
5061 dissect_nfs3_access_call, dissect_nfs3_access_reply },
5062 { 5, "READLINK", /* OK */
5063 dissect_nfs3_nfs_fh3_call, dissect_nfs3_readlink_reply },
5064 { 6, "READ", /* OK */
5065 dissect_nfs3_read_call, dissect_nfs3_read_reply },
5066 { 7, "WRITE", /* OK */
5067 dissect_nfs3_write_call, dissect_nfs3_write_reply },
5068 { 8, "CREATE", /* OK */
5069 dissect_nfs3_create_call, dissect_nfs3_create_reply },
5070 { 9, "MKDIR", /* OK */
5071 dissect_nfs3_mkdir_call, dissect_nfs3_create_reply },
5072 { 10, "SYMLINK", /* OK */
5073 dissect_nfs3_symlink_call, dissect_nfs3_create_reply },
5074 { 11, "MKNOD", /* OK */
5075 dissect_nfs3_mknod_call, dissect_nfs3_create_reply },
5076 { 12, "REMOVE", /* OK */
5077 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
5078 { 13, "RMDIR", /* OK */
5079 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
5080 { 14, "RENAME", /* OK */
5081 dissect_nfs3_rename_call, dissect_nfs3_rename_reply },
5082 { 15, "LINK", /* OK */
5083 dissect_nfs3_link_call, dissect_nfs3_link_reply },
5084 { 16, "READDIR", /* OK */
5085 dissect_nfs3_readdir_call, dissect_nfs3_readdir_reply },
5086 { 17, "READDIRPLUS", /* OK */
5087 dissect_nfs3_readdirplus_call, dissect_nfs3_readdirplus_reply },
5088 { 18, "FSSTAT", /* OK */
5089 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsstat_reply },
5090 { 19, "FSINFO", /* OK */
5091 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsinfo_reply },
5092 { 20, "PATHCONF", /* OK */
5093 dissect_nfs3_nfs_fh3_call, dissect_nfs3_pathconf_reply },
5094 { 21, "COMMIT", /* OK */
5095 dissect_nfs3_commit_call, dissect_nfs3_commit_reply },
5096 { 0,NULL,NULL,NULL }
5098 /* end of NFS Version 3 */
5100 static const old_vsff nfs4_proc[] = {
5104 dissect_nfs4_compound_call, dissect_nfs4_compound_reply },
5105 { 0, NULL, NULL, NULL }
5109 static struct true_false_string yesno = { "Yes", "No" };
5113 proto_register_nfs(void)
5115 static hf_register_info hf[] = {
5116 { &hf_nfs_fh_fsid_major, {
5117 "major", "nfs.fh.fsid.major", FT_UINT32, BASE_DEC,
5118 NULL, 0, "major file system ID" }},
5119 { &hf_nfs_fh_fsid_minor, {
5120 "minor", "nfs.fh.fsid.minor", FT_UINT32, BASE_DEC,
5121 NULL, 0, "minor file system ID" }},
5122 { &hf_nfs_fh_xfsid_major, {
5123 "exported major", "nfs.fh.xfsid.major", FT_UINT32, BASE_DEC,
5124 NULL, 0, "exported major file system ID" }},
5125 { &hf_nfs_fh_xfsid_minor, {
5126 "exported minor", "nfs.fh.xfsid.minor", FT_UINT32, BASE_DEC,
5127 NULL, 0, "exported minor file system ID" }},
5128 { &hf_nfs_fh_fstype, {
5129 "file system type", "nfs.fh.fstype", FT_UINT32, BASE_DEC,
5130 NULL, 0, "file system type" }},
5132 "file number", "nfs.fh.fn", FT_UINT32, BASE_DEC,
5133 NULL, 0, "file number" }},
5134 { &hf_nfs_fh_fn_len, {
5135 "length", "nfs.fh.fn.len", FT_UINT32, BASE_DEC,
5136 NULL, 0, "file number length" }},
5137 { &hf_nfs_fh_fn_inode, {
5138 "inode", "nfs.fh.fn.inode", FT_UINT32, BASE_DEC,
5139 NULL, 0, "file number inode" }},
5140 { &hf_nfs_fh_fn_generation, {
5141 "generation", "nfs.fh.fn.generation", FT_UINT32, BASE_DEC,
5142 NULL, 0, "file number generation" }},
5144 "exported file number", "nfs.fh.xfn", FT_UINT32, BASE_DEC,
5145 NULL, 0, "exported file number" }},
5146 { &hf_nfs_fh_xfn_len, {
5147 "length", "nfs.fh.xfn.len", FT_UINT32, BASE_DEC,
5148 NULL, 0, "exported file number length" }},
5149 { &hf_nfs_fh_xfn_inode, {
5150 "exported inode", "nfs.fh.xfn.inode", FT_UINT32, BASE_DEC,
5151 NULL, 0, "exported file number inode" }},
5152 { &hf_nfs_fh_xfn_generation, {
5153 "generation", "nfs.fh.xfn.generation", FT_UINT32, BASE_DEC,
5154 NULL, 0, "exported file number generation" }},
5155 { &hf_nfs_fh_dentry, {
5156 "dentry", "nfs.fh.dentry", FT_UINT32, BASE_HEX,
5157 NULL, 0, "dentry (cookie)" }},
5159 "device", "nfs.fh.dev", FT_UINT32, BASE_DEC,
5160 NULL, 0, "device" }},
5161 { &hf_nfs_fh_xdev, {
5162 "exported device", "nfs.fh.xdev", FT_UINT32, BASE_DEC,
5163 NULL, 0, "exported device" }},
5164 { &hf_nfs_fh_dirinode, {
5165 "directory inode", "nfs.fh.dirinode", FT_UINT32, BASE_DEC,
5166 NULL, 0, "directory inode" }},
5167 { &hf_nfs_fh_pinode, {
5168 "pseudo inode", "nfs.fh.pinode", FT_UINT32, BASE_HEX,
5169 NULL, 0, "pseudo inode" }},
5170 { &hf_nfs_fh_hp_len, {
5171 "length", "nfs.fh.hp.len", FT_UINT32, BASE_DEC,
5172 NULL, 0, "hash path length" }},
5174 "Status", "nfs.status2", FT_UINT32, BASE_DEC,
5175 VALS(names_nfs_stat), 0, "Reply status" }},
5177 "Name", "nfs.name", FT_STRING, BASE_DEC,
5179 { &hf_nfs_readlink_data, {
5180 "Data", "nfs.readlink.data", FT_STRING, BASE_DEC,
5181 NULL, 0, "Symbolic Link Data" }},
5182 { &hf_nfs_read_offset, {
5183 "Offset", "nfs.read.offset", FT_UINT32, BASE_DEC,
5184 NULL, 0, "Read Offset" }},
5185 { &hf_nfs_read_count, {
5186 "Count", "nfs.read.count", FT_UINT32, BASE_DEC,
5187 NULL, 0, "Read Count" }},
5188 { &hf_nfs_read_totalcount, {
5189 "Total Count", "nfs.read.totalcount", FT_UINT32, BASE_DEC,
5190 NULL, 0, "Total Count (obsolete)" }},
5192 "Data", "nfs.data", FT_STRING, BASE_DEC,
5194 { &hf_nfs_write_beginoffset, {
5195 "Begin Offset", "nfs.write.beginoffset", FT_UINT32, BASE_DEC,
5196 NULL, 0, "Begin offset (obsolete)" }},
5197 { &hf_nfs_write_offset, {
5198 "Offset", "nfs.write.offset", FT_UINT32, BASE_DEC,
5199 NULL, 0, "Offset" }},
5200 { &hf_nfs_write_totalcount, {
5201 "Total Count", "nfs.write.totalcount", FT_UINT32, BASE_DEC,
5202 NULL, 0, "Total Count (obsolete)" }},
5203 { &hf_nfs_symlink_to, {
5204 "To", "nfs.symlink.to", FT_STRING, BASE_DEC,
5205 NULL, 0, "Symbolic link destination name" }},
5206 { &hf_nfs_readdir_cookie, {
5207 "Cookie", "nfs.readdir.cookie", FT_UINT32, BASE_DEC,
5208 NULL, 0, "Directory Cookie" }},
5209 { &hf_nfs_readdir_count, {
5210 "Count", "nfs.readdir.count", FT_UINT32, BASE_DEC,
5211 NULL, 0, "Directory Count" }},
5212 { &hf_nfs_readdir_entry, {
5213 "Entry", "nfs.readdir.entry", FT_NONE, 0,
5214 NULL, 0, "Directory Entry" }},
5215 { &hf_nfs_readdir_entry_fileid, {
5216 "File ID", "nfs.readdir.entry.fileid", FT_UINT32, BASE_DEC,
5217 NULL, 0, "File ID" }},
5218 { &hf_nfs_readdir_entry_name, {
5219 "Name", "nfs.readdir.entry.name", FT_STRING, BASE_DEC,
5221 { &hf_nfs_readdirplus_entry_name, {
5222 "Name", "nfs.readdirplus.entry.name", FT_STRING, BASE_DEC,
5224 { &hf_nfs_readdir_entry_cookie, {
5225 "Cookie", "nfs.readdir.entry.cookie", FT_UINT32, BASE_DEC,
5226 NULL, 0, "Directory Cookie" }},
5227 { &hf_nfs_readdir_eof, {
5228 "EOF", "nfs.readdir.eof", FT_UINT32, BASE_DEC,
5230 { &hf_nfs_statfs_tsize, {
5231 "Transfer Size", "nfs.statfs.tsize", FT_UINT32, BASE_DEC,
5232 NULL, 0, "Transfer Size" }},
5233 { &hf_nfs_statfs_bsize, {
5234 "Block Size", "nfs.statfs.bsize", FT_UINT32, BASE_DEC,
5235 NULL, 0, "Block Size" }},
5236 { &hf_nfs_statfs_blocks, {
5237 "Total Blocks", "nfs.statfs.blocks", FT_UINT32, BASE_DEC,
5238 NULL, 0, "Total Blocks" }},
5239 { &hf_nfs_statfs_bfree, {
5240 "Free Blocks", "nfs.statfs.bfree", FT_UINT32, BASE_DEC,
5241 NULL, 0, "Free Blocks" }},
5242 { &hf_nfs_statfs_bavail, {
5243 "Available Blocks", "nfs.statfs.bavail", FT_UINT32, BASE_DEC,
5244 NULL, 0, "Available Blocks" }},
5246 "Type", "nfs.type", FT_UINT32, BASE_DEC,
5247 VALS(names_nfs_ftype3), 0, "File Type" }},
5248 { &hf_nfs_nfsstat3, {
5249 "Status", "nfs.status", FT_UINT32, BASE_DEC,
5250 VALS(names_nfs_nfsstat3), 0, "Reply status" }},
5251 { &hf_nfs_read_eof, {
5252 "EOF", "nfs.read.eof", FT_BOOLEAN, BASE_NONE,
5253 &yesno, 0, "EOF" }},
5254 { &hf_nfs_write_stable, {
5255 "Stable", "nfs.write.stable", FT_UINT32, BASE_DEC,
5256 VALS(names_stable_how), 0, "Stable" }},
5257 { &hf_nfs_write_committed, {
5258 "Committed", "nfs.write.committed", FT_UINT32, BASE_DEC,
5259 VALS(names_stable_how), 0, "Committed" }},
5260 { &hf_nfs_createmode3, {
5261 "Create Mode", "nfs.createmode", FT_UINT32, BASE_DEC,
5262 VALS(names_createmode3), 0, "Create Mode" }},
5263 { &hf_nfs_fsstat_invarsec, {
5264 "invarsec", "nfs.fsstat.invarsec", FT_UINT32, BASE_DEC,
5265 NULL, 0, "probable number of seconds of file system invariance" }},
5266 { &hf_nfs_fsinfo_rtmax, {
5267 "rtmax", "nfs.fsinfo.rtmax", FT_UINT32, BASE_DEC,
5268 NULL, 0, "maximum READ request" }},
5269 { &hf_nfs_fsinfo_rtpref, {
5270 "rtpref", "nfs.fsinfo.rtpref", FT_UINT32, BASE_DEC,
5271 NULL, 0, "preferred READ request" }},
5272 { &hf_nfs_fsinfo_rtmult, {
5273 "rtmult", "nfs.fsinfo.rtmult", FT_UINT32, BASE_DEC,
5274 NULL, 0, "suggested READ multiple" }},
5275 { &hf_nfs_fsinfo_wtmax, {
5276 "wtmax", "nfs.fsinfo.wtmax", FT_UINT32, BASE_DEC,
5277 NULL, 0, "maximum WRITE request" }},
5278 { &hf_nfs_fsinfo_wtpref, {
5279 "wtpref", "nfs.fsinfo.wtpref", FT_UINT32, BASE_DEC,
5280 NULL, 0, "preferred WRITE request" }},
5281 { &hf_nfs_fsinfo_wtmult, {
5282 "wtmult", "nfs.fsinfo.wtmult", FT_UINT32, BASE_DEC,
5283 NULL, 0, "suggested WRITE multiple" }},
5284 { &hf_nfs_fsinfo_dtpref, {
5285 "dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
5286 NULL, 0, "preferred READDIR request" }},
5287 { &hf_nfs_fsinfo_properties, {
5288 "Properties", "nfs.fsinfo.propeties", FT_UINT32, BASE_HEX,
5289 NULL, 0, "File System Properties" }},
5290 { &hf_nfs_pathconf_linkmax, {
5291 "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC,
5292 NULL, 0, "Maximum number of hard links" }},
5293 { &hf_nfs_pathconf_name_max, {
5294 "name_max", "nfs.pathconf.name_max", FT_UINT32, BASE_DEC,
5295 NULL, 0, "Maximum file name length" }},
5296 { &hf_nfs_pathconf_no_trunc, {
5297 "no_trunc", "nfs.pathconf.no_trunc", FT_BOOLEAN, BASE_NONE,
5298 &yesno, 0, "No long file name truncation" }},
5299 { &hf_nfs_pathconf_chown_restricted, {
5300 "chown_restricted", "nfs.pathconf.chown_restricted", FT_BOOLEAN, BASE_NONE,
5301 &yesno, 0, "chown is restricted to root" }},
5302 { &hf_nfs_pathconf_case_insensitive, {
5303 "case_insensitive", "nfs.pathconf.case_insensitive", FT_BOOLEAN, BASE_NONE,
5304 &yesno, 0, "file names are treated case insensitive" }},
5305 { &hf_nfs_pathconf_case_preserving, {
5306 "case_preserving", "nfs.pathconf.case_preserving", FT_BOOLEAN, BASE_NONE,
5307 &yesno, 0, "file name cases are preserved" }},
5312 "Opcode", "nfs.call.operation", FT_UINT32, BASE_DEC,
5313 VALS(names_nfsv4_operation), 0, "Opcode" }},
5316 "Opcode", "nfs.reply.operation", FT_UINT32, BASE_DEC,
5317 VALS(names_nfsv4_operation), 0, "Opcode" }},
5319 { &hf_nfs_linktext4, {
5320 "Name", "nfs.symlink.linktext", FT_STRING, BASE_DEC,
5321 NULL, 0, "Symbolic link contents" }},
5323 { &hf_nfs_component4, {
5324 "Filename", "nfs.pathname.component", FT_STRING, BASE_DEC,
5325 NULL, 0, "Pathname component" }},
5328 "Tag", "nfs.tag", FT_STRING, BASE_DEC,
5331 { &hf_nfs_clientid4, {
5332 "Client ID", "nfs.clientid", FT_STRING, BASE_DEC,
5336 "ace", "nfs.ace", FT_STRING, BASE_DEC,
5337 NULL, 0, "Access Control Entry" }},
5340 "EOF", "nfs.recall", FT_BOOLEAN, BASE_NONE,
5341 &yesno, 0, "Recall" }},
5343 { &hf_nfs_open_claim_type4, {
5344 "Claim Type", "nfs.open.claim_type", FT_UINT32, BASE_DEC,
5345 VALS(names_claim_type4), 0, "Claim Type" }},
5347 { &hf_nfs_opentype4, {
5348 "Open Type", "nfs.open.opentype", FT_UINT32, BASE_DEC,
5349 VALS(names_opentype4), 0, "Open Type" }},
5351 { &hf_nfs_limit_by4, {
5352 "Space Limit", "nfs.open.limit_by", FT_UINT32, BASE_DEC,
5353 VALS(names_limit_by4), 0, "Limit By" }},
5355 { &hf_nfs_open_delegation_type4, {
5356 "Delegation Type", "nfs.open.delegation_type", FT_UINT32, BASE_DEC,
5357 VALS(names_open_delegation_type4), 0, "Delegation Type" }},
5360 "File Type", "nfs.ftype4", FT_UINT32, BASE_DEC,
5361 VALS(names_ftype4), 0, "File Type" }},
5363 { &hf_nfs_change_info4_atomic, {
5364 "Atomic", "nfs.change_info.atomic", FT_BOOLEAN, BASE_NONE,
5365 &yesno, 0, "Atomic" }},
5367 { &hf_nfs_open4_share_access, {
5368 "share_access", "nfs.open4.share_access", FT_UINT32, BASE_DEC,
5369 VALS(names_open4_share_access), 0, "Share Access" }},
5371 { &hf_nfs_open4_share_deny, {
5372 "share_deny", "nfs.open4.share_deny", FT_UINT32, BASE_DEC,
5373 VALS(names_open4_share_deny), 0, "Share Deny" }},
5375 { &hf_nfs_open4_result_flags, {
5376 "result_flags", "nfs.open4.rflags", FT_UINT32, BASE_HEX,
5377 VALS(names_open4_result_flags), 0, "Result Flags" }},
5380 "seqid", "nfs.seqid", FT_UINT32, BASE_HEX,
5381 NULL, 0, "Sequence ID" }}
5384 static gint *ett[] = {
5397 &ett_nfs_readdir_entry,
5403 &ett_nfs_post_op_fh3,
5405 &ett_nfs_diropargs3,
5406 &ett_nfs_sattrguard3,
5413 &ett_nfs_pre_op_attr,
5414 &ett_nfs_post_op_attr,
5418 &ett_nfs_fsinfo_properties,
5419 &ett_nfs_compound_call4,
5420 &ett_nfs_utf8string,
5427 &ett_nfs_delegpurge4,
5428 &ett_nfs_delegreturn4,
5440 &ett_nfs_open_confirm4,
5441 &ett_nfs_open_downgrade4,
5444 &ett_nfs_putrootfh4,
5451 &ett_nfs_restorefh4,
5455 &ett_nfs_setclientid4,
5456 &ett_nfs_setclientid_confirm4,
5463 &ett_nfs_change_info4,
5464 &ett_nfs_open_delegation4,
5465 &ett_nfs_open_claim4,
5467 &ett_nfs_lockowner4,
5468 &ett_nfs_cb_client4,
5469 &ett_nfs_client_id4,
5472 proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs");
5473 proto_register_field_array(proto_nfs, hf, array_length(hf));
5474 proto_register_subtree_array(ett, array_length(ett));
5478 proto_reg_handoff_nfs(void)
5480 /* Register the protocol as RPC */
5481 rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs);
5482 /* Register the procedure tables */
5483 old_rpc_init_proc_table(NFS_PROGRAM, 2, nfs2_proc);
5484 old_rpc_init_proc_table(NFS_PROGRAM, 3, nfs3_proc);
5485 old_rpc_init_proc_table(NFS_PROGRAM, 4, nfs4_proc);