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