git add -f bin/default/librpc/gen_ndr/*.[ch] bin/default/source*/librpc/gen_ndr/...
[metze/samba/wip.git] / bin.gen_ndr / default / librpc / gen_ndr / ndr_remact_c.c
1 /* client functions auto-generated by pidl */
2
3 #include "includes.h"
4 #include <tevent.h>
5 #include "lib/util/tevent_ntstatus.h"
6 #include "bin/default/librpc/gen_ndr/ndr_remact.h"
7 #include "bin/default/librpc/gen_ndr/ndr_remact_c.h"
8
9 /* IRemoteActivation - client functions generated by pidl */
10
11 struct dcerpc_RemoteActivation_r_state {
12         TALLOC_CTX *out_mem_ctx;
13 };
14
15 static void dcerpc_RemoteActivation_r_done(struct tevent_req *subreq);
16
17 struct tevent_req *dcerpc_RemoteActivation_r_send(TALLOC_CTX *mem_ctx,
18         struct tevent_context *ev,
19         struct dcerpc_binding_handle *h,
20         struct RemoteActivation *r)
21 {
22         struct tevent_req *req;
23         struct dcerpc_RemoteActivation_r_state *state;
24         struct tevent_req *subreq;
25
26         req = tevent_req_create(mem_ctx, &state,
27                                 struct dcerpc_RemoteActivation_r_state);
28         if (req == NULL) {
29                 return NULL;
30         }
31
32         state->out_mem_ctx = talloc_new(state);
33         if (tevent_req_nomem(state->out_mem_ctx, req)) {
34                 return tevent_req_post(req, ev);
35         }
36
37         subreq = dcerpc_binding_handle_call_send(state, ev, h,
38                         NULL, &ndr_table_IRemoteActivation,
39                         NDR_REMOTEACTIVATION, state->out_mem_ctx, r);
40         if (tevent_req_nomem(subreq, req)) {
41                 return tevent_req_post(req, ev);
42         }
43         tevent_req_set_callback(subreq, dcerpc_RemoteActivation_r_done, req);
44
45         return req;
46 }
47
48 static void dcerpc_RemoteActivation_r_done(struct tevent_req *subreq)
49 {
50         struct tevent_req *req =
51                 tevent_req_callback_data(subreq,
52                 struct tevent_req);
53         NTSTATUS status;
54
55         status = dcerpc_binding_handle_call_recv(subreq);
56         TALLOC_FREE(subreq);
57         if (tevent_req_nterror(req, status)) {
58                 return;
59         }
60
61         tevent_req_done(req);
62 }
63
64 NTSTATUS dcerpc_RemoteActivation_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
65 {
66         struct dcerpc_RemoteActivation_r_state *state =
67                 tevent_req_data(req,
68                 struct dcerpc_RemoteActivation_r_state);
69         NTSTATUS status;
70
71         if (tevent_req_is_nterror(req, &status)) {
72                 tevent_req_received(req);
73                 return status;
74         }
75
76         talloc_steal(mem_ctx, state->out_mem_ctx);
77
78         tevent_req_received(req);
79         return NT_STATUS_OK;
80 }
81
82 NTSTATUS dcerpc_RemoteActivation_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct RemoteActivation *r)
83 {
84         NTSTATUS status;
85
86         status = dcerpc_binding_handle_call(h,
87                         NULL, &ndr_table_IRemoteActivation,
88                         NDR_REMOTEACTIVATION, mem_ctx, r);
89
90         return status;
91 }
92
93 struct dcerpc_RemoteActivation_state {
94         struct RemoteActivation orig;
95         struct RemoteActivation tmp;
96         TALLOC_CTX *out_mem_ctx;
97 };
98
99 static void dcerpc_RemoteActivation_done(struct tevent_req *subreq);
100
101 struct tevent_req *dcerpc_RemoteActivation_send(TALLOC_CTX *mem_ctx,
102                                                 struct tevent_context *ev,
103                                                 struct dcerpc_binding_handle *h,
104                                                 struct ORPCTHIS _this_object /* [in]  */,
105                                                 struct ORPCTHAT *_that /* [out] [ref] */,
106                                                 struct GUID _Clsid /* [in]  */,
107                                                 const char *_pwszObjectName /* [in] [ref,charset(UTF16)] */,
108                                                 struct MInterfacePointer *_pObjectStorage /* [in] [ref] */,
109                                                 uint32_t _ClientImpLevel /* [in]  */,
110                                                 uint32_t _Mode /* [in]  */,
111                                                 uint32_t _Interfaces /* [in] [range(1,32768)] */,
112                                                 struct GUID *_pIIDs /* [in] [ref,size_is(Interfaces)] */,
113                                                 uint16_t _num_protseqs /* [in]  */,
114                                                 uint16_t *_protseq /* [in] [size_is(num_protseqs)] */,
115                                                 uint64_t *_pOxid /* [out] [ref] */,
116                                                 struct DUALSTRINGARRAY *_pdsaOxidBindings /* [out] [ref] */,
117                                                 struct GUID *_ipidRemUnknown /* [out] [ref] */,
118                                                 uint32_t *_AuthnHint /* [out] [ref] */,
119                                                 struct COMVERSION *_ServerVersion /* [out] [ref] */,
120                                                 WERROR *_hr /* [out] [ref] */,
121                                                 struct MInterfacePointer **_ifaces /* [out] [ref,size_is(Interfaces)] */,
122                                                 WERROR *_results /* [out] [size_is(Interfaces)] */)
123 {
124         struct tevent_req *req;
125         struct dcerpc_RemoteActivation_state *state;
126         struct tevent_req *subreq;
127
128         req = tevent_req_create(mem_ctx, &state,
129                                 struct dcerpc_RemoteActivation_state);
130         if (req == NULL) {
131                 return NULL;
132         }
133         state->out_mem_ctx = NULL;
134
135         /* In parameters */
136         state->orig.in.this_object = _this_object;
137         state->orig.in.Clsid = _Clsid;
138         state->orig.in.pwszObjectName = _pwszObjectName;
139         state->orig.in.pObjectStorage = _pObjectStorage;
140         state->orig.in.ClientImpLevel = _ClientImpLevel;
141         state->orig.in.Mode = _Mode;
142         state->orig.in.Interfaces = _Interfaces;
143         state->orig.in.pIIDs = _pIIDs;
144         state->orig.in.num_protseqs = _num_protseqs;
145         state->orig.in.protseq = _protseq;
146
147         /* Out parameters */
148         state->orig.out.that = _that;
149         state->orig.out.pOxid = _pOxid;
150         state->orig.out.pdsaOxidBindings = _pdsaOxidBindings;
151         state->orig.out.ipidRemUnknown = _ipidRemUnknown;
152         state->orig.out.AuthnHint = _AuthnHint;
153         state->orig.out.ServerVersion = _ServerVersion;
154         state->orig.out.hr = _hr;
155         state->orig.out.ifaces = _ifaces;
156         state->orig.out.results = _results;
157
158         /* Result */
159         ZERO_STRUCT(state->orig.out.result);
160
161         state->out_mem_ctx = talloc_named_const(state, 0,
162                              "dcerpc_RemoteActivation_out_memory");
163         if (tevent_req_nomem(state->out_mem_ctx, req)) {
164                 return tevent_req_post(req, ev);
165         }
166
167         /* make a temporary copy, that we pass to the dispatch function */
168         state->tmp = state->orig;
169
170         subreq = dcerpc_RemoteActivation_r_send(state, ev, h, &state->tmp);
171         if (tevent_req_nomem(subreq, req)) {
172                 return tevent_req_post(req, ev);
173         }
174         tevent_req_set_callback(subreq, dcerpc_RemoteActivation_done, req);
175         return req;
176 }
177
178 static void dcerpc_RemoteActivation_done(struct tevent_req *subreq)
179 {
180         struct tevent_req *req = tevent_req_callback_data(
181                 subreq, struct tevent_req);
182         struct dcerpc_RemoteActivation_state *state = tevent_req_data(
183                 req, struct dcerpc_RemoteActivation_state);
184         NTSTATUS status;
185         TALLOC_CTX *mem_ctx;
186
187         if (state->out_mem_ctx) {
188                 mem_ctx = state->out_mem_ctx;
189         } else {
190                 mem_ctx = state;
191         }
192
193         status = dcerpc_RemoteActivation_r_recv(subreq, mem_ctx);
194         TALLOC_FREE(subreq);
195         if (tevent_req_nterror(req, status)) {
196                 return;
197         }
198
199         /* Copy out parameters */
200         *state->orig.out.that = *state->tmp.out.that;
201         *state->orig.out.pOxid = *state->tmp.out.pOxid;
202         *state->orig.out.pdsaOxidBindings = *state->tmp.out.pdsaOxidBindings;
203         *state->orig.out.ipidRemUnknown = *state->tmp.out.ipidRemUnknown;
204         *state->orig.out.AuthnHint = *state->tmp.out.AuthnHint;
205         *state->orig.out.ServerVersion = *state->tmp.out.ServerVersion;
206         *state->orig.out.hr = *state->tmp.out.hr;
207         {
208                 size_t _copy_len_ifaces;
209                 _copy_len_ifaces = state->tmp.in.Interfaces;
210                 memcpy(state->orig.out.ifaces, state->tmp.out.ifaces, _copy_len_ifaces * sizeof(*state->orig.out.ifaces));
211         }
212         {
213                 size_t _copy_len_results;
214                 _copy_len_results = state->tmp.in.Interfaces;
215                 memcpy(state->orig.out.results, state->tmp.out.results, _copy_len_results * sizeof(*state->orig.out.results));
216         }
217
218         /* Copy result */
219         state->orig.out.result = state->tmp.out.result;
220
221         /* Reset temporary structure */
222         ZERO_STRUCT(state->tmp);
223
224         tevent_req_done(req);
225 }
226
227 NTSTATUS dcerpc_RemoteActivation_recv(struct tevent_req *req,
228                                       TALLOC_CTX *mem_ctx,
229                                       WERROR *result)
230 {
231         struct dcerpc_RemoteActivation_state *state = tevent_req_data(
232                 req, struct dcerpc_RemoteActivation_state);
233         NTSTATUS status;
234
235         if (tevent_req_is_nterror(req, &status)) {
236                 tevent_req_received(req);
237                 return status;
238         }
239
240         /* Steal possible out parameters to the callers context */
241         talloc_steal(mem_ctx, state->out_mem_ctx);
242
243         /* Return result */
244         *result = state->orig.out.result;
245
246         tevent_req_received(req);
247         return NT_STATUS_OK;
248 }
249
250 NTSTATUS dcerpc_RemoteActivation(struct dcerpc_binding_handle *h,
251                                  TALLOC_CTX *mem_ctx,
252                                  struct ORPCTHIS _this_object /* [in]  */,
253                                  struct ORPCTHAT *_that /* [out] [ref] */,
254                                  struct GUID _Clsid /* [in]  */,
255                                  const char *_pwszObjectName /* [in] [ref,charset(UTF16)] */,
256                                  struct MInterfacePointer *_pObjectStorage /* [in] [ref] */,
257                                  uint32_t _ClientImpLevel /* [in]  */,
258                                  uint32_t _Mode /* [in]  */,
259                                  uint32_t _Interfaces /* [in] [range(1,32768)] */,
260                                  struct GUID *_pIIDs /* [in] [ref,size_is(Interfaces)] */,
261                                  uint16_t _num_protseqs /* [in]  */,
262                                  uint16_t *_protseq /* [in] [size_is(num_protseqs)] */,
263                                  uint64_t *_pOxid /* [out] [ref] */,
264                                  struct DUALSTRINGARRAY *_pdsaOxidBindings /* [out] [ref] */,
265                                  struct GUID *_ipidRemUnknown /* [out] [ref] */,
266                                  uint32_t *_AuthnHint /* [out] [ref] */,
267                                  struct COMVERSION *_ServerVersion /* [out] [ref] */,
268                                  WERROR *_hr /* [out] [ref] */,
269                                  struct MInterfacePointer **_ifaces /* [out] [ref,size_is(Interfaces)] */,
270                                  WERROR *_results /* [out] [size_is(Interfaces)] */,
271                                  WERROR *result)
272 {
273         struct RemoteActivation r;
274         NTSTATUS status;
275
276         /* In parameters */
277         r.in.this_object = _this_object;
278         r.in.Clsid = _Clsid;
279         r.in.pwszObjectName = _pwszObjectName;
280         r.in.pObjectStorage = _pObjectStorage;
281         r.in.ClientImpLevel = _ClientImpLevel;
282         r.in.Mode = _Mode;
283         r.in.Interfaces = _Interfaces;
284         r.in.pIIDs = _pIIDs;
285         r.in.num_protseqs = _num_protseqs;
286         r.in.protseq = _protseq;
287
288         status = dcerpc_RemoteActivation_r(h, mem_ctx, &r);
289         if (!NT_STATUS_IS_OK(status)) {
290                 return status;
291         }
292
293         /* Return variables */
294         *_that = *r.out.that;
295         *_pOxid = *r.out.pOxid;
296         *_pdsaOxidBindings = *r.out.pdsaOxidBindings;
297         *_ipidRemUnknown = *r.out.ipidRemUnknown;
298         *_AuthnHint = *r.out.AuthnHint;
299         *_ServerVersion = *r.out.ServerVersion;
300         *_hr = *r.out.hr;
301         {
302                 size_t _copy_len_ifaces;
303                 _copy_len_ifaces = r.in.Interfaces;
304                 memcpy(_ifaces, r.out.ifaces, _copy_len_ifaces * sizeof(*_ifaces));
305         }
306         {
307                 size_t _copy_len_results;
308                 _copy_len_results = r.in.Interfaces;
309                 memcpy(_results, r.out.results, _copy_len_results * sizeof(*_results));
310         }
311
312         /* Return result */
313         *result = r.out.result;
314
315         return NT_STATUS_OK;
316 }
317