Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

rpc_msg.h

Go to the documentation of this file.
00001 /*  $Id$ */
00002 /*      $OpenBSD: rpc_msg.h,v 1.2 1997/09/21 10:46:15 niklas Exp $      */
00003 /*      $NetBSD: rpc_msg.h,v 1.5 1995/04/29 05:28:00 cgd Exp $  */
00004 
00005 /*
00006  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
00007  * unrestricted use provided that this legend is included on all tape
00008  * media and as a part of the software program in whole or part.  Users
00009  * may copy or modify Sun RPC without charge, but are not authorized
00010  * to license or distribute it to anyone else except as part of a product or
00011  * program developed by the user.
00012  * 
00013  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
00014  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
00015  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
00016  * 
00017  * Sun RPC is provided with no support and without any obligation on the
00018  * part of Sun Microsystems, Inc. to assist in its use, correction,
00019  * modification or enhancement.
00020  * 
00021  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
00022  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
00023  * OR ANY PART THEREOF.
00024  * 
00025  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
00026  * or profits or other special, indirect and consequential damages, even if
00027  * Sun has been advised of the possibility of such damages.
00028  * 
00029  * Sun Microsystems, Inc.
00030  * 2550 Garcia Avenue
00031  * Mountain View, California  94043
00032  *
00033  *      from: @(#)rpc_msg.h 1.7 86/07/16 SMI
00034  *      @(#)rpc_msg.h   2.1 88/07/29 4.0 RPCSRC
00035  */
00036 
00037 /*
00038  * rpc_msg.h
00039  * rpc message definition
00040  *
00041  * Copyright (C) 1984, Sun Microsystems, Inc.
00042  */
00043 
00044 #ifndef _RPC_RPCMSG_H
00045 #define _RPC_RPCMSG_H
00046 
00047 #define RPC_MSG_VERSION         ((u_long) 2)
00048 #define RPC_SERVICE_PORT        ((u_short) 2048)
00049 
00050 /*
00051  * Bottom up definition of an rpc message.
00052  * NOTE: call and reply use the same overall stuct but
00053  * different parts of unions within it.
00054  */
00055 
00056 enum msg_type {
00057         CALL=0,
00058         REPLY=1
00059 };
00060 
00061 enum reply_stat {
00062         MSG_ACCEPTED=0,
00063         MSG_DENIED=1
00064 };
00065 
00066 enum accept_stat {
00067         SUCCESS=0,
00068         PROG_UNAVAIL=1,
00069         PROG_MISMATCH=2,
00070         PROC_UNAVAIL=3,
00071         GARBAGE_ARGS=4,
00072         SYSTEM_ERR=5
00073 };
00074 
00075 enum reject_stat {
00076         RPC_MISMATCH=0,
00077         AUTH_ERROR=1
00078 };
00079 
00080 /*
00081  * Reply part of an rpc exchange
00082  */
00083 
00084 /*
00085  * Reply to an rpc request that was accepted by the server.
00086  * Note: there could be an error even though the request was
00087  * accepted.
00088  */
00089 struct accepted_reply {
00090         struct opaque_auth      ar_verf;
00091         enum accept_stat        ar_stat;
00092         union {
00093                 struct {
00094                         u_int32_t low;
00095                         u_int32_t high;
00096                 } AR_versions;
00097                 struct {
00098                         caddr_t where;
00099                         xdrproc_t proc;
00100                 } AR_results;
00101                 /* and many other null cases */
00102         } ru;
00103 #define ar_results      ru.AR_results
00104 #define ar_vers         ru.AR_versions
00105 };
00106 
00107 /*
00108  * Reply to an rpc request that was rejected by the server.
00109  */
00110 struct rejected_reply {
00111         enum reject_stat rj_stat;
00112         union {
00113                 struct {
00114                         u_int32_t low;
00115                         u_int32_t high;
00116                 } RJ_versions;
00117                 enum auth_stat RJ_why;  /* why authentication did not work */
00118         } ru;
00119 #define rj_vers ru.RJ_versions
00120 #define rj_why  ru.RJ_why
00121 };
00122 
00123 /*
00124  * Body of a reply to an rpc request.
00125  */
00126 struct reply_body {
00127         enum reply_stat rp_stat;
00128         union {
00129                 struct accepted_reply RP_ar;
00130                 struct rejected_reply RP_dr;
00131         } ru;
00132 #define rp_acpt ru.RP_ar
00133 #define rp_rjct ru.RP_dr
00134 };
00135 
00136 /*
00137  * Body of an rpc request call.
00138  */
00139 struct call_body {
00140         u_int32_t cb_rpcvers;   /* must be equal to two */
00141         u_int32_t cb_prog;
00142         u_int32_t cb_vers;
00143         u_int32_t cb_proc;
00144         struct opaque_auth cb_cred;
00145         struct opaque_auth cb_verf; /* protocol specific - provided by client */
00146 };
00147 
00148 /*
00149  * The rpc message
00150  */
00151 struct rpc_msg {
00152         u_int32_t               rm_xid;
00153         enum msg_type           rm_direction;
00154         union {
00155                 struct call_body RM_cmb;
00156                 struct reply_body RM_rmb;
00157         } ru;
00158 #define rm_call         ru.RM_cmb
00159 #define rm_reply        ru.RM_rmb
00160 };
00161 #define acpted_rply     ru.RM_rmb.ru.RP_ar
00162 #define rjcted_rply     ru.RM_rmb.ru.RP_dr
00163 
00164 __BEGIN_DECLS
00165 /*
00166  * XDR routine to handle a rpc message.
00167  * xdr_callmsg(xdrs, cmsg)
00168  *      XDR *xdrs;
00169  *      struct rpc_msg *cmsg;
00170  */
00171 extern bool_t   xdr_callmsg     __P((XDR *, struct rpc_msg *));
00172 
00173 /*
00174  * XDR routine to pre-serialize the static part of a rpc message.
00175  * xdr_callhdr(xdrs, cmsg)
00176  *      XDR *xdrs;
00177  *      struct rpc_msg *cmsg;
00178  */
00179 extern bool_t   xdr_callhdr     __P((XDR *, struct rpc_msg *));
00180 
00181 /*
00182  * XDR routine to handle a rpc reply.
00183  * xdr_replymsg(xdrs, rmsg)
00184  *      XDR *xdrs;
00185  *      struct rpc_msg *rmsg;
00186  */
00187 extern bool_t   xdr_replymsg    __P((XDR *, struct rpc_msg *));
00188 
00189 /*
00190  * Fills in the error part of a reply message.
00191  * _seterr_reply(msg, error)
00192  *      struct rpc_msg *msg;
00193  *      struct rpc_err *error;
00194  */
00195 extern void     _seterr_reply   __P((struct rpc_msg *, struct rpc_err *));
00196 __END_DECLS
00197 
00198 #endif /* !_RPC_RPCMSG_H */

Generated on Sun May 14 14:51:20 2006 by  doxygen 1.4.2