Merge branch 'master' of /home/tridge/samba/git/combined
[Samba/aatanasov.git] / librpc / gen_ndr / srv_initshutdown.c
blobc3d0a2f2edff9823e54cf01f5c97b5c75f1cbe8b
1 /*
2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
4 */
6 #include "includes.h"
7 #include "../librpc/gen_ndr/srv_initshutdown.h"
9 static bool api_initshutdown_Init(pipes_struct *p)
11 const struct ndr_interface_call *call;
12 struct ndr_pull *pull;
13 struct ndr_push *push;
14 enum ndr_err_code ndr_err;
15 DATA_BLOB blob;
16 struct initshutdown_Init *r;
18 call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INIT];
20 r = talloc(talloc_tos(), struct initshutdown_Init);
21 if (r == NULL) {
22 return false;
25 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26 talloc_free(r);
27 return false;
30 pull = ndr_pull_init_blob(&blob, r, NULL);
31 if (pull == NULL) {
32 talloc_free(r);
33 return false;
36 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37 ndr_err = call->ndr_pull(pull, NDR_IN, r);
38 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39 talloc_free(r);
40 return false;
43 if (DEBUGLEVEL >= 10) {
44 NDR_PRINT_IN_DEBUG(initshutdown_Init, r);
47 r->out.result = _initshutdown_Init(p, r);
49 if (p->rng_fault_state) {
50 talloc_free(r);
51 /* Return true here, srv_pipe_hnd.c will take care */
52 return true;
55 if (DEBUGLEVEL >= 10) {
56 NDR_PRINT_OUT_DEBUG(initshutdown_Init, r);
59 push = ndr_push_init_ctx(r, NULL);
60 if (push == NULL) {
61 talloc_free(r);
62 return false;
65 ndr_err = call->ndr_push(push, NDR_OUT, r);
66 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
67 talloc_free(r);
68 return false;
71 blob = ndr_push_blob(push);
72 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
73 talloc_free(r);
74 return false;
77 talloc_free(r);
79 return true;
82 static bool api_initshutdown_Abort(pipes_struct *p)
84 const struct ndr_interface_call *call;
85 struct ndr_pull *pull;
86 struct ndr_push *push;
87 enum ndr_err_code ndr_err;
88 DATA_BLOB blob;
89 struct initshutdown_Abort *r;
91 call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_ABORT];
93 r = talloc(talloc_tos(), struct initshutdown_Abort);
94 if (r == NULL) {
95 return false;
98 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
99 talloc_free(r);
100 return false;
103 pull = ndr_pull_init_blob(&blob, r, NULL);
104 if (pull == NULL) {
105 talloc_free(r);
106 return false;
109 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
110 ndr_err = call->ndr_pull(pull, NDR_IN, r);
111 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
112 talloc_free(r);
113 return false;
116 if (DEBUGLEVEL >= 10) {
117 NDR_PRINT_IN_DEBUG(initshutdown_Abort, r);
120 r->out.result = _initshutdown_Abort(p, r);
122 if (p->rng_fault_state) {
123 talloc_free(r);
124 /* Return true here, srv_pipe_hnd.c will take care */
125 return true;
128 if (DEBUGLEVEL >= 10) {
129 NDR_PRINT_OUT_DEBUG(initshutdown_Abort, r);
132 push = ndr_push_init_ctx(r, NULL);
133 if (push == NULL) {
134 talloc_free(r);
135 return false;
138 ndr_err = call->ndr_push(push, NDR_OUT, r);
139 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
140 talloc_free(r);
141 return false;
144 blob = ndr_push_blob(push);
145 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
146 talloc_free(r);
147 return false;
150 talloc_free(r);
152 return true;
155 static bool api_initshutdown_InitEx(pipes_struct *p)
157 const struct ndr_interface_call *call;
158 struct ndr_pull *pull;
159 struct ndr_push *push;
160 enum ndr_err_code ndr_err;
161 DATA_BLOB blob;
162 struct initshutdown_InitEx *r;
164 call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INITEX];
166 r = talloc(talloc_tos(), struct initshutdown_InitEx);
167 if (r == NULL) {
168 return false;
171 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
172 talloc_free(r);
173 return false;
176 pull = ndr_pull_init_blob(&blob, r, NULL);
177 if (pull == NULL) {
178 talloc_free(r);
179 return false;
182 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
183 ndr_err = call->ndr_pull(pull, NDR_IN, r);
184 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
185 talloc_free(r);
186 return false;
189 if (DEBUGLEVEL >= 10) {
190 NDR_PRINT_IN_DEBUG(initshutdown_InitEx, r);
193 r->out.result = _initshutdown_InitEx(p, r);
195 if (p->rng_fault_state) {
196 talloc_free(r);
197 /* Return true here, srv_pipe_hnd.c will take care */
198 return true;
201 if (DEBUGLEVEL >= 10) {
202 NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, r);
205 push = ndr_push_init_ctx(r, NULL);
206 if (push == NULL) {
207 talloc_free(r);
208 return false;
211 ndr_err = call->ndr_push(push, NDR_OUT, r);
212 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
213 talloc_free(r);
214 return false;
217 blob = ndr_push_blob(push);
218 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
219 talloc_free(r);
220 return false;
223 talloc_free(r);
225 return true;
229 /* Tables */
230 static struct api_struct api_initshutdown_cmds[] =
232 {"INITSHUTDOWN_INIT", NDR_INITSHUTDOWN_INIT, api_initshutdown_Init},
233 {"INITSHUTDOWN_ABORT", NDR_INITSHUTDOWN_ABORT, api_initshutdown_Abort},
234 {"INITSHUTDOWN_INITEX", NDR_INITSHUTDOWN_INITEX, api_initshutdown_InitEx},
237 void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns)
239 *fns = api_initshutdown_cmds;
240 *n_fns = sizeof(api_initshutdown_cmds) / sizeof(struct api_struct);
243 NTSTATUS rpc_initshutdown_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
245 if (cli->pipes_struct == NULL) {
246 return NT_STATUS_INVALID_PARAMETER;
249 switch (opnum)
251 case NDR_INITSHUTDOWN_INIT: {
252 struct initshutdown_Init *r = (struct initshutdown_Init *)_r;
253 r->out.result = _initshutdown_Init(cli->pipes_struct, r);
254 return NT_STATUS_OK;
257 case NDR_INITSHUTDOWN_ABORT: {
258 struct initshutdown_Abort *r = (struct initshutdown_Abort *)_r;
259 r->out.result = _initshutdown_Abort(cli->pipes_struct, r);
260 return NT_STATUS_OK;
263 case NDR_INITSHUTDOWN_INITEX: {
264 struct initshutdown_InitEx *r = (struct initshutdown_InitEx *)_r;
265 r->out.result = _initshutdown_InitEx(cli->pipes_struct, r);
266 return NT_STATUS_OK;
269 default:
270 return NT_STATUS_NOT_IMPLEMENTED;
274 NTSTATUS rpc_initshutdown_init(void)
276 return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "initshutdown", "initshutdown", &ndr_table_initshutdown, api_initshutdown_cmds, sizeof(api_initshutdown_cmds) / sizeof(struct api_struct));