d217a00228dd688cc2cb1621205edde571bbde2b
[ira/wip.git] / librpc / gen_ndr / ndr_xattr.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_xattr.h"
5
6 #include "librpc/gen_ndr/ndr_security.h"
7 static enum ndr_err_code ndr_push_xattr_DosInfo1(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo1 *r)
8 {
9         if (ndr_flags & NDR_SCALARS) {
10                 NDR_CHECK(ndr_push_align(ndr, 4));
11                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
12                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ea_size));
13                 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
14                 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
15                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->create_time));
16                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->change_time));
17         }
18         if (ndr_flags & NDR_BUFFERS) {
19         }
20         return NDR_ERR_SUCCESS;
21 }
22
23 static enum ndr_err_code ndr_pull_xattr_DosInfo1(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo1 *r)
24 {
25         if (ndr_flags & NDR_SCALARS) {
26                 NDR_CHECK(ndr_pull_align(ndr, 4));
27                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
28                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ea_size));
29                 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
30                 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
31                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->create_time));
32                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->change_time));
33         }
34         if (ndr_flags & NDR_BUFFERS) {
35         }
36         return NDR_ERR_SUCCESS;
37 }
38
39 _PUBLIC_ void ndr_print_xattr_DosInfo1(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo1 *r)
40 {
41         ndr_print_struct(ndr, name, "xattr_DosInfo1");
42         ndr->depth++;
43         ndr_print_uint32(ndr, "attrib", r->attrib);
44         ndr_print_uint32(ndr, "ea_size", r->ea_size);
45         ndr_print_udlong(ndr, "size", r->size);
46         ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
47         ndr_print_NTTIME(ndr, "create_time", r->create_time);
48         ndr_print_NTTIME(ndr, "change_time", r->change_time);
49         ndr->depth--;
50 }
51
52 static enum ndr_err_code ndr_push_xattr_DosInfo2Old(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo2Old *r)
53 {
54         if (ndr_flags & NDR_SCALARS) {
55                 NDR_CHECK(ndr_push_align(ndr, 4));
56                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
57                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
58                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ea_size));
59                 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
60                 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
61                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->create_time));
62                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->change_time));
63                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->write_time));
64                 {
65                         uint32_t _flags_save_string = ndr->flags;
66                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
67                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
68                         ndr->flags = _flags_save_string;
69                 }
70         }
71         if (ndr_flags & NDR_BUFFERS) {
72         }
73         return NDR_ERR_SUCCESS;
74 }
75
76 static enum ndr_err_code ndr_pull_xattr_DosInfo2Old(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo2Old *r)
77 {
78         if (ndr_flags & NDR_SCALARS) {
79                 NDR_CHECK(ndr_pull_align(ndr, 4));
80                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
81                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
82                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ea_size));
83                 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
84                 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
85                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->create_time));
86                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->change_time));
87                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->write_time));
88                 {
89                         uint32_t _flags_save_string = ndr->flags;
90                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
91                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
92                         ndr->flags = _flags_save_string;
93                 }
94         }
95         if (ndr_flags & NDR_BUFFERS) {
96         }
97         return NDR_ERR_SUCCESS;
98 }
99
100 _PUBLIC_ void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo2Old *r)
101 {
102         ndr_print_struct(ndr, name, "xattr_DosInfo2Old");
103         ndr->depth++;
104         ndr_print_uint32(ndr, "flags", r->flags);
105         ndr_print_uint32(ndr, "attrib", r->attrib);
106         ndr_print_uint32(ndr, "ea_size", r->ea_size);
107         ndr_print_udlong(ndr, "size", r->size);
108         ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
109         ndr_print_NTTIME(ndr, "create_time", r->create_time);
110         ndr_print_NTTIME(ndr, "change_time", r->change_time);
111         ndr_print_NTTIME(ndr, "write_time", r->write_time);
112         ndr_print_string(ndr, "name", r->name);
113         ndr->depth--;
114 }
115
116 static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_flags, const union xattr_DosInfo *r)
117 {
118         if (ndr_flags & NDR_SCALARS) {
119                 int level = ndr_push_get_switch_value(ndr, r);
120                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
121                 switch (level) {
122                         case 1: {
123                                 NDR_CHECK(ndr_push_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
124                         break; }
125
126                         case 2: {
127                                 NDR_CHECK(ndr_push_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
128                         break; }
129
130                         default:
131                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
132                 }
133         }
134         if (ndr_flags & NDR_BUFFERS) {
135                 int level = ndr_push_get_switch_value(ndr, r);
136                 switch (level) {
137                         case 1:
138                         break;
139
140                         case 2:
141                         break;
142
143                         default:
144                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
145                 }
146         }
147         return NDR_ERR_SUCCESS;
148 }
149
150 static enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *r)
151 {
152         int level;
153         uint16_t _level;
154         level = ndr_pull_get_switch_value(ndr, r);
155         if (ndr_flags & NDR_SCALARS) {
156                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
157                 if (_level != level) {
158                         return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
159                 }
160                 switch (level) {
161                         case 1: {
162                                 NDR_CHECK(ndr_pull_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
163                         break; }
164
165                         case 2: {
166                                 NDR_CHECK(ndr_pull_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
167                         break; }
168
169                         default:
170                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
171                 }
172         }
173         if (ndr_flags & NDR_BUFFERS) {
174                 switch (level) {
175                         case 1:
176                         break;
177
178                         case 2:
179                         break;
180
181                         default:
182                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
183                 }
184         }
185         return NDR_ERR_SUCCESS;
186 }
187
188 _PUBLIC_ void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, const union xattr_DosInfo *r)
189 {
190         int level;
191         level = ndr_print_get_switch_value(ndr, r);
192         ndr_print_union(ndr, name, level, "xattr_DosInfo");
193         switch (level) {
194                 case 1:
195                         ndr_print_xattr_DosInfo1(ndr, "info1", &r->info1);
196                 break;
197
198                 case 2:
199                         ndr_print_xattr_DosInfo2Old(ndr, "oldinfo2", &r->oldinfo2);
200                 break;
201
202                 default:
203                         ndr_print_bad_level(ndr, name, level);
204         }
205 }
206
207 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosAttrib(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosAttrib *r)
208 {
209         if (ndr_flags & NDR_SCALARS) {
210                 NDR_CHECK(ndr_push_align(ndr, 4));
211                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
212                 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
213                 NDR_CHECK(ndr_push_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
214         }
215         if (ndr_flags & NDR_BUFFERS) {
216         }
217         return NDR_ERR_SUCCESS;
218 }
219
220 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosAttrib(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosAttrib *r)
221 {
222         if (ndr_flags & NDR_SCALARS) {
223                 NDR_CHECK(ndr_pull_align(ndr, 4));
224                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
225                 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
226                 NDR_CHECK(ndr_pull_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
227         }
228         if (ndr_flags & NDR_BUFFERS) {
229         }
230         return NDR_ERR_SUCCESS;
231 }
232
233 _PUBLIC_ void ndr_print_xattr_DosAttrib(struct ndr_print *ndr, const char *name, const struct xattr_DosAttrib *r)
234 {
235         ndr_print_struct(ndr, name, "xattr_DosAttrib");
236         ndr->depth++;
237         ndr_print_uint16(ndr, "version", r->version);
238         ndr_print_set_switch_value(ndr, &r->info, r->version);
239         ndr_print_xattr_DosInfo(ndr, "info", &r->info);
240         ndr->depth--;
241 }
242
243 static enum ndr_err_code ndr_push_xattr_EA(struct ndr_push *ndr, int ndr_flags, const struct xattr_EA *r)
244 {
245         if (ndr_flags & NDR_SCALARS) {
246                 NDR_CHECK(ndr_push_align(ndr, 4));
247                 {
248                         uint32_t _flags_save_string = ndr->flags;
249                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
250                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
251                         ndr->flags = _flags_save_string;
252                 }
253                 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value));
254         }
255         if (ndr_flags & NDR_BUFFERS) {
256         }
257         return NDR_ERR_SUCCESS;
258 }
259
260 static enum ndr_err_code ndr_pull_xattr_EA(struct ndr_pull *ndr, int ndr_flags, struct xattr_EA *r)
261 {
262         if (ndr_flags & NDR_SCALARS) {
263                 NDR_CHECK(ndr_pull_align(ndr, 4));
264                 {
265                         uint32_t _flags_save_string = ndr->flags;
266                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
267                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
268                         ndr->flags = _flags_save_string;
269                 }
270                 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value));
271         }
272         if (ndr_flags & NDR_BUFFERS) {
273         }
274         return NDR_ERR_SUCCESS;
275 }
276
277 _PUBLIC_ void ndr_print_xattr_EA(struct ndr_print *ndr, const char *name, const struct xattr_EA *r)
278 {
279         ndr_print_struct(ndr, name, "xattr_EA");
280         ndr->depth++;
281         ndr_print_string(ndr, "name", r->name);
282         ndr_print_DATA_BLOB(ndr, "value", r->value);
283         ndr->depth--;
284 }
285
286 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosEAs(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosEAs *r)
287 {
288         uint32_t cntr_eas_1;
289         if (ndr_flags & NDR_SCALARS) {
290                 NDR_CHECK(ndr_push_align(ndr, 4));
291                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_eas));
292                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->eas));
293         }
294         if (ndr_flags & NDR_BUFFERS) {
295                 if (r->eas) {
296                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
297                         for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
298                                 NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
299                         }
300                 }
301         }
302         return NDR_ERR_SUCCESS;
303 }
304
305 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosEAs(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosEAs *r)
306 {
307         uint32_t _ptr_eas;
308         uint32_t cntr_eas_1;
309         TALLOC_CTX *_mem_save_eas_0;
310         TALLOC_CTX *_mem_save_eas_1;
311         if (ndr_flags & NDR_SCALARS) {
312                 NDR_CHECK(ndr_pull_align(ndr, 4));
313                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_eas));
314                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_eas));
315                 if (_ptr_eas) {
316                         NDR_PULL_ALLOC(ndr, r->eas);
317                 } else {
318                         r->eas = NULL;
319                 }
320         }
321         if (ndr_flags & NDR_BUFFERS) {
322                 if (r->eas) {
323                         _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
324                         NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
325                         NDR_CHECK(ndr_pull_array_size(ndr, &r->eas));
326                         NDR_PULL_ALLOC_N(ndr, r->eas, ndr_get_array_size(ndr, &r->eas));
327                         _mem_save_eas_1 = NDR_PULL_GET_MEM_CTX(ndr);
328                         NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
329                         for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
330                                 NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
331                         }
332                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_1, 0);
333                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
334                 }
335                 if (r->eas) {
336                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->eas, r->num_eas));
337                 }
338         }
339         return NDR_ERR_SUCCESS;
340 }
341
342 _PUBLIC_ void ndr_print_xattr_DosEAs(struct ndr_print *ndr, const char *name, const struct xattr_DosEAs *r)
343 {
344         uint32_t cntr_eas_1;
345         ndr_print_struct(ndr, name, "xattr_DosEAs");
346         ndr->depth++;
347         ndr_print_uint16(ndr, "num_eas", r->num_eas);
348         ndr_print_ptr(ndr, "eas", r->eas);
349         ndr->depth++;
350         if (r->eas) {
351                 ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
352                 ndr->depth++;
353                 for (cntr_eas_1=0;cntr_eas_1<r->num_eas;cntr_eas_1++) {
354                         char *idx_1=NULL;
355                         if (asprintf(&idx_1, "[%d]", cntr_eas_1) != -1) {
356                                 ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_1]);
357                                 free(idx_1);
358                         }
359                 }
360                 ndr->depth--;
361         }
362         ndr->depth--;
363         ndr->depth--;
364 }
365
366 _PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r)
367 {
368         uint32_t cntr_eas_0;
369         if (ndr_flags & NDR_SCALARS) {
370                 NDR_CHECK(ndr_push_align(ndr, 4));
371                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
372                 for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
373                         NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
374                 }
375         }
376         if (ndr_flags & NDR_BUFFERS) {
377         }
378         return NDR_ERR_SUCCESS;
379 }
380
381 _PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r)
382 {
383         uint32_t cntr_eas_0;
384         TALLOC_CTX *_mem_save_eas_0;
385         if (ndr_flags & NDR_SCALARS) {
386                 NDR_CHECK(ndr_pull_align(ndr, 4));
387                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_eas));
388                 NDR_PULL_ALLOC_N(ndr, r->eas, r->num_eas);
389                 _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
390                 NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
391                 for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
392                         NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
393                 }
394                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
395         }
396         if (ndr_flags & NDR_BUFFERS) {
397         }
398         return NDR_ERR_SUCCESS;
399 }
400
401 _PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r)
402 {
403         uint32_t cntr_eas_0;
404         ndr_print_struct(ndr, name, "tdb_xattrs");
405         ndr->depth++;
406         ndr_print_uint32(ndr, "num_eas", r->num_eas);
407         ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
408         ndr->depth++;
409         for (cntr_eas_0=0;cntr_eas_0<r->num_eas;cntr_eas_0++) {
410                 char *idx_0=NULL;
411                 if (asprintf(&idx_0, "[%d]", cntr_eas_0) != -1) {
412                         ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_0]);
413                         free(idx_0);
414                 }
415         }
416         ndr->depth--;
417         ndr->depth--;
418 }
419
420 static enum ndr_err_code ndr_push_xattr_DosStream(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStream *r)
421 {
422         if (ndr_flags & NDR_SCALARS) {
423                 NDR_CHECK(ndr_push_align(ndr, 4));
424                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
425                 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
426                 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
427                 {
428                         uint32_t _flags_save_string = ndr->flags;
429                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
430                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
431                         ndr->flags = _flags_save_string;
432                 }
433         }
434         if (ndr_flags & NDR_BUFFERS) {
435         }
436         return NDR_ERR_SUCCESS;
437 }
438
439 static enum ndr_err_code ndr_pull_xattr_DosStream(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStream *r)
440 {
441         if (ndr_flags & NDR_SCALARS) {
442                 NDR_CHECK(ndr_pull_align(ndr, 4));
443                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
444                 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
445                 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
446                 {
447                         uint32_t _flags_save_string = ndr->flags;
448                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
449                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
450                         ndr->flags = _flags_save_string;
451                 }
452         }
453         if (ndr_flags & NDR_BUFFERS) {
454         }
455         return NDR_ERR_SUCCESS;
456 }
457
458 _PUBLIC_ void ndr_print_xattr_DosStream(struct ndr_print *ndr, const char *name, const struct xattr_DosStream *r)
459 {
460         ndr_print_struct(ndr, name, "xattr_DosStream");
461         ndr->depth++;
462         ndr_print_uint32(ndr, "flags", r->flags);
463         ndr_print_udlong(ndr, "size", r->size);
464         ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
465         ndr_print_string(ndr, "name", r->name);
466         ndr->depth--;
467 }
468
469 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosStreams(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStreams *r)
470 {
471         uint32_t cntr_streams_1;
472         if (ndr_flags & NDR_SCALARS) {
473                 NDR_CHECK(ndr_push_align(ndr, 4));
474                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
475                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->streams));
476         }
477         if (ndr_flags & NDR_BUFFERS) {
478                 if (r->streams) {
479                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
480                         for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
481                                 NDR_CHECK(ndr_push_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
482                         }
483                 }
484         }
485         return NDR_ERR_SUCCESS;
486 }
487
488 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosStreams(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStreams *r)
489 {
490         uint32_t _ptr_streams;
491         uint32_t cntr_streams_1;
492         TALLOC_CTX *_mem_save_streams_0;
493         TALLOC_CTX *_mem_save_streams_1;
494         if (ndr_flags & NDR_SCALARS) {
495                 NDR_CHECK(ndr_pull_align(ndr, 4));
496                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_streams));
497                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_streams));
498                 if (_ptr_streams) {
499                         NDR_PULL_ALLOC(ndr, r->streams);
500                 } else {
501                         r->streams = NULL;
502                 }
503         }
504         if (ndr_flags & NDR_BUFFERS) {
505                 if (r->streams) {
506                         _mem_save_streams_0 = NDR_PULL_GET_MEM_CTX(ndr);
507                         NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
508                         NDR_CHECK(ndr_pull_array_size(ndr, &r->streams));
509                         NDR_PULL_ALLOC_N(ndr, r->streams, ndr_get_array_size(ndr, &r->streams));
510                         _mem_save_streams_1 = NDR_PULL_GET_MEM_CTX(ndr);
511                         NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
512                         for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
513                                 NDR_CHECK(ndr_pull_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
514                         }
515                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_1, 0);
516                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_0, 0);
517                 }
518                 if (r->streams) {
519                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->streams, r->num_streams));
520                 }
521         }
522         return NDR_ERR_SUCCESS;
523 }
524
525 _PUBLIC_ void ndr_print_xattr_DosStreams(struct ndr_print *ndr, const char *name, const struct xattr_DosStreams *r)
526 {
527         uint32_t cntr_streams_1;
528         ndr_print_struct(ndr, name, "xattr_DosStreams");
529         ndr->depth++;
530         ndr_print_uint32(ndr, "num_streams", r->num_streams);
531         ndr_print_ptr(ndr, "streams", r->streams);
532         ndr->depth++;
533         if (r->streams) {
534                 ndr->print(ndr, "%s: ARRAY(%d)", "streams", (int)r->num_streams);
535                 ndr->depth++;
536                 for (cntr_streams_1=0;cntr_streams_1<r->num_streams;cntr_streams_1++) {
537                         char *idx_1=NULL;
538                         if (asprintf(&idx_1, "[%d]", cntr_streams_1) != -1) {
539                                 ndr_print_xattr_DosStream(ndr, "streams", &r->streams[cntr_streams_1]);
540                                 free(idx_1);
541                         }
542                 }
543                 ndr->depth--;
544         }
545         ndr->depth--;
546         ndr->depth--;
547 }
548
549 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_hash(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_hash *r)
550 {
551         if (ndr_flags & NDR_SCALARS) {
552                 NDR_CHECK(ndr_push_align(ndr, 4));
553                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
554                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->hash, 16));
555         }
556         if (ndr_flags & NDR_BUFFERS) {
557                 if (r->sd) {
558                         NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
559                 }
560         }
561         return NDR_ERR_SUCCESS;
562 }
563
564 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_hash(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor_hash *r)
565 {
566         uint32_t _ptr_sd;
567         TALLOC_CTX *_mem_save_sd_0;
568         if (ndr_flags & NDR_SCALARS) {
569                 NDR_CHECK(ndr_pull_align(ndr, 4));
570                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
571                 if (_ptr_sd) {
572                         NDR_PULL_ALLOC(ndr, r->sd);
573                 } else {
574                         r->sd = NULL;
575                 }
576                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, 16));
577         }
578         if (ndr_flags & NDR_BUFFERS) {
579                 if (r->sd) {
580                         _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
581                         NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
582                         NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
583                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
584                 }
585         }
586         return NDR_ERR_SUCCESS;
587 }
588
589 _PUBLIC_ void ndr_print_security_descriptor_hash(struct ndr_print *ndr, const char *name, const struct security_descriptor_hash *r)
590 {
591         ndr_print_struct(ndr, name, "security_descriptor_hash");
592         ndr->depth++;
593         ndr_print_ptr(ndr, "sd", r->sd);
594         ndr->depth++;
595         if (r->sd) {
596                 ndr_print_security_descriptor(ndr, "sd", r->sd);
597         }
598         ndr->depth--;
599         ndr_print_array_uint8(ndr, "hash", r->hash, 16);
600         ndr->depth--;
601 }
602
603 static enum ndr_err_code ndr_push_xattr_NTACL_Info(struct ndr_push *ndr, int ndr_flags, const union xattr_NTACL_Info *r)
604 {
605         if (ndr_flags & NDR_SCALARS) {
606                 int level = ndr_push_get_switch_value(ndr, r);
607                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
608                 switch (level) {
609                         case 1: {
610                                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
611                         break; }
612
613                         case 2: {
614                                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd_hs));
615                         break; }
616
617                         default:
618                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
619                 }
620         }
621         if (ndr_flags & NDR_BUFFERS) {
622                 int level = ndr_push_get_switch_value(ndr, r);
623                 switch (level) {
624                         case 1:
625                                 if (r->sd) {
626                                         NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
627                                 }
628                         break;
629
630                         case 2:
631                                 if (r->sd_hs) {
632                                         NDR_CHECK(ndr_push_security_descriptor_hash(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs));
633                                 }
634                         break;
635
636                         default:
637                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
638                 }
639         }
640         return NDR_ERR_SUCCESS;
641 }
642
643 static enum ndr_err_code ndr_pull_xattr_NTACL_Info(struct ndr_pull *ndr, int ndr_flags, union xattr_NTACL_Info *r)
644 {
645         int level;
646         uint16_t _level;
647         TALLOC_CTX *_mem_save_sd_0;
648         TALLOC_CTX *_mem_save_sd_hs_0;
649         level = ndr_pull_get_switch_value(ndr, r);
650         if (ndr_flags & NDR_SCALARS) {
651                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
652                 if (_level != level) {
653                         return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
654                 }
655                 switch (level) {
656                         case 1: {
657                                 uint32_t _ptr_sd;
658                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
659                                 if (_ptr_sd) {
660                                         NDR_PULL_ALLOC(ndr, r->sd);
661                                 } else {
662                                         r->sd = NULL;
663                                 }
664                         break; }
665
666                         case 2: {
667                                 uint32_t _ptr_sd_hs;
668                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd_hs));
669                                 if (_ptr_sd_hs) {
670                                         NDR_PULL_ALLOC(ndr, r->sd_hs);
671                                 } else {
672                                         r->sd_hs = NULL;
673                                 }
674                         break; }
675
676                         default:
677                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
678                 }
679         }
680         if (ndr_flags & NDR_BUFFERS) {
681                 switch (level) {
682                         case 1:
683                                 if (r->sd) {
684                                         _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
685                                         NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
686                                         NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
687                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
688                                 }
689                         break;
690
691                         case 2:
692                                 if (r->sd_hs) {
693                                         _mem_save_sd_hs_0 = NDR_PULL_GET_MEM_CTX(ndr);
694                                         NDR_PULL_SET_MEM_CTX(ndr, r->sd_hs, 0);
695                                         NDR_CHECK(ndr_pull_security_descriptor_hash(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs));
696                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_hs_0, 0);
697                                 }
698                         break;
699
700                         default:
701                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
702                 }
703         }
704         return NDR_ERR_SUCCESS;
705 }
706
707 _PUBLIC_ void ndr_print_xattr_NTACL_Info(struct ndr_print *ndr, const char *name, const union xattr_NTACL_Info *r)
708 {
709         int level;
710         level = ndr_print_get_switch_value(ndr, r);
711         ndr_print_union(ndr, name, level, "xattr_NTACL_Info");
712         switch (level) {
713                 case 1:
714                         ndr_print_ptr(ndr, "sd", r->sd);
715                         ndr->depth++;
716                         if (r->sd) {
717                                 ndr_print_security_descriptor(ndr, "sd", r->sd);
718                         }
719                         ndr->depth--;
720                 break;
721
722                 case 2:
723                         ndr_print_ptr(ndr, "sd_hs", r->sd_hs);
724                         ndr->depth++;
725                         if (r->sd_hs) {
726                                 ndr_print_security_descriptor_hash(ndr, "sd_hs", r->sd_hs);
727                         }
728                         ndr->depth--;
729                 break;
730
731                 default:
732                         ndr_print_bad_level(ndr, name, level);
733         }
734 }
735
736 _PUBLIC_ enum ndr_err_code ndr_push_xattr_NTACL(struct ndr_push *ndr, int ndr_flags, const struct xattr_NTACL *r)
737 {
738         if (ndr_flags & NDR_SCALARS) {
739                 NDR_CHECK(ndr_push_align(ndr, 4));
740                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
741                 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
742                 NDR_CHECK(ndr_push_xattr_NTACL_Info(ndr, NDR_SCALARS, &r->info));
743         }
744         if (ndr_flags & NDR_BUFFERS) {
745                 NDR_CHECK(ndr_push_xattr_NTACL_Info(ndr, NDR_BUFFERS, &r->info));
746         }
747         return NDR_ERR_SUCCESS;
748 }
749
750 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_NTACL(struct ndr_pull *ndr, int ndr_flags, struct xattr_NTACL *r)
751 {
752         if (ndr_flags & NDR_SCALARS) {
753                 NDR_CHECK(ndr_pull_align(ndr, 4));
754                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
755                 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
756                 NDR_CHECK(ndr_pull_xattr_NTACL_Info(ndr, NDR_SCALARS, &r->info));
757         }
758         if (ndr_flags & NDR_BUFFERS) {
759                 NDR_CHECK(ndr_pull_xattr_NTACL_Info(ndr, NDR_BUFFERS, &r->info));
760         }
761         return NDR_ERR_SUCCESS;
762 }
763
764 _PUBLIC_ void ndr_print_xattr_NTACL(struct ndr_print *ndr, const char *name, const struct xattr_NTACL *r)
765 {
766         ndr_print_struct(ndr, name, "xattr_NTACL");
767         ndr->depth++;
768         ndr_print_uint16(ndr, "version", r->version);
769         ndr_print_set_switch_value(ndr, &r->info, r->version);
770         ndr_print_xattr_NTACL_Info(ndr, "info", &r->info);
771         ndr->depth--;
772 }
773