home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcp30tkt.zip / PGMG1.ZIP / INCLUDE / RPC / RPC_MSG.H < prev    next >
Text File  |  1995-12-04  |  6KB  |  214 lines

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