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