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