s4-smbtorture: fix RPC-SPOOLSS-WIN after PrinterData IDL changes.
[Samba.git] / librpc / gen_ndr / srv_epmapper.c
blob7050b26ad17e4b2ae03081afc00b84ca1f5bc9df
1 /*
2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
4 */
6 #include "includes.h"
7 #include "../librpc/gen_ndr/srv_epmapper.h"
9 static bool api_epm_Insert(pipes_struct *p)
11 const struct ndr_interface_call *call;
12 struct ndr_pull *pull;
13 struct ndr_push *push;
14 enum ndr_err_code ndr_err;
15 DATA_BLOB blob;
16 struct epm_Insert *r;
18 call = &ndr_table_epmapper.calls[NDR_EPM_INSERT];
20 r = talloc(talloc_tos(), struct epm_Insert);
21 if (r == NULL) {
22 return false;
25 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26 talloc_free(r);
27 return false;
30 pull = ndr_pull_init_blob(&blob, r, NULL);
31 if (pull == NULL) {
32 talloc_free(r);
33 return false;
36 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37 ndr_err = call->ndr_pull(pull, NDR_IN, r);
38 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39 talloc_free(r);
40 return false;
43 if (DEBUGLEVEL >= 10) {
44 NDR_PRINT_IN_DEBUG(epm_Insert, r);
47 r->out.result = _epm_Insert(p, r);
49 if (p->rng_fault_state) {
50 talloc_free(r);
51 /* Return true here, srv_pipe_hnd.c will take care */
52 return true;
55 if (DEBUGLEVEL >= 10) {
56 NDR_PRINT_OUT_DEBUG(epm_Insert, r);
59 push = ndr_push_init_ctx(r, NULL);
60 if (push == NULL) {
61 talloc_free(r);
62 return false;
65 ndr_err = call->ndr_push(push, NDR_OUT, r);
66 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
67 talloc_free(r);
68 return false;
71 blob = ndr_push_blob(push);
72 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
73 talloc_free(r);
74 return false;
77 talloc_free(r);
79 return true;
82 static bool api_epm_Delete(pipes_struct *p)
84 const struct ndr_interface_call *call;
85 struct ndr_pull *pull;
86 struct ndr_push *push;
87 enum ndr_err_code ndr_err;
88 DATA_BLOB blob;
89 struct epm_Delete *r;
91 call = &ndr_table_epmapper.calls[NDR_EPM_DELETE];
93 r = talloc(talloc_tos(), struct epm_Delete);
94 if (r == NULL) {
95 return false;
98 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
99 talloc_free(r);
100 return false;
103 pull = ndr_pull_init_blob(&blob, r, NULL);
104 if (pull == NULL) {
105 talloc_free(r);
106 return false;
109 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
110 ndr_err = call->ndr_pull(pull, NDR_IN, r);
111 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
112 talloc_free(r);
113 return false;
116 if (DEBUGLEVEL >= 10) {
117 NDR_PRINT_IN_DEBUG(epm_Delete, r);
120 r->out.result = _epm_Delete(p, r);
122 if (p->rng_fault_state) {
123 talloc_free(r);
124 /* Return true here, srv_pipe_hnd.c will take care */
125 return true;
128 if (DEBUGLEVEL >= 10) {
129 NDR_PRINT_OUT_DEBUG(epm_Delete, r);
132 push = ndr_push_init_ctx(r, NULL);
133 if (push == NULL) {
134 talloc_free(r);
135 return false;
138 ndr_err = call->ndr_push(push, NDR_OUT, r);
139 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
140 talloc_free(r);
141 return false;
144 blob = ndr_push_blob(push);
145 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
146 talloc_free(r);
147 return false;
150 talloc_free(r);
152 return true;
155 static bool api_epm_Lookup(pipes_struct *p)
157 const struct ndr_interface_call *call;
158 struct ndr_pull *pull;
159 struct ndr_push *push;
160 enum ndr_err_code ndr_err;
161 DATA_BLOB blob;
162 struct epm_Lookup *r;
164 call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUP];
166 r = talloc(talloc_tos(), struct epm_Lookup);
167 if (r == NULL) {
168 return false;
171 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
172 talloc_free(r);
173 return false;
176 pull = ndr_pull_init_blob(&blob, r, NULL);
177 if (pull == NULL) {
178 talloc_free(r);
179 return false;
182 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
183 ndr_err = call->ndr_pull(pull, NDR_IN, r);
184 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
185 talloc_free(r);
186 return false;
189 if (DEBUGLEVEL >= 10) {
190 NDR_PRINT_IN_DEBUG(epm_Lookup, r);
193 ZERO_STRUCT(r->out);
194 r->out.entry_handle = r->in.entry_handle;
195 r->out.num_ents = talloc_zero(r, uint32_t);
196 if (r->out.num_ents == NULL) {
197 talloc_free(r);
198 return false;
201 r->out.entries = talloc_zero_array(r, struct epm_entry_t, r->in.max_ents);
202 if (r->out.entries == NULL) {
203 talloc_free(r);
204 return false;
207 r->out.result = _epm_Lookup(p, r);
209 if (p->rng_fault_state) {
210 talloc_free(r);
211 /* Return true here, srv_pipe_hnd.c will take care */
212 return true;
215 if (DEBUGLEVEL >= 10) {
216 NDR_PRINT_OUT_DEBUG(epm_Lookup, r);
219 push = ndr_push_init_ctx(r, NULL);
220 if (push == NULL) {
221 talloc_free(r);
222 return false;
225 ndr_err = call->ndr_push(push, NDR_OUT, r);
226 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
227 talloc_free(r);
228 return false;
231 blob = ndr_push_blob(push);
232 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
233 talloc_free(r);
234 return false;
237 talloc_free(r);
239 return true;
242 static bool api_epm_Map(pipes_struct *p)
244 const struct ndr_interface_call *call;
245 struct ndr_pull *pull;
246 struct ndr_push *push;
247 enum ndr_err_code ndr_err;
248 DATA_BLOB blob;
249 struct epm_Map *r;
251 call = &ndr_table_epmapper.calls[NDR_EPM_MAP];
253 r = talloc(talloc_tos(), struct epm_Map);
254 if (r == NULL) {
255 return false;
258 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
259 talloc_free(r);
260 return false;
263 pull = ndr_pull_init_blob(&blob, r, NULL);
264 if (pull == NULL) {
265 talloc_free(r);
266 return false;
269 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
270 ndr_err = call->ndr_pull(pull, NDR_IN, r);
271 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
272 talloc_free(r);
273 return false;
276 if (DEBUGLEVEL >= 10) {
277 NDR_PRINT_IN_DEBUG(epm_Map, r);
280 ZERO_STRUCT(r->out);
281 r->out.entry_handle = r->in.entry_handle;
282 r->out.num_towers = talloc_zero(r, uint32_t);
283 if (r->out.num_towers == NULL) {
284 talloc_free(r);
285 return false;
288 r->out.towers = talloc_zero_array(r, struct epm_twr_p_t, r->in.max_towers);
289 if (r->out.towers == NULL) {
290 talloc_free(r);
291 return false;
294 r->out.result = _epm_Map(p, r);
296 if (p->rng_fault_state) {
297 talloc_free(r);
298 /* Return true here, srv_pipe_hnd.c will take care */
299 return true;
302 if (DEBUGLEVEL >= 10) {
303 NDR_PRINT_OUT_DEBUG(epm_Map, r);
306 push = ndr_push_init_ctx(r, NULL);
307 if (push == NULL) {
308 talloc_free(r);
309 return false;
312 ndr_err = call->ndr_push(push, NDR_OUT, r);
313 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
314 talloc_free(r);
315 return false;
318 blob = ndr_push_blob(push);
319 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
320 talloc_free(r);
321 return false;
324 talloc_free(r);
326 return true;
329 static bool api_epm_LookupHandleFree(pipes_struct *p)
331 const struct ndr_interface_call *call;
332 struct ndr_pull *pull;
333 struct ndr_push *push;
334 enum ndr_err_code ndr_err;
335 DATA_BLOB blob;
336 struct epm_LookupHandleFree *r;
338 call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUPHANDLEFREE];
340 r = talloc(talloc_tos(), struct epm_LookupHandleFree);
341 if (r == NULL) {
342 return false;
345 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
346 talloc_free(r);
347 return false;
350 pull = ndr_pull_init_blob(&blob, r, NULL);
351 if (pull == NULL) {
352 talloc_free(r);
353 return false;
356 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
357 ndr_err = call->ndr_pull(pull, NDR_IN, r);
358 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
359 talloc_free(r);
360 return false;
363 if (DEBUGLEVEL >= 10) {
364 NDR_PRINT_IN_DEBUG(epm_LookupHandleFree, r);
367 ZERO_STRUCT(r->out);
368 r->out.entry_handle = r->in.entry_handle;
369 r->out.result = _epm_LookupHandleFree(p, r);
371 if (p->rng_fault_state) {
372 talloc_free(r);
373 /* Return true here, srv_pipe_hnd.c will take care */
374 return true;
377 if (DEBUGLEVEL >= 10) {
378 NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, r);
381 push = ndr_push_init_ctx(r, NULL);
382 if (push == NULL) {
383 talloc_free(r);
384 return false;
387 ndr_err = call->ndr_push(push, NDR_OUT, r);
388 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
389 talloc_free(r);
390 return false;
393 blob = ndr_push_blob(push);
394 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
395 talloc_free(r);
396 return false;
399 talloc_free(r);
401 return true;
404 static bool api_epm_InqObject(pipes_struct *p)
406 const struct ndr_interface_call *call;
407 struct ndr_pull *pull;
408 struct ndr_push *push;
409 enum ndr_err_code ndr_err;
410 DATA_BLOB blob;
411 struct epm_InqObject *r;
413 call = &ndr_table_epmapper.calls[NDR_EPM_INQOBJECT];
415 r = talloc(talloc_tos(), struct epm_InqObject);
416 if (r == NULL) {
417 return false;
420 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
421 talloc_free(r);
422 return false;
425 pull = ndr_pull_init_blob(&blob, r, NULL);
426 if (pull == NULL) {
427 talloc_free(r);
428 return false;
431 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
432 ndr_err = call->ndr_pull(pull, NDR_IN, r);
433 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
434 talloc_free(r);
435 return false;
438 if (DEBUGLEVEL >= 10) {
439 NDR_PRINT_IN_DEBUG(epm_InqObject, r);
442 r->out.result = _epm_InqObject(p, r);
444 if (p->rng_fault_state) {
445 talloc_free(r);
446 /* Return true here, srv_pipe_hnd.c will take care */
447 return true;
450 if (DEBUGLEVEL >= 10) {
451 NDR_PRINT_OUT_DEBUG(epm_InqObject, r);
454 push = ndr_push_init_ctx(r, NULL);
455 if (push == NULL) {
456 talloc_free(r);
457 return false;
460 ndr_err = call->ndr_push(push, NDR_OUT, r);
461 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
462 talloc_free(r);
463 return false;
466 blob = ndr_push_blob(push);
467 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
468 talloc_free(r);
469 return false;
472 talloc_free(r);
474 return true;
477 static bool api_epm_MgmtDelete(pipes_struct *p)
479 const struct ndr_interface_call *call;
480 struct ndr_pull *pull;
481 struct ndr_push *push;
482 enum ndr_err_code ndr_err;
483 DATA_BLOB blob;
484 struct epm_MgmtDelete *r;
486 call = &ndr_table_epmapper.calls[NDR_EPM_MGMTDELETE];
488 r = talloc(talloc_tos(), struct epm_MgmtDelete);
489 if (r == NULL) {
490 return false;
493 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
494 talloc_free(r);
495 return false;
498 pull = ndr_pull_init_blob(&blob, r, NULL);
499 if (pull == NULL) {
500 talloc_free(r);
501 return false;
504 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
505 ndr_err = call->ndr_pull(pull, NDR_IN, r);
506 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
507 talloc_free(r);
508 return false;
511 if (DEBUGLEVEL >= 10) {
512 NDR_PRINT_IN_DEBUG(epm_MgmtDelete, r);
515 r->out.result = _epm_MgmtDelete(p, r);
517 if (p->rng_fault_state) {
518 talloc_free(r);
519 /* Return true here, srv_pipe_hnd.c will take care */
520 return true;
523 if (DEBUGLEVEL >= 10) {
524 NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, r);
527 push = ndr_push_init_ctx(r, NULL);
528 if (push == NULL) {
529 talloc_free(r);
530 return false;
533 ndr_err = call->ndr_push(push, NDR_OUT, r);
534 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
535 talloc_free(r);
536 return false;
539 blob = ndr_push_blob(push);
540 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
541 talloc_free(r);
542 return false;
545 talloc_free(r);
547 return true;
550 static bool api_epm_MapAuth(pipes_struct *p)
552 const struct ndr_interface_call *call;
553 struct ndr_pull *pull;
554 struct ndr_push *push;
555 enum ndr_err_code ndr_err;
556 DATA_BLOB blob;
557 struct epm_MapAuth *r;
559 call = &ndr_table_epmapper.calls[NDR_EPM_MAPAUTH];
561 r = talloc(talloc_tos(), struct epm_MapAuth);
562 if (r == NULL) {
563 return false;
566 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
567 talloc_free(r);
568 return false;
571 pull = ndr_pull_init_blob(&blob, r, NULL);
572 if (pull == NULL) {
573 talloc_free(r);
574 return false;
577 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
578 ndr_err = call->ndr_pull(pull, NDR_IN, r);
579 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
580 talloc_free(r);
581 return false;
584 if (DEBUGLEVEL >= 10) {
585 NDR_PRINT_IN_DEBUG(epm_MapAuth, r);
588 r->out.result = _epm_MapAuth(p, r);
590 if (p->rng_fault_state) {
591 talloc_free(r);
592 /* Return true here, srv_pipe_hnd.c will take care */
593 return true;
596 if (DEBUGLEVEL >= 10) {
597 NDR_PRINT_OUT_DEBUG(epm_MapAuth, r);
600 push = ndr_push_init_ctx(r, NULL);
601 if (push == NULL) {
602 talloc_free(r);
603 return false;
606 ndr_err = call->ndr_push(push, NDR_OUT, r);
607 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
608 talloc_free(r);
609 return false;
612 blob = ndr_push_blob(push);
613 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
614 talloc_free(r);
615 return false;
618 talloc_free(r);
620 return true;
624 /* Tables */
625 static struct api_struct api_epmapper_cmds[] =
627 {"EPM_INSERT", NDR_EPM_INSERT, api_epm_Insert},
628 {"EPM_DELETE", NDR_EPM_DELETE, api_epm_Delete},
629 {"EPM_LOOKUP", NDR_EPM_LOOKUP, api_epm_Lookup},
630 {"EPM_MAP", NDR_EPM_MAP, api_epm_Map},
631 {"EPM_LOOKUPHANDLEFREE", NDR_EPM_LOOKUPHANDLEFREE, api_epm_LookupHandleFree},
632 {"EPM_INQOBJECT", NDR_EPM_INQOBJECT, api_epm_InqObject},
633 {"EPM_MGMTDELETE", NDR_EPM_MGMTDELETE, api_epm_MgmtDelete},
634 {"EPM_MAPAUTH", NDR_EPM_MAPAUTH, api_epm_MapAuth},
637 void epmapper_get_pipe_fns(struct api_struct **fns, int *n_fns)
639 *fns = api_epmapper_cmds;
640 *n_fns = sizeof(api_epmapper_cmds) / sizeof(struct api_struct);
643 NTSTATUS rpc_epmapper_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
645 if (cli->pipes_struct == NULL) {
646 return NT_STATUS_INVALID_PARAMETER;
649 switch (opnum)
651 case NDR_EPM_INSERT: {
652 struct epm_Insert *r = (struct epm_Insert *)_r;
653 r->out.result = _epm_Insert(cli->pipes_struct, r);
654 return NT_STATUS_OK;
657 case NDR_EPM_DELETE: {
658 struct epm_Delete *r = (struct epm_Delete *)_r;
659 r->out.result = _epm_Delete(cli->pipes_struct, r);
660 return NT_STATUS_OK;
663 case NDR_EPM_LOOKUP: {
664 struct epm_Lookup *r = (struct epm_Lookup *)_r;
665 ZERO_STRUCT(r->out);
666 r->out.entry_handle = r->in.entry_handle;
667 r->out.num_ents = talloc_zero(mem_ctx, uint32_t);
668 if (r->out.num_ents == NULL) {
669 return NT_STATUS_NO_MEMORY;
672 r->out.entries = talloc_zero_array(mem_ctx, struct epm_entry_t, r->in.max_ents);
673 if (r->out.entries == NULL) {
674 return NT_STATUS_NO_MEMORY;
677 r->out.result = _epm_Lookup(cli->pipes_struct, r);
678 return NT_STATUS_OK;
681 case NDR_EPM_MAP: {
682 struct epm_Map *r = (struct epm_Map *)_r;
683 ZERO_STRUCT(r->out);
684 r->out.entry_handle = r->in.entry_handle;
685 r->out.num_towers = talloc_zero(mem_ctx, uint32_t);
686 if (r->out.num_towers == NULL) {
687 return NT_STATUS_NO_MEMORY;
690 r->out.towers = talloc_zero_array(mem_ctx, struct epm_twr_p_t, r->in.max_towers);
691 if (r->out.towers == NULL) {
692 return NT_STATUS_NO_MEMORY;
695 r->out.result = _epm_Map(cli->pipes_struct, r);
696 return NT_STATUS_OK;
699 case NDR_EPM_LOOKUPHANDLEFREE: {
700 struct epm_LookupHandleFree *r = (struct epm_LookupHandleFree *)_r;
701 ZERO_STRUCT(r->out);
702 r->out.entry_handle = r->in.entry_handle;
703 r->out.result = _epm_LookupHandleFree(cli->pipes_struct, r);
704 return NT_STATUS_OK;
707 case NDR_EPM_INQOBJECT: {
708 struct epm_InqObject *r = (struct epm_InqObject *)_r;
709 r->out.result = _epm_InqObject(cli->pipes_struct, r);
710 return NT_STATUS_OK;
713 case NDR_EPM_MGMTDELETE: {
714 struct epm_MgmtDelete *r = (struct epm_MgmtDelete *)_r;
715 r->out.result = _epm_MgmtDelete(cli->pipes_struct, r);
716 return NT_STATUS_OK;
719 case NDR_EPM_MAPAUTH: {
720 struct epm_MapAuth *r = (struct epm_MapAuth *)_r;
721 r->out.result = _epm_MapAuth(cli->pipes_struct, r);
722 return NT_STATUS_OK;
725 default:
726 return NT_STATUS_NOT_IMPLEMENTED;
730 NTSTATUS rpc_epmapper_init(void)
732 return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "epmapper", "epmapper", &ndr_table_epmapper, api_epmapper_cmds, sizeof(api_epmapper_cmds) / sizeof(struct api_struct));