Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


nlm_prot.x
001: /* @(#)nlm_prot.x       2.1 88/08/01 4.0 RPCSRC */
002: 
003: /*
004:  * Network lock manager protocol definition
005:  * Copyright (c) 2010, Oracle America, Inc.
006:  * Redistribution and use in source and binary forms, with or without
007:  * modification, are permitted provided that the following conditions are
008:  * met:
009:  *
010:  *     * Redistributions of source code must retain the above copyright
011:  *       notice, this list of conditions and the following disclaimer.
012:  *     * Redistributions in binary form must reproduce the above
013:  *       copyright notice, this list of conditions and the following
014:  *       disclaimer in the documentation and/or other materials
015:  *       provided with the distribution.
016:  *     * Neither the name of the "Oracle America, Inc." nor the names of its
017:  *       contributors may be used to endorse or promote products derived
018:  *       from this software without specific prior written permission.
019:  *
020:  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
021:  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
022:  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
023:  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
024:  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
025:  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
026:  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
027:  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
028:  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
029:  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
030:  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
031:  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
032:  *
033:  * protocol used between local lock manager and remote lock manager
034:  */
035: 
036: #ifdef RPC_HDR
037: %#define LM_MAXSTRLEN   1024
038: %#define MAXNAMELEN     LM_MAXSTRLEN+1
039: #endif
040: 
041: /*
042:  * status of a call to the lock manager
043:  */
044: enum nlm_stats {
045:         nlm_granted = 0,
046:         nlm_denied = 1,
047:         nlm_denied_nolocks = 2,
048:         nlm_blocked = 3,
049:         nlm_denied_grace_period = 4
050: };
051: 
052: struct nlm_holder {
053:         bool exclusive;
054:         int svid;
055:         netobj oh;
056:         unsigned l_offset;
057:         unsigned l_len;
058: };
059: 
060: union nlm_testrply switch (nlm_stats stat) {
061:         case nlm_denied:
062:                 struct nlm_holder holder;
063:         default:
064:                 void;
065: };
066: 
067: struct nlm_stat {
068:         nlm_stats stat;
069: };
070: 
071: struct nlm_res {
072:         netobj cookie;
073:         nlm_stat stat;
074: };
075: 
076: struct nlm_testres {
077:         netobj cookie;
078:         nlm_testrply stat;
079: };
080: 
081: struct nlm_lock {
082:         string caller_name<LM_MAXSTRLEN>;
083:         netobj fh;              /* identify a file */
084:         netobj oh;              /* identify owner of a lock */
085:         int svid;               /* generated from pid for svid */
086:         unsigned l_offset;
087:         unsigned l_len;
088: };
089: 
090: struct nlm_lockargs {
091:         netobj cookie;
092:         bool block;
093:         bool exclusive;
094:         struct nlm_lock alock;
095:         bool reclaim;           /* used for recovering locks */
096:         int state;              /* specify local status monitor state */
097: };
098: 
099: 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;
204: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/