xref: /aosp_15_r20/external/tcpdump/rpc_msg.h (revision 05b00f6010a2396e3db2409989fc67270046269f)
1*05b00f60SXin Li /*
2*05b00f60SXin Li  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3*05b00f60SXin Li  * unrestricted use provided that this legend is included on all tape
4*05b00f60SXin Li  * media and as a part of the software program in whole or part.  Users
5*05b00f60SXin Li  * may copy or modify Sun RPC without charge, but are not authorized
6*05b00f60SXin Li  * to license or distribute it to anyone else except as part of a product or
7*05b00f60SXin Li  * program developed by the user.
8*05b00f60SXin Li  *
9*05b00f60SXin Li  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10*05b00f60SXin Li  * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
11*05b00f60SXin Li  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12*05b00f60SXin Li  *
13*05b00f60SXin Li  * Sun RPC is provided with no support and without any obligation on the
14*05b00f60SXin Li  * part of Sun Microsystems, Inc. to assist in its use, correction,
15*05b00f60SXin Li  * modification or enhancement.
16*05b00f60SXin Li  *
17*05b00f60SXin Li  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18*05b00f60SXin Li  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19*05b00f60SXin Li  * OR ANY PART THEREOF.
20*05b00f60SXin Li  *
21*05b00f60SXin Li  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22*05b00f60SXin Li  * or profits or other special, indirect and consequential damages, even if
23*05b00f60SXin Li  * Sun has been advised of the possibility of such damages.
24*05b00f60SXin Li  *
25*05b00f60SXin Li  * Sun Microsystems, Inc.
26*05b00f60SXin Li  * 2550 Garcia Avenue
27*05b00f60SXin Li  * Mountain View, California  94043
28*05b00f60SXin Li  *
29*05b00f60SXin Li  *	from: @(#)rpc_msg.h 1.7 86/07/16 SMI
30*05b00f60SXin Li  *	from: @(#)rpc_msg.h	2.1 88/07/29 4.0 RPCSRC
31*05b00f60SXin Li  * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.11.2.1 1999/08/29 14:39:07 peter Exp $
32*05b00f60SXin Li  */
33*05b00f60SXin Li 
34*05b00f60SXin Li /*
35*05b00f60SXin Li  * rpc_msg.h
36*05b00f60SXin Li  * rpc message definition
37*05b00f60SXin Li  *
38*05b00f60SXin Li  * Copyright (C) 1984, Sun Microsystems, Inc.
39*05b00f60SXin Li  */
40*05b00f60SXin Li 
41*05b00f60SXin Li #define SUNRPC_MSG_VERSION	((uint32_t) 2)
42*05b00f60SXin Li 
43*05b00f60SXin Li /*
44*05b00f60SXin Li  * Bottom up definition of an rpc message.
45*05b00f60SXin Li  * NOTE: call and reply use the same overall struct but
46*05b00f60SXin Li  * different parts of unions within it.
47*05b00f60SXin Li  */
48*05b00f60SXin Li 
49*05b00f60SXin Li enum sunrpc_msg_type {
50*05b00f60SXin Li 	SUNRPC_CALL=0,
51*05b00f60SXin Li 	SUNRPC_REPLY=1
52*05b00f60SXin Li };
53*05b00f60SXin Li 
54*05b00f60SXin Li enum sunrpc_reply_stat {
55*05b00f60SXin Li 	SUNRPC_MSG_ACCEPTED=0,
56*05b00f60SXin Li 	SUNRPC_MSG_DENIED=1
57*05b00f60SXin Li };
58*05b00f60SXin Li 
59*05b00f60SXin Li enum sunrpc_accept_stat {
60*05b00f60SXin Li 	SUNRPC_SUCCESS=0,
61*05b00f60SXin Li 	SUNRPC_PROG_UNAVAIL=1,
62*05b00f60SXin Li 	SUNRPC_PROG_MISMATCH=2,
63*05b00f60SXin Li 	SUNRPC_PROC_UNAVAIL=3,
64*05b00f60SXin Li 	SUNRPC_GARBAGE_ARGS=4,
65*05b00f60SXin Li 	SUNRPC_SYSTEM_ERR=5
66*05b00f60SXin Li };
67*05b00f60SXin Li 
68*05b00f60SXin Li enum sunrpc_reject_stat {
69*05b00f60SXin Li 	SUNRPC_RPC_MISMATCH=0,
70*05b00f60SXin Li 	SUNRPC_AUTH_ERROR=1
71*05b00f60SXin Li };
72*05b00f60SXin Li 
73*05b00f60SXin Li /*
74*05b00f60SXin Li  * Reply part of an rpc exchange
75*05b00f60SXin Li  */
76*05b00f60SXin Li 
77*05b00f60SXin Li /*
78*05b00f60SXin Li  * Reply to an rpc request that was rejected by the server.
79*05b00f60SXin Li  */
80*05b00f60SXin Li struct sunrpc_rejected_reply {
81*05b00f60SXin Li 	nd_uint32_t		 rj_stat;	/* enum reject_stat */
82*05b00f60SXin Li 	union {
83*05b00f60SXin Li 		struct {
84*05b00f60SXin Li 			nd_uint32_t low;
85*05b00f60SXin Li 			nd_uint32_t high;
86*05b00f60SXin Li 		} RJ_versions;
87*05b00f60SXin Li 		nd_uint32_t RJ_why;  /* enum auth_stat - why authentication did not work */
88*05b00f60SXin Li 	} ru;
89*05b00f60SXin Li #define	rj_vers	ru.RJ_versions
90*05b00f60SXin Li #define	rj_why	ru.RJ_why
91*05b00f60SXin Li };
92*05b00f60SXin Li 
93*05b00f60SXin Li /*
94*05b00f60SXin Li  * Body of a reply to an rpc request.
95*05b00f60SXin Li  */
96*05b00f60SXin Li struct sunrpc_reply_body {
97*05b00f60SXin Li 	nd_uint32_t	rp_stat;		/* enum reply_stat */
98*05b00f60SXin Li 	struct sunrpc_rejected_reply rp_reject;	/* if rejected */
99*05b00f60SXin Li };
100*05b00f60SXin Li 
101*05b00f60SXin Li /*
102*05b00f60SXin Li  * Body of an rpc request call.
103*05b00f60SXin Li  */
104*05b00f60SXin Li struct sunrpc_call_body {
105*05b00f60SXin Li 	nd_uint32_t cb_rpcvers;	/* must be equal to two */
106*05b00f60SXin Li 	nd_uint32_t cb_prog;
107*05b00f60SXin Li 	nd_uint32_t cb_vers;
108*05b00f60SXin Li 	nd_uint32_t cb_proc;
109*05b00f60SXin Li 	struct sunrpc_opaque_auth cb_cred;
110*05b00f60SXin Li 	/* followed by opaque verifier */
111*05b00f60SXin Li };
112*05b00f60SXin Li 
113*05b00f60SXin Li /*
114*05b00f60SXin Li  * The rpc message
115*05b00f60SXin Li  */
116*05b00f60SXin Li struct sunrpc_msg {
117*05b00f60SXin Li 	nd_uint32_t		rm_xid;
118*05b00f60SXin Li 	nd_uint32_t		rm_direction;	/* enum msg_type */
119*05b00f60SXin Li 	union {
120*05b00f60SXin Li 		struct sunrpc_call_body RM_cmb;
121*05b00f60SXin Li 		struct sunrpc_reply_body RM_rmb;
122*05b00f60SXin Li 	} ru;
123*05b00f60SXin Li #define	rm_call		ru.RM_cmb
124*05b00f60SXin Li #define	rm_reply	ru.RM_rmb
125*05b00f60SXin Li };
126*05b00f60SXin Li #define	acpted_rply	ru.RM_rmb.ru.RP_ar
127*05b00f60SXin Li #define	rjcted_rply	ru.RM_rmb.ru.RP_dr
128