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