141c99275SPeter Avalos /* 241c99275SPeter Avalos * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 341c99275SPeter Avalos * unrestricted use provided that this legend is included on all tape 441c99275SPeter Avalos * media and as a part of the software program in whole or part. Users 541c99275SPeter Avalos * may copy or modify Sun RPC without charge, but are not authorized 641c99275SPeter Avalos * to license or distribute it to anyone else except as part of a product or 741c99275SPeter Avalos * program developed by the user. 841c99275SPeter Avalos * 941c99275SPeter Avalos * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 1041c99275SPeter Avalos * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1141c99275SPeter Avalos * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 1241c99275SPeter Avalos * 1341c99275SPeter Avalos * Sun RPC is provided with no support and without any obligation on the 1441c99275SPeter Avalos * part of Sun Microsystems, Inc. to assist in its use, correction, 1541c99275SPeter Avalos * modification or enhancement. 1641c99275SPeter Avalos * 1741c99275SPeter Avalos * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 1841c99275SPeter Avalos * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 1941c99275SPeter Avalos * OR ANY PART THEREOF. 2041c99275SPeter Avalos * 2141c99275SPeter Avalos * In no event will Sun Microsystems, Inc. be liable for any lost revenue 2241c99275SPeter Avalos * or profits or other special, indirect and consequential damages, even if 2341c99275SPeter Avalos * Sun has been advised of the possibility of such damages. 2441c99275SPeter Avalos * 2541c99275SPeter Avalos * Sun Microsystems, Inc. 2641c99275SPeter Avalos * 2550 Garcia Avenue 2741c99275SPeter Avalos * Mountain View, California 94043 2841c99275SPeter Avalos * 2941c99275SPeter Avalos * from: @(#)rpc_msg.h 1.7 86/07/16 SMI 3041c99275SPeter Avalos * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC 3141c99275SPeter Avalos * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.11.2.1 1999/08/29 14:39:07 peter Exp $ 3241c99275SPeter Avalos */ 3341c99275SPeter Avalos 3441c99275SPeter Avalos /* 3541c99275SPeter Avalos * rpc_msg.h 3641c99275SPeter Avalos * rpc message definition 3741c99275SPeter Avalos * 3841c99275SPeter Avalos * Copyright (C) 1984, Sun Microsystems, Inc. 3941c99275SPeter Avalos */ 4041c99275SPeter Avalos 41411677aeSAaron LI #define SUNRPC_MSG_VERSION ((uint32_t) 2) 4241c99275SPeter Avalos 4341c99275SPeter Avalos /* 4441c99275SPeter Avalos * Bottom up definition of an rpc message. 45*ed775ee7SAntonio Huete Jimenez * NOTE: call and reply use the same overall struct but 4641c99275SPeter Avalos * different parts of unions within it. 4741c99275SPeter Avalos */ 4841c99275SPeter Avalos 4941c99275SPeter Avalos enum sunrpc_msg_type { 5041c99275SPeter Avalos SUNRPC_CALL=0, 5141c99275SPeter Avalos SUNRPC_REPLY=1 5241c99275SPeter Avalos }; 5341c99275SPeter Avalos 5441c99275SPeter Avalos enum sunrpc_reply_stat { 5541c99275SPeter Avalos SUNRPC_MSG_ACCEPTED=0, 5641c99275SPeter Avalos SUNRPC_MSG_DENIED=1 5741c99275SPeter Avalos }; 5841c99275SPeter Avalos 5941c99275SPeter Avalos enum sunrpc_accept_stat { 6041c99275SPeter Avalos SUNRPC_SUCCESS=0, 6141c99275SPeter Avalos SUNRPC_PROG_UNAVAIL=1, 6241c99275SPeter Avalos SUNRPC_PROG_MISMATCH=2, 6341c99275SPeter Avalos SUNRPC_PROC_UNAVAIL=3, 6441c99275SPeter Avalos SUNRPC_GARBAGE_ARGS=4, 6541c99275SPeter Avalos SUNRPC_SYSTEM_ERR=5 6641c99275SPeter Avalos }; 6741c99275SPeter Avalos 6841c99275SPeter Avalos enum sunrpc_reject_stat { 6941c99275SPeter Avalos SUNRPC_RPC_MISMATCH=0, 7041c99275SPeter Avalos SUNRPC_AUTH_ERROR=1 7141c99275SPeter Avalos }; 7241c99275SPeter Avalos 7341c99275SPeter Avalos /* 7441c99275SPeter Avalos * Reply part of an rpc exchange 7541c99275SPeter Avalos */ 7641c99275SPeter Avalos 7741c99275SPeter Avalos /* 7841c99275SPeter Avalos * Reply to an rpc request that was rejected by the server. 7941c99275SPeter Avalos */ 8041c99275SPeter Avalos struct sunrpc_rejected_reply { 81*ed775ee7SAntonio Huete Jimenez nd_uint32_t rj_stat; /* enum reject_stat */ 8241c99275SPeter Avalos union { 8341c99275SPeter Avalos struct { 84*ed775ee7SAntonio Huete Jimenez nd_uint32_t low; 85*ed775ee7SAntonio Huete Jimenez nd_uint32_t high; 8641c99275SPeter Avalos } RJ_versions; 87*ed775ee7SAntonio Huete Jimenez nd_uint32_t RJ_why; /* enum auth_stat - why authentication did not work */ 8841c99275SPeter Avalos } ru; 8941c99275SPeter Avalos #define rj_vers ru.RJ_versions 9041c99275SPeter Avalos #define rj_why ru.RJ_why 9141c99275SPeter Avalos }; 9241c99275SPeter Avalos 9341c99275SPeter Avalos /* 9441c99275SPeter Avalos * Body of a reply to an rpc request. 9541c99275SPeter Avalos */ 9641c99275SPeter Avalos struct sunrpc_reply_body { 97*ed775ee7SAntonio Huete Jimenez nd_uint32_t rp_stat; /* enum reply_stat */ 9841c99275SPeter Avalos struct sunrpc_rejected_reply rp_reject; /* if rejected */ 9941c99275SPeter Avalos }; 10041c99275SPeter Avalos 10141c99275SPeter Avalos /* 10241c99275SPeter Avalos * Body of an rpc request call. 10341c99275SPeter Avalos */ 10441c99275SPeter Avalos struct sunrpc_call_body { 105*ed775ee7SAntonio Huete Jimenez nd_uint32_t cb_rpcvers; /* must be equal to two */ 106*ed775ee7SAntonio Huete Jimenez nd_uint32_t cb_prog; 107*ed775ee7SAntonio Huete Jimenez nd_uint32_t cb_vers; 108*ed775ee7SAntonio Huete Jimenez nd_uint32_t cb_proc; 10941c99275SPeter Avalos struct sunrpc_opaque_auth cb_cred; 11041c99275SPeter Avalos /* followed by opaque verifier */ 11141c99275SPeter Avalos }; 11241c99275SPeter Avalos 11341c99275SPeter Avalos /* 11441c99275SPeter Avalos * The rpc message 11541c99275SPeter Avalos */ 11641c99275SPeter Avalos struct sunrpc_msg { 117*ed775ee7SAntonio Huete Jimenez nd_uint32_t rm_xid; 118*ed775ee7SAntonio Huete Jimenez nd_uint32_t rm_direction; /* enum msg_type */ 11941c99275SPeter Avalos union { 12041c99275SPeter Avalos struct sunrpc_call_body RM_cmb; 12141c99275SPeter Avalos struct sunrpc_reply_body RM_rmb; 12241c99275SPeter Avalos } ru; 12341c99275SPeter Avalos #define rm_call ru.RM_cmb 12441c99275SPeter Avalos #define rm_reply ru.RM_rmb 12541c99275SPeter Avalos }; 12641c99275SPeter Avalos #define acpted_rply ru.RM_rmb.ru.RP_ar 12741c99275SPeter Avalos #define rjcted_rply ru.RM_rmb.ru.RP_dr 128