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