cpp-d1064d
[cross.git] / i686-linux-gnu-4.7 / usr / include / rpcsvc / nlm_prot.x
1 /* @(#)nlm_prot.x       2.1 88/08/01 4.0 RPCSRC */
2
3 /*
4  * Network lock manager protocol definition
5  * Copyright (c) 2010, Oracle America, Inc.
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above
13  *       copyright notice, this list of conditions and the following
14  *       disclaimer in the documentation and/or other materials
15  *       provided with the distribution.
16  *     * Neither the name of the "Oracle America, Inc." nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * protocol used between local lock manager and remote lock manager
34  */
35
36 #ifdef RPC_HDR
37 %#define LM_MAXSTRLEN   1024
38 %#define MAXNAMELEN     LM_MAXSTRLEN+1
39 #endif
40
41 /*
42  * status of a call to the lock manager
43  */
44 enum nlm_stats {
45         nlm_granted = 0,
46         nlm_denied = 1,
47         nlm_denied_nolocks = 2,
48         nlm_blocked = 3,
49         nlm_denied_grace_period = 4
50 };
51
52 struct nlm_holder {
53         bool exclusive;
54         int svid;
55         netobj oh;
56         unsigned l_offset;
57         unsigned l_len;
58 };
59
60 union nlm_testrply switch (nlm_stats stat) {
61         case nlm_denied:
62                 struct nlm_holder holder;
63         default:
64                 void;
65 };
66
67 struct nlm_stat {
68         nlm_stats stat;
69 };
70
71 struct nlm_res {
72         netobj cookie;
73         nlm_stat stat;
74 };
75
76 struct nlm_testres {
77         netobj cookie;
78         nlm_testrply stat;
79 };
80
81 struct nlm_lock {
82         string caller_name<LM_MAXSTRLEN>;
83         netobj fh;              /* identify a file */
84         netobj oh;              /* identify owner of a lock */
85         int svid;               /* generated from pid for svid */
86         unsigned l_offset;
87         unsigned l_len;
88 };
89
90 struct nlm_lockargs {
91         netobj cookie;
92         bool block;
93         bool exclusive;
94         struct nlm_lock alock;
95         bool reclaim;           /* used for recovering locks */
96         int state;              /* specify local status monitor state */
97 };
98
99 struct nlm_cancargs {
100         netobj cookie;
101         bool block;
102         bool exclusive;
103         struct nlm_lock alock;
104 };
105
106 struct nlm_testargs {
107         netobj cookie;
108         bool exclusive;
109         struct nlm_lock alock;
110 };
111
112 struct nlm_unlockargs {
113         netobj cookie;
114         struct nlm_lock alock;
115 };
116
117
118 #ifdef RPC_HDR
119 %/*
120 % * The following enums are actually bit encoded for efficient
121 % * boolean algebra.... DON'T change them.....
122 % */
123 #endif
124 enum    fsh_mode {
125         fsm_DN  = 0,    /* deny none */
126         fsm_DR  = 1,    /* deny read */
127         fsm_DW  = 2,    /* deny write */
128         fsm_DRW = 3     /* deny read/write */
129 };
130
131 enum    fsh_access {
132         fsa_NONE = 0,   /* for completeness */
133         fsa_R    = 1,   /* read only */
134         fsa_W    = 2,   /* write only */
135         fsa_RW   = 3    /* read/write */
136 };
137
138 struct  nlm_share {
139         string caller_name<LM_MAXSTRLEN>;
140         netobj  fh;
141         netobj  oh;
142         fsh_mode        mode;
143         fsh_access      access;
144 };
145
146 struct  nlm_shareargs {
147         netobj  cookie;
148         nlm_share       share;
149         bool    reclaim;
150 };
151
152 struct  nlm_shareres {
153         netobj  cookie;
154         nlm_stats       stat;
155         int     sequence;
156 };
157
158 struct  nlm_notify {
159         string name<MAXNAMELEN>;
160         long state;
161 };
162
163 /*
164  * Over-the-wire protocol used between the network lock managers
165  */
166
167 program NLM_PROG {
168         version NLM_VERS {
169
170                 nlm_testres     NLM_TEST(struct nlm_testargs) = 1;
171
172                 nlm_res         NLM_LOCK(struct nlm_lockargs) = 2;
173
174                 nlm_res         NLM_CANCEL(struct nlm_cancargs) = 3;
175                 nlm_res         NLM_UNLOCK(struct nlm_unlockargs) =     4;
176
177                 /*
178                  * remote lock manager call-back to grant lock
179                  */
180                 nlm_res         NLM_GRANTED(struct nlm_testargs)= 5;
181                 /*
182                  * message passing style of requesting lock
183                  */
184                 void            NLM_TEST_MSG(struct nlm_testargs) = 6;
185                 void            NLM_LOCK_MSG(struct nlm_lockargs) = 7;
186                 void            NLM_CANCEL_MSG(struct nlm_cancargs) =8;
187                 void            NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
188                 void            NLM_GRANTED_MSG(struct nlm_testargs) = 10;
189                 void            NLM_TEST_RES(nlm_testres) = 11;
190                 void            NLM_LOCK_RES(nlm_res) = 12;
191                 void            NLM_CANCEL_RES(nlm_res) = 13;
192                 void            NLM_UNLOCK_RES(nlm_res) = 14;
193                 void            NLM_GRANTED_RES(nlm_res) = 15;
194         } = 1;
195
196         version NLM_VERSX {
197                 nlm_shareres    NLM_SHARE(nlm_shareargs) = 20;
198                 nlm_shareres    NLM_UNSHARE(nlm_shareargs) = 21;
199                 nlm_res         NLM_NM_LOCK(nlm_lockargs) = 22;
200                 void            NLM_FREE_ALL(nlm_notify) = 23;
201         } = 3;
202
203 } = 100021;