misc: mark winreg_Data little-endian except for a REG_DWORD_BIG_ENDIAN.
[ira/wip.git] / librpc / gen_ndr / ndr_misc.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_misc.h"
5
6 _PUBLIC_ enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r)
7 {
8         if (ndr_flags & NDR_SCALARS) {
9                 NDR_CHECK(ndr_push_align(ndr, 4));
10                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time_low));
11                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_mid));
12                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_hi_and_version));
13                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2));
14                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->node, 6));
15                 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
16         }
17         if (ndr_flags & NDR_BUFFERS) {
18         }
19         return NDR_ERR_SUCCESS;
20 }
21
22 _PUBLIC_ enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r)
23 {
24         if (ndr_flags & NDR_SCALARS) {
25                 NDR_CHECK(ndr_pull_align(ndr, 4));
26                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time_low));
27                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_mid));
28                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_hi_and_version));
29                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2));
30                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->node, 6));
31                 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
32         }
33         if (ndr_flags & NDR_BUFFERS) {
34         }
35         return NDR_ERR_SUCCESS;
36 }
37
38 _PUBLIC_ size_t ndr_size_GUID(const struct GUID *r, struct smb_iconv_convenience *ic, int flags)
39 {
40         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID, ic);
41 }
42
43 _PUBLIC_ enum ndr_err_code ndr_push_ndr_syntax_id(struct ndr_push *ndr, int ndr_flags, const struct ndr_syntax_id *r)
44 {
45         if (ndr_flags & NDR_SCALARS) {
46                 NDR_CHECK(ndr_push_align(ndr, 4));
47                 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid));
48                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->if_version));
49                 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
50         }
51         if (ndr_flags & NDR_BUFFERS) {
52         }
53         return NDR_ERR_SUCCESS;
54 }
55
56 _PUBLIC_ enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_flags, struct ndr_syntax_id *r)
57 {
58         if (ndr_flags & NDR_SCALARS) {
59                 NDR_CHECK(ndr_pull_align(ndr, 4));
60                 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid));
61                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->if_version));
62                 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
63         }
64         if (ndr_flags & NDR_BUFFERS) {
65         }
66         return NDR_ERR_SUCCESS;
67 }
68
69 _PUBLIC_ void ndr_print_ndr_syntax_id(struct ndr_print *ndr, const char *name, const struct ndr_syntax_id *r)
70 {
71         ndr_print_struct(ndr, name, "ndr_syntax_id");
72         ndr->depth++;
73         ndr_print_GUID(ndr, "uuid", &r->uuid);
74         ndr_print_uint32(ndr, "if_version", r->if_version);
75         ndr->depth--;
76 }
77
78 _PUBLIC_ enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r)
79 {
80         if (ndr_flags & NDR_SCALARS) {
81                 NDR_CHECK(ndr_push_align(ndr, 4));
82                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handle_type));
83                 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid));
84                 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
85         }
86         if (ndr_flags & NDR_BUFFERS) {
87         }
88         return NDR_ERR_SUCCESS;
89 }
90
91 _PUBLIC_ enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r)
92 {
93         if (ndr_flags & NDR_SCALARS) {
94                 NDR_CHECK(ndr_pull_align(ndr, 4));
95                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handle_type));
96                 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid));
97                 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
98         }
99         if (ndr_flags & NDR_BUFFERS) {
100         }
101         return NDR_ERR_SUCCESS;
102 }
103
104 _PUBLIC_ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r)
105 {
106         ndr_print_struct(ndr, name, "policy_handle");
107         ndr->depth++;
108         ndr_print_uint32(ndr, "handle_type", r->handle_type);
109         ndr_print_GUID(ndr, "uuid", &r->uuid);
110         ndr->depth--;
111 }
112
113 _PUBLIC_ enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r)
114 {
115         NDR_CHECK(ndr_push_enum_uint1632(ndr, NDR_SCALARS, r));
116         return NDR_ERR_SUCCESS;
117 }
118
119 _PUBLIC_ enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r)
120 {
121         uint16_t v;
122         NDR_CHECK(ndr_pull_enum_uint1632(ndr, NDR_SCALARS, &v));
123         *r = v;
124         return NDR_ERR_SUCCESS;
125 }
126
127 _PUBLIC_ void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum netr_SchannelType r)
128 {
129         const char *val = NULL;
130
131         switch (r) {
132                 case SEC_CHAN_NULL: val = "SEC_CHAN_NULL"; break;
133                 case SEC_CHAN_WKSTA: val = "SEC_CHAN_WKSTA"; break;
134                 case SEC_CHAN_DNS_DOMAIN: val = "SEC_CHAN_DNS_DOMAIN"; break;
135                 case SEC_CHAN_DOMAIN: val = "SEC_CHAN_DOMAIN"; break;
136                 case SEC_CHAN_BDC: val = "SEC_CHAN_BDC"; break;
137         }
138         ndr_print_enum(ndr, name, "ENUM", val, r);
139 }
140
141 _PUBLIC_ enum ndr_err_code ndr_push_KRB5_EDATA_NTSTATUS(struct ndr_push *ndr, int ndr_flags, const struct KRB5_EDATA_NTSTATUS *r)
142 {
143         if (ndr_flags & NDR_SCALARS) {
144                 NDR_CHECK(ndr_push_align(ndr, 4));
145                 NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->ntstatus));
146                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1));
147                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
148                 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
149         }
150         if (ndr_flags & NDR_BUFFERS) {
151         }
152         return NDR_ERR_SUCCESS;
153 }
154
155 _PUBLIC_ enum ndr_err_code ndr_pull_KRB5_EDATA_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, struct KRB5_EDATA_NTSTATUS *r)
156 {
157         if (ndr_flags & NDR_SCALARS) {
158                 NDR_CHECK(ndr_pull_align(ndr, 4));
159                 NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->ntstatus));
160                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1));
161                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
162                 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
163         }
164         if (ndr_flags & NDR_BUFFERS) {
165         }
166         return NDR_ERR_SUCCESS;
167 }
168
169 _PUBLIC_ void ndr_print_KRB5_EDATA_NTSTATUS(struct ndr_print *ndr, const char *name, const struct KRB5_EDATA_NTSTATUS *r)
170 {
171         ndr_print_struct(ndr, name, "KRB5_EDATA_NTSTATUS");
172         ndr->depth++;
173         ndr_print_NTSTATUS(ndr, "ntstatus", r->ntstatus);
174         ndr_print_uint32(ndr, "unknown1", r->unknown1);
175         ndr_print_uint32(ndr, "unknown2", r->unknown2);
176         ndr->depth--;
177 }
178
179 _PUBLIC_ enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r)
180 {
181         NDR_CHECK(ndr_push_enum_uint32(ndr, NDR_SCALARS, r));
182         return NDR_ERR_SUCCESS;
183 }
184
185 _PUBLIC_ enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r)
186 {
187         uint32_t v;
188         NDR_CHECK(ndr_pull_enum_uint32(ndr, NDR_SCALARS, &v));
189         *r = v;
190         return NDR_ERR_SUCCESS;
191 }
192
193 _PUBLIC_ void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r)
194 {
195         const char *val = NULL;
196
197         switch (r) {
198                 case REG_NONE: val = "REG_NONE"; break;
199                 case REG_SZ: val = "REG_SZ"; break;
200                 case REG_EXPAND_SZ: val = "REG_EXPAND_SZ"; break;
201                 case REG_BINARY: val = "REG_BINARY"; break;
202                 case REG_DWORD: val = "REG_DWORD"; break;
203                 case REG_DWORD_BIG_ENDIAN: val = "REG_DWORD_BIG_ENDIAN"; break;
204                 case REG_LINK: val = "REG_LINK"; break;
205                 case REG_MULTI_SZ: val = "REG_MULTI_SZ"; break;
206                 case REG_RESOURCE_LIST: val = "REG_RESOURCE_LIST"; break;
207                 case REG_FULL_RESOURCE_DESCRIPTOR: val = "REG_FULL_RESOURCE_DESCRIPTOR"; break;
208                 case REG_RESOURCE_REQUIREMENTS_LIST: val = "REG_RESOURCE_REQUIREMENTS_LIST"; break;
209                 case REG_QWORD: val = "REG_QWORD"; break;
210         }
211         ndr_print_enum(ndr, name, "ENUM", val, r);
212 }
213
214 _PUBLIC_ enum ndr_err_code ndr_push_winreg_Data(struct ndr_push *ndr, int ndr_flags, const union winreg_Data *r)
215 {
216         {
217                 uint32_t _flags_save_UNION = ndr->flags;
218                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
219                 if (ndr_flags & NDR_SCALARS) {
220                         int level = ndr_push_get_switch_value(ndr, r);
221                         NDR_CHECK(ndr_push_union_align(ndr, 4));
222                         switch (level) {
223                                 case REG_NONE: {
224                                 break; }
225
226                                 case REG_SZ: {
227                                         {
228                                                 uint32_t _flags_save_string = ndr->flags;
229                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
230                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->string));
231                                                 ndr->flags = _flags_save_string;
232                                         }
233                                 break; }
234
235                                 case REG_EXPAND_SZ: {
236                                         {
237                                                 uint32_t _flags_save_string = ndr->flags;
238                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
239                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->string));
240                                                 ndr->flags = _flags_save_string;
241                                         }
242                                 break; }
243
244                                 case REG_BINARY: {
245                                         {
246                                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
247                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
248                                                 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->binary));
249                                                 ndr->flags = _flags_save_DATA_BLOB;
250                                         }
251                                 break; }
252
253                                 case REG_DWORD: {
254                                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->value));
255                                 break; }
256
257                                 case REG_DWORD_BIG_ENDIAN: {
258                                         {
259                                                 uint32_t _flags_save_uint32 = ndr->flags;
260                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
261                                                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->value));
262                                                 ndr->flags = _flags_save_uint32;
263                                         }
264                                 break; }
265
266                                 case REG_MULTI_SZ: {
267                                         {
268                                                 uint32_t _flags_save_string_array = ndr->flags;
269                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
270                                                 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->string_array));
271                                                 ndr->flags = _flags_save_string_array;
272                                         }
273                                 break; }
274
275                                 default: {
276                                         {
277                                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
278                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
279                                                 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data));
280                                                 ndr->flags = _flags_save_DATA_BLOB;
281                                         }
282                                 break; }
283
284                         }
285                 }
286                 if (ndr_flags & NDR_BUFFERS) {
287                         int level = ndr_push_get_switch_value(ndr, r);
288                         switch (level) {
289                                 case REG_NONE:
290                                 break;
291
292                                 case REG_SZ:
293                                 break;
294
295                                 case REG_EXPAND_SZ:
296                                 break;
297
298                                 case REG_BINARY:
299                                 break;
300
301                                 case REG_DWORD:
302                                 break;
303
304                                 case REG_DWORD_BIG_ENDIAN:
305                                 break;
306
307                                 case REG_MULTI_SZ:
308                                 break;
309
310                                 default:
311                                 break;
312
313                         }
314                 }
315                 ndr->flags = _flags_save_UNION;
316         }
317         return NDR_ERR_SUCCESS;
318 }
319
320 _PUBLIC_ enum ndr_err_code ndr_pull_winreg_Data(struct ndr_pull *ndr, int ndr_flags, union winreg_Data *r)
321 {
322         int level;
323         {
324                 uint32_t _flags_save_UNION = ndr->flags;
325                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
326                 level = ndr_pull_get_switch_value(ndr, r);
327                 if (ndr_flags & NDR_SCALARS) {
328                         NDR_CHECK(ndr_pull_union_align(ndr, 4));
329                         switch (level) {
330                                 case REG_NONE: {
331                                 break; }
332
333                                 case REG_SZ: {
334                                         {
335                                                 uint32_t _flags_save_string = ndr->flags;
336                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
337                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->string));
338                                                 ndr->flags = _flags_save_string;
339                                         }
340                                 break; }
341
342                                 case REG_EXPAND_SZ: {
343                                         {
344                                                 uint32_t _flags_save_string = ndr->flags;
345                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
346                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->string));
347                                                 ndr->flags = _flags_save_string;
348                                         }
349                                 break; }
350
351                                 case REG_BINARY: {
352                                         {
353                                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
354                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
355                                                 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->binary));
356                                                 ndr->flags = _flags_save_DATA_BLOB;
357                                         }
358                                 break; }
359
360                                 case REG_DWORD: {
361                                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->value));
362                                 break; }
363
364                                 case REG_DWORD_BIG_ENDIAN: {
365                                         {
366                                                 uint32_t _flags_save_uint32 = ndr->flags;
367                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
368                                                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->value));
369                                                 ndr->flags = _flags_save_uint32;
370                                         }
371                                 break; }
372
373                                 case REG_MULTI_SZ: {
374                                         {
375                                                 uint32_t _flags_save_string_array = ndr->flags;
376                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
377                                                 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->string_array));
378                                                 ndr->flags = _flags_save_string_array;
379                                         }
380                                 break; }
381
382                                 default: {
383                                         {
384                                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
385                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
386                                                 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data));
387                                                 ndr->flags = _flags_save_DATA_BLOB;
388                                         }
389                                 break; }
390
391                         }
392                 }
393                 if (ndr_flags & NDR_BUFFERS) {
394                         switch (level) {
395                                 case REG_NONE:
396                                 break;
397
398                                 case REG_SZ:
399                                 break;
400
401                                 case REG_EXPAND_SZ:
402                                 break;
403
404                                 case REG_BINARY:
405                                 break;
406
407                                 case REG_DWORD:
408                                 break;
409
410                                 case REG_DWORD_BIG_ENDIAN:
411                                 break;
412
413                                 case REG_MULTI_SZ:
414                                 break;
415
416                                 default:
417                                 break;
418
419                         }
420                 }
421                 ndr->flags = _flags_save_UNION;
422         }
423         return NDR_ERR_SUCCESS;
424 }
425
426 _PUBLIC_ void ndr_print_winreg_Data(struct ndr_print *ndr, const char *name, const union winreg_Data *r)
427 {
428         int level;
429         {
430                 uint32_t _flags_save_UNION = ndr->flags;
431                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
432                 level = ndr_print_get_switch_value(ndr, r);
433                 ndr_print_union(ndr, name, level, "winreg_Data");
434                 switch (level) {
435                         case REG_NONE:
436                         break;
437
438                         case REG_SZ:
439                                 ndr_print_string(ndr, "string", r->string);
440                         break;
441
442                         case REG_EXPAND_SZ:
443                                 ndr_print_string(ndr, "string", r->string);
444                         break;
445
446                         case REG_BINARY:
447                                 ndr_print_DATA_BLOB(ndr, "binary", r->binary);
448                         break;
449
450                         case REG_DWORD:
451                                 ndr_print_uint32(ndr, "value", r->value);
452                         break;
453
454                         case REG_DWORD_BIG_ENDIAN:
455                                 ndr_print_uint32(ndr, "value", r->value);
456                         break;
457
458                         case REG_MULTI_SZ:
459                                 ndr_print_string_array(ndr, "string_array", r->string_array);
460                         break;
461
462                         default:
463                                 ndr_print_DATA_BLOB(ndr, "data", r->data);
464                         break;
465
466                 }
467                 ndr->flags = _flags_save_UNION;
468         }
469 }
470