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