home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / rpc / h / rpc_msg < prev    next >
Encoding:
Text File  |  1995-01-11  |  4.4 KB  |  203 lines

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