xref: /freebsd/contrib/tcpdump/rpc_msg.h (revision 3c602fab)
11de50e9fSSam Leffler /*
21de50e9fSSam Leffler  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
31de50e9fSSam Leffler  * unrestricted use provided that this legend is included on all tape
41de50e9fSSam Leffler  * media and as a part of the software program in whole or part.  Users
51de50e9fSSam Leffler  * may copy or modify Sun RPC without charge, but are not authorized
61de50e9fSSam Leffler  * to license or distribute it to anyone else except as part of a product or
71de50e9fSSam Leffler  * program developed by the user.
81de50e9fSSam Leffler  *
91de50e9fSSam Leffler  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
101de50e9fSSam Leffler  * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
111de50e9fSSam Leffler  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
121de50e9fSSam Leffler  *
131de50e9fSSam Leffler  * Sun RPC is provided with no support and without any obligation on the
141de50e9fSSam Leffler  * part of Sun Microsystems, Inc. to assist in its use, correction,
151de50e9fSSam Leffler  * modification or enhancement.
161de50e9fSSam Leffler  *
171de50e9fSSam Leffler  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
181de50e9fSSam Leffler  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
191de50e9fSSam Leffler  * OR ANY PART THEREOF.
201de50e9fSSam Leffler  *
211de50e9fSSam Leffler  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
221de50e9fSSam Leffler  * or profits or other special, indirect and consequential damages, even if
231de50e9fSSam Leffler  * Sun has been advised of the possibility of such damages.
241de50e9fSSam Leffler  *
251de50e9fSSam Leffler  * Sun Microsystems, Inc.
261de50e9fSSam Leffler  * 2550 Garcia Avenue
271de50e9fSSam Leffler  * Mountain View, California  94043
281de50e9fSSam Leffler  *
291de50e9fSSam Leffler  *	from: @(#)rpc_msg.h 1.7 86/07/16 SMI
301de50e9fSSam Leffler  *	from: @(#)rpc_msg.h	2.1 88/07/29 4.0 RPCSRC
311de50e9fSSam Leffler  * $FreeBSD$
32a5779b6eSRui Paulo  * FreeBSD: src/include/rpc/rpc_msg.h,v 1.11.2.1 1999/08/29 14:39:07 peter Exp
331de50e9fSSam Leffler  */
341de50e9fSSam Leffler 
351de50e9fSSam Leffler /*
361de50e9fSSam Leffler  * rpc_msg.h
371de50e9fSSam Leffler  * rpc message definition
381de50e9fSSam Leffler  *
391de50e9fSSam Leffler  * Copyright (C) 1984, Sun Microsystems, Inc.
401de50e9fSSam Leffler  */
411de50e9fSSam Leffler 
423c602fabSXin LI #define SUNRPC_MSG_VERSION	((uint32_t) 2)
431de50e9fSSam Leffler 
441de50e9fSSam Leffler /*
451de50e9fSSam Leffler  * Bottom up definition of an rpc message.
461de50e9fSSam Leffler  * NOTE: call and reply use the same overall stuct but
471de50e9fSSam Leffler  * different parts of unions within it.
481de50e9fSSam Leffler  */
491de50e9fSSam Leffler 
501de50e9fSSam Leffler enum sunrpc_msg_type {
511de50e9fSSam Leffler 	SUNRPC_CALL=0,
521de50e9fSSam Leffler 	SUNRPC_REPLY=1
531de50e9fSSam Leffler };
541de50e9fSSam Leffler 
551de50e9fSSam Leffler enum sunrpc_reply_stat {
561de50e9fSSam Leffler 	SUNRPC_MSG_ACCEPTED=0,
571de50e9fSSam Leffler 	SUNRPC_MSG_DENIED=1
581de50e9fSSam Leffler };
591de50e9fSSam Leffler 
601de50e9fSSam Leffler enum sunrpc_accept_stat {
611de50e9fSSam Leffler 	SUNRPC_SUCCESS=0,
621de50e9fSSam Leffler 	SUNRPC_PROG_UNAVAIL=1,
631de50e9fSSam Leffler 	SUNRPC_PROG_MISMATCH=2,
641de50e9fSSam Leffler 	SUNRPC_PROC_UNAVAIL=3,
651de50e9fSSam Leffler 	SUNRPC_GARBAGE_ARGS=4,
661de50e9fSSam Leffler 	SUNRPC_SYSTEM_ERR=5
671de50e9fSSam Leffler };
681de50e9fSSam Leffler 
691de50e9fSSam Leffler enum sunrpc_reject_stat {
701de50e9fSSam Leffler 	SUNRPC_RPC_MISMATCH=0,
711de50e9fSSam Leffler 	SUNRPC_AUTH_ERROR=1
721de50e9fSSam Leffler };
731de50e9fSSam Leffler 
741de50e9fSSam Leffler /*
751de50e9fSSam Leffler  * Reply part of an rpc exchange
761de50e9fSSam Leffler  */
771de50e9fSSam Leffler 
781de50e9fSSam Leffler /*
791de50e9fSSam Leffler  * Reply to an rpc request that was rejected by the server.
801de50e9fSSam Leffler  */
811de50e9fSSam Leffler struct sunrpc_rejected_reply {
823c602fabSXin LI 	uint32_t		 rj_stat;	/* enum reject_stat */
831de50e9fSSam Leffler 	union {
841de50e9fSSam Leffler 		struct {
853c602fabSXin LI 			uint32_t low;
863c602fabSXin LI 			uint32_t high;
871de50e9fSSam Leffler 		} RJ_versions;
883c602fabSXin LI 		uint32_t RJ_why;  /* enum auth_stat - why authentication did not work */
891de50e9fSSam Leffler 	} ru;
901de50e9fSSam Leffler #define	rj_vers	ru.RJ_versions
911de50e9fSSam Leffler #define	rj_why	ru.RJ_why
921de50e9fSSam Leffler };
931de50e9fSSam Leffler 
941de50e9fSSam Leffler /*
951de50e9fSSam Leffler  * Body of a reply to an rpc request.
961de50e9fSSam Leffler  */
971de50e9fSSam Leffler struct sunrpc_reply_body {
983c602fabSXin LI 	uint32_t	rp_stat;		/* enum reply_stat */
991de50e9fSSam Leffler 	struct sunrpc_rejected_reply rp_reject;	/* if rejected */
1001de50e9fSSam Leffler };
1011de50e9fSSam Leffler 
1021de50e9fSSam Leffler /*
1031de50e9fSSam Leffler  * Body of an rpc request call.
1041de50e9fSSam Leffler  */
1051de50e9fSSam Leffler struct sunrpc_call_body {
1063c602fabSXin LI 	uint32_t cb_rpcvers;	/* must be equal to two */
1073c602fabSXin LI 	uint32_t cb_prog;
1083c602fabSXin LI 	uint32_t cb_vers;
1093c602fabSXin LI 	uint32_t cb_proc;
1101de50e9fSSam Leffler 	struct sunrpc_opaque_auth cb_cred;
1111de50e9fSSam Leffler 	/* followed by opaque verifier */
1121de50e9fSSam Leffler };
1131de50e9fSSam Leffler 
1141de50e9fSSam Leffler /*
1151de50e9fSSam Leffler  * The rpc message
1161de50e9fSSam Leffler  */
1171de50e9fSSam Leffler struct sunrpc_msg {
1183c602fabSXin LI 	uint32_t		rm_xid;
1193c602fabSXin LI 	uint32_t		rm_direction;	/* enum msg_type */
1201de50e9fSSam Leffler 	union {
1211de50e9fSSam Leffler 		struct sunrpc_call_body RM_cmb;
1221de50e9fSSam Leffler 		struct sunrpc_reply_body RM_rmb;
1231de50e9fSSam Leffler 	} ru;
1241de50e9fSSam Leffler #define	rm_call		ru.RM_cmb
1251de50e9fSSam Leffler #define	rm_reply	ru.RM_rmb
1261de50e9fSSam Leffler };
1271de50e9fSSam Leffler #define	acpted_rply	ru.RM_rmb.ru.RP_ar
1281de50e9fSSam Leffler #define	rjcted_rply	ru.RM_rmb.ru.RP_dr
129