1 %/* 2 % * @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro 3 % * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC 4 % * $FreeBSD: src/include/rpcsvc/nlm_prot.x,v 1.8.2.1 2001/08/01 06:39:36 alfred Exp $ 5 % * $DragonFly: src/include/rpcsvc/nlm_prot.x,v 1.2 2003/06/17 04:25:58 dillon Exp $ 6 % */ 7 8 /* 9 * Network lock manager protocol definition 10 * Copyright (C) 1986 Sun Microsystems, Inc. 11 * 12 * protocol used between local lock manager and remote lock manager 13 */ 14 15 #ifdef RPC_HDR 16 %#define LM_MAXSTRLEN 1024 17 %#define MAXNAMELEN LM_MAXSTRLEN+1 18 %#include <sys/types.h> 19 #endif 20 21 /* 22 * status of a call to the lock manager 23 */ 24 enum nlm_stats { 25 nlm_granted = 0, 26 nlm_denied = 1, 27 nlm_denied_nolocks = 2, 28 nlm_blocked = 3, 29 nlm_denied_grace_period = 4 30 }; 31 32 struct nlm_holder { 33 bool exclusive; 34 int svid; 35 netobj oh; 36 u_int32_t l_offset; 37 u_int32_t l_len; 38 }; 39 40 union nlm_testrply switch (nlm_stats stat) { 41 case nlm_denied: 42 struct nlm_holder holder; 43 default: 44 void; 45 }; 46 47 struct nlm_stat { 48 nlm_stats stat; 49 }; 50 51 struct nlm_res { 52 netobj cookie; 53 nlm_stat stat; 54 }; 55 56 struct nlm_testres { 57 netobj cookie; 58 nlm_testrply stat; 59 }; 60 61 struct nlm_lock { 62 string caller_name<LM_MAXSTRLEN>; 63 netobj fh; /* identify a file */ 64 netobj oh; /* identify owner of a lock */ 65 int32_t svid; /* generated from pid for svid */ 66 u_int32_t l_offset; 67 u_int32_t l_len; 68 }; 69 70 struct nlm_lockargs { 71 netobj cookie; 72 bool block; 73 bool exclusive; 74 struct nlm_lock alock; 75 bool reclaim; /* used for recovering locks */ 76 int32_t state; /* specify local status monitor state */ 77 }; 78 79 struct nlm_cancargs { 80 netobj cookie; 81 bool block; 82 bool exclusive; 83 struct nlm_lock alock; 84 }; 85 86 struct nlm_testargs { 87 netobj cookie; 88 bool exclusive; 89 struct nlm_lock alock; 90 }; 91 92 struct nlm_unlockargs { 93 netobj cookie; 94 struct nlm_lock alock; 95 }; 96 97 98 #ifdef RPC_HDR 99 %/* 100 % * The following enums are actually bit encoded for efficient 101 % * boolean algebra.... DON'T change them..... 102 % */ 103 #endif 104 enum fsh_mode { 105 fsm_DN = 0, /* deny none */ 106 fsm_DR = 1, /* deny read */ 107 fsm_DW = 2, /* deny write */ 108 fsm_DRW = 3 /* deny read/write */ 109 }; 110 111 enum fsh_access { 112 fsa_NONE = 0, /* for completeness */ 113 fsa_R = 1, /* read only */ 114 fsa_W = 2, /* write only */ 115 fsa_RW = 3 /* read/write */ 116 }; 117 118 struct nlm_share { 119 string caller_name<LM_MAXSTRLEN>; 120 netobj fh; 121 netobj oh; 122 fsh_mode mode; 123 fsh_access access; 124 }; 125 126 struct nlm_shareargs { 127 netobj cookie; 128 nlm_share share; 129 bool reclaim; 130 }; 131 132 struct nlm_shareres { 133 netobj cookie; 134 nlm_stats stat; 135 int32_t sequence; 136 }; 137 138 struct nlm_notify { 139 string name<MAXNAMELEN>; 140 int32_t state; 141 }; 142 143 enum nlm4_stats { 144 nlm4_granted = 0, 145 nlm4_denied = 1, 146 nlm4_denied_nolocks = 2, 147 nlm4_blocked = 3, 148 nlm4_denied_grace_period = 4, 149 nlm4_deadlck = 5, 150 nlm4_rofs = 6, 151 nlm4_stale_fh = 7, 152 nlm4_fbig = 8, 153 nlm4_failed = 9 154 }; 155 156 struct nlm4_holder { 157 bool exclusive; 158 int32_t svid; 159 netobj oh; 160 u_int64_t l_offset; 161 u_int64_t l_len; 162 }; 163 164 struct nlm4_stat { 165 nlm4_stats stat; 166 }; 167 168 union nlm4_testrply switch (nlm4_stats stat) { 169 case nlm4_denied: 170 struct nlm4_holder holder; 171 default: 172 void; 173 }; 174 175 struct nlm4_res { 176 netobj cookie; 177 nlm4_stat stat; 178 }; 179 180 struct nlm4_testres { 181 netobj cookie; 182 nlm4_testrply stat; 183 }; 184 185 186 struct nlm4_lock { 187 string caller_name<LM_MAXSTRLEN>; 188 netobj fh; /* identify a file */ 189 netobj oh; /* identify owner of a lock */ 190 int32_t svid; /* generated from pid for svid */ 191 int64_t l_offset; 192 int64_t l_len; 193 }; 194 195 struct nlm4_lockargs { 196 netobj cookie; 197 bool block; 198 bool exclusive; 199 struct nlm4_lock alock; 200 bool reclaim; /* used for recovering locks */ 201 int32_t state; /* specify local status monitor state */ 202 }; 203 204 205 struct nlm4_cancargs { 206 netobj cookie; 207 bool block; 208 bool exclusive; 209 struct nlm4_lock alock; 210 }; 211 212 struct nlm4_testargs { 213 netobj cookie; 214 bool exclusive; 215 struct nlm4_lock alock; 216 }; 217 218 struct nlm4_unlockargs { 219 netobj cookie; 220 struct nlm4_lock alock; 221 }; 222 223 struct nlm4_share { 224 string caller_name<LM_MAXSTRLEN>; 225 netobj fh; 226 netobj oh; 227 fsh_mode mode; 228 fsh_access access; 229 }; 230 231 struct nlm4_shareargs { 232 netobj cookie; 233 nlm4_share share; 234 bool reclaim; 235 }; 236 237 struct nlm4_shareres { 238 netobj cookie; 239 nlm4_stats stat; 240 int32_t sequence; 241 }; 242 243 struct nlm4_notify { 244 string name<MAXNAMELEN>; 245 int32_t state; 246 }; 247 248 /* 249 * Over-the-wire protocol used between the network lock managers 250 */ 251 252 program NLM_PROG { 253 version NLM_VERS { 254 255 nlm_testres NLM_TEST(struct nlm_testargs) = 1; 256 257 nlm_res NLM_LOCK(struct nlm_lockargs) = 2; 258 259 nlm_res NLM_CANCEL(struct nlm_cancargs) = 3; 260 nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4; 261 262 /* 263 * remote lock manager call-back to grant lock 264 */ 265 nlm_res NLM_GRANTED(struct nlm_testargs)= 5; 266 /* 267 * message passing style of requesting lock 268 */ 269 void NLM_TEST_MSG(struct nlm_testargs) = 6; 270 void NLM_LOCK_MSG(struct nlm_lockargs) = 7; 271 void NLM_CANCEL_MSG(struct nlm_cancargs) =8; 272 void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9; 273 void NLM_GRANTED_MSG(struct nlm_testargs) = 10; 274 void NLM_TEST_RES(nlm_testres) = 11; 275 void NLM_LOCK_RES(nlm_res) = 12; 276 void NLM_CANCEL_RES(nlm_res) = 13; 277 void NLM_UNLOCK_RES(nlm_res) = 14; 278 void NLM_GRANTED_RES(nlm_res) = 15; 279 } = 1; 280 281 version NLM_VERSX { 282 nlm_shareres NLM_SHARE(nlm_shareargs) = 20; 283 nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21; 284 nlm_res NLM_NM_LOCK(nlm_lockargs) = 22; 285 void NLM_FREE_ALL(nlm_notify) = 23; 286 } = 3; 287 288 version NLM4_VERS { 289 void NLMPROC4_NULL(void) = 0; 290 291 nlm4_testres NLMPROC4_TEST(struct nlm4_testargs) = 1; 292 293 nlm4_res NLMPROC4_LOCK(struct nlm4_lockargs) = 2; 294 295 nlm4_res NLMPROC4_CANCEL(struct nlm4_cancargs) = 3; 296 nlm4_res NLMPROC4_UNLOCK(struct nlm4_unlockargs) = 4; 297 298 /* 299 * remote lock manager call-back to grant lock 300 */ 301 nlm4_res NLMPROC4_GRANTED(struct nlm4_testargs)= 5; 302 /* 303 * message passing style of requesting lock 304 */ 305 void NLMPROC4_TEST_MSG(struct nlm4_testargs) = 6; 306 void NLMPROC4_LOCK_MSG(struct nlm4_lockargs) = 7; 307 void NLMPROC4_CANCEL_MSG(struct nlm4_cancargs) =8; 308 void NLMPROC4_UNLOCK_MSG(struct nlm4_unlockargs) = 9; 309 void NLMPROC4_GRANTED_MSG(struct nlm4_testargs) = 10; 310 void NLMPROC4_TEST_RES(nlm4_testres) = 11; 311 void NLMPROC4_LOCK_RES(nlm4_res) = 12; 312 void NLMPROC4_CANCEL_RES(nlm4_res) = 13; 313 void NLMPROC4_UNLOCK_RES(nlm4_res) = 14; 314 void NLMPROC4_GRANTED_RES(nlm4_res) = 15; 315 316 nlm4_shareres NLMPROC4_SHARE(nlm4_shareargs) = 20; 317 nlm4_shareres NLMPROC4_UNSHARE(nlm4_shareargs) = 21; 318 nlm4_res NLMPROC4_NM_LOCK(nlm4_lockargs) = 22; 319 void NLMPROC4_FREE_ALL(nlm4_notify) = 23; 320 } = 4; 321 322 } = 100021; 323 324