| 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, 5));
|
|---|
| 10 | NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
|
|---|
| 11 | NDR_CHECK(ndr_push_unique_ptr(ndr, r->info));
|
|---|
| 12 | NDR_CHECK(ndr_push_unique_ptr(ndr, r->location));
|
|---|
| 13 | NDR_CHECK(ndr_push_trailer_align(ndr, 5));
|
|---|
| 14 | }
|
|---|
| 15 | if (ndr_flags & NDR_BUFFERS) {
|
|---|
| 16 | if (r->name) {
|
|---|
| 17 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
|
|---|
| 18 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
|
|---|
| 19 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
|
|---|
| 20 | NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
|
|---|
| 21 | }
|
|---|
| 22 | if (r->info) {
|
|---|
| 23 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
|
|---|
| 24 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
|
|---|
| 25 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
|
|---|
| 26 | NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->info, ndr_charset_length(r->info, CH_UTF8), sizeof(uint8_t), CH_UTF8));
|
|---|
| 27 | }
|
|---|
| 28 | if (r->location) {
|
|---|
| 29 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->location, CH_UTF8)));
|
|---|
| 30 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
|
|---|
| 31 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->location, CH_UTF8)));
|
|---|
| 32 | NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->location, ndr_charset_length(r->location, CH_UTF8), sizeof(uint8_t), CH_UTF8));
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 | return NDR_ERR_SUCCESS;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | static enum ndr_err_code ndr_pull_pcap_printer(struct ndr_pull *ndr, int ndr_flags, struct pcap_printer *r)
|
|---|
| 39 | {
|
|---|
| 40 | uint32_t _ptr_name;
|
|---|
| 41 | uint32_t size_name_1 = 0;
|
|---|
| 42 | uint32_t length_name_1 = 0;
|
|---|
| 43 | TALLOC_CTX *_mem_save_name_0;
|
|---|
| 44 | uint32_t _ptr_info;
|
|---|
| 45 | uint32_t size_info_1 = 0;
|
|---|
| 46 | uint32_t length_info_1 = 0;
|
|---|
| 47 | TALLOC_CTX *_mem_save_info_0;
|
|---|
| 48 | uint32_t _ptr_location;
|
|---|
| 49 | uint32_t size_location_1 = 0;
|
|---|
| 50 | uint32_t length_location_1 = 0;
|
|---|
| 51 | TALLOC_CTX *_mem_save_location_0;
|
|---|
| 52 | if (ndr_flags & NDR_SCALARS) {
|
|---|
| 53 | NDR_CHECK(ndr_pull_align(ndr, 5));
|
|---|
| 54 | NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
|
|---|
| 55 | if (_ptr_name) {
|
|---|
| 56 | NDR_PULL_ALLOC(ndr, r->name);
|
|---|
| 57 | } else {
|
|---|
| 58 | r->name = NULL;
|
|---|
| 59 | }
|
|---|
| 60 | NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
|
|---|
| 61 | if (_ptr_info) {
|
|---|
| 62 | NDR_PULL_ALLOC(ndr, r->info);
|
|---|
| 63 | } else {
|
|---|
| 64 | r->info = NULL;
|
|---|
| 65 | }
|
|---|
| 66 | NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_location));
|
|---|
| 67 | if (_ptr_location) {
|
|---|
| 68 | NDR_PULL_ALLOC(ndr, r->location);
|
|---|
| 69 | } else {
|
|---|
| 70 | r->location = NULL;
|
|---|
| 71 | }
|
|---|
| 72 | NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
|
|---|
| 73 | }
|
|---|
| 74 | if (ndr_flags & NDR_BUFFERS) {
|
|---|
| 75 | if (r->name) {
|
|---|
| 76 | _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
|
|---|
| 77 | NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
|
|---|
| 78 | NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
|
|---|
| 79 | NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
|
|---|
| 80 | size_name_1 = ndr_get_array_size(ndr, &r->name);
|
|---|
| 81 | length_name_1 = ndr_get_array_length(ndr, &r->name);
|
|---|
| 82 | if (length_name_1 > size_name_1) {
|
|---|
| 83 | return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_name_1, length_name_1);
|
|---|
| 84 | }
|
|---|
| 85 | NDR_CHECK(ndr_check_string_terminator(ndr, length_name_1, sizeof(uint8_t)));
|
|---|
| 86 | NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, length_name_1, sizeof(uint8_t), CH_UTF8));
|
|---|
| 87 | NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
|
|---|
| 88 | }
|
|---|
| 89 | if (r->info) {
|
|---|
| 90 | _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
|
|---|
| 91 | NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
|
|---|
| 92 | NDR_CHECK(ndr_pull_array_size(ndr, &r->info));
|
|---|
| 93 | NDR_CHECK(ndr_pull_array_length(ndr, &r->info));
|
|---|
| 94 | size_info_1 = ndr_get_array_size(ndr, &r->info);
|
|---|
| 95 | length_info_1 = ndr_get_array_length(ndr, &r->info);
|
|---|
| 96 | if (length_info_1 > size_info_1) {
|
|---|
| 97 | return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_info_1, length_info_1);
|
|---|
| 98 | }
|
|---|
| 99 | NDR_CHECK(ndr_check_string_terminator(ndr, length_info_1, sizeof(uint8_t)));
|
|---|
| 100 | NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->info, length_info_1, sizeof(uint8_t), CH_UTF8));
|
|---|
| 101 | NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
|
|---|
| 102 | }
|
|---|
| 103 | if (r->location) {
|
|---|
| 104 | _mem_save_location_0 = NDR_PULL_GET_MEM_CTX(ndr);
|
|---|
| 105 | NDR_PULL_SET_MEM_CTX(ndr, r->location, 0);
|
|---|
| 106 | NDR_CHECK(ndr_pull_array_size(ndr, &r->location));
|
|---|
| 107 | NDR_CHECK(ndr_pull_array_length(ndr, &r->location));
|
|---|
| 108 | size_location_1 = ndr_get_array_size(ndr, &r->location);
|
|---|
| 109 | length_location_1 = ndr_get_array_length(ndr, &r->location);
|
|---|
| 110 | if (length_location_1 > size_location_1) {
|
|---|
| 111 | return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_location_1, length_location_1);
|
|---|
| 112 | }
|
|---|
| 113 | NDR_CHECK(ndr_check_string_terminator(ndr, length_location_1, sizeof(uint8_t)));
|
|---|
| 114 | NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->location, length_location_1, sizeof(uint8_t), CH_UTF8));
|
|---|
| 115 | NDR_PULL_SET_MEM_CTX(ndr, _mem_save_location_0, 0);
|
|---|
| 116 | }
|
|---|
| 117 | }
|
|---|
| 118 | return NDR_ERR_SUCCESS;
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | _PUBLIC_ void ndr_print_pcap_printer(struct ndr_print *ndr, const char *name, const struct pcap_printer *r)
|
|---|
| 122 | {
|
|---|
| 123 | ndr_print_struct(ndr, name, "pcap_printer");
|
|---|
| 124 | if (r == NULL) { ndr_print_null(ndr); return; }
|
|---|
| 125 | ndr->depth++;
|
|---|
| 126 | ndr_print_ptr(ndr, "name", r->name);
|
|---|
| 127 | ndr->depth++;
|
|---|
| 128 | if (r->name) {
|
|---|
| 129 | ndr_print_string(ndr, "name", r->name);
|
|---|
| 130 | }
|
|---|
| 131 | ndr->depth--;
|
|---|
| 132 | ndr_print_ptr(ndr, "info", r->info);
|
|---|
| 133 | ndr->depth++;
|
|---|
| 134 | if (r->info) {
|
|---|
| 135 | ndr_print_string(ndr, "info", r->info);
|
|---|
| 136 | }
|
|---|
| 137 | ndr->depth--;
|
|---|
| 138 | ndr_print_ptr(ndr, "location", r->location);
|
|---|
| 139 | ndr->depth++;
|
|---|
| 140 | if (r->location) {
|
|---|
| 141 | ndr_print_string(ndr, "location", r->location);
|
|---|
| 142 | }
|
|---|
| 143 | ndr->depth--;
|
|---|
| 144 | ndr->depth--;
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| 147 | _PUBLIC_ enum ndr_err_code ndr_push_pcap_data(struct ndr_push *ndr, int ndr_flags, const struct pcap_data *r)
|
|---|
| 148 | {
|
|---|
| 149 | uint32_t cntr_printers_0;
|
|---|
| 150 | if (ndr_flags & NDR_SCALARS) {
|
|---|
| 151 | NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->count));
|
|---|
| 152 | NDR_CHECK(ndr_push_align(ndr, 5));
|
|---|
| 153 | NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->status));
|
|---|
| 154 | NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
|
|---|
| 155 | for (cntr_printers_0 = 0; cntr_printers_0 < r->count; cntr_printers_0++) {
|
|---|
| 156 | NDR_CHECK(ndr_push_pcap_printer(ndr, NDR_SCALARS, &r->printers[cntr_printers_0]));
|
|---|
| 157 | }
|
|---|
| 158 | NDR_CHECK(ndr_push_trailer_align(ndr, 5));
|
|---|
| 159 | }
|
|---|
| 160 | if (ndr_flags & NDR_BUFFERS) {
|
|---|
| 161 | for (cntr_printers_0 = 0; cntr_printers_0 < r->count; cntr_printers_0++) {
|
|---|
| 162 | NDR_CHECK(ndr_push_pcap_printer(ndr, NDR_BUFFERS, &r->printers[cntr_printers_0]));
|
|---|
| 163 | }
|
|---|
| 164 | }
|
|---|
| 165 | return NDR_ERR_SUCCESS;
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | _PUBLIC_ enum ndr_err_code ndr_pull_pcap_data(struct ndr_pull *ndr, int ndr_flags, struct pcap_data *r)
|
|---|
| 169 | {
|
|---|
| 170 | uint32_t size_printers_0 = 0;
|
|---|
| 171 | uint32_t cntr_printers_0;
|
|---|
| 172 | TALLOC_CTX *_mem_save_printers_0;
|
|---|
| 173 | if (ndr_flags & NDR_SCALARS) {
|
|---|
| 174 | NDR_CHECK(ndr_pull_array_size(ndr, &r->printers));
|
|---|
| 175 | NDR_CHECK(ndr_pull_align(ndr, 5));
|
|---|
| 176 | NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->status));
|
|---|
| 177 | NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
|
|---|
| 178 | size_printers_0 = ndr_get_array_size(ndr, &r->printers);
|
|---|
| 179 | NDR_PULL_ALLOC_N(ndr, r->printers, size_printers_0);
|
|---|
| 180 | _mem_save_printers_0 = NDR_PULL_GET_MEM_CTX(ndr);
|
|---|
| 181 | NDR_PULL_SET_MEM_CTX(ndr, r->printers, 0);
|
|---|
| 182 | for (cntr_printers_0 = 0; cntr_printers_0 < size_printers_0; cntr_printers_0++) {
|
|---|
| 183 | NDR_CHECK(ndr_pull_pcap_printer(ndr, NDR_SCALARS, &r->printers[cntr_printers_0]));
|
|---|
| 184 | }
|
|---|
| 185 | NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printers_0, 0);
|
|---|
| 186 | if (r->printers) {
|
|---|
| 187 | NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->printers, r->count));
|
|---|
| 188 | }
|
|---|
| 189 | NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
|
|---|
| 190 | }
|
|---|
| 191 | if (ndr_flags & NDR_BUFFERS) {
|
|---|
| 192 | size_printers_0 = ndr_get_array_size(ndr, &r->printers);
|
|---|
| 193 | _mem_save_printers_0 = NDR_PULL_GET_MEM_CTX(ndr);
|
|---|
| 194 | NDR_PULL_SET_MEM_CTX(ndr, r->printers, 0);
|
|---|
| 195 | for (cntr_printers_0 = 0; cntr_printers_0 < size_printers_0; cntr_printers_0++) {
|
|---|
| 196 | NDR_CHECK(ndr_pull_pcap_printer(ndr, NDR_BUFFERS, &r->printers[cntr_printers_0]));
|
|---|
| 197 | }
|
|---|
| 198 | NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printers_0, 0);
|
|---|
| 199 | }
|
|---|
| 200 | return NDR_ERR_SUCCESS;
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | _PUBLIC_ void ndr_print_pcap_data(struct ndr_print *ndr, const char *name, const struct pcap_data *r)
|
|---|
| 204 | {
|
|---|
| 205 | uint32_t cntr_printers_0;
|
|---|
| 206 | ndr_print_struct(ndr, name, "pcap_data");
|
|---|
| 207 | if (r == NULL) { ndr_print_null(ndr); return; }
|
|---|
| 208 | ndr->depth++;
|
|---|
| 209 | ndr_print_NTSTATUS(ndr, "status", r->status);
|
|---|
| 210 | ndr_print_uint32(ndr, "count", r->count);
|
|---|
| 211 | ndr->print(ndr, "%s: ARRAY(%d)", "printers", (int)r->count);
|
|---|
| 212 | ndr->depth++;
|
|---|
| 213 | for (cntr_printers_0=0;cntr_printers_0<r->count;cntr_printers_0++) {
|
|---|
| 214 | ndr_print_pcap_printer(ndr, "printers", &r->printers[cntr_printers_0]);
|
|---|
| 215 | }
|
|---|
| 216 | ndr->depth--;
|
|---|
| 217 | ndr->depth--;
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|