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