xref: /netbsd/sys/fs/nfs/common/rpcv2.h (revision 9012e0ed)
1*9012e0edSdholland /*	$NetBSD: rpcv2.h,v 1.1.1.1 2013/09/30 07:19:42 dholland Exp $	*/
2*9012e0edSdholland /*-
3*9012e0edSdholland  * Copyright (c) 1989, 1993
4*9012e0edSdholland  *	The Regents of the University of California.  All rights reserved.
5*9012e0edSdholland  *
6*9012e0edSdholland  * This code is derived from software contributed to Berkeley by
7*9012e0edSdholland  * Rick Macklem at The University of Guelph.
8*9012e0edSdholland  *
9*9012e0edSdholland  * Redistribution and use in source and binary forms, with or without
10*9012e0edSdholland  * modification, are permitted provided that the following conditions
11*9012e0edSdholland  * are met:
12*9012e0edSdholland  * 1. Redistributions of source code must retain the above copyright
13*9012e0edSdholland  *    notice, this list of conditions and the following disclaimer.
14*9012e0edSdholland  * 2. Redistributions in binary form must reproduce the above copyright
15*9012e0edSdholland  *    notice, this list of conditions and the following disclaimer in the
16*9012e0edSdholland  *    documentation and/or other materials provided with the distribution.
17*9012e0edSdholland  * 4. Neither the name of the University nor the names of its contributors
18*9012e0edSdholland  *    may be used to endorse or promote products derived from this software
19*9012e0edSdholland  *    without specific prior written permission.
20*9012e0edSdholland  *
21*9012e0edSdholland  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22*9012e0edSdholland  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23*9012e0edSdholland  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24*9012e0edSdholland  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25*9012e0edSdholland  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*9012e0edSdholland  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27*9012e0edSdholland  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28*9012e0edSdholland  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29*9012e0edSdholland  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30*9012e0edSdholland  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*9012e0edSdholland  * SUCH DAMAGE.
32*9012e0edSdholland  *
33*9012e0edSdholland  * FreeBSD: head/sys/fs/nfs/rpcv2.h 191783 2009-05-04 15:23:58Z rmacklem
34*9012e0edSdholland  * $NetBSD: rpcv2.h,v 1.1.1.1 2013/09/30 07:19:42 dholland Exp $
35*9012e0edSdholland  */
36*9012e0edSdholland 
37*9012e0edSdholland #ifndef _NFS_RPCV2_H_
38*9012e0edSdholland #define	_NFS_RPCV2_H_
39*9012e0edSdholland 
40*9012e0edSdholland /*
41*9012e0edSdholland  * Definitions for Sun RPC Version 2, from
42*9012e0edSdholland  * "RPC: Remote Procedure Call Protocol Specification" RFC1057
43*9012e0edSdholland  */
44*9012e0edSdholland 
45*9012e0edSdholland /* Version # */
46*9012e0edSdholland #define	RPC_VER2		2
47*9012e0edSdholland 
48*9012e0edSdholland /* Authentication flavours */
49*9012e0edSdholland #define	RPCAUTH_NULL			0
50*9012e0edSdholland #define	RPCAUTH_UNIX			1
51*9012e0edSdholland #define	RPCAUTH_SHORT			2
52*9012e0edSdholland #define	RPCAUTH_KERB4			4
53*9012e0edSdholland #define	RPCAUTH_GSS			6
54*9012e0edSdholland #define	RPCAUTH_GSSKRB5			390003
55*9012e0edSdholland #define	RPCAUTH_GSSKRB5INTEGRITY	390004
56*9012e0edSdholland #define	RPCAUTH_GSSKRB5PRIVACY		390005
57*9012e0edSdholland 
58*9012e0edSdholland #define	RPCAUTH_MAXSIZ		400
59*9012e0edSdholland #define	RPCVERF_MAXSIZ	12	/* For Kerb, can actually be 400 */
60*9012e0edSdholland 
61*9012e0edSdholland /*
62*9012e0edSdholland  * RPCAUTH_UNIX defs.
63*9012e0edSdholland  */
64*9012e0edSdholland #define	RPCAUTHUNIX_MINSIZ	(5 * NFSX_UNSIGNED)
65*9012e0edSdholland #define	RPCAUTH_UNIXGIDS 16
66*9012e0edSdholland 
67*9012e0edSdholland /*
68*9012e0edSdholland  * RPCAUTH_GSS defs.
69*9012e0edSdholland  */
70*9012e0edSdholland #define	RPCAUTHGSS_VERS1	1
71*9012e0edSdholland 
72*9012e0edSdholland #define	RPCAUTHGSS_DATA		0
73*9012e0edSdholland #define	RPCAUTHGSS_INIT		1
74*9012e0edSdholland #define	RPCAUTHGSS_CONTINIT	2
75*9012e0edSdholland #define	RPCAUTHGSS_DESTROY	3
76*9012e0edSdholland 
77*9012e0edSdholland #define	RPCAUTHGSS_SVCNONE	1
78*9012e0edSdholland #define	RPCAUTHGSS_SVCINTEGRITY	2
79*9012e0edSdholland #define	RPCAUTHGSS_SVCPRIVACY	3
80*9012e0edSdholland 
81*9012e0edSdholland #define	RPCAUTHGSS_MAXSEQ	0x80000000
82*9012e0edSdholland 
83*9012e0edSdholland #define	RPCAUTHGSS_WINDOW	64	/* # of bits in u_int64_t */
84*9012e0edSdholland #define	RPCAUTHGSS_SEQWINDOW	(RPCAUTHGSS_WINDOW + 1)
85*9012e0edSdholland 
86*9012e0edSdholland #define	RPCAUTHGSS_MIC		1
87*9012e0edSdholland #define	RPCAUTHGSS_WRAP		2
88*9012e0edSdholland 
89*9012e0edSdholland /*
90*9012e0edSdholland  * Qop values for the types of security services.
91*9012e0edSdholland  */
92*9012e0edSdholland #define	GSS_KERBV_QOP		0
93*9012e0edSdholland 
94*9012e0edSdholland /*
95*9012e0edSdholland  * Sizes of GSS stuff.
96*9012e0edSdholland  */
97*9012e0edSdholland #define	RPCGSS_KEYSIZ		8
98*9012e0edSdholland 
99*9012e0edSdholland #define	GSSX_AUTHHEAD	(5 * NFSX_UNSIGNED)
100*9012e0edSdholland #define	GSSX_MYHANDLE	(sizeof (long) + sizeof (u_int64_t))
101*9012e0edSdholland #define	GSSX_RPCHEADER	(13 * NFSX_UNSIGNED + GSSX_MYHANDLE)
102*9012e0edSdholland #define	GSSX_MINWRAP	(2 * NFSX_UNSIGNED)
103*9012e0edSdholland #define	GSSX_KERBVTOKEN	24
104*9012e0edSdholland #define	GSSX_LOCALHANDLE (sizeof (void *))
105*9012e0edSdholland 
106*9012e0edSdholland /*
107*9012e0edSdholland  * Stuff for the gssd.
108*9012e0edSdholland  */
109*9012e0edSdholland #define	RPCPROG_GSSD		0x20101010
110*9012e0edSdholland #define	RPCGSSD_VERS		1
111*9012e0edSdholland #define	RPCGSSD_INIT		1
112*9012e0edSdholland #define	RPCGSSD_CONTINIT	2
113*9012e0edSdholland #define	RPCGSSD_CONTINITDESTROY	3
114*9012e0edSdholland #define	RPCGSSD_CLINIT		4
115*9012e0edSdholland #define	RPCGSSD_CLINITUID	5
116*9012e0edSdholland #define	RPCGSSD_CLCONT		6
117*9012e0edSdholland #define	RPCGSSD_CLCONTUID	7
118*9012e0edSdholland #define	RPCGSSD_CLINITNAME	8
119*9012e0edSdholland #define	RPCGSSD_CLCONTNAME	9
120*9012e0edSdholland 
121*9012e0edSdholland /*
122*9012e0edSdholland  * Stuff for the nfsuserd
123*9012e0edSdholland  */
124*9012e0edSdholland #define	RPCPROG_NFSUSERD	0x21010101
125*9012e0edSdholland #define	RPCNFSUSERD_VERS	1
126*9012e0edSdholland #define	RPCNFSUSERD_GETUID	1
127*9012e0edSdholland #define	RPCNFSUSERD_GETGID	2
128*9012e0edSdholland #define	RPCNFSUSERD_GETUSER	3
129*9012e0edSdholland #define	RPCNFSUSERD_GETGROUP	4
130*9012e0edSdholland 
131*9012e0edSdholland /*
132*9012e0edSdholland  * Some major status codes.
133*9012e0edSdholland  */
134*9012e0edSdholland #if !defined(_GSSAPI_H_) && !defined(GSSAPI_H_) && !defined(_GSSAPI_GSSAPI_H_) && !defined(_RPCSEC_GSS_H)
135*9012e0edSdholland #define	 GSS_S_COMPLETE                  0x00000000
136*9012e0edSdholland #define	 GSS_S_CONTINUE_NEEDED           0x00000001
137*9012e0edSdholland #define	 GSS_S_DUPLICATE_TOKEN           0x00000002
138*9012e0edSdholland #define	 GSS_S_OLD_TOKEN                 0x00000004
139*9012e0edSdholland #define	 GSS_S_UNSEQ_TOKEN               0x00000008
140*9012e0edSdholland #define	 GSS_S_GAP_TOKEN                 0x00000010
141*9012e0edSdholland #define	 GSS_S_BAD_MECH                  0x00010000
142*9012e0edSdholland #define	 GSS_S_BAD_NAME                  0x00020000
143*9012e0edSdholland #define	 GSS_S_BAD_NAMETYPE              0x00030000
144*9012e0edSdholland #define	 GSS_S_BAD_BINDINGS              0x00040000
145*9012e0edSdholland #define	 GSS_S_BAD_STATUS                0x00050000
146*9012e0edSdholland #define	 GSS_S_BAD_MIC                   0x00060000
147*9012e0edSdholland #define	 GSS_S_BAD_SIG                   0x00060000
148*9012e0edSdholland #define	 GSS_S_NO_CRED                   0x00070000
149*9012e0edSdholland #define	 GSS_S_NO_CONTEXT                0x00080000
150*9012e0edSdholland #define	 GSS_S_DEFECTIVE_TOKEN           0x00090000
151*9012e0edSdholland #define	 GSS_S_DEFECTIVE_CREDENTIAL      0x000a0000
152*9012e0edSdholland #define	 GSS_S_CREDENTIALS_EXPIRED       0x000b0000
153*9012e0edSdholland #define	 GSS_S_CONTEXT_EXPIRED           0x000c0000
154*9012e0edSdholland #define	 GSS_S_FAILURE                   0x000d0000
155*9012e0edSdholland #define	 GSS_S_BAD_QOP                   0x000e0000
156*9012e0edSdholland #define	 GSS_S_UNAUTHORIZED              0x000f0000
157*9012e0edSdholland #define	 GSS_S_UNAVAILABLE               0x00100000
158*9012e0edSdholland #define	 GSS_S_DUPLICATE_ELEMENT         0x00110000
159*9012e0edSdholland #define	 GSS_S_NAME_NOT_MN               0x00120000
160*9012e0edSdholland #define	 GSS_S_CALL_INACCESSIBLE_READ    0x01000000
161*9012e0edSdholland #define	 GSS_S_CALL_INACCESSIBLE_WRITE   0x02000000
162*9012e0edSdholland #define	 GSS_S_CALL_BAD_STRUCTURE        0x03000000
163*9012e0edSdholland #endif	/* _GSSAPI_H_ */
164*9012e0edSdholland 
165*9012e0edSdholland /* Rpc Constants */
166*9012e0edSdholland #define	RPC_CALL	0
167*9012e0edSdholland #define	RPC_REPLY	1
168*9012e0edSdholland #define	RPC_MSGACCEPTED	0
169*9012e0edSdholland #define	RPC_MSGDENIED	1
170*9012e0edSdholland #define	RPC_PROGUNAVAIL	1
171*9012e0edSdholland #define	RPC_PROGMISMATCH	2
172*9012e0edSdholland #define	RPC_PROCUNAVAIL	3
173*9012e0edSdholland #define	RPC_GARBAGE	4		/* I like this one */
174*9012e0edSdholland #define	RPC_MISMATCH	0
175*9012e0edSdholland #define	RPC_AUTHERR	1
176*9012e0edSdholland 
177*9012e0edSdholland /* Authentication failures */
178*9012e0edSdholland #define	AUTH_BADCRED	1
179*9012e0edSdholland #define	AUTH_REJECTCRED	2
180*9012e0edSdholland #define	AUTH_BADVERF	3
181*9012e0edSdholland #define	AUTH_REJECTVERF	4
182*9012e0edSdholland #define	AUTH_TOOWEAK	5		/* Give em wheaties */
183*9012e0edSdholland #define	AUTH_PROBCRED	13
184*9012e0edSdholland #define	AUTH_CTXCRED	14
185*9012e0edSdholland 
186*9012e0edSdholland /* Sizes of rpc header parts */
187*9012e0edSdholland #define	RPC_SIZ		24
188*9012e0edSdholland #define	RPC_REPLYSIZ	28
189*9012e0edSdholland 
190*9012e0edSdholland /* RPC Prog definitions */
191*9012e0edSdholland #define	RPCPROG_MNT	100005
192*9012e0edSdholland #define	RPCMNT_VER1	1
193*9012e0edSdholland #define	RPCMNT_VER3	3
194*9012e0edSdholland #define	RPCMNT_MOUNT	1
195*9012e0edSdholland #define	RPCMNT_DUMP	2
196*9012e0edSdholland #define	RPCMNT_UMOUNT	3
197*9012e0edSdholland #define	RPCMNT_UMNTALL	4
198*9012e0edSdholland #define	RPCMNT_EXPORT	5
199*9012e0edSdholland #define	RPCMNT_NAMELEN	255
200*9012e0edSdholland #define	RPCMNT_PATHLEN	1024
201*9012e0edSdholland #define	RPCPROG_NFS	100003
202*9012e0edSdholland 
203*9012e0edSdholland /* Structs for common parts of the rpc's */
204*9012e0edSdholland struct rpcv2_time {
205*9012e0edSdholland 	u_int32_t rpc_sec;
206*9012e0edSdholland 	u_int32_t rpc_usec;
207*9012e0edSdholland };
208*9012e0edSdholland 
209*9012e0edSdholland #endif	/* _NFS_RPCV2_H_ */
210