1 ###################################################
2 # server template function generator
3 # Copyright tridge@samba.org 2003
4 # released under the GNU GPL
6 package Parse::Pidl::Samba4::Template;
11 use Parse::Pidl::Util qw(genpad);
18 #####################################################################
19 # produce boilerplate code for a interface
22 my($interface) = shift;
23 my($data) = $interface->{DATA};
24 my $name = $interface->{NAME};
28 Unix SMB/CIFS implementation.
30 endpoint server for the $name pipe
32 Copyright (C) YOUR NAME HERE YEAR
34 This program is free software; you can redistribute it and/or modify
35 it under the terms of the GNU General Public License as published by
36 the Free Software Foundation; either version 3 of the License, or
37 (at your option) any later version.
39 This program is distributed in the hope that it will be useful,
40 but WITHOUT ANY WARRANTY; without even the implied warranty of
41 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 GNU General Public License for more details.
44 You should have received a copy of the GNU General Public License
45 along with this program. If not, see <http://www.gnu.org/licenses/>.
48 #include \"includes.h\"
49 #include \"rpc_server/dcerpc_server.h\"
50 #include \"librpc/gen_ndr/ndr_$name.h\"
51 #include \"rpc_server/common/common.h\"
55 foreach my $d (@{$data}) {
56 if ($d->{TYPE} eq "FUNCTION") {
57 my $fname = $d->{NAME};
58 my $pad = genpad("static $d->{RETURN_TYPE} dcesrv_$fname");
65 static $d->{RETURN_TYPE} dcesrv_$fname(struct dcesrv_call_state *dce_call,
66 $pad"."TALLOC_CTX *mem_ctx,
67 $pad"."struct $fname *r)
71 if ($d->{RETURN_TYPE} eq "void") {
72 $res .= "\tDCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR);\n";
74 $res .= "\tDCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);\n";
85 /* include the generated boilerplate */
86 #include \"librpc/gen_ndr/ndr_$name\_s.c\"
91 #####################################################################
92 # parse a parsed IDL structure back into an IDL file
97 foreach my $x (@{$idl}) {
98 ($x->{TYPE} eq "INTERFACE") &&