1 /* client functions auto-generated by pidl */
5 #include "lib/util/tevent_ntstatus.h"
6 #include "bin/default/librpc/gen_ndr/ndr_backupkey.h"
7 #include "bin/default/librpc/gen_ndr/ndr_backupkey_c.h"
9 /* backupkey - client functions generated by pidl */
11 struct dcerpc_bkrp_BackupKey_r_state {
12 TALLOC_CTX *out_mem_ctx;
15 static void dcerpc_bkrp_BackupKey_r_done(struct tevent_req *subreq);
17 struct tevent_req *dcerpc_bkrp_BackupKey_r_send(TALLOC_CTX *mem_ctx,
18 struct tevent_context *ev,
19 struct dcerpc_binding_handle *h,
20 struct bkrp_BackupKey *r)
22 struct tevent_req *req;
23 struct dcerpc_bkrp_BackupKey_r_state *state;
24 struct tevent_req *subreq;
26 req = tevent_req_create(mem_ctx, &state,
27 struct dcerpc_bkrp_BackupKey_r_state);
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);
37 subreq = dcerpc_binding_handle_call_send(state, ev, h,
38 NULL, &ndr_table_backupkey,
39 NDR_BKRP_BACKUPKEY, state->out_mem_ctx, r);
40 if (tevent_req_nomem(subreq, req)) {
41 return tevent_req_post(req, ev);
43 tevent_req_set_callback(subreq, dcerpc_bkrp_BackupKey_r_done, req);
48 static void dcerpc_bkrp_BackupKey_r_done(struct tevent_req *subreq)
50 struct tevent_req *req =
51 tevent_req_callback_data(subreq,
55 status = dcerpc_binding_handle_call_recv(subreq);
57 if (tevent_req_nterror(req, status)) {
64 NTSTATUS dcerpc_bkrp_BackupKey_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
66 struct dcerpc_bkrp_BackupKey_r_state *state =
68 struct dcerpc_bkrp_BackupKey_r_state);
71 if (tevent_req_is_nterror(req, &status)) {
72 tevent_req_received(req);
76 talloc_steal(mem_ctx, state->out_mem_ctx);
78 tevent_req_received(req);
82 NTSTATUS dcerpc_bkrp_BackupKey_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct bkrp_BackupKey *r)
86 status = dcerpc_binding_handle_call(h,
87 NULL, &ndr_table_backupkey,
88 NDR_BKRP_BACKUPKEY, mem_ctx, r);
93 struct dcerpc_bkrp_BackupKey_state {
94 struct bkrp_BackupKey orig;
95 struct bkrp_BackupKey tmp;
96 TALLOC_CTX *out_mem_ctx;
99 static void dcerpc_bkrp_BackupKey_done(struct tevent_req *subreq);
101 struct tevent_req *dcerpc_bkrp_BackupKey_send(TALLOC_CTX *mem_ctx,
102 struct tevent_context *ev,
103 struct dcerpc_binding_handle *h,
104 struct GUID *_guidActionAgent /* [in] [ref] */,
105 uint8_t *_data_in /* [in] [ref,size_is(data_in_len)] */,
106 uint32_t _data_in_len /* [in] */,
107 uint8_t **_data_out /* [out] [ref,size_is(,*data_out_len)] */,
108 uint32_t *_data_out_len /* [out] [ref] */,
109 uint32_t _param /* [in] */)
111 struct tevent_req *req;
112 struct dcerpc_bkrp_BackupKey_state *state;
113 struct tevent_req *subreq;
115 req = tevent_req_create(mem_ctx, &state,
116 struct dcerpc_bkrp_BackupKey_state);
120 state->out_mem_ctx = NULL;
123 state->orig.in.guidActionAgent = _guidActionAgent;
124 state->orig.in.data_in = _data_in;
125 state->orig.in.data_in_len = _data_in_len;
126 state->orig.in.param = _param;
129 state->orig.out.data_out = _data_out;
130 state->orig.out.data_out_len = _data_out_len;
133 ZERO_STRUCT(state->orig.out.result);
135 state->out_mem_ctx = talloc_named_const(state, 0,
136 "dcerpc_bkrp_BackupKey_out_memory");
137 if (tevent_req_nomem(state->out_mem_ctx, req)) {
138 return tevent_req_post(req, ev);
141 /* make a temporary copy, that we pass to the dispatch function */
142 state->tmp = state->orig;
144 subreq = dcerpc_bkrp_BackupKey_r_send(state, ev, h, &state->tmp);
145 if (tevent_req_nomem(subreq, req)) {
146 return tevent_req_post(req, ev);
148 tevent_req_set_callback(subreq, dcerpc_bkrp_BackupKey_done, req);
152 static void dcerpc_bkrp_BackupKey_done(struct tevent_req *subreq)
154 struct tevent_req *req = tevent_req_callback_data(
155 subreq, struct tevent_req);
156 struct dcerpc_bkrp_BackupKey_state *state = tevent_req_data(
157 req, struct dcerpc_bkrp_BackupKey_state);
161 if (state->out_mem_ctx) {
162 mem_ctx = state->out_mem_ctx;
167 status = dcerpc_bkrp_BackupKey_r_recv(subreq, mem_ctx);
169 if (tevent_req_nterror(req, status)) {
173 /* Copy out parameters */
174 *state->orig.out.data_out = *state->tmp.out.data_out;
175 *state->orig.out.data_out_len = *state->tmp.out.data_out_len;
178 state->orig.out.result = state->tmp.out.result;
180 /* Reset temporary structure */
181 ZERO_STRUCT(state->tmp);
183 tevent_req_done(req);
186 NTSTATUS dcerpc_bkrp_BackupKey_recv(struct tevent_req *req,
190 struct dcerpc_bkrp_BackupKey_state *state = tevent_req_data(
191 req, struct dcerpc_bkrp_BackupKey_state);
194 if (tevent_req_is_nterror(req, &status)) {
195 tevent_req_received(req);
199 /* Steal possible out parameters to the callers context */
200 talloc_steal(mem_ctx, state->out_mem_ctx);
203 *result = state->orig.out.result;
205 tevent_req_received(req);
209 NTSTATUS dcerpc_bkrp_BackupKey(struct dcerpc_binding_handle *h,
211 struct GUID *_guidActionAgent /* [in] [ref] */,
212 uint8_t *_data_in /* [in] [ref,size_is(data_in_len)] */,
213 uint32_t _data_in_len /* [in] */,
214 uint8_t **_data_out /* [out] [ref,size_is(,*data_out_len)] */,
215 uint32_t *_data_out_len /* [out] [ref] */,
216 uint32_t _param /* [in] */,
219 struct bkrp_BackupKey r;
223 r.in.guidActionAgent = _guidActionAgent;
224 r.in.data_in = _data_in;
225 r.in.data_in_len = _data_in_len;
228 status = dcerpc_bkrp_BackupKey_r(h, mem_ctx, &r);
229 if (!NT_STATUS_IS_OK(status)) {
233 /* Return variables */
234 *_data_out = *r.out.data_out;
235 *_data_out_len = *r.out.data_out_len;
238 *result = r.out.result;