Imported Upstream version 1.9.4
[deb_libnfs.git] / nlm / libnfs-raw-nlm.c
1 /*
2 Copyright (c) 2014, Ronnie Sahlberg
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25 The views and conclusions contained in the software and documentation are those
26 of the authors and should not be interpreted as representing official policies,
27 either expressed or implied, of the FreeBSD Project.
28 */
29
30 /*
31 * Please do not edit this file.
32 * It was generated using rpcgen.
33 */
34
35 #include "libnfs-zdr.h"
36 #include "libnfs-raw-nlm.h"
37
38 bool_t
39 zdr_nlm_fh4 (ZDR *zdrs, nlm_fh4 *objp)
40 {
41 register int32_t *buf;
42 buf = NULL;
43
44 if (!zdr_bytes (zdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
45 return FALSE;
46 return TRUE;
47 }
48
49 bool_t
50 zdr_nlm4_oh (ZDR *zdrs, nlm4_oh *objp)
51 {
52 register int32_t *buf;
53 buf = NULL;
54
55 if (!zdr_string (zdrs, objp, ~0))
56 return FALSE;
57 return TRUE;
58 }
59
60 bool_t
61 zdr_nlm_cookie (ZDR *zdrs, nlm_cookie *objp)
62 {
63 register int32_t *buf;
64 buf = NULL;
65
66 if (!zdr_bytes (zdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
67 return FALSE;
68 return TRUE;
69 }
70
71 bool_t
72 zdr_nlmstat4 (ZDR *zdrs, nlmstat4 *objp)
73 {
74 register int32_t *buf;
75 buf = NULL;
76
77 if (!zdr_enum (zdrs, (enum_t *) objp))
78 return FALSE;
79 return TRUE;
80 }
81
82 bool_t
83 zdr_nlm4_holder (ZDR *zdrs, nlm4_holder *objp)
84 {
85 register int32_t *buf;
86 buf = NULL;
87
88 if (!zdr_bool (zdrs, &objp->exclusive))
89 return FALSE;
90 if (!zdr_u_int (zdrs, &objp->svid))
91 return FALSE;
92 if (!zdr_nlm4_oh (zdrs, &objp->oh))
93 return FALSE;
94 if (!zdr_u_quad_t (zdrs, &objp->l_offset))
95 return FALSE;
96 if (!zdr_u_quad_t (zdrs, &objp->l_len))
97 return FALSE;
98 return TRUE;
99 }
100
101 bool_t
102 zdr_nlm4_lock (ZDR *zdrs, nlm4_lock *objp)
103 {
104 register int32_t *buf;
105 buf = NULL;
106
107 if (!zdr_string (zdrs, &objp->caller_name, NLM_MAXNAME))
108 return FALSE;
109 if (!zdr_nlm_fh4 (zdrs, &objp->fh))
110 return FALSE;
111 if (!zdr_nlm4_oh (zdrs, &objp->oh))
112 return FALSE;
113 if (!zdr_u_int (zdrs, &objp->svid))
114 return FALSE;
115 if (!zdr_u_quad_t (zdrs, &objp->l_offset))
116 return FALSE;
117 if (!zdr_u_quad_t (zdrs, &objp->l_len))
118 return FALSE;
119 return TRUE;
120 }
121
122 bool_t
123 zdr_nlm4_share (ZDR *zdrs, nlm4_share *objp)
124 {
125 register int32_t *buf;
126 buf = NULL;
127
128 if (!zdr_string (zdrs, &objp->caller_name, NLM_MAXNAME))
129 return FALSE;
130 if (!zdr_nlm_fh4 (zdrs, &objp->fh))
131 return FALSE;
132 if (!zdr_nlm4_oh (zdrs, &objp->oh))
133 return FALSE;
134 if (!zdr_u_int (zdrs, &objp->mode))
135 return FALSE;
136 if (!zdr_u_int (zdrs, &objp->access))
137 return FALSE;
138 return TRUE;
139 }
140
141 bool_t
142 zdr_nlm4_testres_denied (ZDR *zdrs, nlm4_testres_denied *objp)
143 {
144 register int32_t *buf;
145 buf = NULL;
146
147 if (!zdr_nlm4_holder (zdrs, &objp->holder))
148 return FALSE;
149 return TRUE;
150 }
151
152 bool_t
153 zdr_nlm4_testreply (ZDR *zdrs, nlm4_testreply *objp)
154 {
155 register int32_t *buf;
156 buf = NULL;
157
158 if (!zdr_nlmstat4 (zdrs, &objp->status))
159 return FALSE;
160 switch (objp->status) {
161 case NLM4_DENIED:
162 if (!zdr_nlm4_testres_denied (zdrs, &objp->nlm4_testreply_u.lock))
163 return FALSE;
164 break;
165 default:
166 break;
167 }
168 return TRUE;
169 }
170
171 bool_t
172 zdr_NLM4_TESTres (ZDR *zdrs, NLM4_TESTres *objp)
173 {
174 register int32_t *buf;
175 buf = NULL;
176
177 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
178 return FALSE;
179 if (!zdr_nlm4_testreply (zdrs, &objp->reply))
180 return FALSE;
181 return TRUE;
182 }
183
184 bool_t
185 zdr_NLM4_TESTargs (ZDR *zdrs, NLM4_TESTargs *objp)
186 {
187 register int32_t *buf;
188 buf = NULL;
189
190 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
191 return FALSE;
192 if (!zdr_bool (zdrs, &objp->exclusive))
193 return FALSE;
194 if (!zdr_nlm4_lock (zdrs, &objp->lock))
195 return FALSE;
196 return TRUE;
197 }
198
199 bool_t
200 zdr_NLM4_CANCres (ZDR *zdrs, NLM4_CANCres *objp)
201 {
202 register int32_t *buf;
203 buf = NULL;
204
205 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
206 return FALSE;
207 if (!zdr_nlmstat4 (zdrs, &objp->status))
208 return FALSE;
209 return TRUE;
210 }
211
212 bool_t
213 zdr_NLM4_CANCargs (ZDR *zdrs, NLM4_CANCargs *objp)
214 {
215 register int32_t *buf;
216 buf = NULL;
217
218 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
219 return FALSE;
220 if (!zdr_bool (zdrs, &objp->block))
221 return FALSE;
222 if (!zdr_bool (zdrs, &objp->exclusive))
223 return FALSE;
224 if (!zdr_nlm4_lock (zdrs, &objp->lock))
225 return FALSE;
226 return TRUE;
227 }
228
229 bool_t
230 zdr_NLM4_UNLOCKres (ZDR *zdrs, NLM4_UNLOCKres *objp)
231 {
232 register int32_t *buf;
233 buf = NULL;
234
235 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
236 return FALSE;
237 if (!zdr_nlmstat4 (zdrs, &objp->status))
238 return FALSE;
239 return TRUE;
240 }
241
242 bool_t
243 zdr_NLM4_UNLOCKargs (ZDR *zdrs, NLM4_UNLOCKargs *objp)
244 {
245 register int32_t *buf;
246 buf = NULL;
247
248 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
249 return FALSE;
250 if (!zdr_nlm4_lock (zdrs, &objp->lock))
251 return FALSE;
252 return TRUE;
253 }
254
255 bool_t
256 zdr_NLM4_LOCKres (ZDR *zdrs, NLM4_LOCKres *objp)
257 {
258 register int32_t *buf;
259 buf = NULL;
260
261 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
262 return FALSE;
263 if (!zdr_nlmstat4 (zdrs, &objp->status))
264 return FALSE;
265 return TRUE;
266 }
267
268 bool_t
269 zdr_NLM4_LOCKargs (ZDR *zdrs, NLM4_LOCKargs *objp)
270 {
271 register int32_t *buf;
272 buf = NULL;
273
274 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
275 return FALSE;
276 if (!zdr_bool (zdrs, &objp->block))
277 return FALSE;
278 if (!zdr_bool (zdrs, &objp->exclusive))
279 return FALSE;
280 if (!zdr_nlm4_lock (zdrs, &objp->lock))
281 return FALSE;
282 if (!zdr_bool (zdrs, &objp->reclaim))
283 return FALSE;
284 if (!zdr_int (zdrs, &objp->state))
285 return FALSE;
286 return TRUE;
287 }
288
289 bool_t
290 zdr_NLM4_GRANTEDargs (ZDR *zdrs, NLM4_GRANTEDargs *objp)
291 {
292 register int32_t *buf;
293 buf = NULL;
294
295 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
296 return FALSE;
297 if (!zdr_bool (zdrs, &objp->exclusive))
298 return FALSE;
299 if (!zdr_nlm4_lock (zdrs, &objp->lock))
300 return FALSE;
301 return TRUE;
302 }
303
304 bool_t
305 zdr_NLM4_GRANTEDres (ZDR *zdrs, NLM4_GRANTEDres *objp)
306 {
307 register int32_t *buf;
308 buf = NULL;
309
310 if (!zdr_nlm_cookie (zdrs, &objp->cookie))
311 return FALSE;
312 if (!zdr_nlmstat4 (zdrs, &objp->status))
313 return FALSE;
314 return TRUE;
315 }