WHATSNEW: Add changes since 3.5.16.
[samba.git] / librpc / gen_ndr / cli_epmapper.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * client auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/cli_epmapper.h"
8
9 struct rpccli_epm_Insert_state {
10         struct epm_Insert orig;
11         struct epm_Insert tmp;
12         TALLOC_CTX *out_mem_ctx;
13         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14 };
15
16 static void rpccli_epm_Insert_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_epm_Insert_send(TALLOC_CTX *mem_ctx,
19                                           struct tevent_context *ev,
20                                           struct rpc_pipe_client *cli,
21                                           uint32_t _num_ents /* [in]  */,
22                                           struct epm_entry_t *_entries /* [in] [size_is(num_ents)] */,
23                                           uint32_t _replace /* [in]  */)
24 {
25         struct tevent_req *req;
26         struct rpccli_epm_Insert_state *state;
27         struct tevent_req *subreq;
28
29         req = tevent_req_create(mem_ctx, &state,
30                                 struct rpccli_epm_Insert_state);
31         if (req == NULL) {
32                 return NULL;
33         }
34         state->out_mem_ctx = NULL;
35         state->dispatch_recv = cli->dispatch_recv;
36
37         /* In parameters */
38         state->orig.in.num_ents = _num_ents;
39         state->orig.in.entries = _entries;
40         state->orig.in.replace = _replace;
41
42         /* Out parameters */
43
44         /* Result */
45         ZERO_STRUCT(state->orig.out.result);
46
47         /* make a temporary copy, that we pass to the dispatch function */
48         state->tmp = state->orig;
49
50         subreq = cli->dispatch_send(state, ev, cli,
51                                     &ndr_table_epmapper,
52                                     NDR_EPM_INSERT,
53                                     &state->tmp);
54         if (tevent_req_nomem(subreq, req)) {
55                 return tevent_req_post(req, ev);
56         }
57         tevent_req_set_callback(subreq, rpccli_epm_Insert_done, req);
58         return req;
59 }
60
61 static void rpccli_epm_Insert_done(struct tevent_req *subreq)
62 {
63         struct tevent_req *req = tevent_req_callback_data(
64                 subreq, struct tevent_req);
65         struct rpccli_epm_Insert_state *state = tevent_req_data(
66                 req, struct rpccli_epm_Insert_state);
67         NTSTATUS status;
68         TALLOC_CTX *mem_ctx;
69
70         if (state->out_mem_ctx) {
71                 mem_ctx = state->out_mem_ctx;
72         } else {
73                 mem_ctx = state;
74         }
75
76         status = state->dispatch_recv(subreq, mem_ctx);
77         TALLOC_FREE(subreq);
78         if (!NT_STATUS_IS_OK(status)) {
79                 tevent_req_nterror(req, status);
80                 return;
81         }
82
83         /* Copy out parameters */
84
85         /* Copy result */
86         state->orig.out.result = state->tmp.out.result;
87
88         /* Reset temporary structure */
89         ZERO_STRUCT(state->tmp);
90
91         tevent_req_done(req);
92 }
93
94 NTSTATUS rpccli_epm_Insert_recv(struct tevent_req *req,
95                                 TALLOC_CTX *mem_ctx,
96                                 uint32 *result)
97 {
98         struct rpccli_epm_Insert_state *state = tevent_req_data(
99                 req, struct rpccli_epm_Insert_state);
100         NTSTATUS status;
101
102         if (tevent_req_is_nterror(req, &status)) {
103                 tevent_req_received(req);
104                 return status;
105         }
106
107         /* Steal possbile out parameters to the callers context */
108         talloc_steal(mem_ctx, state->out_mem_ctx);
109
110         /* Return result */
111         *result = state->orig.out.result;
112
113         tevent_req_received(req);
114         return NT_STATUS_OK;
115 }
116
117 NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli,
118                            TALLOC_CTX *mem_ctx,
119                            uint32_t num_ents /* [in]  */,
120                            struct epm_entry_t *entries /* [in] [size_is(num_ents)] */,
121                            uint32_t replace /* [in]  */)
122 {
123         struct epm_Insert r;
124         NTSTATUS status;
125
126         /* In parameters */
127         r.in.num_ents = num_ents;
128         r.in.entries = entries;
129         r.in.replace = replace;
130
131         status = cli->dispatch(cli,
132                                 mem_ctx,
133                                 &ndr_table_epmapper,
134                                 NDR_EPM_INSERT,
135                                 &r);
136
137         if (!NT_STATUS_IS_OK(status)) {
138                 return status;
139         }
140
141         if (NT_STATUS_IS_ERR(status)) {
142                 return status;
143         }
144
145         /* Return variables */
146
147         /* Return result */
148         return NT_STATUS_OK;
149 }
150
151 struct rpccli_epm_Delete_state {
152         struct epm_Delete orig;
153         struct epm_Delete tmp;
154         TALLOC_CTX *out_mem_ctx;
155         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
156 };
157
158 static void rpccli_epm_Delete_done(struct tevent_req *subreq);
159
160 struct tevent_req *rpccli_epm_Delete_send(TALLOC_CTX *mem_ctx,
161                                           struct tevent_context *ev,
162                                           struct rpc_pipe_client *cli,
163                                           uint32_t _num_ents /* [in]  */,
164                                           struct epm_entry_t *_entries /* [in] [size_is(num_ents)] */)
165 {
166         struct tevent_req *req;
167         struct rpccli_epm_Delete_state *state;
168         struct tevent_req *subreq;
169
170         req = tevent_req_create(mem_ctx, &state,
171                                 struct rpccli_epm_Delete_state);
172         if (req == NULL) {
173                 return NULL;
174         }
175         state->out_mem_ctx = NULL;
176         state->dispatch_recv = cli->dispatch_recv;
177
178         /* In parameters */
179         state->orig.in.num_ents = _num_ents;
180         state->orig.in.entries = _entries;
181
182         /* Out parameters */
183
184         /* Result */
185         ZERO_STRUCT(state->orig.out.result);
186
187         /* make a temporary copy, that we pass to the dispatch function */
188         state->tmp = state->orig;
189
190         subreq = cli->dispatch_send(state, ev, cli,
191                                     &ndr_table_epmapper,
192                                     NDR_EPM_DELETE,
193                                     &state->tmp);
194         if (tevent_req_nomem(subreq, req)) {
195                 return tevent_req_post(req, ev);
196         }
197         tevent_req_set_callback(subreq, rpccli_epm_Delete_done, req);
198         return req;
199 }
200
201 static void rpccli_epm_Delete_done(struct tevent_req *subreq)
202 {
203         struct tevent_req *req = tevent_req_callback_data(
204                 subreq, struct tevent_req);
205         struct rpccli_epm_Delete_state *state = tevent_req_data(
206                 req, struct rpccli_epm_Delete_state);
207         NTSTATUS status;
208         TALLOC_CTX *mem_ctx;
209
210         if (state->out_mem_ctx) {
211                 mem_ctx = state->out_mem_ctx;
212         } else {
213                 mem_ctx = state;
214         }
215
216         status = state->dispatch_recv(subreq, mem_ctx);
217         TALLOC_FREE(subreq);
218         if (!NT_STATUS_IS_OK(status)) {
219                 tevent_req_nterror(req, status);
220                 return;
221         }
222
223         /* Copy out parameters */
224
225         /* Copy result */
226         state->orig.out.result = state->tmp.out.result;
227
228         /* Reset temporary structure */
229         ZERO_STRUCT(state->tmp);
230
231         tevent_req_done(req);
232 }
233
234 NTSTATUS rpccli_epm_Delete_recv(struct tevent_req *req,
235                                 TALLOC_CTX *mem_ctx,
236                                 uint32 *result)
237 {
238         struct rpccli_epm_Delete_state *state = tevent_req_data(
239                 req, struct rpccli_epm_Delete_state);
240         NTSTATUS status;
241
242         if (tevent_req_is_nterror(req, &status)) {
243                 tevent_req_received(req);
244                 return status;
245         }
246
247         /* Steal possbile out parameters to the callers context */
248         talloc_steal(mem_ctx, state->out_mem_ctx);
249
250         /* Return result */
251         *result = state->orig.out.result;
252
253         tevent_req_received(req);
254         return NT_STATUS_OK;
255 }
256
257 NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli,
258                            TALLOC_CTX *mem_ctx,
259                            uint32_t num_ents /* [in]  */,
260                            struct epm_entry_t *entries /* [in] [size_is(num_ents)] */)
261 {
262         struct epm_Delete r;
263         NTSTATUS status;
264
265         /* In parameters */
266         r.in.num_ents = num_ents;
267         r.in.entries = entries;
268
269         status = cli->dispatch(cli,
270                                 mem_ctx,
271                                 &ndr_table_epmapper,
272                                 NDR_EPM_DELETE,
273                                 &r);
274
275         if (!NT_STATUS_IS_OK(status)) {
276                 return status;
277         }
278
279         if (NT_STATUS_IS_ERR(status)) {
280                 return status;
281         }
282
283         /* Return variables */
284
285         /* Return result */
286         return NT_STATUS_OK;
287 }
288
289 struct rpccli_epm_Lookup_state {
290         struct epm_Lookup orig;
291         struct epm_Lookup tmp;
292         TALLOC_CTX *out_mem_ctx;
293         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
294 };
295
296 static void rpccli_epm_Lookup_done(struct tevent_req *subreq);
297
298 struct tevent_req *rpccli_epm_Lookup_send(TALLOC_CTX *mem_ctx,
299                                           struct tevent_context *ev,
300                                           struct rpc_pipe_client *cli,
301                                           uint32_t _inquiry_type /* [in]  */,
302                                           struct GUID *_object /* [in] [ptr] */,
303                                           struct rpc_if_id_t *_interface_id /* [in] [ptr] */,
304                                           uint32_t _vers_option /* [in]  */,
305                                           struct policy_handle *_entry_handle /* [in,out] [ref] */,
306                                           uint32_t _max_ents /* [in]  */,
307                                           uint32_t *_num_ents /* [out] [ref] */,
308                                           struct epm_entry_t *_entries /* [out] [length_is(*num_ents),size_is(max_ents)] */)
309 {
310         struct tevent_req *req;
311         struct rpccli_epm_Lookup_state *state;
312         struct tevent_req *subreq;
313
314         req = tevent_req_create(mem_ctx, &state,
315                                 struct rpccli_epm_Lookup_state);
316         if (req == NULL) {
317                 return NULL;
318         }
319         state->out_mem_ctx = NULL;
320         state->dispatch_recv = cli->dispatch_recv;
321
322         /* In parameters */
323         state->orig.in.inquiry_type = _inquiry_type;
324         state->orig.in.object = _object;
325         state->orig.in.interface_id = _interface_id;
326         state->orig.in.vers_option = _vers_option;
327         state->orig.in.entry_handle = _entry_handle;
328         state->orig.in.max_ents = _max_ents;
329
330         /* Out parameters */
331         state->orig.out.entry_handle = _entry_handle;
332         state->orig.out.num_ents = _num_ents;
333         state->orig.out.entries = _entries;
334
335         /* Result */
336         ZERO_STRUCT(state->orig.out.result);
337
338         state->out_mem_ctx = talloc_named_const(state, 0,
339                              "rpccli_epm_Lookup_out_memory");
340         if (tevent_req_nomem(state->out_mem_ctx, req)) {
341                 return tevent_req_post(req, ev);
342         }
343
344         /* make a temporary copy, that we pass to the dispatch function */
345         state->tmp = state->orig;
346
347         subreq = cli->dispatch_send(state, ev, cli,
348                                     &ndr_table_epmapper,
349                                     NDR_EPM_LOOKUP,
350                                     &state->tmp);
351         if (tevent_req_nomem(subreq, req)) {
352                 return tevent_req_post(req, ev);
353         }
354         tevent_req_set_callback(subreq, rpccli_epm_Lookup_done, req);
355         return req;
356 }
357
358 static void rpccli_epm_Lookup_done(struct tevent_req *subreq)
359 {
360         struct tevent_req *req = tevent_req_callback_data(
361                 subreq, struct tevent_req);
362         struct rpccli_epm_Lookup_state *state = tevent_req_data(
363                 req, struct rpccli_epm_Lookup_state);
364         NTSTATUS status;
365         TALLOC_CTX *mem_ctx;
366
367         if (state->out_mem_ctx) {
368                 mem_ctx = state->out_mem_ctx;
369         } else {
370                 mem_ctx = state;
371         }
372
373         status = state->dispatch_recv(subreq, mem_ctx);
374         TALLOC_FREE(subreq);
375         if (!NT_STATUS_IS_OK(status)) {
376                 tevent_req_nterror(req, status);
377                 return;
378         }
379
380         /* Copy out parameters */
381         *state->orig.out.entry_handle = *state->tmp.out.entry_handle;
382         *state->orig.out.num_ents = *state->tmp.out.num_ents;
383         if ((*state->tmp.out.num_ents) > (state->tmp.in.max_ents)) {
384                 tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
385                 return;
386         }
387         memcpy(state->orig.out.entries, state->tmp.out.entries, (*state->tmp.out.num_ents) * sizeof(*state->orig.out.entries));
388
389         /* Copy result */
390         state->orig.out.result = state->tmp.out.result;
391
392         /* Reset temporary structure */
393         ZERO_STRUCT(state->tmp);
394
395         tevent_req_done(req);
396 }
397
398 NTSTATUS rpccli_epm_Lookup_recv(struct tevent_req *req,
399                                 TALLOC_CTX *mem_ctx,
400                                 uint32 *result)
401 {
402         struct rpccli_epm_Lookup_state *state = tevent_req_data(
403                 req, struct rpccli_epm_Lookup_state);
404         NTSTATUS status;
405
406         if (tevent_req_is_nterror(req, &status)) {
407                 tevent_req_received(req);
408                 return status;
409         }
410
411         /* Steal possbile out parameters to the callers context */
412         talloc_steal(mem_ctx, state->out_mem_ctx);
413
414         /* Return result */
415         *result = state->orig.out.result;
416
417         tevent_req_received(req);
418         return NT_STATUS_OK;
419 }
420
421 NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli,
422                            TALLOC_CTX *mem_ctx,
423                            uint32_t inquiry_type /* [in]  */,
424                            struct GUID *object /* [in] [ptr] */,
425                            struct rpc_if_id_t *interface_id /* [in] [ptr] */,
426                            uint32_t vers_option /* [in]  */,
427                            struct policy_handle *entry_handle /* [in,out] [ref] */,
428                            uint32_t max_ents /* [in]  */,
429                            uint32_t *num_ents /* [out] [ref] */,
430                            struct epm_entry_t *entries /* [out] [length_is(*num_ents),size_is(max_ents)] */)
431 {
432         struct epm_Lookup r;
433         NTSTATUS status;
434
435         /* In parameters */
436         r.in.inquiry_type = inquiry_type;
437         r.in.object = object;
438         r.in.interface_id = interface_id;
439         r.in.vers_option = vers_option;
440         r.in.entry_handle = entry_handle;
441         r.in.max_ents = max_ents;
442
443         status = cli->dispatch(cli,
444                                 mem_ctx,
445                                 &ndr_table_epmapper,
446                                 NDR_EPM_LOOKUP,
447                                 &r);
448
449         if (!NT_STATUS_IS_OK(status)) {
450                 return status;
451         }
452
453         if (NT_STATUS_IS_ERR(status)) {
454                 return status;
455         }
456
457         /* Return variables */
458         *entry_handle = *r.out.entry_handle;
459         *num_ents = *r.out.num_ents;
460         if ((*r.out.num_ents) > (r.in.max_ents)) {
461                 return NT_STATUS_INVALID_NETWORK_RESPONSE;
462         }
463         memcpy(entries, r.out.entries, (*r.out.num_ents) * sizeof(*entries));
464
465         /* Return result */
466         return NT_STATUS_OK;
467 }
468
469 struct rpccli_epm_Map_state {
470         struct epm_Map orig;
471         struct epm_Map tmp;
472         TALLOC_CTX *out_mem_ctx;
473         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
474 };
475
476 static void rpccli_epm_Map_done(struct tevent_req *subreq);
477
478 struct tevent_req *rpccli_epm_Map_send(TALLOC_CTX *mem_ctx,
479                                        struct tevent_context *ev,
480                                        struct rpc_pipe_client *cli,
481                                        struct GUID *_object /* [in] [ptr] */,
482                                        struct epm_twr_t *_map_tower /* [in] [ptr] */,
483                                        struct policy_handle *_entry_handle /* [in,out] [ref] */,
484                                        uint32_t _max_towers /* [in]  */,
485                                        uint32_t *_num_towers /* [out] [ref] */,
486                                        struct epm_twr_p_t *_towers /* [out] [length_is(*num_towers),size_is(max_towers)] */)
487 {
488         struct tevent_req *req;
489         struct rpccli_epm_Map_state *state;
490         struct tevent_req *subreq;
491
492         req = tevent_req_create(mem_ctx, &state,
493                                 struct rpccli_epm_Map_state);
494         if (req == NULL) {
495                 return NULL;
496         }
497         state->out_mem_ctx = NULL;
498         state->dispatch_recv = cli->dispatch_recv;
499
500         /* In parameters */
501         state->orig.in.object = _object;
502         state->orig.in.map_tower = _map_tower;
503         state->orig.in.entry_handle = _entry_handle;
504         state->orig.in.max_towers = _max_towers;
505
506         /* Out parameters */
507         state->orig.out.entry_handle = _entry_handle;
508         state->orig.out.num_towers = _num_towers;
509         state->orig.out.towers = _towers;
510
511         /* Result */
512         ZERO_STRUCT(state->orig.out.result);
513
514         state->out_mem_ctx = talloc_named_const(state, 0,
515                              "rpccli_epm_Map_out_memory");
516         if (tevent_req_nomem(state->out_mem_ctx, req)) {
517                 return tevent_req_post(req, ev);
518         }
519
520         /* make a temporary copy, that we pass to the dispatch function */
521         state->tmp = state->orig;
522
523         subreq = cli->dispatch_send(state, ev, cli,
524                                     &ndr_table_epmapper,
525                                     NDR_EPM_MAP,
526                                     &state->tmp);
527         if (tevent_req_nomem(subreq, req)) {
528                 return tevent_req_post(req, ev);
529         }
530         tevent_req_set_callback(subreq, rpccli_epm_Map_done, req);
531         return req;
532 }
533
534 static void rpccli_epm_Map_done(struct tevent_req *subreq)
535 {
536         struct tevent_req *req = tevent_req_callback_data(
537                 subreq, struct tevent_req);
538         struct rpccli_epm_Map_state *state = tevent_req_data(
539                 req, struct rpccli_epm_Map_state);
540         NTSTATUS status;
541         TALLOC_CTX *mem_ctx;
542
543         if (state->out_mem_ctx) {
544                 mem_ctx = state->out_mem_ctx;
545         } else {
546                 mem_ctx = state;
547         }
548
549         status = state->dispatch_recv(subreq, mem_ctx);
550         TALLOC_FREE(subreq);
551         if (!NT_STATUS_IS_OK(status)) {
552                 tevent_req_nterror(req, status);
553                 return;
554         }
555
556         /* Copy out parameters */
557         *state->orig.out.entry_handle = *state->tmp.out.entry_handle;
558         *state->orig.out.num_towers = *state->tmp.out.num_towers;
559         if ((*state->tmp.out.num_towers) > (state->tmp.in.max_towers)) {
560                 tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
561                 return;
562         }
563         memcpy(state->orig.out.towers, state->tmp.out.towers, (*state->tmp.out.num_towers) * sizeof(*state->orig.out.towers));
564
565         /* Copy result */
566         state->orig.out.result = state->tmp.out.result;
567
568         /* Reset temporary structure */
569         ZERO_STRUCT(state->tmp);
570
571         tevent_req_done(req);
572 }
573
574 NTSTATUS rpccli_epm_Map_recv(struct tevent_req *req,
575                              TALLOC_CTX *mem_ctx,
576                              uint32 *result)
577 {
578         struct rpccli_epm_Map_state *state = tevent_req_data(
579                 req, struct rpccli_epm_Map_state);
580         NTSTATUS status;
581
582         if (tevent_req_is_nterror(req, &status)) {
583                 tevent_req_received(req);
584                 return status;
585         }
586
587         /* Steal possbile out parameters to the callers context */
588         talloc_steal(mem_ctx, state->out_mem_ctx);
589
590         /* Return result */
591         *result = state->orig.out.result;
592
593         tevent_req_received(req);
594         return NT_STATUS_OK;
595 }
596
597 NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli,
598                         TALLOC_CTX *mem_ctx,
599                         struct GUID *object /* [in] [ptr] */,
600                         struct epm_twr_t *map_tower /* [in] [ptr] */,
601                         struct policy_handle *entry_handle /* [in,out] [ref] */,
602                         uint32_t max_towers /* [in]  */,
603                         uint32_t *num_towers /* [out] [ref] */,
604                         struct epm_twr_p_t *towers /* [out] [length_is(*num_towers),size_is(max_towers)] */)
605 {
606         struct epm_Map r;
607         NTSTATUS status;
608
609         /* In parameters */
610         r.in.object = object;
611         r.in.map_tower = map_tower;
612         r.in.entry_handle = entry_handle;
613         r.in.max_towers = max_towers;
614
615         status = cli->dispatch(cli,
616                                 mem_ctx,
617                                 &ndr_table_epmapper,
618                                 NDR_EPM_MAP,
619                                 &r);
620
621         if (!NT_STATUS_IS_OK(status)) {
622                 return status;
623         }
624
625         if (NT_STATUS_IS_ERR(status)) {
626                 return status;
627         }
628
629         /* Return variables */
630         *entry_handle = *r.out.entry_handle;
631         *num_towers = *r.out.num_towers;
632         if ((*r.out.num_towers) > (r.in.max_towers)) {
633                 return NT_STATUS_INVALID_NETWORK_RESPONSE;
634         }
635         memcpy(towers, r.out.towers, (*r.out.num_towers) * sizeof(*towers));
636
637         /* Return result */
638         return NT_STATUS_OK;
639 }
640
641 struct rpccli_epm_LookupHandleFree_state {
642         struct epm_LookupHandleFree orig;
643         struct epm_LookupHandleFree tmp;
644         TALLOC_CTX *out_mem_ctx;
645         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
646 };
647
648 static void rpccli_epm_LookupHandleFree_done(struct tevent_req *subreq);
649
650 struct tevent_req *rpccli_epm_LookupHandleFree_send(TALLOC_CTX *mem_ctx,
651                                                     struct tevent_context *ev,
652                                                     struct rpc_pipe_client *cli,
653                                                     struct policy_handle *_entry_handle /* [in,out] [ref] */)
654 {
655         struct tevent_req *req;
656         struct rpccli_epm_LookupHandleFree_state *state;
657         struct tevent_req *subreq;
658
659         req = tevent_req_create(mem_ctx, &state,
660                                 struct rpccli_epm_LookupHandleFree_state);
661         if (req == NULL) {
662                 return NULL;
663         }
664         state->out_mem_ctx = NULL;
665         state->dispatch_recv = cli->dispatch_recv;
666
667         /* In parameters */
668         state->orig.in.entry_handle = _entry_handle;
669
670         /* Out parameters */
671         state->orig.out.entry_handle = _entry_handle;
672
673         /* Result */
674         ZERO_STRUCT(state->orig.out.result);
675
676         state->out_mem_ctx = talloc_named_const(state, 0,
677                              "rpccli_epm_LookupHandleFree_out_memory");
678         if (tevent_req_nomem(state->out_mem_ctx, req)) {
679                 return tevent_req_post(req, ev);
680         }
681
682         /* make a temporary copy, that we pass to the dispatch function */
683         state->tmp = state->orig;
684
685         subreq = cli->dispatch_send(state, ev, cli,
686                                     &ndr_table_epmapper,
687                                     NDR_EPM_LOOKUPHANDLEFREE,
688                                     &state->tmp);
689         if (tevent_req_nomem(subreq, req)) {
690                 return tevent_req_post(req, ev);
691         }
692         tevent_req_set_callback(subreq, rpccli_epm_LookupHandleFree_done, req);
693         return req;
694 }
695
696 static void rpccli_epm_LookupHandleFree_done(struct tevent_req *subreq)
697 {
698         struct tevent_req *req = tevent_req_callback_data(
699                 subreq, struct tevent_req);
700         struct rpccli_epm_LookupHandleFree_state *state = tevent_req_data(
701                 req, struct rpccli_epm_LookupHandleFree_state);
702         NTSTATUS status;
703         TALLOC_CTX *mem_ctx;
704
705         if (state->out_mem_ctx) {
706                 mem_ctx = state->out_mem_ctx;
707         } else {
708                 mem_ctx = state;
709         }
710
711         status = state->dispatch_recv(subreq, mem_ctx);
712         TALLOC_FREE(subreq);
713         if (!NT_STATUS_IS_OK(status)) {
714                 tevent_req_nterror(req, status);
715                 return;
716         }
717
718         /* Copy out parameters */
719         *state->orig.out.entry_handle = *state->tmp.out.entry_handle;
720
721         /* Copy result */
722         state->orig.out.result = state->tmp.out.result;
723
724         /* Reset temporary structure */
725         ZERO_STRUCT(state->tmp);
726
727         tevent_req_done(req);
728 }
729
730 NTSTATUS rpccli_epm_LookupHandleFree_recv(struct tevent_req *req,
731                                           TALLOC_CTX *mem_ctx,
732                                           uint32 *result)
733 {
734         struct rpccli_epm_LookupHandleFree_state *state = tevent_req_data(
735                 req, struct rpccli_epm_LookupHandleFree_state);
736         NTSTATUS status;
737
738         if (tevent_req_is_nterror(req, &status)) {
739                 tevent_req_received(req);
740                 return status;
741         }
742
743         /* Steal possbile out parameters to the callers context */
744         talloc_steal(mem_ctx, state->out_mem_ctx);
745
746         /* Return result */
747         *result = state->orig.out.result;
748
749         tevent_req_received(req);
750         return NT_STATUS_OK;
751 }
752
753 NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli,
754                                      TALLOC_CTX *mem_ctx,
755                                      struct policy_handle *entry_handle /* [in,out] [ref] */)
756 {
757         struct epm_LookupHandleFree r;
758         NTSTATUS status;
759
760         /* In parameters */
761         r.in.entry_handle = entry_handle;
762
763         status = cli->dispatch(cli,
764                                 mem_ctx,
765                                 &ndr_table_epmapper,
766                                 NDR_EPM_LOOKUPHANDLEFREE,
767                                 &r);
768
769         if (!NT_STATUS_IS_OK(status)) {
770                 return status;
771         }
772
773         if (NT_STATUS_IS_ERR(status)) {
774                 return status;
775         }
776
777         /* Return variables */
778         *entry_handle = *r.out.entry_handle;
779
780         /* Return result */
781         return NT_STATUS_OK;
782 }
783
784 struct rpccli_epm_InqObject_state {
785         struct epm_InqObject orig;
786         struct epm_InqObject tmp;
787         TALLOC_CTX *out_mem_ctx;
788         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
789 };
790
791 static void rpccli_epm_InqObject_done(struct tevent_req *subreq);
792
793 struct tevent_req *rpccli_epm_InqObject_send(TALLOC_CTX *mem_ctx,
794                                              struct tevent_context *ev,
795                                              struct rpc_pipe_client *cli,
796                                              struct GUID *_epm_object /* [in] [ref] */)
797 {
798         struct tevent_req *req;
799         struct rpccli_epm_InqObject_state *state;
800         struct tevent_req *subreq;
801
802         req = tevent_req_create(mem_ctx, &state,
803                                 struct rpccli_epm_InqObject_state);
804         if (req == NULL) {
805                 return NULL;
806         }
807         state->out_mem_ctx = NULL;
808         state->dispatch_recv = cli->dispatch_recv;
809
810         /* In parameters */
811         state->orig.in.epm_object = _epm_object;
812
813         /* Out parameters */
814
815         /* Result */
816         ZERO_STRUCT(state->orig.out.result);
817
818         /* make a temporary copy, that we pass to the dispatch function */
819         state->tmp = state->orig;
820
821         subreq = cli->dispatch_send(state, ev, cli,
822                                     &ndr_table_epmapper,
823                                     NDR_EPM_INQOBJECT,
824                                     &state->tmp);
825         if (tevent_req_nomem(subreq, req)) {
826                 return tevent_req_post(req, ev);
827         }
828         tevent_req_set_callback(subreq, rpccli_epm_InqObject_done, req);
829         return req;
830 }
831
832 static void rpccli_epm_InqObject_done(struct tevent_req *subreq)
833 {
834         struct tevent_req *req = tevent_req_callback_data(
835                 subreq, struct tevent_req);
836         struct rpccli_epm_InqObject_state *state = tevent_req_data(
837                 req, struct rpccli_epm_InqObject_state);
838         NTSTATUS status;
839         TALLOC_CTX *mem_ctx;
840
841         if (state->out_mem_ctx) {
842                 mem_ctx = state->out_mem_ctx;
843         } else {
844                 mem_ctx = state;
845         }
846
847         status = state->dispatch_recv(subreq, mem_ctx);
848         TALLOC_FREE(subreq);
849         if (!NT_STATUS_IS_OK(status)) {
850                 tevent_req_nterror(req, status);
851                 return;
852         }
853
854         /* Copy out parameters */
855
856         /* Copy result */
857         state->orig.out.result = state->tmp.out.result;
858
859         /* Reset temporary structure */
860         ZERO_STRUCT(state->tmp);
861
862         tevent_req_done(req);
863 }
864
865 NTSTATUS rpccli_epm_InqObject_recv(struct tevent_req *req,
866                                    TALLOC_CTX *mem_ctx,
867                                    uint32 *result)
868 {
869         struct rpccli_epm_InqObject_state *state = tevent_req_data(
870                 req, struct rpccli_epm_InqObject_state);
871         NTSTATUS status;
872
873         if (tevent_req_is_nterror(req, &status)) {
874                 tevent_req_received(req);
875                 return status;
876         }
877
878         /* Steal possbile out parameters to the callers context */
879         talloc_steal(mem_ctx, state->out_mem_ctx);
880
881         /* Return result */
882         *result = state->orig.out.result;
883
884         tevent_req_received(req);
885         return NT_STATUS_OK;
886 }
887
888 NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli,
889                               TALLOC_CTX *mem_ctx,
890                               struct GUID *epm_object /* [in] [ref] */)
891 {
892         struct epm_InqObject r;
893         NTSTATUS status;
894
895         /* In parameters */
896         r.in.epm_object = epm_object;
897
898         status = cli->dispatch(cli,
899                                 mem_ctx,
900                                 &ndr_table_epmapper,
901                                 NDR_EPM_INQOBJECT,
902                                 &r);
903
904         if (!NT_STATUS_IS_OK(status)) {
905                 return status;
906         }
907
908         if (NT_STATUS_IS_ERR(status)) {
909                 return status;
910         }
911
912         /* Return variables */
913
914         /* Return result */
915         return NT_STATUS_OK;
916 }
917
918 struct rpccli_epm_MgmtDelete_state {
919         struct epm_MgmtDelete orig;
920         struct epm_MgmtDelete tmp;
921         TALLOC_CTX *out_mem_ctx;
922         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
923 };
924
925 static void rpccli_epm_MgmtDelete_done(struct tevent_req *subreq);
926
927 struct tevent_req *rpccli_epm_MgmtDelete_send(TALLOC_CTX *mem_ctx,
928                                               struct tevent_context *ev,
929                                               struct rpc_pipe_client *cli,
930                                               uint32_t _object_speced /* [in]  */,
931                                               struct GUID *_object /* [in] [ptr] */,
932                                               struct epm_twr_t *_tower /* [in] [ptr] */)
933 {
934         struct tevent_req *req;
935         struct rpccli_epm_MgmtDelete_state *state;
936         struct tevent_req *subreq;
937
938         req = tevent_req_create(mem_ctx, &state,
939                                 struct rpccli_epm_MgmtDelete_state);
940         if (req == NULL) {
941                 return NULL;
942         }
943         state->out_mem_ctx = NULL;
944         state->dispatch_recv = cli->dispatch_recv;
945
946         /* In parameters */
947         state->orig.in.object_speced = _object_speced;
948         state->orig.in.object = _object;
949         state->orig.in.tower = _tower;
950
951         /* Out parameters */
952
953         /* Result */
954         ZERO_STRUCT(state->orig.out.result);
955
956         /* make a temporary copy, that we pass to the dispatch function */
957         state->tmp = state->orig;
958
959         subreq = cli->dispatch_send(state, ev, cli,
960                                     &ndr_table_epmapper,
961                                     NDR_EPM_MGMTDELETE,
962                                     &state->tmp);
963         if (tevent_req_nomem(subreq, req)) {
964                 return tevent_req_post(req, ev);
965         }
966         tevent_req_set_callback(subreq, rpccli_epm_MgmtDelete_done, req);
967         return req;
968 }
969
970 static void rpccli_epm_MgmtDelete_done(struct tevent_req *subreq)
971 {
972         struct tevent_req *req = tevent_req_callback_data(
973                 subreq, struct tevent_req);
974         struct rpccli_epm_MgmtDelete_state *state = tevent_req_data(
975                 req, struct rpccli_epm_MgmtDelete_state);
976         NTSTATUS status;
977         TALLOC_CTX *mem_ctx;
978
979         if (state->out_mem_ctx) {
980                 mem_ctx = state->out_mem_ctx;
981         } else {
982                 mem_ctx = state;
983         }
984
985         status = state->dispatch_recv(subreq, mem_ctx);
986         TALLOC_FREE(subreq);
987         if (!NT_STATUS_IS_OK(status)) {
988                 tevent_req_nterror(req, status);
989                 return;
990         }
991
992         /* Copy out parameters */
993
994         /* Copy result */
995         state->orig.out.result = state->tmp.out.result;
996
997         /* Reset temporary structure */
998         ZERO_STRUCT(state->tmp);
999
1000         tevent_req_done(req);
1001 }
1002
1003 NTSTATUS rpccli_epm_MgmtDelete_recv(struct tevent_req *req,
1004                                     TALLOC_CTX *mem_ctx,
1005                                     uint32 *result)
1006 {
1007         struct rpccli_epm_MgmtDelete_state *state = tevent_req_data(
1008                 req, struct rpccli_epm_MgmtDelete_state);
1009         NTSTATUS status;
1010
1011         if (tevent_req_is_nterror(req, &status)) {
1012                 tevent_req_received(req);
1013                 return status;
1014         }
1015
1016         /* Steal possbile out parameters to the callers context */
1017         talloc_steal(mem_ctx, state->out_mem_ctx);
1018
1019         /* Return result */
1020         *result = state->orig.out.result;
1021
1022         tevent_req_received(req);
1023         return NT_STATUS_OK;
1024 }
1025
1026 NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli,
1027                                TALLOC_CTX *mem_ctx,
1028                                uint32_t object_speced /* [in]  */,
1029                                struct GUID *object /* [in] [ptr] */,
1030                                struct epm_twr_t *tower /* [in] [ptr] */)
1031 {
1032         struct epm_MgmtDelete r;
1033         NTSTATUS status;
1034
1035         /* In parameters */
1036         r.in.object_speced = object_speced;
1037         r.in.object = object;
1038         r.in.tower = tower;
1039
1040         status = cli->dispatch(cli,
1041                                 mem_ctx,
1042                                 &ndr_table_epmapper,
1043                                 NDR_EPM_MGMTDELETE,
1044                                 &r);
1045
1046         if (!NT_STATUS_IS_OK(status)) {
1047                 return status;
1048         }
1049
1050         if (NT_STATUS_IS_ERR(status)) {
1051                 return status;
1052         }
1053
1054         /* Return variables */
1055
1056         /* Return result */
1057         return NT_STATUS_OK;
1058 }
1059
1060 struct rpccli_epm_MapAuth_state {
1061         struct epm_MapAuth orig;
1062         struct epm_MapAuth tmp;
1063         TALLOC_CTX *out_mem_ctx;
1064         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1065 };
1066
1067 static void rpccli_epm_MapAuth_done(struct tevent_req *subreq);
1068
1069 struct tevent_req *rpccli_epm_MapAuth_send(TALLOC_CTX *mem_ctx,
1070                                            struct tevent_context *ev,
1071                                            struct rpc_pipe_client *cli)
1072 {
1073         struct tevent_req *req;
1074         struct rpccli_epm_MapAuth_state *state;
1075         struct tevent_req *subreq;
1076
1077         req = tevent_req_create(mem_ctx, &state,
1078                                 struct rpccli_epm_MapAuth_state);
1079         if (req == NULL) {
1080                 return NULL;
1081         }
1082         state->out_mem_ctx = NULL;
1083         state->dispatch_recv = cli->dispatch_recv;
1084
1085         /* In parameters */
1086
1087         /* Out parameters */
1088
1089         /* Result */
1090         ZERO_STRUCT(state->orig.out.result);
1091
1092         /* make a temporary copy, that we pass to the dispatch function */
1093         state->tmp = state->orig;
1094
1095         subreq = cli->dispatch_send(state, ev, cli,
1096                                     &ndr_table_epmapper,
1097                                     NDR_EPM_MAPAUTH,
1098                                     &state->tmp);
1099         if (tevent_req_nomem(subreq, req)) {
1100                 return tevent_req_post(req, ev);
1101         }
1102         tevent_req_set_callback(subreq, rpccli_epm_MapAuth_done, req);
1103         return req;
1104 }
1105
1106 static void rpccli_epm_MapAuth_done(struct tevent_req *subreq)
1107 {
1108         struct tevent_req *req = tevent_req_callback_data(
1109                 subreq, struct tevent_req);
1110         struct rpccli_epm_MapAuth_state *state = tevent_req_data(
1111                 req, struct rpccli_epm_MapAuth_state);
1112         NTSTATUS status;
1113         TALLOC_CTX *mem_ctx;
1114
1115         if (state->out_mem_ctx) {
1116                 mem_ctx = state->out_mem_ctx;
1117         } else {
1118                 mem_ctx = state;
1119         }
1120
1121         status = state->dispatch_recv(subreq, mem_ctx);
1122         TALLOC_FREE(subreq);
1123         if (!NT_STATUS_IS_OK(status)) {
1124                 tevent_req_nterror(req, status);
1125                 return;
1126         }
1127
1128         /* Copy out parameters */
1129
1130         /* Copy result */
1131         state->orig.out.result = state->tmp.out.result;
1132
1133         /* Reset temporary structure */
1134         ZERO_STRUCT(state->tmp);
1135
1136         tevent_req_done(req);
1137 }
1138
1139 NTSTATUS rpccli_epm_MapAuth_recv(struct tevent_req *req,
1140                                  TALLOC_CTX *mem_ctx,
1141                                  uint32 *result)
1142 {
1143         struct rpccli_epm_MapAuth_state *state = tevent_req_data(
1144                 req, struct rpccli_epm_MapAuth_state);
1145         NTSTATUS status;
1146
1147         if (tevent_req_is_nterror(req, &status)) {
1148                 tevent_req_received(req);
1149                 return status;
1150         }
1151
1152         /* Steal possbile out parameters to the callers context */
1153         talloc_steal(mem_ctx, state->out_mem_ctx);
1154
1155         /* Return result */
1156         *result = state->orig.out.result;
1157
1158         tevent_req_received(req);
1159         return NT_STATUS_OK;
1160 }
1161
1162 NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli,
1163                             TALLOC_CTX *mem_ctx)
1164 {
1165         struct epm_MapAuth r;
1166         NTSTATUS status;
1167
1168         /* In parameters */
1169
1170         status = cli->dispatch(cli,
1171                                 mem_ctx,
1172                                 &ndr_table_epmapper,
1173                                 NDR_EPM_MAPAUTH,
1174                                 &r);
1175
1176         if (!NT_STATUS_IS_OK(status)) {
1177                 return status;
1178         }
1179
1180         if (NT_STATUS_IS_ERR(status)) {
1181                 return status;
1182         }
1183
1184         /* Return variables */
1185
1186         /* Return result */
1187         return NT_STATUS_OK;
1188 }
1189