rpc_msg.h revision 1839
11839Swollman/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ 21839Swollman/* 31839Swollman * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 41839Swollman * unrestricted use provided that this legend is included on all tape 51839Swollman * media and as a part of the software program in whole or part. Users 61839Swollman * may copy or modify Sun RPC without charge, but are not authorized 71839Swollman * to license or distribute it to anyone else except as part of a product or 81839Swollman * program developed by the user. 91839Swollman * 101839Swollman * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 111839Swollman * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 121839Swollman * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 131839Swollman * 141839Swollman * Sun RPC is provided with no support and without any obligation on the 151839Swollman * part of Sun Microsystems, Inc. to assist in its use, correction, 161839Swollman * modification or enhancement. 171839Swollman * 181839Swollman * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 191839Swollman * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 201839Swollman * OR ANY PART THEREOF. 211839Swollman * 221839Swollman * In no event will Sun Microsystems, Inc. be liable for any lost revenue 231839Swollman * or profits or other special, indirect and consequential damages, even if 241839Swollman * Sun has been advised of the possibility of such damages. 251839Swollman * 261839Swollman * Sun Microsystems, Inc. 271839Swollman * 2550 Garcia Avenue 281839Swollman * Mountain View, California 94043 291839Swollman */ 301839Swollman/* @(#)rpc_msg.h 1.7 86/07/16 SMI */ 311839Swollman 321839Swollman/* 331839Swollman * rpc_msg.h 341839Swollman * rpc message definition 351839Swollman * 361839Swollman * Copyright (C) 1984, Sun Microsystems, Inc. 371839Swollman */ 381839Swollman 391839Swollman#define RPC_MSG_VERSION ((u_long) 2) 401839Swollman#define RPC_SERVICE_PORT ((u_short) 2048) 411839Swollman 421839Swollman/* 431839Swollman * Bottom up definition of an rpc message. 441839Swollman * NOTE: call and reply use the same overall stuct but 451839Swollman * different parts of unions within it. 461839Swollman */ 471839Swollman 481839Swollmanenum msg_type { 491839Swollman CALL=0, 501839Swollman REPLY=1 511839Swollman}; 521839Swollman 531839Swollmanenum reply_stat { 541839Swollman MSG_ACCEPTED=0, 551839Swollman MSG_DENIED=1 561839Swollman}; 571839Swollman 581839Swollmanenum accept_stat { 591839Swollman SUCCESS=0, 601839Swollman PROG_UNAVAIL=1, 611839Swollman PROG_MISMATCH=2, 621839Swollman PROC_UNAVAIL=3, 631839Swollman GARBAGE_ARGS=4, 641839Swollman SYSTEM_ERR=5 651839Swollman}; 661839Swollman 671839Swollmanenum reject_stat { 681839Swollman RPC_MISMATCH=0, 691839Swollman AUTH_ERROR=1 701839Swollman}; 711839Swollman 721839Swollman/* 731839Swollman * Reply part of an rpc exchange 741839Swollman */ 751839Swollman 761839Swollman/* 771839Swollman * Reply to an rpc request that was accepted by the server. 781839Swollman * Note: there could be an error even though the request was 791839Swollman * accepted. 801839Swollman */ 811839Swollmanstruct accepted_reply { 821839Swollman struct opaque_auth ar_verf; 831839Swollman enum accept_stat ar_stat; 841839Swollman union { 851839Swollman struct { 861839Swollman u_long low; 871839Swollman u_long high; 881839Swollman } AR_versions; 891839Swollman struct { 901839Swollman caddr_t where; 911839Swollman xdrproc_t proc; 921839Swollman } AR_results; 931839Swollman /* and many other null cases */ 941839Swollman } ru; 951839Swollman#define ar_results ru.AR_results 961839Swollman#define ar_vers ru.AR_versions 971839Swollman}; 981839Swollman 991839Swollman/* 1001839Swollman * Reply to an rpc request that was rejected by the server. 1011839Swollman */ 1021839Swollmanstruct rejected_reply { 1031839Swollman enum reject_stat rj_stat; 1041839Swollman union { 1051839Swollman struct { 1061839Swollman u_long low; 1071839Swollman u_long high; 1081839Swollman } RJ_versions; 1091839Swollman enum auth_stat RJ_why; /* why authentication did not work */ 1101839Swollman } ru; 1111839Swollman#define rj_vers ru.RJ_versions 1121839Swollman#define rj_why ru.RJ_why 1131839Swollman}; 1141839Swollman 1151839Swollman/* 1161839Swollman * Body of a reply to an rpc request. 1171839Swollman */ 1181839Swollmanstruct reply_body { 1191839Swollman enum reply_stat rp_stat; 1201839Swollman union { 1211839Swollman struct accepted_reply RP_ar; 1221839Swollman struct rejected_reply RP_dr; 1231839Swollman } ru; 1241839Swollman#define rp_acpt ru.RP_ar 1251839Swollman#define rp_rjct ru.RP_dr 1261839Swollman}; 1271839Swollman 1281839Swollman/* 1291839Swollman * Body of an rpc request call. 1301839Swollman */ 1311839Swollmanstruct call_body { 1321839Swollman u_long cb_rpcvers; /* must be equal to two */ 1331839Swollman u_long cb_prog; 1341839Swollman u_long cb_vers; 1351839Swollman u_long cb_proc; 1361839Swollman struct opaque_auth cb_cred; 1371839Swollman struct opaque_auth cb_verf; /* protocol specific - provided by client */ 1381839Swollman}; 1391839Swollman 1401839Swollman/* 1411839Swollman * The rpc message 1421839Swollman */ 1431839Swollmanstruct rpc_msg { 1441839Swollman u_long rm_xid; 1451839Swollman enum msg_type rm_direction; 1461839Swollman union { 1471839Swollman struct call_body RM_cmb; 1481839Swollman struct reply_body RM_rmb; 1491839Swollman } ru; 1501839Swollman#define rm_call ru.RM_cmb 1511839Swollman#define rm_reply ru.RM_rmb 1521839Swollman}; 1531839Swollman#define acpted_rply ru.RM_rmb.ru.RP_ar 1541839Swollman#define rjcted_rply ru.RM_rmb.ru.RP_dr 1551839Swollman 1561839Swollman 1571839Swollman/* 1581839Swollman * XDR routine to handle a rpc message. 1591839Swollman * xdr_callmsg(xdrs, cmsg) 1601839Swollman * XDR *xdrs; 1611839Swollman * struct rpc_msg *cmsg; 1621839Swollman */ 1631839Swollmanextern bool_t xdr_callmsg(); 1641839Swollman 1651839Swollman/* 1661839Swollman * XDR routine to pre-serialize the static part of a rpc message. 1671839Swollman * xdr_callhdr(xdrs, cmsg) 1681839Swollman * XDR *xdrs; 1691839Swollman * struct rpc_msg *cmsg; 1701839Swollman */ 1711839Swollmanextern bool_t xdr_callhdr(); 1721839Swollman 1731839Swollman/* 1741839Swollman * XDR routine to handle a rpc reply. 1751839Swollman * xdr_replymsg(xdrs, rmsg) 1761839Swollman * XDR *xdrs; 1771839Swollman * struct rpc_msg *rmsg; 1781839Swollman */ 1791839Swollmanextern bool_t xdr_replymsg(); 1801839Swollman 1811839Swollman/* 1821839Swollman * Fills in the error part of a reply message. 1831839Swollman * _seterr_reply(msg, error) 1841839Swollman * struct rpc_msg *msg; 1851839Swollman * struct rpc_err *error; 1861839Swollman */ 1871839Swollmanextern void _seterr_reply(); 188