xref: /openbsd-src/sys/lib/libsa/rpc.h (revision eb76c208173c67d7ebbeb2537785e4cca078f06d)
1 /*	$OpenBSD: rpc.h,v 1.6 2014/07/13 15:31:20 mpi Exp $	*/
2 /*	$NetBSD: rpc.h,v 1.8 1996/09/26 23:22:03 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1992 Regents of the University of California.
6  * All rights reserved.
7  *
8  * This software was developed by the Computer Systems Engineering group
9  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10  * contributed to Berkeley.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. All advertising materials mentioning features or use of this software
21  *    must display the following acknowledgement:
22  *	This product includes software developed by the University of
23  *	California, Lawrence Berkeley Laboratory and its contributors.
24  * 4. Neither the name of the University nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  */
40 
41 /* XXX defines we can't easily get from system includes */
42 #define	PMAPPORT		111
43 #define	PMAPPROG		100000
44 #define	PMAPVERS		2
45 #define	PMAPPROC_NULL		0
46 #define	PMAPPROC_SET		1
47 #define	PMAPPROC_UNSET		2
48 #define	PMAPPROC_GETPORT	3
49 #define	PMAPPROC_DUMP		4
50 #define	PMAPPROC_CALLIT		5
51 
52 /* RPC functions: */
53 ssize_t	rpc_call(struct iodesc *, u_int32_t, u_int32_t, u_int32_t,
54 	    void *, size_t, void *, size_t);
55 void	rpc_fromaddr(void *, struct in_addr *, u_short *);
56 int	rpc_pmap_getcache(struct in_addr, u_int, u_int);
57 void	rpc_pmap_putcache(struct in_addr, u_int, u_int, int);
58 
59 extern int rpc_port;	/* decrement before bind */
60 
61 /*
62  * How much space to leave in front of RPC requests.
63  * In 32-bit words (alignment) we have:
64  * 12: Ether + IP + UDP + padding
65  *  6: RPC call header
66  *  7: Auth UNIX
67  *  2: Auth NULL
68  */
69 #define	RPC_HEADER_WORDS 28
70