s3-spoolss: Move info_ctr conversion to a public helper.
[Samba/ekacnet.git] / librpc / gen_ndr / cli_initshutdown.c
blobebc0af5d2c676fc764e0540c6e27f9ca6f3db1bb
1 /*
2 * Unix SMB/CIFS implementation.
3 * client auto-generated by pidl. DO NOT MODIFY!
4 */
6 #include "includes.h"
7 #include "../librpc/gen_ndr/cli_initshutdown.h"
9 struct rpccli_initshutdown_Init_state {
10 struct initshutdown_Init orig;
11 struct initshutdown_Init tmp;
12 TALLOC_CTX *out_mem_ctx;
13 NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
16 static void rpccli_initshutdown_Init_done(struct tevent_req *subreq);
18 struct tevent_req *rpccli_initshutdown_Init_send(TALLOC_CTX *mem_ctx,
19 struct tevent_context *ev,
20 struct rpc_pipe_client *cli,
21 uint16_t *_hostname /* [in] [unique] */,
22 struct lsa_StringLarge *_message /* [in] [unique] */,
23 uint32_t _timeout /* [in] */,
24 uint8_t _force_apps /* [in] */,
25 uint8_t _do_reboot /* [in] */)
27 struct tevent_req *req;
28 struct rpccli_initshutdown_Init_state *state;
29 struct tevent_req *subreq;
31 req = tevent_req_create(mem_ctx, &state,
32 struct rpccli_initshutdown_Init_state);
33 if (req == NULL) {
34 return NULL;
36 state->out_mem_ctx = NULL;
37 state->dispatch_recv = cli->dispatch_recv;
39 /* In parameters */
40 state->orig.in.hostname = _hostname;
41 state->orig.in.message = _message;
42 state->orig.in.timeout = _timeout;
43 state->orig.in.force_apps = _force_apps;
44 state->orig.in.do_reboot = _do_reboot;
46 /* Out parameters */
48 /* Result */
49 ZERO_STRUCT(state->orig.out.result);
51 /* make a temporary copy, that we pass to the dispatch function */
52 state->tmp = state->orig;
54 subreq = cli->dispatch_send(state, ev, cli,
55 &ndr_table_initshutdown,
56 NDR_INITSHUTDOWN_INIT,
57 &state->tmp);
58 if (tevent_req_nomem(subreq, req)) {
59 return tevent_req_post(req, ev);
61 tevent_req_set_callback(subreq, rpccli_initshutdown_Init_done, req);
62 return req;
65 static void rpccli_initshutdown_Init_done(struct tevent_req *subreq)
67 struct tevent_req *req = tevent_req_callback_data(
68 subreq, struct tevent_req);
69 struct rpccli_initshutdown_Init_state *state = tevent_req_data(
70 req, struct rpccli_initshutdown_Init_state);
71 NTSTATUS status;
72 TALLOC_CTX *mem_ctx;
74 if (state->out_mem_ctx) {
75 mem_ctx = state->out_mem_ctx;
76 } else {
77 mem_ctx = state;
80 status = state->dispatch_recv(subreq, mem_ctx);
81 TALLOC_FREE(subreq);
82 if (!NT_STATUS_IS_OK(status)) {
83 tevent_req_nterror(req, status);
84 return;
87 /* Copy out parameters */
89 /* Copy result */
90 state->orig.out.result = state->tmp.out.result;
92 /* Reset temporary structure */
93 ZERO_STRUCT(state->tmp);
95 tevent_req_done(req);
98 NTSTATUS rpccli_initshutdown_Init_recv(struct tevent_req *req,
99 TALLOC_CTX *mem_ctx,
100 WERROR *result)
102 struct rpccli_initshutdown_Init_state *state = tevent_req_data(
103 req, struct rpccli_initshutdown_Init_state);
104 NTSTATUS status;
106 if (tevent_req_is_nterror(req, &status)) {
107 tevent_req_received(req);
108 return status;
111 /* Steal possbile out parameters to the callers context */
112 talloc_steal(mem_ctx, state->out_mem_ctx);
114 /* Return result */
115 *result = state->orig.out.result;
117 tevent_req_received(req);
118 return NT_STATUS_OK;
121 NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli,
122 TALLOC_CTX *mem_ctx,
123 uint16_t *hostname /* [in] [unique] */,
124 struct lsa_StringLarge *message /* [in] [unique] */,
125 uint32_t timeout /* [in] */,
126 uint8_t force_apps /* [in] */,
127 uint8_t do_reboot /* [in] */,
128 WERROR *werror)
130 struct initshutdown_Init r;
131 NTSTATUS status;
133 /* In parameters */
134 r.in.hostname = hostname;
135 r.in.message = message;
136 r.in.timeout = timeout;
137 r.in.force_apps = force_apps;
138 r.in.do_reboot = do_reboot;
140 status = cli->dispatch(cli,
141 mem_ctx,
142 &ndr_table_initshutdown,
143 NDR_INITSHUTDOWN_INIT,
144 &r);
146 if (!NT_STATUS_IS_OK(status)) {
147 return status;
150 if (NT_STATUS_IS_ERR(status)) {
151 return status;
154 /* Return variables */
156 /* Return result */
157 if (werror) {
158 *werror = r.out.result;
161 return werror_to_ntstatus(r.out.result);
164 struct rpccli_initshutdown_Abort_state {
165 struct initshutdown_Abort orig;
166 struct initshutdown_Abort tmp;
167 TALLOC_CTX *out_mem_ctx;
168 NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
171 static void rpccli_initshutdown_Abort_done(struct tevent_req *subreq);
173 struct tevent_req *rpccli_initshutdown_Abort_send(TALLOC_CTX *mem_ctx,
174 struct tevent_context *ev,
175 struct rpc_pipe_client *cli,
176 uint16_t *_server /* [in] [unique] */)
178 struct tevent_req *req;
179 struct rpccli_initshutdown_Abort_state *state;
180 struct tevent_req *subreq;
182 req = tevent_req_create(mem_ctx, &state,
183 struct rpccli_initshutdown_Abort_state);
184 if (req == NULL) {
185 return NULL;
187 state->out_mem_ctx = NULL;
188 state->dispatch_recv = cli->dispatch_recv;
190 /* In parameters */
191 state->orig.in.server = _server;
193 /* Out parameters */
195 /* Result */
196 ZERO_STRUCT(state->orig.out.result);
198 /* make a temporary copy, that we pass to the dispatch function */
199 state->tmp = state->orig;
201 subreq = cli->dispatch_send(state, ev, cli,
202 &ndr_table_initshutdown,
203 NDR_INITSHUTDOWN_ABORT,
204 &state->tmp);
205 if (tevent_req_nomem(subreq, req)) {
206 return tevent_req_post(req, ev);
208 tevent_req_set_callback(subreq, rpccli_initshutdown_Abort_done, req);
209 return req;
212 static void rpccli_initshutdown_Abort_done(struct tevent_req *subreq)
214 struct tevent_req *req = tevent_req_callback_data(
215 subreq, struct tevent_req);
216 struct rpccli_initshutdown_Abort_state *state = tevent_req_data(
217 req, struct rpccli_initshutdown_Abort_state);
218 NTSTATUS status;
219 TALLOC_CTX *mem_ctx;
221 if (state->out_mem_ctx) {
222 mem_ctx = state->out_mem_ctx;
223 } else {
224 mem_ctx = state;
227 status = state->dispatch_recv(subreq, mem_ctx);
228 TALLOC_FREE(subreq);
229 if (!NT_STATUS_IS_OK(status)) {
230 tevent_req_nterror(req, status);
231 return;
234 /* Copy out parameters */
236 /* Copy result */
237 state->orig.out.result = state->tmp.out.result;
239 /* Reset temporary structure */
240 ZERO_STRUCT(state->tmp);
242 tevent_req_done(req);
245 NTSTATUS rpccli_initshutdown_Abort_recv(struct tevent_req *req,
246 TALLOC_CTX *mem_ctx,
247 WERROR *result)
249 struct rpccli_initshutdown_Abort_state *state = tevent_req_data(
250 req, struct rpccli_initshutdown_Abort_state);
251 NTSTATUS status;
253 if (tevent_req_is_nterror(req, &status)) {
254 tevent_req_received(req);
255 return status;
258 /* Steal possbile out parameters to the callers context */
259 talloc_steal(mem_ctx, state->out_mem_ctx);
261 /* Return result */
262 *result = state->orig.out.result;
264 tevent_req_received(req);
265 return NT_STATUS_OK;
268 NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli,
269 TALLOC_CTX *mem_ctx,
270 uint16_t *server /* [in] [unique] */,
271 WERROR *werror)
273 struct initshutdown_Abort r;
274 NTSTATUS status;
276 /* In parameters */
277 r.in.server = server;
279 status = cli->dispatch(cli,
280 mem_ctx,
281 &ndr_table_initshutdown,
282 NDR_INITSHUTDOWN_ABORT,
283 &r);
285 if (!NT_STATUS_IS_OK(status)) {
286 return status;
289 if (NT_STATUS_IS_ERR(status)) {
290 return status;
293 /* Return variables */
295 /* Return result */
296 if (werror) {
297 *werror = r.out.result;
300 return werror_to_ntstatus(r.out.result);
303 struct rpccli_initshutdown_InitEx_state {
304 struct initshutdown_InitEx orig;
305 struct initshutdown_InitEx tmp;
306 TALLOC_CTX *out_mem_ctx;
307 NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
310 static void rpccli_initshutdown_InitEx_done(struct tevent_req *subreq);
312 struct tevent_req *rpccli_initshutdown_InitEx_send(TALLOC_CTX *mem_ctx,
313 struct tevent_context *ev,
314 struct rpc_pipe_client *cli,
315 uint16_t *_hostname /* [in] [unique] */,
316 struct lsa_StringLarge *_message /* [in] [unique] */,
317 uint32_t _timeout /* [in] */,
318 uint8_t _force_apps /* [in] */,
319 uint8_t _do_reboot /* [in] */,
320 uint32_t _reason /* [in] */)
322 struct tevent_req *req;
323 struct rpccli_initshutdown_InitEx_state *state;
324 struct tevent_req *subreq;
326 req = tevent_req_create(mem_ctx, &state,
327 struct rpccli_initshutdown_InitEx_state);
328 if (req == NULL) {
329 return NULL;
331 state->out_mem_ctx = NULL;
332 state->dispatch_recv = cli->dispatch_recv;
334 /* In parameters */
335 state->orig.in.hostname = _hostname;
336 state->orig.in.message = _message;
337 state->orig.in.timeout = _timeout;
338 state->orig.in.force_apps = _force_apps;
339 state->orig.in.do_reboot = _do_reboot;
340 state->orig.in.reason = _reason;
342 /* Out parameters */
344 /* Result */
345 ZERO_STRUCT(state->orig.out.result);
347 /* make a temporary copy, that we pass to the dispatch function */
348 state->tmp = state->orig;
350 subreq = cli->dispatch_send(state, ev, cli,
351 &ndr_table_initshutdown,
352 NDR_INITSHUTDOWN_INITEX,
353 &state->tmp);
354 if (tevent_req_nomem(subreq, req)) {
355 return tevent_req_post(req, ev);
357 tevent_req_set_callback(subreq, rpccli_initshutdown_InitEx_done, req);
358 return req;
361 static void rpccli_initshutdown_InitEx_done(struct tevent_req *subreq)
363 struct tevent_req *req = tevent_req_callback_data(
364 subreq, struct tevent_req);
365 struct rpccli_initshutdown_InitEx_state *state = tevent_req_data(
366 req, struct rpccli_initshutdown_InitEx_state);
367 NTSTATUS status;
368 TALLOC_CTX *mem_ctx;
370 if (state->out_mem_ctx) {
371 mem_ctx = state->out_mem_ctx;
372 } else {
373 mem_ctx = state;
376 status = state->dispatch_recv(subreq, mem_ctx);
377 TALLOC_FREE(subreq);
378 if (!NT_STATUS_IS_OK(status)) {
379 tevent_req_nterror(req, status);
380 return;
383 /* Copy out parameters */
385 /* Copy result */
386 state->orig.out.result = state->tmp.out.result;
388 /* Reset temporary structure */
389 ZERO_STRUCT(state->tmp);
391 tevent_req_done(req);
394 NTSTATUS rpccli_initshutdown_InitEx_recv(struct tevent_req *req,
395 TALLOC_CTX *mem_ctx,
396 WERROR *result)
398 struct rpccli_initshutdown_InitEx_state *state = tevent_req_data(
399 req, struct rpccli_initshutdown_InitEx_state);
400 NTSTATUS status;
402 if (tevent_req_is_nterror(req, &status)) {
403 tevent_req_received(req);
404 return status;
407 /* Steal possbile out parameters to the callers context */
408 talloc_steal(mem_ctx, state->out_mem_ctx);
410 /* Return result */
411 *result = state->orig.out.result;
413 tevent_req_received(req);
414 return NT_STATUS_OK;
417 NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli,
418 TALLOC_CTX *mem_ctx,
419 uint16_t *hostname /* [in] [unique] */,
420 struct lsa_StringLarge *message /* [in] [unique] */,
421 uint32_t timeout /* [in] */,
422 uint8_t force_apps /* [in] */,
423 uint8_t do_reboot /* [in] */,
424 uint32_t reason /* [in] */,
425 WERROR *werror)
427 struct initshutdown_InitEx r;
428 NTSTATUS status;
430 /* In parameters */
431 r.in.hostname = hostname;
432 r.in.message = message;
433 r.in.timeout = timeout;
434 r.in.force_apps = force_apps;
435 r.in.do_reboot = do_reboot;
436 r.in.reason = reason;
438 status = cli->dispatch(cli,
439 mem_ctx,
440 &ndr_table_initshutdown,
441 NDR_INITSHUTDOWN_INITEX,
442 &r);
444 if (!NT_STATUS_IS_OK(status)) {
445 return status;
448 if (NT_STATUS_IS_ERR(status)) {
449 return status;
452 /* Return variables */
454 /* Return result */
455 if (werror) {
456 *werror = r.out.result;
459 return werror_to_ntstatus(r.out.result);