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_browser_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_browser.h"
7 #include "bin/default/librpc/gen_ndr/ndr_browser_c.h"
8
9 /* browser - client functions generated by pidl */
10
11 struct dcerpc_BrowserrQueryOtherDomains_r_state {
12         TALLOC_CTX *out_mem_ctx;
13 };
14
15 static void dcerpc_BrowserrQueryOtherDomains_r_done(struct tevent_req *subreq);
16
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)
21 {
22         struct tevent_req *req;
23         struct dcerpc_BrowserrQueryOtherDomains_r_state *state;
24         struct tevent_req *subreq;
25
26         req = tevent_req_create(mem_ctx, &state,
27                                 struct dcerpc_BrowserrQueryOtherDomains_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_browser,
39                         NDR_BROWSERRQUERYOTHERDOMAINS, 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_BrowserrQueryOtherDomains_r_done, req);
44
45         return req;
46 }
47
48 static void dcerpc_BrowserrQueryOtherDomains_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_BrowserrQueryOtherDomains_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
65 {
66         struct dcerpc_BrowserrQueryOtherDomains_r_state *state =
67                 tevent_req_data(req,
68                 struct dcerpc_BrowserrQueryOtherDomains_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_BrowserrQueryOtherDomains_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct BrowserrQueryOtherDomains *r)
83 {
84         NTSTATUS status;
85
86         status = dcerpc_binding_handle_call(h,
87                         NULL, &ndr_table_browser,
88                         NDR_BROWSERRQUERYOTHERDOMAINS, mem_ctx, r);
89
90         return status;
91 }
92
93 struct dcerpc_BrowserrQueryOtherDomains_state {
94         struct BrowserrQueryOtherDomains orig;
95         struct BrowserrQueryOtherDomains tmp;
96         TALLOC_CTX *out_mem_ctx;
97 };
98
99 static void dcerpc_BrowserrQueryOtherDomains_done(struct tevent_req *subreq);
100
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] */)
107 {
108         struct tevent_req *req;
109         struct dcerpc_BrowserrQueryOtherDomains_state *state;
110         struct tevent_req *subreq;
111
112         req = tevent_req_create(mem_ctx, &state,
113                                 struct dcerpc_BrowserrQueryOtherDomains_state);
114         if (req == NULL) {
115                 return NULL;
116         }
117         state->out_mem_ctx = NULL;
118
119         /* In parameters */
120         state->orig.in.server_unc = _server_unc;
121         state->orig.in.info = _info;
122
123         /* Out parameters */
124         state->orig.out.info = _info;
125         state->orig.out.total_entries = _total_entries;
126
127         /* Result */
128         ZERO_STRUCT(state->orig.out.result);
129
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);
134         }
135
136         /* make a temporary copy, that we pass to the dispatch function */
137         state->tmp = state->orig;
138
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);
142         }
143         tevent_req_set_callback(subreq, dcerpc_BrowserrQueryOtherDomains_done, req);
144         return req;
145 }
146
147 static void dcerpc_BrowserrQueryOtherDomains_done(struct tevent_req *subreq)
148 {
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);
153         NTSTATUS status;
154         TALLOC_CTX *mem_ctx;
155
156         if (state->out_mem_ctx) {
157                 mem_ctx = state->out_mem_ctx;
158         } else {
159                 mem_ctx = state;
160         }
161
162         status = dcerpc_BrowserrQueryOtherDomains_r_recv(subreq, mem_ctx);
163         TALLOC_FREE(subreq);
164         if (tevent_req_nterror(req, status)) {
165                 return;
166         }
167
168         /* Copy out parameters */
169         *state->orig.out.info = *state->tmp.out.info;
170         *state->orig.out.total_entries = *state->tmp.out.total_entries;
171
172         /* Copy result */
173         state->orig.out.result = state->tmp.out.result;
174
175         /* Reset temporary structure */
176         ZERO_STRUCT(state->tmp);
177
178         tevent_req_done(req);
179 }
180
181 NTSTATUS dcerpc_BrowserrQueryOtherDomains_recv(struct tevent_req *req,
182                                                TALLOC_CTX *mem_ctx,
183                                                WERROR *result)
184 {
185         struct dcerpc_BrowserrQueryOtherDomains_state *state = tevent_req_data(
186                 req, struct dcerpc_BrowserrQueryOtherDomains_state);
187         NTSTATUS status;
188
189         if (tevent_req_is_nterror(req, &status)) {
190                 tevent_req_received(req);
191                 return status;
192         }
193
194         /* Steal possible out parameters to the callers context */
195         talloc_steal(mem_ctx, state->out_mem_ctx);
196
197         /* Return result */
198         *result = state->orig.out.result;
199
200         tevent_req_received(req);
201         return NT_STATUS_OK;
202 }
203
204 NTSTATUS dcerpc_BrowserrQueryOtherDomains(struct dcerpc_binding_handle *h,
205                                           TALLOC_CTX *mem_ctx,
206                                           const char *_server_unc /* [in] [unique,charset(UTF16)] */,
207                                           struct BrowserrSrvInfo *_info /* [in,out] [ref] */,
208                                           uint32_t *_total_entries /* [out] [ref] */,
209                                           WERROR *result)
210 {
211         struct BrowserrQueryOtherDomains r;
212         NTSTATUS status;
213
214         /* In parameters */
215         r.in.server_unc = _server_unc;
216         r.in.info = _info;
217
218         status = dcerpc_BrowserrQueryOtherDomains_r(h, mem_ctx, &r);
219         if (!NT_STATUS_IS_OK(status)) {
220                 return status;
221         }
222
223         /* Return variables */
224         *_info = *r.out.info;
225         *_total_entries = *r.out.total_entries;
226
227         /* Return result */
228         *result = r.out.result;
229
230         return NT_STATUS_OK;
231 }
232