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