Add myself for packaging copyright and some minor tweaks
[deb_libnfs.git] / portmap / libnfs-raw-portmap.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-portmap.h"
37
38 bool_t
39 zdr_pmap2_mapping (ZDR *zdrs, pmap2_mapping *objp)
40 {
41 register int32_t *buf;
42 buf = NULL;
43
44
45 if (zdrs->x_op == ZDR_ENCODE) {
46 buf = ZDR_INLINE (zdrs, 4 * BYTES_PER_ZDR_UNIT);
47 if (buf == NULL) {
48 if (!zdr_u_int (zdrs, &objp->prog))
49 return FALSE;
50 if (!zdr_u_int (zdrs, &objp->vers))
51 return FALSE;
52 if (!zdr_u_int (zdrs, &objp->prot))
53 return FALSE;
54 if (!zdr_u_int (zdrs, &objp->port))
55 return FALSE;
56 } else {
57 IZDR_PUT_U_LONG(buf, objp->prog);
58 IZDR_PUT_U_LONG(buf, objp->vers);
59 IZDR_PUT_U_LONG(buf, objp->prot);
60 IZDR_PUT_U_LONG(buf, objp->port);
61 }
62 return TRUE;
63 } else if (zdrs->x_op == ZDR_DECODE) {
64 buf = ZDR_INLINE (zdrs, 4 * BYTES_PER_ZDR_UNIT);
65 if (buf == NULL) {
66 if (!zdr_u_int (zdrs, &objp->prog))
67 return FALSE;
68 if (!zdr_u_int (zdrs, &objp->vers))
69 return FALSE;
70 if (!zdr_u_int (zdrs, &objp->prot))
71 return FALSE;
72 if (!zdr_u_int (zdrs, &objp->port))
73 return FALSE;
74 } else {
75 objp->prog = IZDR_GET_U_LONG(buf);
76 objp->vers = IZDR_GET_U_LONG(buf);
77 objp->prot = IZDR_GET_U_LONG(buf);
78 objp->port = IZDR_GET_U_LONG(buf);
79 }
80 return TRUE;
81 }
82
83 if (!zdr_u_int (zdrs, &objp->prog))
84 return FALSE;
85 if (!zdr_u_int (zdrs, &objp->vers))
86 return FALSE;
87 if (!zdr_u_int (zdrs, &objp->prot))
88 return FALSE;
89 if (!zdr_u_int (zdrs, &objp->port))
90 return FALSE;
91 return TRUE;
92 }
93
94 bool_t
95 zdr_pmap2_call_args (ZDR *zdrs, pmap2_call_args *objp)
96 {
97 register int32_t *buf;
98 buf = NULL;
99
100
101 if (zdrs->x_op == ZDR_ENCODE) {
102 buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
103 if (buf == NULL) {
104 if (!zdr_u_int (zdrs, &objp->prog))
105 return FALSE;
106 if (!zdr_u_int (zdrs, &objp->vers))
107 return FALSE;
108 if (!zdr_u_int (zdrs, &objp->proc))
109 return FALSE;
110
111 } else {
112 IZDR_PUT_U_LONG(buf, objp->prog);
113 IZDR_PUT_U_LONG(buf, objp->vers);
114 IZDR_PUT_U_LONG(buf, objp->proc);
115 }
116 if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
117 return FALSE;
118 return TRUE;
119 } else if (zdrs->x_op == ZDR_DECODE) {
120 buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
121 if (buf == NULL) {
122 if (!zdr_u_int (zdrs, &objp->prog))
123 return FALSE;
124 if (!zdr_u_int (zdrs, &objp->vers))
125 return FALSE;
126 if (!zdr_u_int (zdrs, &objp->proc))
127 return FALSE;
128
129 } else {
130 objp->prog = IZDR_GET_U_LONG(buf);
131 objp->vers = IZDR_GET_U_LONG(buf);
132 objp->proc = IZDR_GET_U_LONG(buf);
133 }
134 if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
135 return FALSE;
136 return TRUE;
137 }
138
139 if (!zdr_u_int (zdrs, &objp->prog))
140 return FALSE;
141 if (!zdr_u_int (zdrs, &objp->vers))
142 return FALSE;
143 if (!zdr_u_int (zdrs, &objp->proc))
144 return FALSE;
145 if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
146 return FALSE;
147 return TRUE;
148 }
149
150 bool_t
151 zdr_pmap2_call_result (ZDR *zdrs, pmap2_call_result *objp)
152 {
153 register int32_t *buf;
154 buf = NULL;
155
156 if (!zdr_u_int (zdrs, &objp->port))
157 return FALSE;
158 if (!zdr_bytes (zdrs, (char **)&objp->res.res_val, (u_int *) &objp->res.res_len, ~0))
159 return FALSE;
160 return TRUE;
161 }
162
163 bool_t
164 zdr_pmap2_mapping_list (ZDR *zdrs, pmap2_mapping_list *objp)
165 {
166 register int32_t *buf;
167 buf = NULL;
168
169 if (!zdr_pmap2_mapping (zdrs, &objp->map))
170 return FALSE;
171 if (!zdr_pointer (zdrs, (char **)&objp->next, sizeof (pmap2_mapping_list), (zdrproc_t) zdr_pmap2_mapping_list))
172 return FALSE;
173 return TRUE;
174 }
175
176 bool_t
177 zdr_pmap2_dump_result (ZDR *zdrs, pmap2_dump_result *objp)
178 {
179 register int32_t *buf;
180 buf = NULL;
181
182 if (!zdr_pointer (zdrs, (char **)&objp->list, sizeof (pmap2_mapping_list), (zdrproc_t) zdr_pmap2_mapping_list))
183 return FALSE;
184 return TRUE;
185 }
186
187 bool_t
188 zdr_pmap3_string_result (ZDR *zdrs, pmap3_string_result *objp)
189 {
190 register int32_t *buf;
191 buf = NULL;
192
193 if (!zdr_string (zdrs, &objp->addr, ~0))
194 return FALSE;
195 return TRUE;
196 }
197
198 bool_t
199 zdr_pmap3_mapping (ZDR *zdrs, pmap3_mapping *objp)
200 {
201 register int32_t *buf;
202 buf = NULL;
203
204 if (!zdr_u_int (zdrs, &objp->prog))
205 return FALSE;
206 if (!zdr_u_int (zdrs, &objp->vers))
207 return FALSE;
208 if (!zdr_string (zdrs, &objp->netid, ~0))
209 return FALSE;
210 if (!zdr_string (zdrs, &objp->addr, ~0))
211 return FALSE;
212 if (!zdr_string (zdrs, &objp->owner, ~0))
213 return FALSE;
214 return TRUE;
215 }
216
217 bool_t
218 zdr_pmap3_mapping_list (ZDR *zdrs, pmap3_mapping_list *objp)
219 {
220 register int32_t *buf;
221 buf = NULL;
222
223 if (!zdr_pmap3_mapping (zdrs, &objp->map))
224 return FALSE;
225 if (!zdr_pointer (zdrs, (char **)&objp->next, sizeof (pmap3_mapping_list), (zdrproc_t) zdr_pmap3_mapping_list))
226 return FALSE;
227 return TRUE;
228 }
229
230 bool_t
231 zdr_pmap3_dump_result (ZDR *zdrs, pmap3_dump_result *objp)
232 {
233 register int32_t *buf;
234 buf = NULL;
235
236 if (!zdr_pointer (zdrs, (char **)&objp->list, sizeof (pmap3_mapping_list), (zdrproc_t) zdr_pmap3_mapping_list))
237 return FALSE;
238 return TRUE;
239 }
240
241 bool_t
242 zdr_pmap3_call_args (ZDR *zdrs, pmap3_call_args *objp)
243 {
244 register int32_t *buf;
245 buf = NULL;
246
247
248 if (zdrs->x_op == ZDR_ENCODE) {
249 buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
250 if (buf == NULL) {
251 if (!zdr_u_int (zdrs, &objp->prog))
252 return FALSE;
253 if (!zdr_u_int (zdrs, &objp->vers))
254 return FALSE;
255 if (!zdr_u_int (zdrs, &objp->proc))
256 return FALSE;
257
258 } else {
259 IZDR_PUT_U_LONG(buf, objp->prog);
260 IZDR_PUT_U_LONG(buf, objp->vers);
261 IZDR_PUT_U_LONG(buf, objp->proc);
262 }
263 if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
264 return FALSE;
265 return TRUE;
266 } else if (zdrs->x_op == ZDR_DECODE) {
267 buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
268 if (buf == NULL) {
269 if (!zdr_u_int (zdrs, &objp->prog))
270 return FALSE;
271 if (!zdr_u_int (zdrs, &objp->vers))
272 return FALSE;
273 if (!zdr_u_int (zdrs, &objp->proc))
274 return FALSE;
275
276 } else {
277 objp->prog = IZDR_GET_U_LONG(buf);
278 objp->vers = IZDR_GET_U_LONG(buf);
279 objp->proc = IZDR_GET_U_LONG(buf);
280 }
281 if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
282 return FALSE;
283 return TRUE;
284 }
285
286 if (!zdr_u_int (zdrs, &objp->prog))
287 return FALSE;
288 if (!zdr_u_int (zdrs, &objp->vers))
289 return FALSE;
290 if (!zdr_u_int (zdrs, &objp->proc))
291 return FALSE;
292 if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
293 return FALSE;
294 return TRUE;
295 }
296
297 bool_t
298 zdr_pmap3_call_result (ZDR *zdrs, pmap3_call_result *objp)
299 {
300 register int32_t *buf;
301 buf = NULL;
302
303 if (!zdr_u_int (zdrs, &objp->port))
304 return FALSE;
305 if (!zdr_bytes (zdrs, (char **)&objp->res.res_val, (u_int *) &objp->res.res_len, ~0))
306 return FALSE;
307 return TRUE;
308 }
309
310 bool_t
311 zdr_pmap3_netbuf (ZDR *zdrs, pmap3_netbuf *objp)
312 {
313 register int32_t *buf;
314 buf = NULL;
315
316 if (!zdr_u_int (zdrs, &objp->maxlen))
317 return FALSE;
318 if (!zdr_bytes (zdrs, (char **)&objp->buf.buf_val, (u_int *) &objp->buf.buf_len, ~0))
319 return FALSE;
320 return TRUE;
321 }