r18690: Regenerate RPC files after pidl changes.
[kai/samba.git] / source3 / librpc / gen_ndr / srv_echo.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "librpc/gen_ndr/srv_echo.h"
8
9 static BOOL api_echo_AddOne(pipes_struct *p)
10 {
11         struct ndr_pull *pull;
12         struct ndr_push *push;
13         NTSTATUS status;
14         DATA_BLOB blob;
15         struct echo_AddOne r;
16         TALLOC_CTX *mem_ctx = talloc_init("api_echo_AddOne");
17         
18         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
19                 talloc_free(mem_ctx);
20                 return False;
21         }
22         
23         pull = ndr_pull_init_blob(&blob, mem_ctx);
24         if (pull == NULL)
25                 return False;
26         
27         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
28         status = ndr_pull_echo_AddOne(pull, NDR_IN, &r);
29         if (NT_STATUS_IS_ERR(status)) {
30                 talloc_free(mem_ctx);
31                 return False;
32         }
33         
34         ZERO_STRUCT(r.out);
35         r.out.out_data = talloc_size(mem_ctx, sizeof(*r.out.out_data));
36         if (r.out.out_data == NULL) {
37                 talloc_free(mem_ctx);
38                 return False;
39         }
40         
41         _echo_AddOne(p, r.in.in_data, r.out.out_data);
42         
43         push = ndr_push_init_ctx(mem_ctx);
44         if (push == NULL) {
45                 talloc_free(mem_ctx);
46                 return False;
47         }
48         
49         status = ndr_push_echo_AddOne(push, NDR_OUT, &r);
50         if (NT_STATUS_IS_ERR(status)) {
51                 talloc_free(mem_ctx);
52                 return False;
53         }
54         
55         blob = ndr_push_blob(push);
56         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
57                 talloc_free(mem_ctx);
58                 return False;
59         }
60         
61         talloc_free(mem_ctx);
62         
63         return True;
64 }
65
66 static BOOL api_echo_EchoData(pipes_struct *p)
67 {
68         struct ndr_pull *pull;
69         struct ndr_push *push;
70         NTSTATUS status;
71         DATA_BLOB blob;
72         struct echo_EchoData r;
73         TALLOC_CTX *mem_ctx = talloc_init("api_echo_EchoData");
74         
75         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
76                 talloc_free(mem_ctx);
77                 return False;
78         }
79         
80         pull = ndr_pull_init_blob(&blob, mem_ctx);
81         if (pull == NULL)
82                 return False;
83         
84         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
85         status = ndr_pull_echo_EchoData(pull, NDR_IN, &r);
86         if (NT_STATUS_IS_ERR(status)) {
87                 talloc_free(mem_ctx);
88                 return False;
89         }
90         
91         ZERO_STRUCT(r.out);
92         r.out.out_data = talloc_array_size(mem_ctx, sizeof(*r.out.out_data), r.in.len);
93         if (r.out.out_data == NULL) {
94                 talloc_free(mem_ctx);
95                 return False;
96         }
97         
98         _echo_EchoData(p, r.in.len, r.in.in_data, r.out.out_data);
99         
100         push = ndr_push_init_ctx(mem_ctx);
101         if (push == NULL) {
102                 talloc_free(mem_ctx);
103                 return False;
104         }
105         
106         status = ndr_push_echo_EchoData(push, NDR_OUT, &r);
107         if (NT_STATUS_IS_ERR(status)) {
108                 talloc_free(mem_ctx);
109                 return False;
110         }
111         
112         blob = ndr_push_blob(push);
113         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
114                 talloc_free(mem_ctx);
115                 return False;
116         }
117         
118         talloc_free(mem_ctx);
119         
120         return True;
121 }
122
123 static BOOL api_echo_SinkData(pipes_struct *p)
124 {
125         struct ndr_pull *pull;
126         struct ndr_push *push;
127         NTSTATUS status;
128         DATA_BLOB blob;
129         struct echo_SinkData r;
130         TALLOC_CTX *mem_ctx = talloc_init("api_echo_SinkData");
131         
132         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
133                 talloc_free(mem_ctx);
134                 return False;
135         }
136         
137         pull = ndr_pull_init_blob(&blob, mem_ctx);
138         if (pull == NULL)
139                 return False;
140         
141         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
142         status = ndr_pull_echo_SinkData(pull, NDR_IN, &r);
143         if (NT_STATUS_IS_ERR(status)) {
144                 talloc_free(mem_ctx);
145                 return False;
146         }
147         
148         _echo_SinkData(p, r.in.len, r.in.data);
149         
150         push = ndr_push_init_ctx(mem_ctx);
151         if (push == NULL) {
152                 talloc_free(mem_ctx);
153                 return False;
154         }
155         
156         status = ndr_push_echo_SinkData(push, NDR_OUT, &r);
157         if (NT_STATUS_IS_ERR(status)) {
158                 talloc_free(mem_ctx);
159                 return False;
160         }
161         
162         blob = ndr_push_blob(push);
163         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
164                 talloc_free(mem_ctx);
165                 return False;
166         }
167         
168         talloc_free(mem_ctx);
169         
170         return True;
171 }
172
173 static BOOL api_echo_SourceData(pipes_struct *p)
174 {
175         struct ndr_pull *pull;
176         struct ndr_push *push;
177         NTSTATUS status;
178         DATA_BLOB blob;
179         struct echo_SourceData r;
180         TALLOC_CTX *mem_ctx = talloc_init("api_echo_SourceData");
181         
182         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
183                 talloc_free(mem_ctx);
184                 return False;
185         }
186         
187         pull = ndr_pull_init_blob(&blob, mem_ctx);
188         if (pull == NULL)
189                 return False;
190         
191         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
192         status = ndr_pull_echo_SourceData(pull, NDR_IN, &r);
193         if (NT_STATUS_IS_ERR(status)) {
194                 talloc_free(mem_ctx);
195                 return False;
196         }
197         
198         ZERO_STRUCT(r.out);
199         r.out.data = talloc_array_size(mem_ctx, sizeof(*r.out.data), r.in.len);
200         if (r.out.data == NULL) {
201                 talloc_free(mem_ctx);
202                 return False;
203         }
204         
205         _echo_SourceData(p, r.in.len, r.out.data);
206         
207         push = ndr_push_init_ctx(mem_ctx);
208         if (push == NULL) {
209                 talloc_free(mem_ctx);
210                 return False;
211         }
212         
213         status = ndr_push_echo_SourceData(push, NDR_OUT, &r);
214         if (NT_STATUS_IS_ERR(status)) {
215                 talloc_free(mem_ctx);
216                 return False;
217         }
218         
219         blob = ndr_push_blob(push);
220         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
221                 talloc_free(mem_ctx);
222                 return False;
223         }
224         
225         talloc_free(mem_ctx);
226         
227         return True;
228 }
229
230 static BOOL api_echo_TestCall(pipes_struct *p)
231 {
232         struct ndr_pull *pull;
233         struct ndr_push *push;
234         NTSTATUS status;
235         DATA_BLOB blob;
236         struct echo_TestCall r;
237         TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall");
238         
239         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
240                 talloc_free(mem_ctx);
241                 return False;
242         }
243         
244         pull = ndr_pull_init_blob(&blob, mem_ctx);
245         if (pull == NULL)
246                 return False;
247         
248         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
249         status = ndr_pull_echo_TestCall(pull, NDR_IN, &r);
250         if (NT_STATUS_IS_ERR(status)) {
251                 talloc_free(mem_ctx);
252                 return False;
253         }
254         
255         ZERO_STRUCT(r.out);
256         r.out.s2 = talloc_size(mem_ctx, sizeof(*r.out.s2));
257         if (r.out.s2 == NULL) {
258                 talloc_free(mem_ctx);
259                 return False;
260         }
261         
262         _echo_TestCall(p, r.in.s1, r.out.s2);
263         
264         push = ndr_push_init_ctx(mem_ctx);
265         if (push == NULL) {
266                 talloc_free(mem_ctx);
267                 return False;
268         }
269         
270         status = ndr_push_echo_TestCall(push, NDR_OUT, &r);
271         if (NT_STATUS_IS_ERR(status)) {
272                 talloc_free(mem_ctx);
273                 return False;
274         }
275         
276         blob = ndr_push_blob(push);
277         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
278                 talloc_free(mem_ctx);
279                 return False;
280         }
281         
282         talloc_free(mem_ctx);
283         
284         return True;
285 }
286
287 static BOOL api_echo_TestCall2(pipes_struct *p)
288 {
289         struct ndr_pull *pull;
290         struct ndr_push *push;
291         NTSTATUS status;
292         DATA_BLOB blob;
293         struct echo_TestCall2 r;
294         TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall2");
295         
296         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
297                 talloc_free(mem_ctx);
298                 return False;
299         }
300         
301         pull = ndr_pull_init_blob(&blob, mem_ctx);
302         if (pull == NULL)
303                 return False;
304         
305         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
306         status = ndr_pull_echo_TestCall2(pull, NDR_IN, &r);
307         if (NT_STATUS_IS_ERR(status)) {
308                 talloc_free(mem_ctx);
309                 return False;
310         }
311         
312         ZERO_STRUCT(r.out);
313         r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
314         if (r.out.info == NULL) {
315                 talloc_free(mem_ctx);
316                 return False;
317         }
318         
319         r.out.result = _echo_TestCall2(p, r.in.level, r.out.info);
320         
321         push = ndr_push_init_ctx(mem_ctx);
322         if (push == NULL) {
323                 talloc_free(mem_ctx);
324                 return False;
325         }
326         
327         status = ndr_push_echo_TestCall2(push, NDR_OUT, &r);
328         if (NT_STATUS_IS_ERR(status)) {
329                 talloc_free(mem_ctx);
330                 return False;
331         }
332         
333         blob = ndr_push_blob(push);
334         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
335                 talloc_free(mem_ctx);
336                 return False;
337         }
338         
339         talloc_free(mem_ctx);
340         
341         return True;
342 }
343
344 static BOOL api_echo_TestSleep(pipes_struct *p)
345 {
346         struct ndr_pull *pull;
347         struct ndr_push *push;
348         NTSTATUS status;
349         DATA_BLOB blob;
350         struct echo_TestSleep r;
351         TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSleep");
352         
353         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
354                 talloc_free(mem_ctx);
355                 return False;
356         }
357         
358         pull = ndr_pull_init_blob(&blob, mem_ctx);
359         if (pull == NULL)
360                 return False;
361         
362         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
363         status = ndr_pull_echo_TestSleep(pull, NDR_IN, &r);
364         if (NT_STATUS_IS_ERR(status)) {
365                 talloc_free(mem_ctx);
366                 return False;
367         }
368         
369         r.out.result = _echo_TestSleep(p, r.in.seconds);
370         
371         push = ndr_push_init_ctx(mem_ctx);
372         if (push == NULL) {
373                 talloc_free(mem_ctx);
374                 return False;
375         }
376         
377         status = ndr_push_echo_TestSleep(push, NDR_OUT, &r);
378         if (NT_STATUS_IS_ERR(status)) {
379                 talloc_free(mem_ctx);
380                 return False;
381         }
382         
383         blob = ndr_push_blob(push);
384         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
385                 talloc_free(mem_ctx);
386                 return False;
387         }
388         
389         talloc_free(mem_ctx);
390         
391         return True;
392 }
393
394 static BOOL api_echo_TestEnum(pipes_struct *p)
395 {
396         struct ndr_pull *pull;
397         struct ndr_push *push;
398         NTSTATUS status;
399         DATA_BLOB blob;
400         struct echo_TestEnum r;
401         TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestEnum");
402         
403         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
404                 talloc_free(mem_ctx);
405                 return False;
406         }
407         
408         pull = ndr_pull_init_blob(&blob, mem_ctx);
409         if (pull == NULL)
410                 return False;
411         
412         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
413         status = ndr_pull_echo_TestEnum(pull, NDR_IN, &r);
414         if (NT_STATUS_IS_ERR(status)) {
415                 talloc_free(mem_ctx);
416                 return False;
417         }
418         
419         ZERO_STRUCT(r.out);
420         r.out.foo1 = r.in.foo1;
421         r.out.foo2 = r.in.foo2;
422         r.out.foo3 = r.in.foo3;
423         _echo_TestEnum(p, r.in.foo1, r.in.foo2, r.in.foo3);
424         
425         push = ndr_push_init_ctx(mem_ctx);
426         if (push == NULL) {
427                 talloc_free(mem_ctx);
428                 return False;
429         }
430         
431         status = ndr_push_echo_TestEnum(push, NDR_OUT, &r);
432         if (NT_STATUS_IS_ERR(status)) {
433                 talloc_free(mem_ctx);
434                 return False;
435         }
436         
437         blob = ndr_push_blob(push);
438         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
439                 talloc_free(mem_ctx);
440                 return False;
441         }
442         
443         talloc_free(mem_ctx);
444         
445         return True;
446 }
447
448 static BOOL api_echo_TestSurrounding(pipes_struct *p)
449 {
450         struct ndr_pull *pull;
451         struct ndr_push *push;
452         NTSTATUS status;
453         DATA_BLOB blob;
454         struct echo_TestSurrounding r;
455         TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSurrounding");
456         
457         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
458                 talloc_free(mem_ctx);
459                 return False;
460         }
461         
462         pull = ndr_pull_init_blob(&blob, mem_ctx);
463         if (pull == NULL)
464                 return False;
465         
466         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
467         status = ndr_pull_echo_TestSurrounding(pull, NDR_IN, &r);
468         if (NT_STATUS_IS_ERR(status)) {
469                 talloc_free(mem_ctx);
470                 return False;
471         }
472         
473         ZERO_STRUCT(r.out);
474         r.out.data = r.in.data;
475         _echo_TestSurrounding(p, r.in.data);
476         
477         push = ndr_push_init_ctx(mem_ctx);
478         if (push == NULL) {
479                 talloc_free(mem_ctx);
480                 return False;
481         }
482         
483         status = ndr_push_echo_TestSurrounding(push, NDR_OUT, &r);
484         if (NT_STATUS_IS_ERR(status)) {
485                 talloc_free(mem_ctx);
486                 return False;
487         }
488         
489         blob = ndr_push_blob(push);
490         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
491                 talloc_free(mem_ctx);
492                 return False;
493         }
494         
495         talloc_free(mem_ctx);
496         
497         return True;
498 }
499
500 static BOOL api_echo_TestDoublePointer(pipes_struct *p)
501 {
502         struct ndr_pull *pull;
503         struct ndr_push *push;
504         NTSTATUS status;
505         DATA_BLOB blob;
506         struct echo_TestDoublePointer r;
507         TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestDoublePointer");
508         
509         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
510                 talloc_free(mem_ctx);
511                 return False;
512         }
513         
514         pull = ndr_pull_init_blob(&blob, mem_ctx);
515         if (pull == NULL)
516                 return False;
517         
518         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
519         status = ndr_pull_echo_TestDoublePointer(pull, NDR_IN, &r);
520         if (NT_STATUS_IS_ERR(status)) {
521                 talloc_free(mem_ctx);
522                 return False;
523         }
524         
525         r.out.result = _echo_TestDoublePointer(p, r.in.data);
526         
527         push = ndr_push_init_ctx(mem_ctx);
528         if (push == NULL) {
529                 talloc_free(mem_ctx);
530                 return False;
531         }
532         
533         status = ndr_push_echo_TestDoublePointer(push, NDR_OUT, &r);
534         if (NT_STATUS_IS_ERR(status)) {
535                 talloc_free(mem_ctx);
536                 return False;
537         }
538         
539         blob = ndr_push_blob(push);
540         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
541                 talloc_free(mem_ctx);
542                 return False;
543         }
544         
545         talloc_free(mem_ctx);
546         
547         return True;
548 }
549
550
551 /* Tables */
552 static struct api_struct api_rpcecho_cmds[] = 
553 {
554         {"ECHO_ADDONE", DCERPC_ECHO_ADDONE, api_echo_AddOne},
555         {"ECHO_ECHODATA", DCERPC_ECHO_ECHODATA, api_echo_EchoData},
556         {"ECHO_SINKDATA", DCERPC_ECHO_SINKDATA, api_echo_SinkData},
557         {"ECHO_SOURCEDATA", DCERPC_ECHO_SOURCEDATA, api_echo_SourceData},
558         {"ECHO_TESTCALL", DCERPC_ECHO_TESTCALL, api_echo_TestCall},
559         {"ECHO_TESTCALL2", DCERPC_ECHO_TESTCALL2, api_echo_TestCall2},
560         {"ECHO_TESTSLEEP", DCERPC_ECHO_TESTSLEEP, api_echo_TestSleep},
561         {"ECHO_TESTENUM", DCERPC_ECHO_TESTENUM, api_echo_TestEnum},
562         {"ECHO_TESTSURROUNDING", DCERPC_ECHO_TESTSURROUNDING, api_echo_TestSurrounding},
563         {"ECHO_TESTDOUBLEPOINTER", DCERPC_ECHO_TESTDOUBLEPOINTER, api_echo_TestDoublePointer},
564 };
565
566 void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns)
567 {
568         *fns = api_rpcecho_cmds;
569         *n_fns = sizeof(api_rpcecho_cmds) / sizeof(struct api_struct);
570 }
571
572 NTSTATUS rpc_rpcecho_init(void)
573 {
574         return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct));
575 }