Home | History | Annotate | Download | only in rpcsvc
      1  0  stevel /*
      2  0  stevel  * CDDL HEADER START
      3  0  stevel  *
      4  0  stevel  * The contents of this file are subject to the terms of the
      5  0  stevel  * Common Development and Distribution License, Version 1.0 only
      6  0  stevel  * (the "License").  You may not use this file except in compliance
      7  0  stevel  * with the License.
      8  0  stevel  *
      9  0  stevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10  0  stevel  * or http://www.opensolaris.org/os/licensing.
     11  0  stevel  * See the License for the specific language governing permissions
     12  0  stevel  * and limitations under the License.
     13  0  stevel  *
     14  0  stevel  * When distributing Covered Code, include this CDDL HEADER in each
     15  0  stevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16  0  stevel  * If applicable, add the following below this CDDL HEADER, with the
     17  0  stevel  * fields enclosed by brackets "[]" replaced with your own identifying
     18  0  stevel  * information: Portions Copyright [yyyy] [name of copyright owner]
     19  0  stevel  *
     20  0  stevel  * CDDL HEADER END
     21  0  stevel  */
     22  0  stevel /* ident	"%Z%%M%	%I%	%E% SMI" */
     23  0  stevel 
     24  0  stevel /*
     25  0  stevel  * Copyright (c) 1988,1990-1992,1998 by Sun Microsystems, Inc.
     26  0  stevel  * All rights reserved.
     27  0  stevel  */
     28  0  stevel 
     29  0  stevel /*
     30  0  stevel  * Protocol description for the mount program
     31  0  stevel  */
     32  0  stevel 
     33  0  stevel const MNTPATHLEN = 1024;	/* maximum bytes in a pathname argument */
     34  0  stevel const MNTNAMLEN = 255;		/* maximum bytes in a name argument */
     35  0  stevel const FHSIZE = 32;		/* size in bytes of a v2 file handle */
     36  0  stevel const FHSIZE3 = 64;		/*  "   "    "   "  " v3  "     "    */
     37  0  stevel 
     38  0  stevel /*
     39  0  stevel  * The fhandle is the file handle that the server passes to the client.
     40  0  stevel  * All file operations are done using the file handles to refer to a file
     41  0  stevel  * or a directory. The file handle can contain whatever information the
     42  0  stevel  * server needs to distinguish an individual file.
     43  0  stevel  *
     44  0  stevel  * Versions 1 and 2 of the protocol share a filehandle of 32 bytes.
     45  0  stevel  *
     46  0  stevel  * Version 3 supports a 64 byte filehandle that can be used only
     47  0  stevel  * with version 3 of the NFS protocol.
     48  0  stevel  */
     49  0  stevel 
     50  0  stevel typedef opaque fhandle[FHSIZE];
     51  0  stevel typedef opaque fhandle3<FHSIZE3>;
     52  0  stevel 
     53  0  stevel /*
     54  0  stevel  * If a V2 status of zero is returned, the call completed successfully, and
     55  0  stevel  * a file handle for the directory follows. A non-zero status indicates
     56  0  stevel  * some sort of error. The status corresponds with UNIX error numbers.
     57  0  stevel  */
     58  0  stevel union fhstatus switch (unsigned fhs_status) {
     59  0  stevel case 0:
     60  0  stevel 	fhandle fhs_fhandle;
     61  0  stevel default:
     62  0  stevel 	void;
     63  0  stevel };
     64  0  stevel 
     65  0  stevel /*
     66  0  stevel  * This #define is added for backwards compatability with applications
     67  0  stevel  * which reference the old style fhstatus.  The second element of that
     68  0  stevel  * structure was called fhs_fh, instead of the current fhs_fhandle.
     69  0  stevel  */
     70  0  stevel %
     71  0  stevel %#define	fhs_fh	fhstatus_u.fhs_fhandle
     72  0  stevel 
     73  0  stevel /*
     74  0  stevel  * The following status codes are defined for the V3 mount service:
     75  0  stevel  * Note that the precise enum encoding must be followed; the values
     76  0  stevel  * are derived from existing implementation practice, and there is
     77  0  stevel  * no good reason to disturb them.
     78  0  stevel  */
     79  0  stevel enum mountstat3 {
     80  0  stevel         MNT_OK= 0,              /* no error */
     81  0  stevel         MNT3ERR_PERM=1,         /* Not owner */
     82  0  stevel         MNT3ERR_NOENT=2,        /* No such file or directory */
     83  0  stevel         MNT3ERR_IO=5,           /* I/O error */
     84  0  stevel         MNT3ERR_ACCES=13,       /* Permission denied */
     85  0  stevel         MNT3ERR_NOTDIR=20,      /* Not a directory*/
     86  0  stevel         MNT3ERR_INVAL=22,       /* Invalid argument.*/
     87  0  stevel         MNT3ERR_NAMETOOLONG=63, /* File name too long */
     88  0  stevel         MNT3ERR_NOTSUPP=10004,  /* operation not supported */
     89  0  stevel         MNT3ERR_SERVERFAULT=10006 /* An i/o or similar failure caused */
     90  0  stevel                                 /* the server to abandon the request */
     91  0  stevel                                 /* No attributes can be returned. The */
     92  0  stevel                                 /* client should translate this into EIO */
     93  0  stevel };
     94  0  stevel 
     95  0  stevel /*
     96  0  stevel  * A V3 server returns a file handle and a list of the authentication
     97  0  stevel  * flavors that the server will accept for this mount.  If the list
     98  0  stevel  * is empty, AUTH_UNIX is required.  Otherwise, any of the flavors
     99  0  stevel  * listed in auth_flavors<> may be used (but no others).
    100  0  stevel  * The values of the authentication flavors are defined in the
    101  0  stevel  * underlying RPC protocol.
    102  0  stevel  */
    103  0  stevel struct mountres3_ok {
    104  0  stevel 	fhandle3 fhandle;
    105  0  stevel 	int auth_flavors<>;
    106  0  stevel };
    107  0  stevel 
    108  0  stevel /*
    109  0  stevel  * If a V3 status of MNT_OK is returned, the call completed successfully, and
    110  0  stevel  * a file handle for the directory follows. Any other status indicates
    111  0  stevel  * some sort of error.
    112  0  stevel  */
    113  0  stevel 
    114  0  stevel union mountres3 switch (mountstat3 fhs_status) {
    115  0  stevel case MNT_OK:
    116  0  stevel         mountres3_ok mountinfo;
    117  0  stevel default:
    118  0  stevel         void;
    119  0  stevel };
    120  0  stevel 
    121  0  stevel /*
    122  0  stevel  * The type dirpath is the pathname of a directory
    123  0  stevel  */
    124  0  stevel typedef string dirpath<MNTPATHLEN>;
    125  0  stevel 
    126  0  stevel /*
    127  0  stevel  * The type name is used for arbitrary names (hostnames, groupnames)
    128  0  stevel  */
    129  0  stevel typedef string name<MNTNAMLEN>;
    130  0  stevel 
    131  0  stevel /*
    132  0  stevel  * A list of who has what mounted. This information is
    133  0  stevel  * strictly advisory, since there is no mechanism to
    134  0  stevel  * enforce the removal of stale information. The strongest
    135  0  stevel  * assertion that can be made is that if a hostname:directory
    136  0  stevel  * pair appears in the list, the server has exported the
    137  0  stevel  * directory to that client at some point since the server
    138  0  stevel  * export data base was (re)initialized. Note also that there
    139  0  stevel  * is no limit on the length of the information returned
    140  0  stevel  * in this structure, and this may cause problems if the
    141  0  stevel  * mount service is accessed via a connectionless transport.
    142  0  stevel  *
    143  0  stevel  * The ifdef will ensure that these are only carried over to
    144  0  stevel  * mount.h - no xdr routines will be generated. We want to
    145  0  stevel  * do these by hand, to avoid the recursive stack-blowing ones
    146  0  stevel  * that rpcgen will generate.
    147  0  stevel  */
    148  0  stevel #ifdef RPC_HDR
    149  0  stevel typedef struct mountbody *mountlist;
    150  0  stevel struct mountbody {
    151  0  stevel 	name ml_hostname;
    152  0  stevel 	dirpath ml_directory;
    153  0  stevel 	mountlist ml_next;
    154  0  stevel };
    155  0  stevel #endif /* RPC_HDR */
    156  0  stevel 
    157  0  stevel /*
    158  0  stevel  * A list of netgroups
    159  0  stevel  */
    160  0  stevel typedef struct groupnode *groups;
    161  0  stevel struct groupnode {
    162  0  stevel 	name gr_name;
    163  0  stevel 	groups gr_next;
    164  0  stevel };
    165  0  stevel 
    166  0  stevel /*
    167  0  stevel  * A list of what is exported and to whom
    168  0  stevel  */
    169  0  stevel typedef struct exportnode *exports;
    170  0  stevel struct exportnode {
    171  0  stevel 	dirpath ex_dir;
    172  0  stevel 	groups ex_groups;
    173  0  stevel 	exports ex_next;
    174  0  stevel };
    175  0  stevel 
    176  0  stevel /*
    177  0  stevel  * POSIX pathconf information
    178  0  stevel  */
    179  0  stevel struct ppathcnf {
    180  0  stevel 	int	pc_link_max;	/* max links allowed */
    181  0  stevel 	short	pc_max_canon;	/* max line len for a tty */
    182  0  stevel 	short	pc_max_input;	/* input a tty can eat all at once */
    183  0  stevel 	short	pc_name_max;	/* max file name length (dir entry) */
    184  0  stevel 	short	pc_path_max;	/* max path name length (/x/y/x/.. ) */
    185  0  stevel 	short	pc_pipe_buf;	/* size of a pipe (bytes) */
    186  0  stevel 	u_char	pc_vdisable;	/* safe char to turn off c_cc[i] */
    187  0  stevel 	char	pc_xxx;		/* alignment padding; cc_t == char */
    188  0  stevel 	short	pc_mask[2];	/* validity and boolean bits */
    189  0  stevel };
    190  0  stevel 
    191  0  stevel program MOUNTPROG {
    192  0  stevel 	/*
    193  0  stevel 	 * Version one of the mount protocol communicates with version two
    194  0  stevel 	 * of the NFS protocol. The only connecting point is the fhandle
    195  0  stevel 	 * structure, which is the same for both protocols.
    196  0  stevel 	 */
    197  0  stevel 	version MOUNTVERS {
    198  0  stevel 		/*
    199  0  stevel 		 * Does no work. It is made available in all RPC services
    200  0  stevel 		 * to allow server reponse testing and timing
    201  0  stevel 		 */
    202  0  stevel 		void
    203  0  stevel 		MOUNTPROC_NULL(void) = 0;
    204  0  stevel 
    205  0  stevel 		/*
    206  0  stevel 		 * If fhs_status is 0, then fhs_fhandle contains the
    207  0  stevel 	 	 * file handle for the directory. This file handle may
    208  0  stevel 		 * be used in the NFS protocol. This procedure also adds
    209  0  stevel 		 * a new entry to the mount list for this client mounting
    210  0  stevel 		 * the directory.
    211  0  stevel 		 * Unix authentication required.
    212  0  stevel 		 */
    213  0  stevel 		fhstatus
    214  0  stevel 		MOUNTPROC_MNT(dirpath) = 1;
    215  0  stevel 
    216  0  stevel 		/*
    217  0  stevel 		 * Returns the list of remotely mounted filesystems. The
    218  0  stevel 		 * mountlist contains one entry for each hostname and
    219  0  stevel 		 * directory pair.
    220  0  stevel 		 */
    221  0  stevel 		mountlist
    222  0  stevel 		MOUNTPROC_DUMP(void) = 2;
    223  0  stevel 
    224  0  stevel 		/*
    225  0  stevel 		 * Removes the mount list entry for the directory
    226  0  stevel 		 * Unix authentication required.
    227  0  stevel 		 */
    228  0  stevel 		void
    229  0  stevel 		MOUNTPROC_UMNT(dirpath) = 3;
    230  0  stevel 
    231  0  stevel 		/*
    232  0  stevel 		 * Removes all of the mount list entries for this client
    233  0  stevel 		 * Unix authentication required.
    234  0  stevel 		 */
    235  0  stevel 		void
    236  0  stevel 		MOUNTPROC_UMNTALL(void) = 4;
    237  0  stevel 
    238  0  stevel 		/*
    239  0  stevel 		 * Returns a list of all the exported filesystems, and which
    240  0  stevel 		 * machines are allowed to import it.
    241  0  stevel 		 */
    242  0  stevel 		exports
    243  0  stevel 		MOUNTPROC_EXPORT(void)  = 5;
    244  0  stevel 
    245  0  stevel 		/*
    246  0  stevel 		 * Identical to MOUNTPROC_EXPORT above
    247  0  stevel 		 */
    248  0  stevel 		exports
    249  0  stevel 		MOUNTPROC_EXPORTALL(void) = 6;
    250  0  stevel 	} = 1;
    251  0  stevel 
    252  0  stevel 	/*
    253  0  stevel 	 * Version two of the mount protocol communicates with version two
    254  0  stevel 	 * of the NFS protocol. It is identical to version one except for a
    255  0  stevel 	 * new procedure call for posix.
    256  0  stevel 	 */
    257  0  stevel 	version MOUNTVERS_POSIX {
    258  0  stevel 		/*
    259  0  stevel 		 * Does no work. It is made available in all RPC services
    260  0  stevel 		 * to allow server reponse testing and timing
    261  0  stevel 		 */
    262  0  stevel 		void
    263  0  stevel 		MOUNTPROC_NULL(void) = 0;
    264  0  stevel 
    265  0  stevel 		/*
    266  0  stevel 		 * If fhs_status is 0, then fhs_fhandle contains the
    267  0  stevel 	 	 * file handle for the directory. This file handle may
    268  0  stevel 		 * be used in the NFS protocol. This procedure also adds
    269  0  stevel 		 * a new entry to the mount list for this client mounting
    270  0  stevel 		 * the directory.
    271  0  stevel 		 * Unix authentication required.
    272  0  stevel 		 */
    273  0  stevel 		fhstatus
    274  0  stevel 		MOUNTPROC_MNT(dirpath) = 1;
    275  0  stevel 
    276  0  stevel 		/*
    277  0  stevel 		 * Returns the list of remotely mounted filesystems. The
    278  0  stevel 		 * mountlist contains one entry for each hostname and
    279  0  stevel 		 * directory pair.
    280  0  stevel 		 */
    281  0  stevel 		mountlist
    282  0  stevel 		MOUNTPROC_DUMP(void) = 2;
    283  0  stevel 
    284  0  stevel 		/*
    285  0  stevel 		 * Removes the mount list entry for the directory
    286  0  stevel 		 * Unix authentication required.
    287  0  stevel 		 */
    288  0  stevel 		void
    289  0  stevel 		MOUNTPROC_UMNT(dirpath) = 3;
    290  0  stevel 
    291  0  stevel 		/*
    292  0  stevel 		 * Removes all of the mount list entries for this client
    293  0  stevel 		 * Unix authentication required.
    294  0  stevel 		 */
    295  0  stevel 		void
    296  0  stevel 		MOUNTPROC_UMNTALL(void) = 4;
    297  0  stevel 
    298  0  stevel 		/*
    299  0  stevel 		 * Returns a list of all the exported filesystems, and which
    300  0  stevel 		 * machines are allowed to import it.
    301  0  stevel 		 */
    302  0  stevel 		exports
    303  0  stevel 		MOUNTPROC_EXPORT(void)  = 5;
    304  0  stevel 
    305  0  stevel 		/*
    306  0  stevel 		 * Identical to MOUNTPROC_EXPORT above
    307  0  stevel 		 */
    308  0  stevel 		exports
    309  0  stevel 		MOUNTPROC_EXPORTALL(void) = 6;
    310  0  stevel 
    311  0  stevel 		/*
    312  0  stevel 		 * Posix info over the wire isn't supported in NFS version 2
    313  0  stevel 		 * so we get it here at mount time.
    314  0  stevel 		 */
    315  0  stevel 		ppathcnf
    316  0  stevel 		MOUNTPROC_PATHCONF(dirpath) = 7;
    317  0  stevel 	} = 2;
    318  0  stevel 
    319  0  stevel 	/*
    320  0  stevel 	 * Version 3 of the mount protocol communicates with version 3
    321  0  stevel 	 * of the NFS protocol. The only connecting point is the nfs_fh3
    322  0  stevel 	 * structure, which is the same for both protocols.
    323  0  stevel 	 *
    324  0  stevel 	 * The only significant change over version 2 is that MOUNTPROC_MNT
    325  0  stevel 	 * returns a longer filehandle (64 bytes instead of 32) as well
    326  0  stevel 	 * as authentication information.  MOUNTPROC_PATHCONF is subsumed
    327  0  stevel 	 * into V3 of the NFS protocol and MOUNTPROC_EXPORTALL is eliminated.
    328  0  stevel 	 */
    329  0  stevel 	version MOUNTVERS3 {
    330  0  stevel 		/*
    331  0  stevel 		 * Does no work. It is made available in all RPC services
    332  0  stevel 		 * to allow server reponse testing and timing
    333  0  stevel 		 */
    334  0  stevel 		void
    335  0  stevel 		MOUNTPROC_NULL(void) = 0;
    336  0  stevel 
    337  0  stevel 		/*
    338  0  stevel 		 * Mount a file system.
    339  0  stevel 		 *
    340  0  stevel 		 * If mountres.fhs_status is NFS_OK, then mountres.mountinfo
    341  0  stevel 		 * contains the file handle for the directory and
    342  0  stevel 		 * a list of acceptable authentication flavors. This file
    343  0  stevel 		 * handle may only be used in version 3 of the NFS protocol.
    344  0  stevel 		 * This procedure also results in the server adding a new
    345  0  stevel 		 * entry to its mount list recording that this client has
    346  0  stevel 		 * mounted the directory. Unix authentication or better
    347  0  stevel 		 * is required.
    348  0  stevel 		 */
    349  0  stevel 		mountres3
    350  0  stevel 		MOUNTPROC_MNT(dirpath) = 1;
    351  0  stevel 
    352  0  stevel 		/*
    353  0  stevel 		 * Returns the list of remotely mounted filesystems. The
    354  0  stevel 		 * mountlist contains one entry for each hostname and
    355  0  stevel 		 * directory pair.
    356  0  stevel 		 */
    357  0  stevel 		mountlist
    358  0  stevel 		MOUNTPROC_DUMP(void) = 2;
    359  0  stevel 
    360  0  stevel 		/*
    361  0  stevel 		 * Removes the mount list entry for the directory
    362  0  stevel 		 * Unix authentication or better is required.
    363  0  stevel 		 */
    364  0  stevel 		void
    365  0  stevel 		MOUNTPROC_UMNT(dirpath) = 3;
    366  0  stevel 
    367  0  stevel 		/*
    368  0  stevel 		 * Removes all of the mount list entries for this client
    369  0  stevel 		 * Unix authentication or better is required.
    370  0  stevel 		 */
    371  0  stevel 		void
    372  0  stevel 		MOUNTPROC_UMNTALL(void) = 4;
    373  0  stevel 
    374  0  stevel 		/*
    375  0  stevel 		 * Returns a list of all the exported filesystems, and which
    376  0  stevel 		 * machines are allowed to import each one.
    377  0  stevel 		 */
    378  0  stevel 		exports
    379  0  stevel 		MOUNTPROC_EXPORT(void)  = 5;
    380  0  stevel 
    381  0  stevel 	} = 3;
    382  0  stevel } = 100005;
    383