Add the "Edit:Protocols..." feature which currently only implements
[metze/wireshark/wip.git] / packet-mount.c
1 /* packet-mount.c
2  * Routines for mount dissection
3  *
4  * $Id: packet-mount.c,v 1.16 2000/08/13 14:08:29 deniel Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * Copied from packet-smb.c
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30
31
32 #ifdef HAVE_SYS_TYPES_H
33 #include <sys/types.h>
34 #endif
35
36
37 #include "packet-rpc.h"
38 #include "packet-mount.h"
39 #include "packet-nfs.h"
40
41
42 static int proto_mount = -1;
43 static int hf_mount_path = -1;
44 static int hf_mount_status = -1;
45 static int hf_mount_mountlist_hostname = -1;
46 static int hf_mount_mountlist_directory = -1;
47 static int hf_mount_mountlist = -1;
48 static int hf_mount_groups_group = -1;
49 static int hf_mount_groups = -1;
50 static int hf_mount_exportlist_directory = -1;
51 static int hf_mount_exportlist = -1;
52 static int hf_mount_pathconf_link_max = -1;
53 static int hf_mount_pathconf_max_canon = -1;
54 static int hf_mount_pathconf_max_input = -1;
55 static int hf_mount_pathconf_name_max = -1;
56 static int hf_mount_pathconf_path_max = -1;
57 static int hf_mount_pathconf_pipe_buf = -1;
58 static int hf_mount_pathconf_vdisable = -1;
59 static int hf_mount_pathconf_mask = -1;
60 static int hf_mount_pathconf_error_all = -1;
61 static int hf_mount_pathconf_error_link_max = -1;
62 static int hf_mount_pathconf_error_max_canon = -1;
63 static int hf_mount_pathconf_error_max_input = -1;
64 static int hf_mount_pathconf_error_name_max = -1;
65 static int hf_mount_pathconf_error_path_max = -1;
66 static int hf_mount_pathconf_error_pipe_buf = -1;
67 static int hf_mount_pathconf_chown_restricted = -1;
68 static int hf_mount_pathconf_no_trunc = -1;
69 static int hf_mount_pathconf_error_vdisable = -1;
70 static int hf_mount_flavors = -1;
71 static int hf_mount_flavor = -1;
72
73 static gint ett_mount = -1;
74 static gint ett_mount_mountlist = -1;
75 static gint ett_mount_groups = -1;
76 static gint ett_mount_exportlist = -1;
77 static gint ett_mount_pathconf_mask = -1;
78
79
80 /* RFC 1094, Page 24 */
81 static int
82 dissect_fhstatus(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
83 {
84         guint32 status;
85
86         if (!proto_is_protocol_enabled(proto_mount)) 
87           return offset;
88
89         if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
90         status = EXTRACT_UINT(pd, offset+0);
91         if (tree) {
92                 proto_tree_add_uint(tree, hf_mount_status, NullTVB, offset, 4, status);
93         }
94         offset += 4;
95
96         switch (status) {
97                 case 0:
98                         offset = dissect_fhandle(pd,offset,fd,tree,"fhandle");
99                 break;
100                 default:
101                         /* void */
102                 break;
103         }
104
105         return offset;
106 }
107
108
109 static int
110 dissect_mount_dirpath_call(const u_char *pd, int offset, frame_data *fd,
111         proto_tree *tree)
112 {
113
114         if (!proto_is_protocol_enabled(proto_mount)) 
115           return offset;
116
117         if ( tree )
118         {
119                 offset = dissect_rpc_string(pd,offset,fd,tree,hf_mount_path,NULL);
120         }
121         
122         return offset;
123 }
124
125
126 /* RFC 1094, Page 25,26 */
127 static int
128 dissect_mount_mnt_reply(const u_char *pd, int offset, frame_data *fd,
129         proto_tree *tree)
130 {
131
132         if (!proto_is_protocol_enabled(proto_mount)) 
133           return offset;
134
135         offset = dissect_fhstatus(pd, offset, fd, tree);
136
137         return offset;
138 }
139
140
141 /* RFC 1094, Page 26 */
142 /* RFC 1813, Page 110 */
143 static int
144 dissect_mountlist(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
145 {
146         proto_item* mountlist_item = NULL;
147         proto_tree* mountlist_tree = NULL;
148         int old_offset = offset;
149         char* hostname;
150         char* directory;
151
152         if (!proto_is_protocol_enabled(proto_mount)) 
153           return offset;
154
155         if (tree) {
156                 mountlist_item = proto_tree_add_item(tree, hf_mount_mountlist, NullTVB,
157                                         offset+0, END_OF_FRAME, FALSE);
158                 if (mountlist_item)
159                         mountlist_tree = proto_item_add_subtree(mountlist_item, ett_mount_mountlist);
160         }
161
162         offset = dissect_rpc_string(pd, offset, fd, mountlist_tree, hf_mount_mountlist_hostname,&hostname);
163         offset = dissect_rpc_string(pd, offset, fd, mountlist_tree, hf_mount_mountlist_directory,&directory);
164
165         if (mountlist_item) {
166                 /* now we have a nicer string */
167                 proto_item_set_text(mountlist_item, "Mount List Entry: %s:%s", hostname, directory);
168                 /* now we know, that mountlist is shorter */
169                 proto_item_set_len(mountlist_item, offset - old_offset);
170         }
171         g_free(hostname);
172         g_free(directory);
173
174         return offset;
175 }
176
177
178 /* RFC 1094, Page 26 */
179 /* RFC 1813, Page 110 */
180 static int
181 dissect_mount_dump_reply(const u_char *pd, int offset, frame_data *fd,
182         proto_tree *tree)
183 {
184
185         if (!proto_is_protocol_enabled(proto_mount)) 
186           return offset;
187
188         offset = dissect_rpc_list(pd,offset,fd,tree,dissect_mountlist);
189
190         return offset;
191 }
192
193
194 /* RFC 1094, Page 26 */
195 /* RFC 1813, Page 110 */
196 static int
197 dissect_group(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
198 {
199
200         if (!proto_is_protocol_enabled(proto_mount)) 
201           return offset;
202
203         offset = dissect_rpc_string(pd, offset, fd, tree, hf_mount_groups_group,NULL);
204
205         return offset;
206 }
207
208
209 /* RFC 1094, Page 26 */
210 /* RFC 1813, Page 113 */
211 static int
212 dissect_exportlist(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
213 {
214         proto_item* exportlist_item = NULL;
215         proto_tree* exportlist_tree = NULL;
216         int old_offset = offset;
217         int groups_offset;
218         proto_item* groups_item = NULL;
219         proto_item* groups_tree = NULL;
220         char* directory;
221
222         if (!proto_is_protocol_enabled(proto_mount)) 
223           return offset;
224
225         if (tree) {
226                 exportlist_item = proto_tree_add_item(tree, hf_mount_exportlist, NullTVB,
227                                         offset+0, END_OF_FRAME, FALSE);
228                 if (exportlist_item)
229                         exportlist_tree = proto_item_add_subtree(exportlist_item, ett_mount_exportlist);
230         }
231
232         offset = dissect_rpc_string(pd, offset, fd, exportlist_tree, hf_mount_exportlist_directory,&directory);
233         groups_offset = offset;
234         if (tree) {
235                 groups_item = proto_tree_add_item(exportlist_tree, hf_mount_groups, NullTVB,
236                                 offset+0, END_OF_FRAME, FALSE);
237                 if (groups_item)
238                         groups_tree = proto_item_add_subtree(groups_item, ett_mount_groups);
239         }
240         offset = dissect_rpc_list(pd,offset,fd,groups_tree,dissect_group);
241         if (groups_item) {
242                 /* mark empty lists */
243                 if (offset - groups_offset == 4) {
244                         proto_item_set_text(groups_item, "Groups: empty");
245                 }
246
247                 /* now we know, that groups is shorter */
248                 proto_item_set_len(groups_item, offset - groups_offset);
249         }
250
251         if (exportlist_item) {
252                 /* now we have a nicer string */
253                 proto_item_set_text(exportlist_item, "Export List Entry: %s", directory);
254                 /* now we know, that exportlist is shorter */
255                 proto_item_set_len(exportlist_item, offset - old_offset);
256         }
257         g_free(directory);
258
259         return offset;
260 }
261
262
263 /* RFC 1094, Page 26 */
264 /* RFC 1813, Page 113 */
265 static int
266 dissect_mount_export_reply(const u_char *pd, int offset, frame_data *fd,
267         proto_tree *tree)
268 {
269
270         if (!proto_is_protocol_enabled(proto_mount)) 
271           return offset;
272
273         offset = dissect_rpc_list(pd,offset,fd,tree,dissect_exportlist);
274
275         return offset;
276 }
277
278
279 #define OFFS_MASK       32      /* offset of the "pc_mask" field */
280
281 #define PC_ERROR_ALL            0x0001
282 #define PC_ERROR_LINK_MAX       0x0002
283 #define PC_ERROR_MAX_CANON      0x0004
284 #define PC_ERROR_MAX_INPUT      0x0008
285 #define PC_ERROR_NAME_MAX       0x0010
286 #define PC_ERROR_PATH_MAX       0x0020
287 #define PC_ERROR_PIPE_BUF       0x0040
288 #define PC_CHOWN_RESTRICTED     0x0080
289 #define PC_NO_TRUNC             0x0100
290 #define PC_ERROR_VDISABLE       0x0200
291
292 static const true_false_string tos_error_all = {
293   "All info invalid",
294   "Some or all info valid"
295 };
296
297 static const true_false_string tos_error_link_max = {
298   "LINK_MAX invalid",
299   "LINK_MAX valid"
300 };
301
302 static const true_false_string tos_error_max_canon = {
303   "MAX_CANON invalid",
304   "MAX_CANON valid"
305 };
306
307 static const true_false_string tos_error_max_input = {
308   "MAX_INPUT invalid",
309   "MAX_INPUT valid"
310 };
311
312 static const true_false_string tos_error_name_max = {
313   "NAME_MAX invalid",
314   "NAME_MAX valid"
315 };
316
317 static const true_false_string tos_error_path_max = {
318   "PATH_MAX invalid",
319   "PATH_MAX valid"
320 };
321
322 static const true_false_string tos_error_pipe_buf = {
323   "PIPE_BUF invalid",
324   "PIPE_BUF valid"
325 };
326
327 static const true_false_string tos_chown_restricted = {
328   "Only a privileged user can change the ownership of a file",
329   "Users may give away their own files"
330 };
331
332 static const true_false_string tos_no_trunc = {
333   "File names that are too long will get an error",
334   "File names that are too long will be truncated"
335 };
336
337 static const true_false_string tos_error_vdisable = {
338   "VDISABLE invalid",
339   "VDISABLE valid"
340 };
341
342 static int
343 dissect_mount_pathconf_reply(const u_char *pd, int offset, frame_data *fd,
344         proto_tree *tree)
345 {
346         guint32 pc_mask;
347         proto_item *ti;
348         proto_tree *mask_tree;
349
350         if (!proto_is_protocol_enabled(proto_mount)) 
351           return offset;
352
353         /*
354          * Extract the mask first, so we know which other fields the
355          * server was able to return to us.
356          */
357         if (!BYTES_ARE_IN_FRAME(offset + OFFS_MASK, 4))
358                 return offset;
359         pc_mask = EXTRACT_UINT(pd, offset+OFFS_MASK) & 0xFFFF;
360
361         if (!BYTES_ARE_IN_FRAME(offset + 0,4))
362                 return offset;
363         if (!(pc_mask & (PC_ERROR_LINK_MAX|PC_ERROR_ALL))) {
364                 if (tree) {
365                         proto_tree_add_uint(tree,
366                             hf_mount_pathconf_link_max, NullTVB, offset, 4,
367                             EXTRACT_UINT(pd, offset+0));
368                 }
369         }
370         offset += 4;
371
372         if (!BYTES_ARE_IN_FRAME(offset,4))
373                 return offset;
374         if (!(pc_mask & (PC_ERROR_MAX_CANON|PC_ERROR_ALL))) {
375                 if (tree) {
376                         proto_tree_add_uint(tree,
377                             hf_mount_pathconf_max_canon, NullTVB, offset + 2, 2,
378                             (EXTRACT_UINT(pd, offset+0)) & 0xFFFF);
379                 }
380         }
381         
382         offset += 4;
383
384         if (!BYTES_ARE_IN_FRAME(offset,4))
385                 return offset;
386         if (!(pc_mask & (PC_ERROR_MAX_INPUT|PC_ERROR_ALL))) {
387                 if (tree) {
388                         proto_tree_add_uint(tree,
389                             hf_mount_pathconf_max_input, NullTVB, offset + 2, 2,
390                             (EXTRACT_UINT(pd, offset+0)) & 0xFFFF);
391                 }
392         }
393         offset += 4;
394
395         if (!BYTES_ARE_IN_FRAME(offset,4))
396                 return offset;
397         if (!(pc_mask & (PC_ERROR_NAME_MAX|PC_ERROR_ALL))) {
398                 if (tree) {
399                         proto_tree_add_uint(tree,
400                             hf_mount_pathconf_name_max, NullTVB, offset + 2, 2,
401                             (EXTRACT_UINT(pd, offset+0)) & 0xFFFF);
402                 }
403         }
404         offset += 4;
405
406         if (!BYTES_ARE_IN_FRAME(offset,4))
407                 return offset;
408         if (!(pc_mask & (PC_ERROR_PATH_MAX|PC_ERROR_ALL))) {
409                 if (tree) {
410                         proto_tree_add_uint(tree,
411                             hf_mount_pathconf_path_max, NullTVB, offset + 2, 2,
412                             (EXTRACT_UINT(pd, offset+0)) & 0xFFFF);
413                 }
414         }
415         offset += 4;
416
417         if (!BYTES_ARE_IN_FRAME(offset,4))
418                 return offset;
419         if (!(pc_mask & (PC_ERROR_PIPE_BUF|PC_ERROR_ALL))) {
420                 if (tree) {
421                         proto_tree_add_uint(tree,
422                             hf_mount_pathconf_pipe_buf, NullTVB, offset + 2, 2,
423                             (EXTRACT_UINT(pd, offset+0)) & 0xFFFF);
424                 }
425         }
426         offset += 4;
427
428         offset += 4;    /* skip "pc_xxx" pad field */
429
430         if (!BYTES_ARE_IN_FRAME(offset,4))
431                 return offset;
432         if (!(pc_mask & (PC_ERROR_VDISABLE|PC_ERROR_ALL))) {
433                 if (tree) {
434                         proto_tree_add_uint(tree,
435                             hf_mount_pathconf_vdisable, NullTVB, offset + 3, 1,
436                             (EXTRACT_UINT(pd, offset+0)) & 0xFF);
437                 }
438         }
439         offset += 4;
440
441         if (tree) {
442                 ti = proto_tree_add_uint(tree, hf_mount_pathconf_mask, NullTVB,
443                     offset + 2, 2, pc_mask);
444                 mask_tree = proto_item_add_subtree(ti, ett_mount_pathconf_mask);
445                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_all, NullTVB,
446                     offset + 2, 2, pc_mask);
447                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_link_max, NullTVB,
448                     offset + 2, 2, pc_mask);
449                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_max_canon, NullTVB,
450                     offset + 2, 2, pc_mask);
451                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_max_input, NullTVB,
452                     offset + 2, 2, pc_mask);
453                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_name_max, NullTVB,
454                     offset + 2, 2, pc_mask);
455                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_path_max, NullTVB,
456                     offset + 2, 2, pc_mask);
457                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_pipe_buf, NullTVB,
458                     offset + 2, 2, pc_mask);
459                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_chown_restricted, NullTVB,
460                     offset + 2, 2, pc_mask);
461                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_no_trunc, NullTVB,
462                     offset + 2, 2, pc_mask);
463                 proto_tree_add_boolean(mask_tree, hf_mount_pathconf_error_vdisable, NullTVB,
464                     offset + 2, 2, pc_mask);
465         }
466         offset += 4;
467         return offset;
468 }
469
470 /* proc number, "proc name", dissect_request, dissect_reply */
471 /* NULL as function pointer means: take the generic one. */
472
473 /* Mount protocol version 1, RFC 1094 */
474 static const vsff mount1_proc[] = {
475     { 0, "NULL", NULL, NULL },
476     { MOUNTPROC_MNT,        "MNT",      
477                 dissect_mount_dirpath_call, dissect_mount_mnt_reply },
478     { MOUNTPROC_DUMP,       "DUMP",
479                 NULL, dissect_mount_dump_reply },
480     { MOUNTPROC_UMNT,      "UMNT",        
481                 dissect_mount_dirpath_call, NULL },
482     { MOUNTPROC_UMNTALL,   "UMNTALL",
483                 NULL, NULL },
484     { MOUNTPROC_EXPORT,    "EXPORT",
485                 NULL, dissect_mount_export_reply },
486     { MOUNTPROC_EXPORTALL, "EXPORTALL",
487                 NULL, dissect_mount_export_reply },
488     { 0, NULL, NULL, NULL }
489 };
490 /* end of mount version 1 */
491
492
493 /* Mount protocol version 2, private communication from somebody at Sun;
494    mount V2 is V1 plus MOUNTPROC_PATHCONF to fetch information for the
495    POSIX "pathconf()" call. */
496 static const vsff mount2_proc[] = {
497     { 0, "NULL", NULL, NULL },
498     { MOUNTPROC_MNT,        "MNT",      
499                 dissect_mount_dirpath_call, dissect_mount_mnt_reply },
500     { MOUNTPROC_DUMP,       "DUMP",
501                 NULL, dissect_mount_dump_reply },
502     { MOUNTPROC_UMNT,      "UMNT",        
503                 dissect_mount_dirpath_call, NULL },
504     { MOUNTPROC_UMNTALL,   "UMNTALL",
505                 NULL, NULL },
506     { MOUNTPROC_EXPORT,    "EXPORT",
507                 NULL, dissect_mount_export_reply },
508     { MOUNTPROC_EXPORTALL, "EXPORTALL",
509                 NULL, dissect_mount_export_reply },
510     { MOUNTPROC_PATHCONF,  "PATHCONF",
511                 dissect_mount_dirpath_call, dissect_mount_pathconf_reply },
512     { 0, NULL, NULL, NULL }
513 };
514 /* end of mount version 2 */
515
516
517 /* RFC 1813, Page 107 */
518 static const value_string mount3_mountstat3[] = 
519 {
520         {       0,      "OK" },
521         {       1,      "ERR_PERM" },
522         {       2,      "ERR_NOENT" },
523         {       5,      "ERR_IO" },
524         {       13,     "ERR_ACCESS" },
525         {       20,     "ERR_NOTDIR" },
526         {       22,     "ERR_INVAL" },
527         {       63,     "ERR_NAMETOOLONG" },
528         {       10004,  "ERR_NOTSUPP" },
529         {       10006,  "ERR_SERVERFAULT" },
530         {       0,      NULL }
531 };
532
533
534 /* RFC 1813, Page 107 */
535 static int
536 dissect_mountstat3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
537         int hfindex, guint32* status)
538 {
539         guint32 mountstat3;
540
541         if (!proto_is_protocol_enabled(proto_mount)) 
542           return offset;
543
544         if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
545         mountstat3 = EXTRACT_UINT(pd, offset+0);
546
547         if (tree) {
548                 proto_tree_add_uint(tree, hfindex, NullTVB, offset, 4, mountstat3);
549         }
550         
551         offset += 4;
552         *status = mountstat3;
553         return offset;
554 }
555
556
557 /* RFC 1831, Page 109 */
558 static int
559 dissect_mount3_mnt_reply(const u_char *pd, int offset, frame_data *fd,
560         proto_tree *tree)
561 {
562         guint32 status;
563         guint32 auth_flavors;
564         guint32 auth_flavor;
565         guint32 auth_flavor_i;
566
567         if (!proto_is_protocol_enabled(proto_mount)) 
568           return offset;
569
570         offset = dissect_mountstat3(pd, offset, fd, tree, hf_mount_status, &status);
571         switch (status) {
572                 case 0:
573                         offset = dissect_nfs_fh3(pd,offset,fd,tree,"fhandle");
574                         if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
575                         auth_flavors = EXTRACT_UINT(pd,offset+0);
576                         proto_tree_add_uint(tree,hf_mount_flavors, NullTVB,
577                                 offset, 4, auth_flavors);
578                         offset += 4;
579                         for (auth_flavor_i = 0 ; auth_flavor_i < hf_mount_flavors ; auth_flavor_i++) {
580                                 if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
581                                 auth_flavor = EXTRACT_UINT(pd,offset+0);
582                                 proto_tree_add_uint(tree,hf_mount_flavor, NullTVB,
583                                         offset, 4, auth_flavor);
584                                 offset += 4;
585                         }
586                 break;
587                 default:
588                         /* void */
589                 break;
590         }
591         
592         return offset;
593 }
594
595 /* Mount protocol version 3, RFC 1813 */
596 static const vsff mount3_proc[] = {
597         { 0, "NULL", NULL, NULL },
598         { MOUNTPROC_MNT, "MNT",
599                 dissect_mount_dirpath_call, dissect_mount3_mnt_reply },
600         { MOUNTPROC_DUMP, "DUMP",
601                 NULL, dissect_mount_dump_reply },
602         { MOUNTPROC_UMNT, "UMNT",
603                 dissect_mount_dirpath_call, NULL },
604         { MOUNTPROC_UMNTALL, "UMNTALL",
605                 NULL, NULL },
606         { MOUNTPROC_EXPORT, "EXPORT",
607                 NULL, dissect_mount_export_reply },
608         { 0, NULL, NULL, NULL }
609 };
610 /* end of Mount protocol version 3 */
611
612
613 void
614 proto_register_mount(void)
615 {
616         static hf_register_info hf[] = {
617                 { &hf_mount_path, {
618                         "Path", "mount.path", FT_STRING, BASE_DEC,
619                         NULL, 0, "Path" }},
620                 { &hf_mount_status, {
621                         "Status", "mount.status", FT_UINT32, BASE_DEC,
622                         VALS(mount3_mountstat3), 0, "Status" }},
623                 { &hf_mount_mountlist_hostname, {
624                         "Hostname", "mount.dump.hostname", FT_STRING, BASE_DEC,
625                         NULL, 0, "Hostname" }},
626                 { &hf_mount_mountlist_directory, {
627                         "Directory", "mount.dump.directory", FT_STRING, BASE_DEC,
628                         NULL, 0, "Directory" }},
629                 { &hf_mount_mountlist, {
630                         "Mount List Entry", "mount.dump.entry", FT_NONE, 0,
631                         NULL, 0, "Mount List Entry" }},
632                 { &hf_mount_groups_group, {
633                         "Group", "mount.export.group", FT_STRING, BASE_DEC,
634                         NULL, 0, "Group" }},
635                 { &hf_mount_groups, {
636                         "Groups", "mount.export.groups", FT_NONE, 0,
637                         NULL, 0, "Groups" }},
638                 { &hf_mount_exportlist_directory, {
639                         "Directory", "mount.export.directory", FT_STRING, BASE_DEC,
640                         NULL, 0, "Directory" }},
641                 { &hf_mount_exportlist, {
642                         "Export List Entry", "mount.export.entry", FT_NONE, 0,
643                         NULL, 0, "Export List Entry" }},
644                 { &hf_mount_pathconf_link_max, {
645                         "Maximum number of links to a file", "mount.pathconf.link_max",
646                         FT_UINT32, BASE_DEC,
647                         NULL, 0, "Maximum number of links allowed to a file" }},
648                 { &hf_mount_pathconf_max_canon, {
649                         "Maximum terminal input line length", "mount.pathconf.max_canon",
650                         FT_UINT16, BASE_DEC,
651                         NULL, 0, "Max tty input line length" }},
652                 { &hf_mount_pathconf_max_input, {
653                         "Terminal input buffer size", "mount.pathconf.max_input",
654                         FT_UINT16, BASE_DEC,
655                         NULL, 0, "Terminal input buffer size" }},
656                 { &hf_mount_pathconf_name_max, {
657                         "Maximum file name length", "mount.pathconf.name_max",
658                         FT_UINT16, BASE_DEC,
659                         NULL, 0, "Maximum file name length" }},
660                 { &hf_mount_pathconf_path_max, {
661                         "Maximum path name length", "mount.pathconf.path_max",
662                         FT_UINT16, BASE_DEC,
663                         NULL, 0, "Maximum path name length" }},
664                 { &hf_mount_pathconf_pipe_buf, {
665                         "Pipe buffer size", "mount.pathconf.pipe_buf",
666                         FT_UINT16, BASE_DEC,
667                         NULL, 0, "Maximum amount of data that can be written atomically to a pipe" }},
668                 { &hf_mount_pathconf_vdisable, {
669                         "VDISABLE character", "mount.pathconf.vdisable_char",
670                         FT_UINT8, BASE_HEX,
671                         NULL, 0, "Character value to disable a terminal special character" }},
672                 { &hf_mount_pathconf_mask, {
673                         "Reply error/status bits", "mount.pathconf.mask",
674                         FT_UINT16, BASE_HEX,
675                         NULL, 0, "Bit mask with error and status bits" }},
676                 { &hf_mount_pathconf_error_all, {
677                         "ERROR_ALL",    "mount.pathconf.mask.error_all",
678                         FT_BOOLEAN, 16, TFS(&tos_error_all),
679                         PC_ERROR_ALL, "" }},
680                 { &hf_mount_pathconf_error_link_max, {
681                         "ERROR_LINK_MAX", "mount.pathconf.mask.error_link_max",
682                         FT_BOOLEAN, 16, TFS(&tos_error_link_max),
683                         PC_ERROR_LINK_MAX, "" }},
684                 { &hf_mount_pathconf_error_max_canon, {
685                         "ERROR_MAX_CANON", "mount.pathconf.mask.error_max_canon",
686                         FT_BOOLEAN, 16, TFS(&tos_error_max_canon),
687                         PC_ERROR_MAX_CANON, "" }},
688                 { &hf_mount_pathconf_error_max_input, {
689                         "ERROR_MAX_INPUT", "mount.pathconf.mask.error_max_input",
690                         FT_BOOLEAN, 16, TFS(&tos_error_max_input),
691                         PC_ERROR_MAX_INPUT, "" }},
692                 { &hf_mount_pathconf_error_name_max, {
693                         "ERROR_NAME_MAX", "mount.pathconf.mask.error_name_max",
694                         FT_BOOLEAN, 16, TFS(&tos_error_name_max),
695                         PC_ERROR_NAME_MAX, "" }},
696                 { &hf_mount_pathconf_error_path_max, {
697                         "ERROR_PATH_MAX", "mount.pathconf.mask.error_path_max",
698                         FT_BOOLEAN, 16, TFS(&tos_error_path_max),
699                         PC_ERROR_PATH_MAX, "" }},
700                 { &hf_mount_pathconf_error_pipe_buf, {
701                         "ERROR_PIPE_BUF", "mount.pathconf.mask.error_pipe_buf",
702                         FT_BOOLEAN, 16, TFS(&tos_error_pipe_buf),
703                         PC_ERROR_PIPE_BUF, "" }},
704                 { &hf_mount_pathconf_chown_restricted, {
705                         "CHOWN_RESTRICTED", "mount.pathconf.mask.chown_restricted",
706                         FT_BOOLEAN, 16, TFS(&tos_chown_restricted),
707                         PC_CHOWN_RESTRICTED, "" }},
708                 { &hf_mount_pathconf_no_trunc, {
709                         "NO_TRUNC", "mount.pathconf.mask.no_trunc",
710                         FT_BOOLEAN, 16, TFS(&tos_no_trunc),
711                         PC_NO_TRUNC, "" }},
712                 { &hf_mount_pathconf_error_vdisable, {
713                         "ERROR_VDISABLE", "mount.pathconf.mask.error_vdisable",
714                         FT_BOOLEAN, 16, TFS(&tos_error_vdisable),
715                         PC_ERROR_VDISABLE, "" }},
716                 { &hf_mount_flavors, {
717                         "Flavors", "mount.flavors", FT_UINT32, BASE_DEC,
718                         NULL, 0, "Flavors" }},
719                 { &hf_mount_flavor, {
720                         "Flavor", "mount.flavor", FT_UINT32, BASE_DEC,
721                         VALS(rpc_auth_flavor), 0, "Flavor" }},
722         };
723         static gint *ett[] = {
724                 &ett_mount,
725                 &ett_mount_mountlist,
726                 &ett_mount_groups,
727                 &ett_mount_exportlist,
728                 &ett_mount_pathconf_mask,
729         };
730
731         proto_mount = proto_register_protocol("Mount Service", "mount");
732         proto_register_field_array(proto_mount, hf, array_length(hf));
733         proto_register_subtree_array(ett, array_length(ett));
734 }
735
736 void
737 proto_reg_handoff_mount(void)
738 {
739         /* Register the protocol as RPC */
740         rpc_init_prog(proto_mount, MOUNT_PROGRAM, ett_mount);
741         /* Register the procedure tables */
742         rpc_init_proc_table(MOUNT_PROGRAM, 1, mount1_proc);
743         rpc_init_proc_table(MOUNT_PROGRAM, 2, mount2_proc);
744         rpc_init_proc_table(MOUNT_PROGRAM, 3, mount3_proc);
745 }