rerun 'make samba3-idl'
[samba.git] / source3 / librpc / gen_ndr / ndr_printcap.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "librpc/gen_ndr/ndr_printcap.h"
5
6 static enum ndr_err_code ndr_push_pcap_printer(struct ndr_push *ndr, int ndr_flags, const struct pcap_printer *r)
7 {
8         if (ndr_flags & NDR_SCALARS) {
9                 NDR_CHECK(ndr_push_align(ndr, 4));
10                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
11                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->info));
12         }
13         if (ndr_flags & NDR_BUFFERS) {
14                 if (r->name) {
15                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
16                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
17                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
18                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
19                 }
20                 if (r->info) {
21                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
22                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
23                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
24                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->info, ndr_charset_length(r->info, CH_UTF8), sizeof(uint8_t), CH_UTF8));
25                 }
26         }
27         return NDR_ERR_SUCCESS;
28 }
29
30 static enum ndr_err_code ndr_pull_pcap_printer(struct ndr_pull *ndr, int ndr_flags, struct pcap_printer *r)
31 {
32         uint32_t _ptr_name;
33         uint32_t size_name_1 = 0;
34         uint32_t length_name_1 = 0;
35         TALLOC_CTX *_mem_save_name_0;
36         uint32_t _ptr_info;
37         uint32_t size_info_1 = 0;
38         uint32_t length_info_1 = 0;
39         TALLOC_CTX *_mem_save_info_0;
40         if (ndr_flags & NDR_SCALARS) {
41                 NDR_CHECK(ndr_pull_align(ndr, 4));
42                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
43                 if (_ptr_name) {
44                         NDR_PULL_ALLOC(ndr, r->name);
45                 } else {
46                         r->name = NULL;
47                 }
48                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
49                 if (_ptr_info) {
50                         NDR_PULL_ALLOC(ndr, r->info);
51                 } else {
52                         r->info = NULL;
53                 }
54         }
55         if (ndr_flags & NDR_BUFFERS) {
56                 if (r->name) {
57                         _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
58                         NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
59                         NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
60                         NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
61                         size_name_1 = ndr_get_array_size(ndr, &r->name);
62                         length_name_1 = ndr_get_array_length(ndr, &r->name);
63                         if (length_name_1 > size_name_1) {
64                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_name_1, length_name_1);
65                         }
66                         NDR_CHECK(ndr_check_string_terminator(ndr, length_name_1, sizeof(uint8_t)));
67                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, length_name_1, sizeof(uint8_t), CH_UTF8));
68                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
69                 }
70                 if (r->info) {
71                         _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
72                         NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
73                         NDR_CHECK(ndr_pull_array_size(ndr, &r->info));
74                         NDR_CHECK(ndr_pull_array_length(ndr, &r->info));
75                         size_info_1 = ndr_get_array_size(ndr, &r->info);
76                         length_info_1 = ndr_get_array_length(ndr, &r->info);
77                         if (length_info_1 > size_info_1) {
78                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_info_1, length_info_1);
79                         }
80                         NDR_CHECK(ndr_check_string_terminator(ndr, length_info_1, sizeof(uint8_t)));
81                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->info, length_info_1, sizeof(uint8_t), CH_UTF8));
82                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
83                 }
84         }
85         return NDR_ERR_SUCCESS;
86 }
87
88 _PUBLIC_ void ndr_print_pcap_printer(struct ndr_print *ndr, const char *name, const struct pcap_printer *r)
89 {
90         ndr_print_struct(ndr, name, "pcap_printer");
91         ndr->depth++;
92         ndr_print_ptr(ndr, "name", r->name);
93         ndr->depth++;
94         if (r->name) {
95                 ndr_print_string(ndr, "name", r->name);
96         }
97         ndr->depth--;
98         ndr_print_ptr(ndr, "info", r->info);
99         ndr->depth++;
100         if (r->info) {
101                 ndr_print_string(ndr, "info", r->info);
102         }
103         ndr->depth--;
104         ndr->depth--;
105 }
106
107 _PUBLIC_ enum ndr_err_code ndr_push_pcap_data(struct ndr_push *ndr, int ndr_flags, const struct pcap_data *r)
108 {
109         uint32_t cntr_printers_0;
110         if (ndr_flags & NDR_SCALARS) {
111                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
112                 NDR_CHECK(ndr_push_align(ndr, 4));
113                 NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->status));
114                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
115                 for (cntr_printers_0 = 0; cntr_printers_0 < r->count; cntr_printers_0++) {
116                         NDR_CHECK(ndr_push_pcap_printer(ndr, NDR_SCALARS, &r->printers[cntr_printers_0]));
117                 }
118         }
119         if (ndr_flags & NDR_BUFFERS) {
120                 for (cntr_printers_0 = 0; cntr_printers_0 < r->count; cntr_printers_0++) {
121                         NDR_CHECK(ndr_push_pcap_printer(ndr, NDR_BUFFERS, &r->printers[cntr_printers_0]));
122                 }
123         }
124         return NDR_ERR_SUCCESS;
125 }
126
127 _PUBLIC_ enum ndr_err_code ndr_pull_pcap_data(struct ndr_pull *ndr, int ndr_flags, struct pcap_data *r)
128 {
129         uint32_t size_printers_0 = 0;
130         uint32_t cntr_printers_0;
131         TALLOC_CTX *_mem_save_printers_0;
132         if (ndr_flags & NDR_SCALARS) {
133                 NDR_CHECK(ndr_pull_array_size(ndr, &r->printers));
134                 NDR_CHECK(ndr_pull_align(ndr, 4));
135                 NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->status));
136                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
137                 size_printers_0 = ndr_get_array_size(ndr, &r->printers);
138                 NDR_PULL_ALLOC_N(ndr, r->printers, size_printers_0);
139                 _mem_save_printers_0 = NDR_PULL_GET_MEM_CTX(ndr);
140                 NDR_PULL_SET_MEM_CTX(ndr, r->printers, 0);
141                 for (cntr_printers_0 = 0; cntr_printers_0 < size_printers_0; cntr_printers_0++) {
142                         NDR_CHECK(ndr_pull_pcap_printer(ndr, NDR_SCALARS, &r->printers[cntr_printers_0]));
143                 }
144                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printers_0, 0);
145                 if (r->printers) {
146                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->printers, r->count));
147                 }
148         }
149         if (ndr_flags & NDR_BUFFERS) {
150                 size_printers_0 = ndr_get_array_size(ndr, &r->printers);
151                 _mem_save_printers_0 = NDR_PULL_GET_MEM_CTX(ndr);
152                 NDR_PULL_SET_MEM_CTX(ndr, r->printers, 0);
153                 for (cntr_printers_0 = 0; cntr_printers_0 < size_printers_0; cntr_printers_0++) {
154                         NDR_CHECK(ndr_pull_pcap_printer(ndr, NDR_BUFFERS, &r->printers[cntr_printers_0]));
155                 }
156                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printers_0, 0);
157         }
158         return NDR_ERR_SUCCESS;
159 }
160
161 _PUBLIC_ void ndr_print_pcap_data(struct ndr_print *ndr, const char *name, const struct pcap_data *r)
162 {
163         uint32_t cntr_printers_0;
164         ndr_print_struct(ndr, name, "pcap_data");
165         ndr->depth++;
166         ndr_print_NTSTATUS(ndr, "status", r->status);
167         ndr_print_uint32(ndr, "count", r->count);
168         ndr->print(ndr, "%s: ARRAY(%d)", "printers", (int)r->count);
169         ndr->depth++;
170         for (cntr_printers_0=0;cntr_printers_0<r->count;cntr_printers_0++) {
171                 char *idx_0=NULL;
172                 if (asprintf(&idx_0, "[%d]", cntr_printers_0) != -1) {
173                         ndr_print_pcap_printer(ndr, "printers", &r->printers[cntr_printers_0]);
174                         free(idx_0);
175                 }
176         }
177         ndr->depth--;
178         ndr->depth--;
179 }