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