rpc.h revision 1.2
11.2Scgd/*	$NetBSD: rpc.h,v 1.2 1994/10/26 05:45:03 cgd Exp $	*/
21.2Scgd
31.1Sbrezak/*
41.1Sbrezak * Copyright (c) 1992 Regents of the University of California.
51.1Sbrezak * All rights reserved.
61.1Sbrezak *
71.1Sbrezak * This software was developed by the Computer Systems Engineering group
81.1Sbrezak * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
91.1Sbrezak * contributed to Berkeley.
101.1Sbrezak *
111.1Sbrezak * Redistribution and use in source and binary forms, with or without
121.1Sbrezak * modification, are permitted provided that the following conditions
131.1Sbrezak * are met:
141.1Sbrezak * 1. Redistributions of source code must retain the above copyright
151.1Sbrezak *    notice, this list of conditions and the following disclaimer.
161.1Sbrezak * 2. Redistributions in binary form must reproduce the above copyright
171.1Sbrezak *    notice, this list of conditions and the following disclaimer in the
181.1Sbrezak *    documentation and/or other materials provided with the distribution.
191.1Sbrezak * 3. All advertising materials mentioning features or use of this software
201.1Sbrezak *    must display the following acknowledgement:
211.1Sbrezak *	This product includes software developed by the University of
221.1Sbrezak *	California, Lawrence Berkeley Laboratory and its contributors.
231.1Sbrezak * 4. Neither the name of the University nor the names of its contributors
241.1Sbrezak *    may be used to endorse or promote products derived from this software
251.1Sbrezak *    without specific prior written permission.
261.1Sbrezak *
271.1Sbrezak * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
281.1Sbrezak * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
291.1Sbrezak * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
301.1Sbrezak * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
311.1Sbrezak * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
321.1Sbrezak * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
331.1Sbrezak * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
341.1Sbrezak * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
351.1Sbrezak * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
361.1Sbrezak * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
371.1Sbrezak * SUCH DAMAGE.
381.1Sbrezak */
391.1Sbrezak
401.1Sbrezak/* XXX defines we can't easily get from system includes */
411.1Sbrezak#define	PMAPPORT		111
421.1Sbrezak#define	PMAPPROG		100000
431.1Sbrezak#define	PMAPVERS		2
441.1Sbrezak#define	PMAPPROC_GETPORT	3
451.1Sbrezak
461.1Sbrezak#define	RPC_MSG_VERSION		2
471.1Sbrezak#define MSG_ACCEPTED		0
481.1Sbrezak#define CALL			0
491.1Sbrezak#define REPLY			1
501.1Sbrezak
511.1Sbrezak
521.1Sbrezak/* Null rpc auth info */
531.1Sbrezakstruct auth_info {
541.1Sbrezak	int	rp_atype;		/* zero (really AUTH_NULL) */
551.1Sbrezak	u_long	rp_alen;		/* zero (size of auth struct) */
561.1Sbrezak};
571.1Sbrezak
581.1Sbrezak/* Generic rpc call header */
591.1Sbrezakstruct rpc_call {
601.1Sbrezak	u_long	rp_xid;			/* request transaction id */
611.1Sbrezak	int	rp_direction;		/* call direction */
621.1Sbrezak	u_long	rp_rpcvers;		/* rpc version (2) */
631.1Sbrezak	u_long	rp_prog;		/* program */
641.1Sbrezak	u_long	rp_vers;		/* version */
651.1Sbrezak	u_long	rp_proc;		/* procedure */
661.1Sbrezak	struct	auth_info rp_auth;	/* AUTH_NULL */
671.1Sbrezak	struct	auth_info rp_verf;	/* AUTH_NULL */
681.1Sbrezak};
691.1Sbrezak
701.1Sbrezak/* Generic rpc reply header */
711.1Sbrezakstruct rpc_reply {
721.1Sbrezak	u_long	rp_xid;			/* request transaction id */
731.1Sbrezak	int	rp_direction;		/* call direction */
741.1Sbrezak	int	rp_stat;		/* accept status */
751.1Sbrezak	u_long	rp_prog;		/* program (unused) */
761.1Sbrezak	u_long	rp_vers;		/* version (unused) */
771.1Sbrezak	u_long	rp_proc;		/* procedure (unused) */
781.1Sbrezak};
791.1Sbrezak
801.1Sbrezak/* RPC functions: */
811.1Sbrezakint	callrpc __P((struct iodesc *d, u_long prog, u_long ver, u_long op,
821.1Sbrezak	    void *sdata, int slen, void *rdata, int rlen));
831.1Sbrezaku_short	getport __P((struct iodesc *d, u_long prog, u_long vers));
841.1Sbrezak
85