Home | History | Annotate | Line # | Download | only in rpc
rpc_msg.h revision 1.6
      1  1.6  christos /*	$NetBSD: rpc_msg.h,v 1.6 1997/07/13 18:16:43 christos Exp $	*/
      2  1.4       cgd 
      3  1.1   deraadt /*
      4  1.1   deraadt  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
      5  1.1   deraadt  * unrestricted use provided that this legend is included on all tape
      6  1.1   deraadt  * media and as a part of the software program in whole or part.  Users
      7  1.1   deraadt  * may copy or modify Sun RPC without charge, but are not authorized
      8  1.1   deraadt  * to license or distribute it to anyone else except as part of a product or
      9  1.1   deraadt  * program developed by the user.
     10  1.1   deraadt  *
     11  1.1   deraadt  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
     12  1.1   deraadt  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
     13  1.1   deraadt  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
     14  1.1   deraadt  *
     15  1.1   deraadt  * Sun RPC is provided with no support and without any obligation on the
     16  1.1   deraadt  * part of Sun Microsystems, Inc. to assist in its use, correction,
     17  1.1   deraadt  * modification or enhancement.
     18  1.1   deraadt  *
     19  1.1   deraadt  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
     20  1.1   deraadt  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
     21  1.1   deraadt  * OR ANY PART THEREOF.
     22  1.1   deraadt  *
     23  1.1   deraadt  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
     24  1.1   deraadt  * or profits or other special, indirect and consequential damages, even if
     25  1.1   deraadt  * Sun has been advised of the possibility of such damages.
     26  1.1   deraadt  *
     27  1.1   deraadt  * Sun Microsystems, Inc.
     28  1.1   deraadt  * 2550 Garcia Avenue
     29  1.1   deraadt  * Mountain View, California  94043
     30  1.3   mycroft  *
     31  1.3   mycroft  *	from: @(#)rpc_msg.h 1.7 86/07/16 SMI
     32  1.4       cgd  *	@(#)rpc_msg.h	2.1 88/07/29 4.0 RPCSRC
     33  1.1   deraadt  */
     34  1.1   deraadt 
     35  1.1   deraadt /*
     36  1.1   deraadt  * rpc_msg.h
     37  1.1   deraadt  * rpc message definition
     38  1.1   deraadt  *
     39  1.1   deraadt  * Copyright (C) 1984, Sun Microsystems, Inc.
     40  1.1   deraadt  */
     41  1.1   deraadt 
     42  1.2    brezak #ifndef _RPC_RPCMSG_H
     43  1.2    brezak #define _RPC_RPCMSG_H
     44  1.2    brezak 
     45  1.1   deraadt #define RPC_MSG_VERSION		((u_long) 2)
     46  1.1   deraadt #define RPC_SERVICE_PORT	((u_short) 2048)
     47  1.1   deraadt 
     48  1.1   deraadt /*
     49  1.1   deraadt  * Bottom up definition of an rpc message.
     50  1.1   deraadt  * NOTE: call and reply use the same overall stuct but
     51  1.1   deraadt  * different parts of unions within it.
     52  1.1   deraadt  */
     53  1.1   deraadt 
     54  1.1   deraadt enum msg_type {
     55  1.1   deraadt 	CALL=0,
     56  1.1   deraadt 	REPLY=1
     57  1.1   deraadt };
     58  1.1   deraadt 
     59  1.1   deraadt enum reply_stat {
     60  1.1   deraadt 	MSG_ACCEPTED=0,
     61  1.1   deraadt 	MSG_DENIED=1
     62  1.1   deraadt };
     63  1.1   deraadt 
     64  1.1   deraadt enum accept_stat {
     65  1.1   deraadt 	SUCCESS=0,
     66  1.1   deraadt 	PROG_UNAVAIL=1,
     67  1.1   deraadt 	PROG_MISMATCH=2,
     68  1.1   deraadt 	PROC_UNAVAIL=3,
     69  1.1   deraadt 	GARBAGE_ARGS=4,
     70  1.1   deraadt 	SYSTEM_ERR=5
     71  1.1   deraadt };
     72  1.1   deraadt 
     73  1.1   deraadt enum reject_stat {
     74  1.1   deraadt 	RPC_MISMATCH=0,
     75  1.1   deraadt 	AUTH_ERROR=1
     76  1.1   deraadt };
     77  1.1   deraadt 
     78  1.1   deraadt /*
     79  1.1   deraadt  * Reply part of an rpc exchange
     80  1.1   deraadt  */
     81  1.1   deraadt 
     82  1.1   deraadt /*
     83  1.1   deraadt  * Reply to an rpc request that was accepted by the server.
     84  1.1   deraadt  * Note: there could be an error even though the request was
     85  1.1   deraadt  * accepted.
     86  1.1   deraadt  */
     87  1.1   deraadt struct accepted_reply {
     88  1.1   deraadt 	struct opaque_auth	ar_verf;
     89  1.1   deraadt 	enum accept_stat	ar_stat;
     90  1.1   deraadt 	union {
     91  1.1   deraadt 		struct {
     92  1.5       cgd 			u_int32_t low;
     93  1.5       cgd 			u_int32_t high;
     94  1.1   deraadt 		} AR_versions;
     95  1.1   deraadt 		struct {
     96  1.1   deraadt 			caddr_t	where;
     97  1.1   deraadt 			xdrproc_t proc;
     98  1.1   deraadt 		} AR_results;
     99  1.1   deraadt 		/* and many other null cases */
    100  1.1   deraadt 	} ru;
    101  1.1   deraadt #define	ar_results	ru.AR_results
    102  1.1   deraadt #define	ar_vers		ru.AR_versions
    103  1.1   deraadt };
    104  1.1   deraadt 
    105  1.1   deraadt /*
    106  1.1   deraadt  * Reply to an rpc request that was rejected by the server.
    107  1.1   deraadt  */
    108  1.1   deraadt struct rejected_reply {
    109  1.1   deraadt 	enum reject_stat rj_stat;
    110  1.1   deraadt 	union {
    111  1.1   deraadt 		struct {
    112  1.5       cgd 			u_int32_t low;
    113  1.5       cgd 			u_int32_t high;
    114  1.1   deraadt 		} RJ_versions;
    115  1.1   deraadt 		enum auth_stat RJ_why;  /* why authentication did not work */
    116  1.1   deraadt 	} ru;
    117  1.1   deraadt #define	rj_vers	ru.RJ_versions
    118  1.1   deraadt #define	rj_why	ru.RJ_why
    119  1.1   deraadt };
    120  1.1   deraadt 
    121  1.1   deraadt /*
    122  1.1   deraadt  * Body of a reply to an rpc request.
    123  1.1   deraadt  */
    124  1.1   deraadt struct reply_body {
    125  1.1   deraadt 	enum reply_stat rp_stat;
    126  1.1   deraadt 	union {
    127  1.1   deraadt 		struct accepted_reply RP_ar;
    128  1.1   deraadt 		struct rejected_reply RP_dr;
    129  1.1   deraadt 	} ru;
    130  1.1   deraadt #define	rp_acpt	ru.RP_ar
    131  1.1   deraadt #define	rp_rjct	ru.RP_dr
    132  1.1   deraadt };
    133  1.1   deraadt 
    134  1.1   deraadt /*
    135  1.1   deraadt  * Body of an rpc request call.
    136  1.1   deraadt  */
    137  1.1   deraadt struct call_body {
    138  1.5       cgd 	u_int32_t cb_rpcvers;	/* must be equal to two */
    139  1.5       cgd 	u_int32_t cb_prog;
    140  1.5       cgd 	u_int32_t cb_vers;
    141  1.5       cgd 	u_int32_t cb_proc;
    142  1.1   deraadt 	struct opaque_auth cb_cred;
    143  1.1   deraadt 	struct opaque_auth cb_verf; /* protocol specific - provided by client */
    144  1.1   deraadt };
    145  1.1   deraadt 
    146  1.1   deraadt /*
    147  1.1   deraadt  * The rpc message
    148  1.1   deraadt  */
    149  1.1   deraadt struct rpc_msg {
    150  1.5       cgd 	u_int32_t		rm_xid;
    151  1.1   deraadt 	enum msg_type		rm_direction;
    152  1.1   deraadt 	union {
    153  1.1   deraadt 		struct call_body RM_cmb;
    154  1.1   deraadt 		struct reply_body RM_rmb;
    155  1.1   deraadt 	} ru;
    156  1.1   deraadt #define	rm_call		ru.RM_cmb
    157  1.1   deraadt #define	rm_reply	ru.RM_rmb
    158  1.1   deraadt };
    159  1.1   deraadt #define	acpted_rply	ru.RM_rmb.ru.RP_ar
    160  1.1   deraadt #define	rjcted_rply	ru.RM_rmb.ru.RP_dr
    161  1.1   deraadt 
    162  1.2    brezak __BEGIN_DECLS
    163  1.1   deraadt /*
    164  1.1   deraadt  * XDR routine to handle a rpc message.
    165  1.1   deraadt  * xdr_callmsg(xdrs, cmsg)
    166  1.1   deraadt  * 	XDR *xdrs;
    167  1.1   deraadt  * 	struct rpc_msg *cmsg;
    168  1.1   deraadt  */
    169  1.2    brezak extern bool_t	xdr_callmsg	__P((XDR *, struct rpc_msg *));
    170  1.1   deraadt 
    171  1.1   deraadt /*
    172  1.1   deraadt  * XDR routine to pre-serialize the static part of a rpc message.
    173  1.1   deraadt  * xdr_callhdr(xdrs, cmsg)
    174  1.1   deraadt  * 	XDR *xdrs;
    175  1.1   deraadt  * 	struct rpc_msg *cmsg;
    176  1.1   deraadt  */
    177  1.2    brezak extern bool_t	xdr_callhdr	__P((XDR *, struct rpc_msg *));
    178  1.1   deraadt 
    179  1.1   deraadt /*
    180  1.1   deraadt  * XDR routine to handle a rpc reply.
    181  1.1   deraadt  * xdr_replymsg(xdrs, rmsg)
    182  1.1   deraadt  * 	XDR *xdrs;
    183  1.1   deraadt  * 	struct rpc_msg *rmsg;
    184  1.1   deraadt  */
    185  1.2    brezak extern bool_t	xdr_replymsg	__P((XDR *, struct rpc_msg *));
    186  1.6  christos 
    187  1.6  christos 
    188  1.6  christos /*
    189  1.6  christos  * XDR routine to handle a accepted rpc reply.
    190  1.6  christos  * xdr_accepted_reply(xdrs, rej)
    191  1.6  christos  * 	XDR *xdrs;
    192  1.6  christos  * 	struct accepted_reply *rej;
    193  1.6  christos  */
    194  1.6  christos extern bool_t	xdr_accepted_reply	__P((XDR *, struct accepted_reply *));
    195  1.6  christos 
    196  1.6  christos /*
    197  1.6  christos  * XDR routine to handle a rejected rpc reply.
    198  1.6  christos  * xdr_rejected_reply(xdrs, rej)
    199  1.6  christos  * 	XDR *xdrs;
    200  1.6  christos  * 	struct rejected_reply *rej;
    201  1.6  christos  */
    202  1.6  christos extern bool_t	xdr_rejected_reply	__P((XDR *, struct rejected_reply *));
    203  1.1   deraadt 
    204  1.1   deraadt /*
    205  1.1   deraadt  * Fills in the error part of a reply message.
    206  1.1   deraadt  * _seterr_reply(msg, error)
    207  1.1   deraadt  * 	struct rpc_msg *msg;
    208  1.1   deraadt  * 	struct rpc_err *error;
    209  1.1   deraadt  */
    210  1.2    brezak extern void	_seterr_reply	__P((struct rpc_msg *, struct rpc_err *));
    211  1.2    brezak __END_DECLS
    212  1.2    brezak 
    213  1.2    brezak #endif /* !_RPC_RPCMSG_H */
    214