]> git.saurik.com Git - apple/xnu.git/blob - bsd/nfs/rpcv2.h
xnu-792.18.15.tar.gz
[apple/xnu.git] / bsd / nfs / rpcv2.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29 /*
30 * Copyright (c) 1989, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * This code is derived from software contributed to Berkeley by
34 * Rick Macklem at The University of Guelph.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)rpcv2.h 8.2 (Berkeley) 3/30/95
65 * FreeBSD-Id: rpcv2.h,v 1.8 1997/05/11 18:05:39 tegge Exp $
66 */
67
68
69 #ifndef _NFS_RPCV2_H_
70 #define _NFS_RPCV2_H_
71
72 #include <sys/appleapiopts.h>
73
74 #ifdef __APPLE_API_PRIVATE
75 /*
76 * Definitions for Sun RPC Version 2, from
77 * "RPC: Remote Procedure Call Protocol Specification" RFC1057
78 */
79
80 /* Version # */
81 #define RPC_VER2 2
82
83 /* Authentication */
84 #define RPCAUTH_NULL 0
85 #define RPCAUTH_UNIX 1
86 #define RPCAUTH_SHORT 2
87 #define RPCAUTH_KERB4 4
88 #define RPCAUTH_MAXSIZ 400
89 #define RPCVERF_MAXSIZ 12 /* For Kerb, can actually be 400 */
90 #define RPCAUTH_UNIXGIDS 16
91
92 /*
93 * Constants associated with authentication flavours.
94 */
95 #define RPCAKN_FULLNAME 0
96 #define RPCAKN_NICKNAME 1
97
98 /* Rpc Constants */
99 #define RPC_CALL 0
100 #define RPC_REPLY 1
101 #define RPC_MSGACCEPTED 0
102 #define RPC_MSGDENIED 1
103 #define RPC_PROGUNAVAIL 1
104 #define RPC_PROGMISMATCH 2
105 #define RPC_PROCUNAVAIL 3
106 #define RPC_GARBAGE 4 /* I like this one */
107 #define RPC_SYSTEM_ERR 5
108 #define RPC_MISMATCH 0
109 #define RPC_AUTHERR 1
110
111 /* Authentication failures */
112 #define AUTH_BADCRED 1
113 #define AUTH_REJECTCRED 2
114 #define AUTH_BADVERF 3
115 #define AUTH_REJECTVERF 4
116 #define AUTH_TOOWEAK 5 /* Give em wheaties */
117
118 /* Sizes of rpc header parts */
119 #define RPC_SIZ 24
120 #define RPC_REPLYSIZ 28
121
122 /* RPC Prog definitions */
123 #define RPCPROG_MNT 100005
124 #define RPCMNT_VER1 1
125 #define RPCMNT_VER3 3
126 #define RPCMNT_MOUNT 1
127 #define RPCMNT_DUMP 2
128 #define RPCMNT_UMOUNT 3
129 #define RPCMNT_UMNTALL 4
130 #define RPCMNT_EXPORT 5
131 #define RPCMNT_NAMELEN 255
132 #define RPCMNT_PATHLEN 1024
133 #define RPCPROG_NFS 100003
134
135 /*
136 * Structures used for RPCAUTH_KERB4.
137 */
138 struct nfsrpc_fullverf {
139 u_long t1;
140 u_long t2;
141 u_long w2;
142 };
143
144 struct nfsrpc_fullblock {
145 u_long t1;
146 u_long t2;
147 u_long w1;
148 u_long w2;
149 };
150
151 struct nfsrpc_nickverf {
152 u_long kind;
153 struct nfsrpc_fullverf verf;
154 };
155
156 /*
157 * and their sizes in bytes.. If sizeof (struct nfsrpc_xx) != these
158 * constants, well then things will break in mount_nfs and nfsd.
159 */
160 #define RPCX_FULLVERF 12
161 #define RPCX_FULLBLOCK 16
162 #define RPCX_NICKVERF 16
163
164 #if NFSKERB
165 XXX
166 #else
167 typedef u_char NFSKERBKEY_T[2];
168 typedef u_char NFSKERBKEYSCHED_T[2];
169 #endif
170 #define NFS_KERBSRV "rcmd" /* Kerberos Service for NFS */
171 #define NFS_KERBTTL (30 * 60) /* Credential ttl (sec) */
172 #define NFS_KERBCLOCKSKEW (5 * 60) /* Clock skew (sec) */
173 #define NFS_KERBW1(t) (*((u_long *)(&((t).dat[((t).length + 3) & ~0x3]))))
174
175 #endif /* __APPLE_API_PRIVATE */
176 #endif /* _NFS_RPCV2_H_ */