| 1 | /* based on rfc1813 and wireshark */ |
| 2 | |
| 3 | |
| 4 | struct nlm_fh4 { |
| 5 | opaque data<>; |
| 6 | }; |
| 7 | |
| 8 | typedef string nlm4_oh<>; |
| 9 | |
| 10 | struct nlm_cookie { |
| 11 | opaque data<>; |
| 12 | }; |
| 13 | |
| 14 | enum nlmstat4 { |
| 15 | NLM4_GRANTED = 0, |
| 16 | NLM4_DENIED = 1, |
| 17 | NLM4_DENIED_NOLOCKS = 2, |
| 18 | NLM4_BLOCKED = 3, |
| 19 | NLM4_DENIED_GRACE_PERIOD = 4, |
| 20 | NLM4_DEADLCK = 5, |
| 21 | NLM4_ROFS = 6, |
| 22 | NLM4_STALE_FH = 7, |
| 23 | NLM4_FBIG = 8, |
| 24 | NLM4_FAILED = 9 |
| 25 | }; |
| 26 | |
| 27 | struct nlm4_holder { |
| 28 | bool exclusive; |
| 29 | unsigned int svid; |
| 30 | nlm4_oh oh; |
| 31 | unsigned hyper l_offset; |
| 32 | unsigned hyper l_len; |
| 33 | }; |
| 34 | |
| 35 | const NLM_MAXNAME = 256; |
| 36 | struct nlm4_lock { |
| 37 | string caller_name<NLM_MAXNAME>; |
| 38 | struct nlm_fh4 fh; |
| 39 | nlm4_oh oh; |
| 40 | unsigned int svid; |
| 41 | unsigned hyper l_offset; |
| 42 | unsigned hyper l_len; |
| 43 | }; |
| 44 | |
| 45 | struct nlm4_share { |
| 46 | string caller_name<NLM_MAXNAME>; |
| 47 | struct nlm_fh4 fh; |
| 48 | nlm4_oh oh; |
| 49 | unsigned int mode; |
| 50 | unsigned int access; |
| 51 | }; |
| 52 | |
| 53 | struct nlm4_testres_denied { |
| 54 | nlm4_holder holder; |
| 55 | }; |
| 56 | |
| 57 | union nlm4_testreply switch (nlmstat4 status) { |
| 58 | case NLM4_DENIED: |
| 59 | nlm4_testres_denied lock; |
| 60 | default: |
| 61 | void; |
| 62 | }; |
| 63 | |
| 64 | struct NLM4_TESTres { |
| 65 | nlm_cookie cookie; |
| 66 | nlm4_testreply reply; |
| 67 | }; |
| 68 | |
| 69 | struct NLM4_TESTargs { |
| 70 | nlm_cookie cookie; |
| 71 | bool exclusive; |
| 72 | nlm4_lock lock; |
| 73 | }; |
| 74 | |
| 75 | struct NLM4_CANCres { |
| 76 | nlm_cookie cookie; |
| 77 | nlmstat4 status; |
| 78 | }; |
| 79 | |
| 80 | struct NLM4_CANCargs { |
| 81 | nlm_cookie cookie; |
| 82 | bool block; |
| 83 | bool exclusive; |
| 84 | nlm4_lock lock; |
| 85 | }; |
| 86 | |
| 87 | struct NLM4_UNLOCKres { |
| 88 | nlm_cookie cookie; |
| 89 | nlmstat4 status; |
| 90 | }; |
| 91 | |
| 92 | struct NLM4_UNLOCKargs { |
| 93 | nlm_cookie cookie; |
| 94 | nlm4_lock lock; |
| 95 | }; |
| 96 | |
| 97 | struct NLM4_LOCKres { |
| 98 | nlm_cookie cookie; |
| 99 | nlmstat4 status; |
| 100 | }; |
| 101 | |
| 102 | struct NLM4_LOCKargs { |
| 103 | nlm_cookie cookie; |
| 104 | bool block; |
| 105 | bool exclusive; |
| 106 | nlm4_lock lock; |
| 107 | bool reclaim; |
| 108 | int state; |
| 109 | }; |
| 110 | |
| 111 | struct NLM4_GRANTEDargs { |
| 112 | nlm_cookie cookie; |
| 113 | bool exclusive; |
| 114 | nlm4_lock lock; |
| 115 | }; |
| 116 | |
| 117 | struct NLM4_GRANTEDres { |
| 118 | nlm_cookie cookie; |
| 119 | nlmstat4 status; |
| 120 | }; |
| 121 | |
| 122 | program NLM_PROGRAM { |
| 123 | version NLM_V4 { |
| 124 | void |
| 125 | NLM4_NULL(void) = 0; |
| 126 | |
| 127 | NLM4_TESTres |
| 128 | NLM4_TEST(NLM4_TESTargs) = 1; |
| 129 | |
| 130 | NLM4_LOCKres |
| 131 | NLM4_LOCK(NLM4_LOCKargs) = 2; |
| 132 | |
| 133 | NLM4_CANCres |
| 134 | NLM4_CANCEL(NLM4_CANCargs) = 3; |
| 135 | |
| 136 | NLM4_UNLOCKres |
| 137 | NLM4_UNLOCK(NLM4_UNLOCKargs) = 4; |
| 138 | |
| 139 | NLM4_GRANTEDres |
| 140 | NLM4_GRANT(NLM4_GRANTEDargs) = 5; |
| 141 | |
| 142 | void |
| 143 | NLM4_TEST_MSG(NLM4_TESTargs) = 6; |
| 144 | |
| 145 | void |
| 146 | NLM4_LOCK_MSG(NLM4_LOCKargs) = 7; |
| 147 | |
| 148 | void |
| 149 | NLM4_CANCEL_MSG(NLM4_CANCargs) = 8; |
| 150 | |
| 151 | void |
| 152 | NLM4_UNLOCK_MSG(NLM4_UNLOCKargs) = 9; |
| 153 | |
| 154 | void |
| 155 | NLM4_GRANT_MSG(NLM4_GRANTEDargs) = 10; |
| 156 | |
| 157 | void |
| 158 | NLM4_TEST_RES(NLM4_TESTres) = 11; |
| 159 | |
| 160 | void |
| 161 | NLM4_LOCK_RES(NLM4_LOCKres) = 12; |
| 162 | |
| 163 | void |
| 164 | NLM4_CANCEL_RES(NLM4_CANCres) = 13; |
| 165 | |
| 166 | void |
| 167 | NLM4_UNLOCK_RES(NLM4_UNLOCKres) = 14; |
| 168 | |
| 169 | void |
| 170 | NLM4_GRANT_RES(NLM4_GRANTEDres) = 15; |
| 171 | |
| 172 | /* nlm4_shareres */ |
| 173 | /* NLM4_SHARE(nlm4_shareargs) = 20; */ |
| 174 | |
| 175 | /* nlm4_shareres */ |
| 176 | /* NLM4_UNSHARE(nlm4_shareargs) = 21; */ |
| 177 | |
| 178 | /* nlm4_res */ |
| 179 | /* NLM4_NM_LOCK(nlm4_lockargs) = 22; */ |
| 180 | |
| 181 | /* void */ |
| 182 | /* NLM4_FREE_ALL(nlm4_notify) = 23; */ |
| 183 | } = 4; |
| 184 | } = 100021; |