Line data Source code
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_dssetup.h"
7 : #include "bin/default/librpc/gen_ndr/ndr_dssetup_c.h"
8 :
9 : /* dssetup - client functions generated by pidl */
10 :
11 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_state {
12 : TALLOC_CTX *out_mem_ctx;
13 : };
14 :
15 : static void dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_done(struct tevent_req *subreq);
16 :
17 0 : struct tevent_req *dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_send(TALLOC_CTX *mem_ctx,
18 : struct tevent_context *ev,
19 : struct dcerpc_binding_handle *h,
20 : struct dssetup_DsRoleGetPrimaryDomainInformation *r)
21 : {
22 0 : struct tevent_req *req;
23 0 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_state *state;
24 0 : struct tevent_req *subreq;
25 :
26 0 : req = tevent_req_create(mem_ctx, &state,
27 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_state);
28 0 : if (req == NULL) {
29 0 : return NULL;
30 : }
31 :
32 0 : state->out_mem_ctx = talloc_new(state);
33 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
34 0 : return tevent_req_post(req, ev);
35 : }
36 :
37 0 : subreq = dcerpc_binding_handle_call_send(state, ev, h,
38 : NULL, &ndr_table_dssetup,
39 0 : NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION, state->out_mem_ctx, r);
40 0 : if (tevent_req_nomem(subreq, req)) {
41 0 : return tevent_req_post(req, ev);
42 : }
43 0 : tevent_req_set_callback(subreq, dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_done, req);
44 :
45 0 : return req;
46 : }
47 :
48 0 : static void dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_done(struct tevent_req *subreq)
49 : {
50 0 : struct tevent_req *req =
51 0 : tevent_req_callback_data(subreq,
52 : struct tevent_req);
53 0 : NTSTATUS status;
54 :
55 0 : status = dcerpc_binding_handle_call_recv(subreq);
56 0 : TALLOC_FREE(subreq);
57 0 : if (tevent_req_nterror(req, status)) {
58 0 : return;
59 : }
60 :
61 0 : tevent_req_done(req);
62 : }
63 :
64 0 : NTSTATUS dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
65 : {
66 0 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_state *state =
67 0 : tevent_req_data(req,
68 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_state);
69 0 : NTSTATUS status;
70 :
71 0 : if (tevent_req_is_nterror(req, &status)) {
72 0 : tevent_req_received(req);
73 0 : return status;
74 : }
75 :
76 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
77 :
78 0 : tevent_req_received(req);
79 0 : return NT_STATUS_OK;
80 : }
81 :
82 90 : NTSTATUS dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct dssetup_DsRoleGetPrimaryDomainInformation *r)
83 : {
84 9 : NTSTATUS status;
85 :
86 90 : status = dcerpc_binding_handle_call(h,
87 : NULL, &ndr_table_dssetup,
88 : NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION, mem_ctx, r);
89 :
90 90 : return status;
91 : }
92 :
93 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_state {
94 : struct dssetup_DsRoleGetPrimaryDomainInformation orig;
95 : struct dssetup_DsRoleGetPrimaryDomainInformation tmp;
96 : TALLOC_CTX *out_mem_ctx;
97 : };
98 :
99 : static void dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_done(struct tevent_req *subreq);
100 :
101 0 : struct tevent_req *dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_send(TALLOC_CTX *mem_ctx,
102 : struct tevent_context *ev,
103 : struct dcerpc_binding_handle *h,
104 : enum dssetup_DsRoleInfoLevel _level /* [in] */,
105 : union dssetup_DsRoleInfo *_info /* [out] [switch_is(level),unique] */)
106 : {
107 0 : struct tevent_req *req;
108 0 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_state *state;
109 0 : struct tevent_req *subreq;
110 :
111 0 : req = tevent_req_create(mem_ctx, &state,
112 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_state);
113 0 : if (req == NULL) {
114 0 : return NULL;
115 : }
116 0 : state->out_mem_ctx = NULL;
117 :
118 : /* In parameters */
119 0 : state->orig.in.level = _level;
120 :
121 : /* Out parameters */
122 0 : state->orig.out.info = _info;
123 :
124 : /* Result */
125 0 : NDR_ZERO_STRUCT(state->orig.out.result);
126 :
127 0 : state->out_mem_ctx = talloc_named_const(state, 0,
128 : "dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_out_memory");
129 0 : if (tevent_req_nomem(state->out_mem_ctx, req)) {
130 0 : return tevent_req_post(req, ev);
131 : }
132 :
133 : /* make a temporary copy, that we pass to the dispatch function */
134 0 : state->tmp = state->orig;
135 :
136 0 : subreq = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_send(state, ev, h, &state->tmp);
137 0 : if (tevent_req_nomem(subreq, req)) {
138 0 : return tevent_req_post(req, ev);
139 : }
140 0 : tevent_req_set_callback(subreq, dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_done, req);
141 0 : return req;
142 : }
143 :
144 0 : static void dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_done(struct tevent_req *subreq)
145 : {
146 0 : struct tevent_req *req = tevent_req_callback_data(
147 : subreq, struct tevent_req);
148 0 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_state *state = tevent_req_data(
149 : req, struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_state);
150 0 : NTSTATUS status;
151 0 : TALLOC_CTX *mem_ctx;
152 :
153 0 : if (state->out_mem_ctx) {
154 0 : mem_ctx = state->out_mem_ctx;
155 : } else {
156 0 : mem_ctx = state;
157 : }
158 :
159 0 : status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r_recv(subreq, mem_ctx);
160 0 : TALLOC_FREE(subreq);
161 0 : if (tevent_req_nterror(req, status)) {
162 0 : return;
163 : }
164 :
165 : /* Copy out parameters */
166 0 : if (state->orig.out.info && state->tmp.out.info) {
167 0 : *state->orig.out.info = *state->tmp.out.info;
168 : }
169 :
170 : /* Copy result */
171 0 : state->orig.out.result = state->tmp.out.result;
172 :
173 : /* Reset temporary structure */
174 0 : NDR_ZERO_STRUCT(state->tmp);
175 :
176 0 : tevent_req_done(req);
177 : }
178 :
179 0 : NTSTATUS dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_recv(struct tevent_req *req,
180 : TALLOC_CTX *mem_ctx,
181 : WERROR *result)
182 : {
183 0 : struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_state *state = tevent_req_data(
184 : req, struct dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_state);
185 0 : NTSTATUS status;
186 :
187 0 : if (tevent_req_is_nterror(req, &status)) {
188 0 : tevent_req_received(req);
189 0 : return status;
190 : }
191 :
192 : /* Steal possible out parameters to the callers context */
193 0 : talloc_steal(mem_ctx, state->out_mem_ctx);
194 :
195 : /* Return result */
196 0 : *result = state->orig.out.result;
197 :
198 0 : tevent_req_received(req);
199 0 : return NT_STATUS_OK;
200 : }
201 :
202 0 : NTSTATUS dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(struct dcerpc_binding_handle *h,
203 : TALLOC_CTX *mem_ctx,
204 : enum dssetup_DsRoleInfoLevel _level /* [in] */,
205 : union dssetup_DsRoleInfo *_info /* [out] [switch_is(level),unique] */,
206 : WERROR *result)
207 : {
208 0 : struct dssetup_DsRoleGetPrimaryDomainInformation r;
209 0 : NTSTATUS status;
210 :
211 : /* In parameters */
212 0 : r.in.level = _level;
213 :
214 : /* Out parameters */
215 0 : r.out.info = _info;
216 :
217 : /* Result */
218 0 : NDR_ZERO_STRUCT(r.out.result);
219 :
220 0 : status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r(h, mem_ctx, &r);
221 0 : if (!NT_STATUS_IS_OK(status)) {
222 0 : return status;
223 : }
224 :
225 : /* Return variables */
226 0 : if (_info && r.out.info) {
227 0 : *_info = *r.out.info;
228 : }
229 :
230 : /* Return result */
231 0 : *result = r.out.result;
232 :
233 0 : return NT_STATUS_OK;
234 : }
235 :
|