xref: /freebsd/include/rpcsvc/nlm_prot.x (revision daf1cffce2e07931f27c6c6998652e90df6ba87e)
1 /* @(#)nlm_prot.x	2.1 88/08/01 4.0 RPCSRC */
2 /* @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro */
3 
4 /*
5  * Network lock manager protocol definition
6  * Copyright (C) 1986 Sun Microsystems, Inc.
7  *
8  * protocol used between local lock manager and remote lock manager
9  */
10 
11 #ifdef RPC_HDR
12 %#define LM_MAXSTRLEN	1024
13 %#define MAXNAMELEN	LM_MAXSTRLEN+1
14 #else
15 %#ifndef lint
16 %static const char rcsid[] =
17 %  "$FreeBSD$";
18 %#endif /* not lint */
19 #endif
20 
21 /*
22  * status of a call to the lock manager
23  */
24 enum nlm_stats {
25 	nlm_granted = 0,
26 	nlm_denied = 1,
27 	nlm_denied_nolocks = 2,
28 	nlm_blocked = 3,
29 	nlm_denied_grace_period = 4
30 };
31 
32 struct nlm_holder {
33 	bool exclusive;
34 	int svid;
35 	netobj oh;
36 	unsigned l_offset;
37 	unsigned l_len;
38 };
39 
40 union nlm_testrply switch (nlm_stats stat) {
41 	case nlm_denied:
42 		struct nlm_holder holder;
43 	default:
44 		void;
45 };
46 
47 struct nlm_stat {
48 	nlm_stats stat;
49 };
50 
51 struct nlm_res {
52 	netobj cookie;
53 	nlm_stat stat;
54 };
55 
56 struct nlm_testres {
57 	netobj cookie;
58 	nlm_testrply stat;
59 };
60 
61 struct nlm_lock {
62 	string caller_name<LM_MAXSTRLEN>;
63 	netobj fh;		/* identify a file */
64 	netobj oh;		/* identify owner of a lock */
65 	int svid;		/* generated from pid for svid */
66 	unsigned l_offset;
67 	unsigned l_len;
68 };
69 
70 struct nlm_lockargs {
71 	netobj cookie;
72 	bool block;
73 	bool exclusive;
74 	struct nlm_lock alock;
75 	bool reclaim;		/* used for recovering locks */
76 	int state;		/* specify local status monitor state */
77 };
78 
79 struct nlm_cancargs {
80 	netobj cookie;
81 	bool block;
82 	bool exclusive;
83 	struct nlm_lock alock;
84 };
85 
86 struct nlm_testargs {
87 	netobj cookie;
88 	bool exclusive;
89 	struct nlm_lock alock;
90 };
91 
92 struct nlm_unlockargs {
93 	netobj cookie;
94 	struct nlm_lock alock;
95 };
96 
97 
98 #ifdef RPC_HDR
99 %/*
100 % * The following enums are actually bit encoded for efficient
101 % * boolean algebra.... DON'T change them.....
102 % */
103 #endif
104 enum	fsh_mode {
105 	fsm_DN  = 0,	/* deny none */
106 	fsm_DR  = 1,	/* deny read */
107 	fsm_DW  = 2,	/* deny write */
108 	fsm_DRW = 3	/* deny read/write */
109 };
110 
111 enum	fsh_access {
112 	fsa_NONE = 0,	/* for completeness */
113 	fsa_R    = 1,	/* read only */
114 	fsa_W    = 2,	/* write only */
115 	fsa_RW   = 3	/* read/write */
116 };
117 
118 struct	nlm_share {
119 	string caller_name<LM_MAXSTRLEN>;
120 	netobj	fh;
121 	netobj	oh;
122 	fsh_mode	mode;
123 	fsh_access	access;
124 };
125 
126 struct	nlm_shareargs {
127 	netobj	cookie;
128 	nlm_share	share;
129 	bool	reclaim;
130 };
131 
132 struct	nlm_shareres {
133 	netobj	cookie;
134 	nlm_stats	stat;
135 	int	sequence;
136 };
137 
138 struct	nlm_notify {
139 	string name<MAXNAMELEN>;
140 	long state;
141 };
142 
143 /*
144  * Over-the-wire protocol used between the network lock managers
145  */
146 
147 program NLM_PROG {
148 	version NLM_VERS {
149 
150 		nlm_testres	NLM_TEST(struct nlm_testargs) =	1;
151 
152 		nlm_res		NLM_LOCK(struct nlm_lockargs) =	2;
153 
154 		nlm_res		NLM_CANCEL(struct nlm_cancargs) = 3;
155 		nlm_res		NLM_UNLOCK(struct nlm_unlockargs) =	4;
156 
157 		/*
158 		 * remote lock manager call-back to grant lock
159 		 */
160 		nlm_res		NLM_GRANTED(struct nlm_testargs)= 5;
161 		/*
162 		 * message passing style of requesting lock
163 		 */
164 		void		NLM_TEST_MSG(struct nlm_testargs) = 6;
165 		void		NLM_LOCK_MSG(struct nlm_lockargs) = 7;
166 		void		NLM_CANCEL_MSG(struct nlm_cancargs) =8;
167 		void		NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
168 		void		NLM_GRANTED_MSG(struct nlm_testargs) = 10;
169 		void		NLM_TEST_RES(nlm_testres) = 11;
170 		void		NLM_LOCK_RES(nlm_res) = 12;
171 		void		NLM_CANCEL_RES(nlm_res) = 13;
172 		void		NLM_UNLOCK_RES(nlm_res) = 14;
173 		void		NLM_GRANTED_RES(nlm_res) = 15;
174 	} = 1;
175 
176 	version NLM_VERSX {
177 		nlm_shareres	NLM_SHARE(nlm_shareargs) = 20;
178 		nlm_shareres	NLM_UNSHARE(nlm_shareargs) = 21;
179 		nlm_res		NLM_NM_LOCK(nlm_lockargs) = 22;
180 		void		NLM_FREE_ALL(nlm_notify) = 23;
181 	} = 3;
182 
183 } = 100021;
184 
185