pidl:NDR/Client: skip sync functions if pipe elements are used
[kai/samba.git] / pidl / lib / Parse / Pidl / Samba4 / NDR / Client.pm
index 2397f1a17d1070d266613330296a70ac6984cd4c..82dcc1dbec66fc9e91769d88f03bbba809790907 100644 (file)
@@ -12,6 +12,7 @@ use Exporter;
 
 use Parse::Pidl qw(fatal warning error);
 use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::NDR qw(ContainsPipe);
 use Parse::Pidl::Typelist qw(mapTypeName);
 use Parse::Pidl::Samba4 qw(choose_header is_intree DeclLong);
 use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv);
@@ -44,6 +45,17 @@ sub new($)
        bless($self, $class);
 }
 
+sub ParseFunctionHasPipes($$)
+{
+       my ($self, $fn) = @_;
+
+       foreach my $e (@{$fn->{ELEMENTS}}) {
+               return 1 if ContainsPipe($e, $e->{LEVELS}[0]);
+       }
+
+       return 0;
+}
+
 sub ParseFunction_r_State($$$$)
 {
        my ($self, $if, $fn, $name) = @_;
@@ -200,6 +212,17 @@ sub ParseFunction_r_Sync($$$$)
        my ($self, $if, $fn, $name) = @_;
        my $uname = uc $name;
 
+       if ($self->ParseFunctionHasPipes($fn)) {
+               $self->pidl_both("/*");
+               $self->pidl_both(" * The following function is skipped because");
+               $self->pidl_both(" * it uses pipes:");
+               $self->pidl_both(" *");
+               $self->pidl_both(" * dcerpc_$name\_r()");
+               $self->pidl_both(" */");
+               $self->pidl_both("");
+               return;
+       }
+
        my $proto = "NTSTATUS dcerpc_$name\_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct $name *r)";
 
        $self->fn_declare($proto);
@@ -622,6 +645,17 @@ sub ParseFunction_Sync($$$$)
 {
        my ($self, $if, $fn, $name) = @_;
 
+       if ($self->ParseFunctionHasPipes($fn)) {
+               $self->pidl_both("/*");
+               $self->pidl_both(" * The following function is skipped because");
+               $self->pidl_both(" * it uses pipes:");
+               $self->pidl_both(" *");
+               $self->pidl_both(" * dcerpc_$name()");
+               $self->pidl_both(" */");
+               $self->pidl_both("");
+               return;
+       }
+
        my $uname = uc $name;
        my $fn_args = "";
        my $fn_str = "NTSTATUS dcerpc_$name";