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