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