1 /* client functions auto-generated by pidl */
5 #include "lib/util/tevent_ntstatus.h"
6 #include "bin/default/librpc/gen_ndr/ndr_browser.h"
7 #include "bin/default/librpc/gen_ndr/ndr_browser_c.h"
9 /* browser - client functions generated by pidl */
11 struct dcerpc_BrowserrQueryOtherDomains_r_state {
12 TALLOC_CTX *out_mem_ctx;
15 static void dcerpc_BrowserrQueryOtherDomains_r_done(struct tevent_req *subreq);
17 struct tevent_req *dcerpc_BrowserrQueryOtherDomains_r_send(TALLOC_CTX *mem_ctx,
18 struct tevent_context *ev,
19 struct dcerpc_binding_handle *h,
20 struct BrowserrQueryOtherDomains *r)
22 struct tevent_req *req;
23 struct dcerpc_BrowserrQueryOtherDomains_r_state *state;
24 struct tevent_req *subreq;
26 req = tevent_req_create(mem_ctx, &state,
27 struct dcerpc_BrowserrQueryOtherDomains_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_browser,
39 NDR_BROWSERRQUERYOTHERDOMAINS, 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_BrowserrQueryOtherDomains_r_done, req);
48 static void dcerpc_BrowserrQueryOtherDomains_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_BrowserrQueryOtherDomains_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
66 struct dcerpc_BrowserrQueryOtherDomains_r_state *state =
68 struct dcerpc_BrowserrQueryOtherDomains_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_BrowserrQueryOtherDomains_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct BrowserrQueryOtherDomains *r)
86 status = dcerpc_binding_handle_call(h,
87 NULL, &ndr_table_browser,
88 NDR_BROWSERRQUERYOTHERDOMAINS, mem_ctx, r);
93 struct dcerpc_BrowserrQueryOtherDomains_state {
94 struct BrowserrQueryOtherDomains orig;
95 struct BrowserrQueryOtherDomains tmp;
96 TALLOC_CTX *out_mem_ctx;
99 static void dcerpc_BrowserrQueryOtherDomains_done(struct tevent_req *subreq);
101 struct tevent_req *dcerpc_BrowserrQueryOtherDomains_send(TALLOC_CTX *mem_ctx,
102 struct tevent_context *ev,
103 struct dcerpc_binding_handle *h,
104 const char *_server_unc /* [in] [unique,charset(UTF16)] */,
105 struct BrowserrSrvInfo *_info /* [in,out] [ref] */,
106 uint32_t *_total_entries /* [out] [ref] */)
108 struct tevent_req *req;
109 struct dcerpc_BrowserrQueryOtherDomains_state *state;
110 struct tevent_req *subreq;
112 req = tevent_req_create(mem_ctx, &state,
113 struct dcerpc_BrowserrQueryOtherDomains_state);
117 state->out_mem_ctx = NULL;
120 state->orig.in.server_unc = _server_unc;
121 state->orig.in.info = _info;
124 state->orig.out.info = _info;
125 state->orig.out.total_entries = _total_entries;
128 ZERO_STRUCT(state->orig.out.result);
130 state->out_mem_ctx = talloc_named_const(state, 0,
131 "dcerpc_BrowserrQueryOtherDomains_out_memory");
132 if (tevent_req_nomem(state->out_mem_ctx, req)) {
133 return tevent_req_post(req, ev);
136 /* make a temporary copy, that we pass to the dispatch function */
137 state->tmp = state->orig;
139 subreq = dcerpc_BrowserrQueryOtherDomains_r_send(state, ev, h, &state->tmp);
140 if (tevent_req_nomem(subreq, req)) {
141 return tevent_req_post(req, ev);
143 tevent_req_set_callback(subreq, dcerpc_BrowserrQueryOtherDomains_done, req);
147 static void dcerpc_BrowserrQueryOtherDomains_done(struct tevent_req *subreq)
149 struct tevent_req *req = tevent_req_callback_data(
150 subreq, struct tevent_req);
151 struct dcerpc_BrowserrQueryOtherDomains_state *state = tevent_req_data(
152 req, struct dcerpc_BrowserrQueryOtherDomains_state);
156 if (state->out_mem_ctx) {
157 mem_ctx = state->out_mem_ctx;
162 status = dcerpc_BrowserrQueryOtherDomains_r_recv(subreq, mem_ctx);
164 if (tevent_req_nterror(req, status)) {
168 /* Copy out parameters */
169 *state->orig.out.info = *state->tmp.out.info;
170 *state->orig.out.total_entries = *state->tmp.out.total_entries;
173 state->orig.out.result = state->tmp.out.result;
175 /* Reset temporary structure */
176 ZERO_STRUCT(state->tmp);
178 tevent_req_done(req);
181 NTSTATUS dcerpc_BrowserrQueryOtherDomains_recv(struct tevent_req *req,
185 struct dcerpc_BrowserrQueryOtherDomains_state *state = tevent_req_data(
186 req, struct dcerpc_BrowserrQueryOtherDomains_state);
189 if (tevent_req_is_nterror(req, &status)) {
190 tevent_req_received(req);
194 /* Steal possible out parameters to the callers context */
195 talloc_steal(mem_ctx, state->out_mem_ctx);
198 *result = state->orig.out.result;
200 tevent_req_received(req);
204 NTSTATUS dcerpc_BrowserrQueryOtherDomains(struct dcerpc_binding_handle *h,
206 const char *_server_unc /* [in] [unique,charset(UTF16)] */,
207 struct BrowserrSrvInfo *_info /* [in,out] [ref] */,
208 uint32_t *_total_entries /* [out] [ref] */,
211 struct BrowserrQueryOtherDomains r;
215 r.in.server_unc = _server_unc;
218 status = dcerpc_BrowserrQueryOtherDomains_r(h, mem_ctx, &r);
219 if (!NT_STATUS_IS_OK(status)) {
223 /* Return variables */
224 *_info = *r.out.info;
225 *_total_entries = *r.out.total_entries;
228 *result = r.out.result;