1 /* client functions auto-generated by pidl */
5 #include "lib/util/tevent_ntstatus.h"
6 #include "bin/default/source4/librpc/gen_ndr/ndr_winsrepl.h"
7 #include "bin/default/source4/librpc/gen_ndr/ndr_winsrepl_c.h"
9 /* wrepl - client functions generated by pidl */
11 struct dcerpc_decode_winsrepl_r_state {
12 TALLOC_CTX *out_mem_ctx;
15 static void dcerpc_decode_winsrepl_r_done(struct tevent_req *subreq);
17 struct tevent_req *dcerpc_decode_winsrepl_r_send(TALLOC_CTX *mem_ctx,
18 struct tevent_context *ev,
19 struct dcerpc_binding_handle *h,
20 struct decode_winsrepl *r)
22 struct tevent_req *req;
23 struct dcerpc_decode_winsrepl_r_state *state;
24 struct tevent_req *subreq;
26 req = tevent_req_create(mem_ctx, &state,
27 struct dcerpc_decode_winsrepl_r_state);
32 state->out_mem_ctx = NULL;
34 subreq = dcerpc_binding_handle_call_send(state, ev, h,
35 NULL, &ndr_table_wrepl,
36 NDR_DECODE_WINSREPL, state, r);
37 if (tevent_req_nomem(subreq, req)) {
38 return tevent_req_post(req, ev);
40 tevent_req_set_callback(subreq, dcerpc_decode_winsrepl_r_done, req);
45 static void dcerpc_decode_winsrepl_r_done(struct tevent_req *subreq)
47 struct tevent_req *req =
48 tevent_req_callback_data(subreq,
52 status = dcerpc_binding_handle_call_recv(subreq);
54 if (tevent_req_nterror(req, status)) {
61 NTSTATUS dcerpc_decode_winsrepl_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
63 struct dcerpc_decode_winsrepl_r_state *state =
65 struct dcerpc_decode_winsrepl_r_state);
68 if (tevent_req_is_nterror(req, &status)) {
69 tevent_req_received(req);
73 talloc_steal(mem_ctx, state->out_mem_ctx);
75 tevent_req_received(req);
79 NTSTATUS dcerpc_decode_winsrepl_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct decode_winsrepl *r)
83 status = dcerpc_binding_handle_call(h,
84 NULL, &ndr_table_wrepl,
85 NDR_DECODE_WINSREPL, mem_ctx, r);
90 struct dcerpc_decode_winsrepl_state {
91 struct decode_winsrepl orig;
92 struct decode_winsrepl tmp;
93 TALLOC_CTX *out_mem_ctx;
96 static void dcerpc_decode_winsrepl_done(struct tevent_req *subreq);
98 struct tevent_req *dcerpc_decode_winsrepl_send(TALLOC_CTX *mem_ctx,
99 struct tevent_context *ev,
100 struct dcerpc_binding_handle *h,
101 struct wrepl_wrap _p /* [in] */)
103 struct tevent_req *req;
104 struct dcerpc_decode_winsrepl_state *state;
105 struct tevent_req *subreq;
107 req = tevent_req_create(mem_ctx, &state,
108 struct dcerpc_decode_winsrepl_state);
112 state->out_mem_ctx = NULL;
115 state->orig.in.p = _p;
119 /* make a temporary copy, that we pass to the dispatch function */
120 state->tmp = state->orig;
122 subreq = dcerpc_decode_winsrepl_r_send(state, ev, h, &state->tmp);
123 if (tevent_req_nomem(subreq, req)) {
124 return tevent_req_post(req, ev);
126 tevent_req_set_callback(subreq, dcerpc_decode_winsrepl_done, req);
130 static void dcerpc_decode_winsrepl_done(struct tevent_req *subreq)
132 struct tevent_req *req = tevent_req_callback_data(
133 subreq, struct tevent_req);
134 struct dcerpc_decode_winsrepl_state *state = tevent_req_data(
135 req, struct dcerpc_decode_winsrepl_state);
139 if (state->out_mem_ctx) {
140 mem_ctx = state->out_mem_ctx;
145 status = dcerpc_decode_winsrepl_r_recv(subreq, mem_ctx);
147 if (tevent_req_nterror(req, status)) {
151 /* Copy out parameters */
153 /* Reset temporary structure */
154 ZERO_STRUCT(state->tmp);
156 tevent_req_done(req);
159 NTSTATUS dcerpc_decode_winsrepl_recv(struct tevent_req *req,
162 struct dcerpc_decode_winsrepl_state *state = tevent_req_data(
163 req, struct dcerpc_decode_winsrepl_state);
166 if (tevent_req_is_nterror(req, &status)) {
167 tevent_req_received(req);
171 /* Steal possible out parameters to the callers context */
172 talloc_steal(mem_ctx, state->out_mem_ctx);
174 tevent_req_received(req);
178 NTSTATUS dcerpc_decode_winsrepl(struct dcerpc_binding_handle *h,
180 struct wrepl_wrap _p /* [in] */)
182 struct decode_winsrepl r;
188 status = dcerpc_decode_winsrepl_r(h, mem_ctx, &r);
189 if (!NT_STATUS_IS_OK(status)) {
193 /* Return variables */