rpcv2.h revision 1.4
1/*	$OpenBSD: rpcv2.h,v 1.4 1996/04/17 04:50:42 mickey Exp $	*/
2/*	$NetBSD: rpcv2.h,v 1.8 1996/02/18 11:54:11 fvdl Exp $	*/
3
4/*
5 * Copyright (c) 1989, 1993
6 *	The Regents of the University of California.  All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Rick Macklem at The University of Guelph.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 *    must display the following acknowledgement:
21 *	This product includes software developed by the University of
22 *	California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 *    may be used to endorse or promote products derived from this software
25 *    without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 *	@(#)rpcv2.h	8.2 (Berkeley) 3/30/95
40 */
41
42
43#ifndef _NFS_RPCV2_H_
44#define _NFS_RPCV2_H_
45
46/*
47 * Definitions for Sun RPC Version 2, from
48 * "RPC: Remote Procedure Call Protocol Specification" RFC1057
49 */
50
51/* Version # */
52#define	RPC_VER2	2
53
54/* Authentication */
55#define	RPCAUTH_NULL	0
56#define	RPCAUTH_UNIX	1
57#define	RPCAUTH_SHORT	2
58#define RPCAUTH_KERB4	4
59#define	RPCAUTH_NQNFS	300000
60#define	RPCAUTH_MAXSIZ	400
61#define	RPCVERF_MAXSIZ	12	/* For Kerb, can actually be 400 */
62#define	RPCAUTH_UNIXGIDS 16
63
64/*
65 * Constants associated with authentication flavours.
66 */
67#define RPCAKN_FULLNAME	0
68#define RPCAKN_NICKNAME	1
69
70/* Rpc Constants */
71#define	RPC_CALL	0
72#define	RPC_REPLY	1
73#define	RPC_MSGACCEPTED	0
74#define	RPC_MSGDENIED	1
75#define	RPC_PROGUNAVAIL	1
76#define	RPC_PROGMISMATCH	2
77#define	RPC_PROCUNAVAIL	3
78#define	RPC_GARBAGE	4		/* I like this one */
79#define	RPC_MISMATCH	0
80#define	RPC_AUTHERR	1
81
82/* Authentication failures */
83#define	AUTH_BADCRED	1
84#define	AUTH_REJECTCRED	2
85#define	AUTH_BADVERF	3
86#define	AUTH_REJECTVERF	4
87#define	AUTH_TOOWEAK	5		/* Give em wheaties */
88
89/* Sizes of rpc header parts */
90#define	RPC_SIZ		24
91#define	RPC_REPLYSIZ	28
92
93/* RPC Prog definitions */
94#define	RPCPROG_MNT	100005
95#define	RPCMNT_VER1	1
96#define	RPCMNT_VER3	3
97#define	RPCMNT_MOUNT	1
98#define	RPCMNT_DUMP	2
99#define	RPCMNT_UMOUNT	3
100#define	RPCMNT_UMNTALL	4
101#define	RPCMNT_EXPORT	5
102#define	RPCMNT_NAMELEN	255
103#define	RPCMNT_PATHLEN	1024
104#define	RPCPROG_NFS	100003
105
106/* Structs for common parts of the rpc's */
107struct rpcv2_time {
108	u_int32_t rpc_sec;
109	u_int32_t rpc_usec;
110};
111
112/*
113 * Structures used for RPCAUTH_KERB4.
114 */
115struct nfsrpc_fullverf {
116	u_int32_t t1;
117	u_int32_t t2;
118	u_int32_t w2;
119};
120
121struct nfsrpc_fullblock {
122	u_int32_t t1;
123	u_int32_t t2;
124	u_int32_t w1;
125	u_int32_t w2;
126};
127
128struct nfsrpc_nickverf {
129	u_int32_t kind;
130	struct nfsrpc_fullverf	verf;
131};
132
133/*
134 * and their sizes in bytes.. If sizeof (struct nfsrpc_xx) != these
135 * constants, well then things will break in mount_nfs and nfsd.
136 */
137#define RPCX_FULLVERF	12
138#define RPCX_FULLBLOCK	16
139#define RPCX_NICKVERF	16
140
141#ifdef NFSKERB
142XXX
143#else
144typedef u_char			NFSKERBKEY_T[2];
145typedef u_char			NFSKERBKEYSCHED_T[2];
146#endif
147#define NFS_KERBSRV	"rcmd"		/* Kerberos Service for NFS */
148#define NFS_KERBTTL	(30 * 60)	/* Credential ttl (sec) */
149#define NFS_KERBCLOCKSKEW (5 * 60)	/* Clock skew (sec) */
150#define NFS_KERBW1(t)	(*((u_long *)(&((t).dat[((t).length + 3) & ~0x3]))))
151#endif
152