r21433: Get rid of the COM support code - it's not used and unmaintained. We can
authorJelmer Vernooij <jelmer@samba.org>
Sun, 18 Feb 2007 18:44:56 +0000 (18:44 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:48:33 +0000 (14:48 -0500)
always bring it back if we need to. This code was getting in the way while
refactoring.

Add some tests for TDR.

Get rid of typedef in lib/registry/tdr_regf.idl and fix the
TDR code to be able to deal with it.
(This used to be commit 1ad0f99a439f0d52a735b391bf9900d50171aca5)

23 files changed:
source4/lib/registry/regf.idl
source4/librpc/config.mk
source4/librpc/idl/dcom.idl [deleted file]
source4/librpc/idl/oxidresolver.idl
source4/librpc/idl/remact.idl
source4/pidl/lib/Parse/Pidl/ODL.pm [deleted file]
source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
source4/pidl/lib/Parse/Pidl/Samba4.pm
source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm [deleted file]
source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm [deleted file]
source4/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm [deleted file]
source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
source4/pidl/lib/Parse/Pidl/Samba4/SWIG.pm
source4/pidl/lib/Parse/Pidl/Samba4/TDR.pm
source4/pidl/lib/Parse/Pidl/Typelist.pm
source4/pidl/pidl
source4/pidl/tests/tdr.pl [new file with mode: 0755]
source4/script/build_idl.sh
source4/torture/rpc/oxidresolve.c
source4/torture/rpc/remact.c

index 48a34462e61691406540e59a0463e63d2d97d383..e313dfc4dad74706b44cba33984b7be5ec9f4bf7 100644 (file)
@@ -22,12 +22,12 @@ interface regf
         * 1.5.0.1 for WinXP
         */
        
-       typedef [noprint] struct {
+       [noprint] struct regf_version {
                [value(1)] uint32 major; 
                [value(3)] uint32 minor;
                [value(0)] uint32 release;
                [value(1)] uint32 build;
-       } regf_version;
+       };
 
        /* 
                "regf" is obviously the abbreviation for "Registry file". "regf" is the
@@ -36,7 +36,7 @@ interface regf
                the first 0x200 bytes only!
         */
        
-       typedef [public,noprint] struct {
+       [public,noprint] struct regf_hdr {
                [charset(DOS)] uint8 REGF_ID[4];     /* 'regf' */
                uint32 update_counter1;
                uint32 update_counter2;
@@ -49,14 +49,14 @@ interface regf
                uint32 padding[83];                                     /* Padding */
                /* Checksum of first 0x200 bytes XOR-ed */
                uint32 chksum;  
-       } regf_hdr;
+       };
 
        /* 
                hbin probably means hive-bin (i.e. hive-container)
                This block is always a multiple
                of 4kb in size.
      */
-       typedef [public,noprint] struct {
+       [public,noprint] struct hbin_block {
                [charset(DOS)] uint8 HBIN_ID[4]; /* hbin */
                uint32 offset_from_first; /* Offset from 1st hbin-Block */
                uint32 offset_to_next;    /* Offset to the next hbin-Block */
@@ -71,19 +71,19 @@ interface regf
                        uint8_t data[length];  
                                Free space marker if 0xffffffff
             */
-       } hbin_block;
+       };
 
-       typedef [base_type(uint16),noprint] enum { 
+       [base_type(uint16),noprint] enum reg_key_type { 
                REG_ROOT_KEY = 0x20, 
                REG_SUB_KEY  = 0x2C, 
                REG_SYM_LINK = 0x10 
-       } reg_key_type;
+       };
 
        /*
       The nk-record can be treated as a combination of tree-record and
       key-record of the win 95 registry.
        */
-       typedef [public,noprint] struct {
+       [public,noprint] struct nk_block {
                [charset(DOS)] uint8 header[2];
                reg_key_type type;
                NTTIME last_change;
@@ -101,10 +101,10 @@ interface regf
                [value(strlen(key_name))] uint16 name_length;
                uint16 clsname_length;
                [charset(DOS)] uint8 key_name[name_length];  
-       } nk_block;
+       };
 
        /* sk (? Security Key ?) is the ACL of the registry. */
-       typedef [noprint,public] struct {
+       [noprint,public] struct sk_block {
                [charset(DOS)] uint8 header[2];
                uint16 tag;
                uint32 prev_offset;
@@ -112,34 +112,34 @@ interface regf
                uint32 ref_cnt;
                uint32 rec_size;
                uint8 sec_desc[rec_size]; 
-       } sk_block;
+       };
 
-       typedef [noprint] struct {
+       [noprint] struct lh_hash {
                        uint32 nk_offset;
                        uint32 base37; /* base37 of key name */
-       } lh_hash;
+       };
        
        /* Subkey listing with hash of first 4 characters */
-       typedef [public,noprint] struct {
+       [public,noprint] struct lh_block {
                [charset(DOS)] uint8 header[2];
                uint16 key_count;
                lh_hash hr[key_count];
-       } lh_block;
+       };
 
-       typedef [public,noprint] struct {
+       [public,noprint] struct li_block {
                [charset(DOS)] uint8 header[2];
                uint16 key_count;
                uint32 nk_offset[key_count];
-       } li_block;
+       };
 
-       typedef [public,noprint] struct {
+       [public,noprint] struct ri_block {
                [charset(DOS)] uint8 header[2];
                uint16 key_count;
                uint32 offset[key_count]; /* li/lh offset */
-       } ri_block;
+       };
 
        /* The vk-record consists information to a single value (value key). */
-       typedef [public,noprint] struct {
+       [public,noprint] struct vk_block {
                [charset(DOS)] uint8 header[2];
                [value(strlen(data_name))] uint16 name_length;
                uint32 data_length;    /* If top-bit set, offset contains the data */
@@ -148,20 +148,20 @@ interface regf
                uint16 flag;        /* =1, has name, else no name (=Default). */
                uint16 unk1;
                [charset(DOS)] uint8 data_name[name_length];
-       } vk_block;
+       };
 
-       typedef [noprint] struct {
+       [noprint] struct hash_record {
                uint32 nk_offset;
                [charset(DOS)] uint8 hash[4];
-       } hash_record;
+       };
 
        /*
       The lf-record is the counterpart to the RGKN-record (the
       hash-function)
        */
-       typedef [public,noprint] struct {
+       [public,noprint] struct lf_block {
                [charset(DOS)] uint8 header[2];
                uint16 key_count;
                hash_record hr[key_count];  /* Array of hash records, depending on key_count */
-       } lf_block;
+       };
 }
index 07a884661cfc7e656299f7361b772d03e8fe3e3a..c1a9d209b6a828824eac491b6e2c032897483020 100644 (file)
@@ -183,10 +183,6 @@ PUBLIC_DEPENDENCIES = LIBNDR
 OBJ_FILES = gen_ndr/ndr_protected_storage.o
 PUBLIC_DEPENDENCIES = LIBNDR
 
-[SUBSYSTEM::NDR_DCOM]
-OBJ_FILES = gen_ndr/ndr_dcom.o
-PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC
-
 [SUBSYSTEM::NDR_ORPC]
 OBJ_FILES = gen_ndr/ndr_orpc.o ndr/ndr_orpc.o 
 PUBLIC_DEPENDENCIES = LIBNDR 
@@ -285,7 +281,7 @@ PUBLIC_DEPENDENCIES = \
        NDR_REMACT NDR_WZCSVC NDR_BROWSER NDR_W32TIME NDR_SCERPC NDR_NTSVCS \
        NDR_NETLOGON NDR_TRKWKS NDR_KEYSVC NDR_KRB5PAC NDR_XATTR NDR_SCHANNEL \
        NDR_ROT NDR_DRSBLOBS NDR_SVCCTL NDR_NBT NDR_WINSREPL NDR_SECURITY \
-       NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_DCOM NDR_OPENDB \
+       NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_OPENDB \
        NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI NDR_NFS4ACL
 
 [SUBSYSTEM::RPC_NDR_ROT]
@@ -394,10 +390,6 @@ PUBLIC_DEPENDENCIES = dcerpc NDR_MGMT
 OBJ_FILES = gen_ndr/ndr_protected_storage_c.o
 PUBLIC_DEPENDENCIES = dcerpc NDR_PROTECTED_STORAGE
 
-[SUBSYSTEM::DCOM_PROXY_DCOM]
-OBJ_FILES = gen_ndr/ndr_dcom_c.o
-PUBLIC_DEPENDENCIES = dcerpc NDR_DCOM
-
 [SUBSYSTEM::RPC_NDR_OXIDRESOLVER]
 OBJ_FILES = gen_ndr/ndr_oxidresolver_c.o
 PUBLIC_DEPENDENCIES = dcerpc NDR_OXIDRESOLVER
diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl
deleted file mode 100644 (file)
index 75430f7..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-/**
-  DCOM interfaces
-  http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt
- */
-
-[
-       uuid("18f70770-8e64-11cf-9af1-0020af6e72f4"),
-       pointer_default(unique),
-       version(0.0)
-] interface dcom_Unknown
-{
-       void UseProtSeq();
-       void GetCustomProtseqInfo();
-       void UpdateResolverBindings();
-}
-
-[
-       object,
-       uuid("00000000-0000-0000-C000-000000000046"),
-       pointer_default(unique),
-       helpstring("Base interface for all COM interfaces")
-]
-interface IUnknown
-{
-       /*****************/
-       /* Function 0x00 */
-       /* Returns the interface with the specified IID 
-          if implemented by this object */
-       [local] WERROR QueryInterface([in,unique] GUID *iid,
-          [out,iid_is(riid)] IUnknown **data);
-
-       /*****************/
-       /* Function 0x01 */
-       [local] uint32 AddRef();
-
-       /*****************/
-       /* Function 0x02 */
-       [local] uint32 Release();
-}
-
-
-[
-       object,
-       uuid("00000001-0000-0000-C000-000000000046"),
-       pointer_default(unique)
-] interface IClassFactory : IUnknown
-{
-       [local] WERROR CreateInstance([in,unique] MInterfacePointer *pUnknown, 
-                              [in,unique] GUID *iid,
-                              [out, iid_is(riid)] MInterfacePointer **ppv);
-
-       [call_as(CreateInstance)] WERROR RemoteCreateInstance();
-
-       /* Set lock to TRUE when you want to do a lock
-       and set it to FALSE when you want to unlock */
-       [local] WERROR LockServer([in] uint8 lock);
-
-       [call_as(LockServer)] WERROR RemoteLockServer();
-}
-
-/* The remote version of IUnknown. This interface exists on every */
-/* OXID (whether an OXID represents either a thread or a process is */
-/* implementation specific). It is used by clients to query for new */
-/* interfaces, get additional references (for marshaling), and release */
-/* outstanding references. */
-/* This interface is passed along during OXID resolution. */
-/* */
-[
-       uuid("00000131-0000-0000-C000-000000000046"),
-       object,
-       pointer_default(unique),
-       helpstring("Remote version of IUnknown")
-]
-interface IRemUnknown : IUnknown
-{
-       typedef [public] struct 
-       {
-               WERROR hResult; /* result of call */
-               STDOBJREF std; /* data for returned interface */
-       }
-       REMQIRESULT;
-
-       [call_as(QueryInterface)] WERROR RemQueryInterface (
-               [in,unique] GUID *ripid, /* interface to QI on */
-               [in] uint32 cRefs, /* count of AddRefs requested */
-               [in] uint16 cIids, /* count of IIDs that follow */
-               [in, unique, size_is(cIids)] GUID *iids, /* IIDs to QI for */
-               [out, size_is(cIids)] MInterfacePointer **ip
-               );
-
-       typedef struct 
-       {
-               GUID ipid; /* ipid to AddRef/Release */
-               uint32 cPublicRefs;
-               uint32 cPrivateRefs;
-       } REMINTERFACEREF;
-
-       [call_as(AddRef)] WERROR RemAddRef (
-                [in] uint16 cInterfaceRefs,
-                [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[],
-                [out, size_is(cInterfaceRefs)] WERROR **pResults
-               );
-
-       [call_as(Release)] WERROR RemRelease (
-                [in] uint16 cInterfaceRefs,
-                [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
-               );
-}
-
-[
-       uuid("00000140-0000-0000-c000-000000000046"),
-       pointer_default(unique),
-       object
-] interface IClassActivator : IUnknown
-{
-       void GetClassObject([in] GUID clsid, 
-                               [in] uint32 context,
-                                               [in] uint32 locale,
-                                               [in] GUID iid,
-                                               [out, iid_is(iid)] MInterfacePointer *data);
-}
-
-[
-       uuid("00000136-0000-0000-c000-000000000046"),
-       pointer_default(unique),
-       object
-] interface ISCMLocalActivator : IClassActivator
-{
-       WERROR ISCMLocalActivator_CreateInstance( );
-}
-
-[
-       pointer_default(unique),
-       uuid("c6f3ee72-ce7e-11d1-b71e-00c04fc3111a")
-] interface IMachineLocalActivator 
-{
-       WERROR IMachineLocalActivator_foo();
-}
-
-[
-       pointer_default(unique),
-       uuid("e60c73e6-88f9-11cf-9af1-0020af6e72f4")
-] interface ILocalObjectExporter
-{
-       WERROR ILocalObjectExporter_Foo();
-}
-
-/* Looks like this is the equivalent of .NET's 
-   System.Activator class */
-[
-       uuid("000001a0-0000-0000-c000-000000000046"),
-       pointer_default(unique),
-       object
-]
-       interface ISystemActivator : IClassActivator
-{
-       WERROR ISystemActivatorRemoteCreateInstance([in] hyper unknown1,  /* OXID ? */
-                                                                                         [in] MInterfacePointer iface1,
-                                                                                         [in] hyper unknown2,
-                                                                                         [out,ref] uint32 *unknown3, 
-                                                                                         [out,ref] MInterfacePointer *iface2);
-}
-
-
-
-/* Derived from IRemUnknown, this interface supports Remote Query interface */
-/* for objects that supply additional data beyond the STDOBJREF in their */
-/* marshaled interface packets. */
-[
-       object,
-       pointer_default(unique),
-       uuid("00000143-0000-0000-C000-000000000046")
-]
-
-interface IRemUnknown2 : IRemUnknown
-{
-       [call_as(QueryInterface2)] WERROR RemQueryInterface2 (
-                [in, unique] GUID *ripid,
-                [in] uint16 cIids,
-                [in, size_is(cIids)] GUID **iids,
-                [out, size_is(cIids)] WERROR **phr,
-                [out, size_is(cIids)] MInterfacePointer **ppMIF
-               );
-}
-
-[
-       object,
-       pointer_default(unique),
-       uuid("00020400-0000-0000-C000-000000000046")
-] interface IDispatch : IUnknown
-{
-       /*****************/
-       /* Function 0x03 */
-       WERROR GetTypeInfoCount([out] uint16 *pctinfo);
-
-       typedef struct {
-       } REF_ITypeInfo;
-
-       /*****************/
-       /* Function 0x04 */
-       WERROR GetTypeInfo (
-                       [in] uint16 iTInfo,
-                       [in] uint32 lcid,
-                       [out] REF_ITypeInfo **ppTInfo);
-
-       /*****************/
-       /* Function 0x05 */
-       WERROR GetIDsOfNames(
-                       [in, unique] GUID *riid,
-                       /*FIXME[in,size_is(cNames)] OLESTR *rgszNames[], */
-                       [in] uint16 cNames,
-                       [in] uint32 lcid,
-                       [out,size_is(cNames)] uint32 **rgDispId);
-
-       typedef struct {
-               uint16 vartype;
-               uint16 unknown /* FIXME */;
-       } VARIANT;
-
-       typedef struct {
-               uint16 unknown /* FIXME */;
-       } DISPPARAMS;
-
-       /* Exception ? */
-       typedef struct {
-               uint16 unknown /* FIXME */;
-       } EXCEPINFO;
-
-       /*****************/
-       /* Function 0x06 */
-       WERROR Invoke(
-                       [in] uint32 dispIdMember,
-                       [in, unique] GUID *riid,
-                       [in] uint32 lcid,
-                       [in] uint16 wFlags,
-                       [out,in, unique] DISPPARAMS *pDispParams,
-                       [out] VARIANT **pVarResult,
-                       [out] EXCEPINFO **pExcepInfo,
-                       [out] uint16 **puArgErr);
-}
-
-[
-       object,
-       local,
-       uuid("00000003-0000-0000-C000-000000000046")
-] interface IMarshal : IUnknown
-{
-       WERROR MarshalInterface();
-       WERROR UnMarshalInterface();
-}
-
-[
-       uuid(DA23F6DB-6F45-466C-9EED-0B65286F2D78),
-       helpstring("ICoffeeMachine Interface"),
-       pointer_default(unique),
-       object
-] interface ICoffeeMachine : IUnknown
-{
-       WERROR MakeCoffee([in,string,charset(UTF16)] uint16 *flavor);
-}
-
-[
-       uuid("db7c21f8-fe33-4c11-aea5-ceb56f076fbb"),
-       helpstring("coffeemachine class")
-] coclass coffeemachine
-{
-       interface icoffeemachine;
-}
-
-[
-       object,
-       pointer_default(unique),
-       uuid("0000000C-0000-0000-C000-000000000046"),
-       helpstring("Stream")
-]
-interface IStream : IUnknown
-{
-       WERROR Read(
-                               [out, size_is(num_requested), length_is(*num_read)] uint8 pv[],
-                               [in] uint32 num_requested, 
-                               [in, unique] uint32 *num_readx,
-                               [out,ref] uint32 *num_read
-                               );
-
-       WERROR Write(
-                               [in,size_is(num_requested),unique] uint8 *data,
-                                [in] uint32 num_requested,
-                                [out,ref] uint32 *num_written);
-}
-
-[
-       uuid("5e9ddec7-5767-11cf-beab-00aa006c3606"),
-       progid("Samba.Simple"),
-       helpstring("simple class"),
-       internal
-] coclass simple 
-{
-       interface IStream;
-}
index 872a01d54495066fc9f15b2c2114e05a035d6506..ac028cec29501ce10993af43ef50c171ba5764f0 100644 (file)
@@ -10,7 +10,7 @@
  (used by DCOM)
  */
 
-import "dcom.idl", "orpc.idl";
+import "orpc.idl";
 
 [ 
        uuid("99fcfec4-5260-101b-bbcb-00aa0021347a"),
index 57a8d14fa2f935ef388a8cc1c63c08d49c733d4d..58d976e07826761b6310c855d226f752311be54e 100644 (file)
@@ -3,7 +3,7 @@
   http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm
  */
 
-import "dcom.idl", "orpc.idl";
+import "orpc.idl";
 
 [
        uuid("4d9f4ab8-7d1c-11cf-861e-0020af6e7c57"),
diff --git a/source4/pidl/lib/Parse/Pidl/ODL.pm b/source4/pidl/lib/Parse/Pidl/ODL.pm
deleted file mode 100644 (file)
index ee8d030..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-##########################################
-# Converts ODL stuctures to IDL structures
-# (C) 2004-2005 Jelmer Vernooij <jelmer@samba.org>
-
-package Parse::Pidl::ODL;
-
-use Parse::Pidl::Util qw(has_property);
-use Parse::Pidl::Typelist qw(hasType getType);
-use strict;
-
-use vars qw($VERSION);
-$VERSION = '0.01';
-
-#####################################################################
-# find an interface in an array of interfaces
-sub get_interface($$)
-{
-       my($if,$n) = @_;
-
-       foreach(@$if) {
-               next if ($_->{TYPE} ne "INTERFACE");
-               return $_ if($_->{NAME} eq $n);
-       }
-       
-       return 0;
-}
-
-sub FunctionAddObjArgs($)
-{
-       my $e = shift;
-       
-       unshift(@{$e->{ELEMENTS}}, {
-               'NAME' => 'ORPCthis',
-               'POINTERS' => 0,
-               'PROPERTIES' => { 'in' => '1' },
-               'TYPE' => 'ORPCTHIS',
-               'FILE' => $e->{FILE},
-               'LINE' => $e->{LINE}
-       });
-       unshift(@{$e->{ELEMENTS}}, {
-               'NAME' => 'ORPCthat',
-               'POINTERS' => 1,
-               'PROPERTIES' => { 'out' => '1', 'ref' => '1' },
-               'TYPE' => 'ORPCTHAT',
-               'FILE' => $e->{FILE},
-               'LINE' => $e->{LINE}
-       });
-}
-
-sub ReplaceInterfacePointers($)
-{
-       my $e = shift;
-
-       foreach my $x (@{$e->{ELEMENTS}}) {
-               next unless (hasType($x->{TYPE}));
-               next unless getType($x->{TYPE})->{DATA}->{TYPE} eq "INTERFACE";
-               
-               $x->{TYPE} = "MInterfacePointer";
-       }
-}
-
-# Add ORPC specific bits to an interface.
-sub ODL2IDL($)
-{
-       my $odl = shift;
-       my $addedorpc = 0;
-
-       foreach my $x (@$odl) {
-               next if ($x->{TYPE} ne "INTERFACE");
-               # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
-               # and replace interfacepointers with MInterfacePointer
-               # for 'object' interfaces
-               if (has_property($x, "object")) {
-                       foreach my $e (@{$x->{DATA}}) {
-                               ($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e);
-                               ReplaceInterfacePointers($e);
-                       }
-                       $addedorpc = 1;
-               }
-
-               if ($x->{BASE}) {
-                       my $base = get_interface($odl, $x->{BASE});
-
-                       foreach my $fn (reverse @{$base->{DATA}}) {
-                               next unless ($fn->{TYPE} eq "FUNCTION");
-                               unshift (@{$x->{DATA}}, $fn);
-                               push (@{$x->{INHERITED_FUNCTIONS}}, $fn->{NAME});
-                       }
-               }
-       }
-
-       unshift (@$odl, {
-               TYPE => "IMPORT", 
-               PATHS => [ "\"orpc.idl\"" ],
-               FILE => undef,
-               LINE => undef
-       }) if ($addedorpc);
-
-       return $odl;
-}
-
-1;
index 0ffa321782f9f4b0323f6e26b12a2b71d80fd055..8fa37ca300688084591b77c6fac4fbaa872d80d5 100644 (file)
@@ -12,7 +12,7 @@ use Exporter;
 
 use strict;
 use Parse::Pidl qw(fatal warning);
-use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
+use Parse::Pidl::Typelist qw(hasType getType mapTypeName scalar_is_reference);
 use Parse::Pidl::Util qw(has_property is_constant ParseExpr);
 use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
 use Parse::Pidl::Samba4 qw(DeclLong);
index 52e384814d8476b437b98124adb6a50b2c7416fe..aa4f3dd1ce2e554a4d1de1947868c610f2ef6fbb 100644 (file)
@@ -8,7 +8,7 @@ package Parse::Pidl::Samba3::ServerNDR;
 
 use strict;
 use Parse::Pidl qw(warning fatal);
-use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
+use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
 use Parse::Pidl::Util qw(ParseExpr has_property is_constant);
 use Parse::Pidl::NDR qw(GetNextLevel);
 use Parse::Pidl::Samba4 qw(DeclLong);
@@ -35,7 +35,7 @@ sub DeclLevel($$)
        if (has_property($e, "charset")) {
                $ret.="const char";
        } else {
-               $ret.=mapType($e->{TYPE});
+               $ret.=mapTypeName($e->{TYPE});
        }
 
        my $numstar = $e->{ORIGINAL}->{POINTERS};
index 4ef2daa591ff7ef6c10c9d837edffc0fedade65f..f0c6ae38e8fcccf6d560f9523c727a832072e383 100644 (file)
@@ -10,7 +10,7 @@ require Exporter;
 @EXPORT = qw(is_intree choose_header DeclLong);
 
 use Parse::Pidl::Util qw(has_property is_constant);
-use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
+use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
 use strict;
 
 use vars qw($VERSION);
@@ -38,12 +38,12 @@ sub DeclLong($)
        my $ret = "";
 
        if (has_property($element, "represent_as")) {
-               $ret.=mapType($element->{PROPERTIES}->{represent_as})." ";
+               $ret.=mapTypeName($element->{PROPERTIES}->{represent_as})." ";
        } else {
                if (has_property($element, "charset")) {
                        $ret.="const char";
                } else {
-                       $ret.=mapType($element->{TYPE});
+                       $ret.=mapTypeName($element->{TYPE});
                }
 
                $ret.=" ";
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
deleted file mode 100644 (file)
index 85dab37..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-# COM Header generation
-# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
-
-package Parse::Pidl::Samba4::COM::Header;
-
-use Parse::Pidl::Typelist qw(mapType);
-use Parse::Pidl::Util qw(has_property is_constant);
-
-use vars qw($VERSION);
-$VERSION = '0.01';
-
-use strict;
-
-sub GetArgumentProtoList($)
-{
-       my $f = shift;
-       my $res = "";
-
-       foreach my $a (@{$f->{ELEMENTS}}) {
-
-               $res .= ", " . mapType($a->{TYPE}) . " ";
-
-               my $l = $a->{POINTERS};
-               $l-- if (Parse::Pidl::Typelist::scalar_is_reference($a->{TYPE}));
-               foreach my $i (1..$l) {
-                       $res .= "*";
-               }
-
-               if (defined $a->{ARRAY_LEN}[0] && !is_constant($a->{ARRAY_LEN}[0]) &&
-               !$a->{POINTERS}) {
-                       $res .= "*";
-               }
-               $res .= $a->{NAME};
-               if (defined $a->{ARRAY_LEN}[0] && is_constant($a->{ARRAY_LEN}[0])) {
-                       $res .= "[$a->{ARRAY_LEN}[0]]";
-               }
-       }
-
-       return $res;
-}
-
-sub GetArgumentList($)
-{
-       my $f = shift;
-       my $res = "";
-
-       foreach (@{$f->{ELEMENTS}}) { $res .= ", $_->{NAME}"; }
-
-       return $res;
-}
-
-#####################################################################
-# generate vtable structure for COM interface
-sub HeaderVTable($)
-{
-       my $interface = shift;
-       my $res;
-       $res .= "#define " . uc($interface->{NAME}) . "_METHODS \\\n";
-       if (defined($interface->{BASE})) {
-               $res .= "\t" . uc($interface->{BASE} . "_METHODS") . "\\\n";
-       }
-
-       my $data = $interface->{DATA};
-       foreach my $d (@{$data}) {
-               $res .= "\t" . mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n" if ($d->{TYPE} eq "FUNCTION");
-       }
-       $res .= "\n";
-       $res .= "struct $interface->{NAME}_vtable {\n";
-       $res .= "\tstruct GUID iid;\n";
-       $res .= "\t" . uc($interface->{NAME}) . "_METHODS\n";
-       $res .= "};\n\n";
-
-       return $res;
-}
-
-sub ParseInterface($)
-{
-       my $if = shift;
-       my $res;
-
-       $res .="\n\n/* $if->{NAME} */\n";
-
-       $res .="#define COM_" . uc($if->{NAME}) . "_UUID $if->{PROPERTIES}->{uuid}\n\n";
-
-       $res .="struct $if->{NAME}_vtable;\n\n";
-
-       $res .="struct $if->{NAME} {
-       struct com_context *ctx;
-       struct $if->{NAME}_vtable *vtable;
-       void *object_data;
-};\n\n";
-
-       $res.=HeaderVTable($if);
-
-       foreach my $d (@{$if->{DATA}}) {
-               next if ($d->{TYPE} ne "FUNCTION");
-
-               $res .= "#define $if->{NAME}_$d->{NAME}(interface, mem_ctx" . GetArgumentList($d) . ") ";
-
-               $res .= "((interface)->vtable->$d->{NAME}(interface, mem_ctx" . GetArgumentList($d) . "))";
-
-               $res .="\n";
-       }
-
-       return $res;
-}
-
-sub ParseCoClass($)
-{
-       my $c = shift;
-       my $res = "";
-       $res .= "#define CLSID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{uuid}\n";
-       if (has_property($c, "progid")) {
-               $res .= "#define PROGID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{progid}\n";
-       }
-       $res .= "\n";
-       return $res;
-}
-
-sub Parse($$)
-{
-       my ($idl,$ndr_header) = @_;
-       my $res = "";
-
-       $res .= "#include \"librpc/gen_ndr/orpc.h\"\n" . 
-                       "#include \"$ndr_header\"\n\n";
-
-       foreach (@{$idl})
-       {
-               if ($_->{TYPE} eq "INTERFACE" && has_property($_, "object")) {
-                       $res.=ParseInterface($_);
-               } 
-
-               if ($_->{TYPE} eq "COCLASS") {
-                       $res.=ParseCoClass($_);
-               }
-       }
-
-       return $res;
-}
-
-1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
deleted file mode 100644 (file)
index e6366f0..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-###################################################
-# DCOM parser for Samba
-# Basically the glue between COM and DCE/RPC with NDR
-# Copyright jelmer@samba.org 2003-2005
-# released under the GNU GPL
-
-package Parse::Pidl::Samba4::COM::Proxy;
-
-use Parse::Pidl::Samba4::COM::Header;
-use Parse::Pidl::Util qw(has_property);
-
-use vars qw($VERSION);
-$VERSION = '0.01';
-
-use strict;
-
-my($res);
-
-sub ParseVTable($$)
-{
-       my $interface = shift;
-       my $name = shift;
-
-       # Generate the vtable
-       $res .="\tstruct $interface->{NAME}_vtable $name = {";
-
-       if (defined($interface->{BASE})) {
-               $res .= "\n\t\t{},";
-       }
-
-       my $data = $interface->{DATA};
-
-       foreach my $d (@{$data}) {
-               if ($d->{TYPE} eq "FUNCTION") {
-                   $res .= "\n\t\tdcom_proxy_$interface->{NAME}_$d->{NAME}";
-                       $res .= ",";
-               }
-       }
-
-       $res .= "\n\t};\n\n";
-}
-
-sub ParseRegFunc($)
-{
-       my $interface = shift;
-
-       $res .= "static NTSTATUS dcom_proxy_$interface->{NAME}_init(void)
-{
-       struct GUID base_iid;
-       struct $interface->{NAME}_vtable *proxy_vtable = talloc(talloc_autofree_context(), struct $interface->{NAME}_vtable);
-";
-
-       if (defined($interface->{BASE})) {
-               $res.= "
-       const void *base_vtable;
-
-       base_iid = dcerpc_table_$interface->{BASE}.uuid;
-
-       base_vtable = dcom_proxy_vtable_by_iid(&base_iid);
-       if (base_vtable == NULL) {
-               DEBUG(0, (\"No proxy registered for base interface '$interface->{BASE}'\\n\"));
-               return NT_STATUS_FOOBAR;
-       }
-       
-       memcpy(&proxy_vtable, base_vtable, sizeof(struct $interface->{BASE}_vtable));
-
-";
-       }
-       foreach my $x (@{$interface->{DATA}}) {
-               next unless ($x->{TYPE} eq "FUNCTION");
-
-               $res .= "\tproxy_vtable.$x->{NAME} = dcom_proxy_$interface->{NAME}_$x->{NAME};\n";
-       }
-
-       $res.= "
-       proxy_vtable.iid = dcerpc_table_$interface->{NAME}.uuid;
-
-       return dcom_register_proxy(&proxy_vtable);
-}\n\n";
-}
-
-#####################################################################
-# parse a function
-sub ParseFunction($$)
-{
-       my $interface = shift;
-       my $fn = shift;
-       my $name = $fn->{NAME};
-       my $uname = uc $name;
-
-       $res.="
-static $fn->{RETURN_TYPE} dcom_proxy_$interface->{NAME}_$name(struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . Parse::Pidl::Samba4::COM::Header::GetArgumentProtoList($fn) . ")
-{
-       struct dcerpc_pipe *p;
-       NTSTATUS status = dcom_get_pipe(d, &p);
-       struct $name r;
-       struct rpc_request *req;
-
-       if (NT_STATUS_IS_ERR(status)) {
-               return status;
-       }
-
-       ZERO_STRUCT(r.in.ORPCthis);
-       r.in.ORPCthis.version.MajorVersion = COM_MAJOR_VERSION;
-       r.in.ORPCthis.version.MinorVersion = COM_MINOR_VERSION;
-";
-       
-       # Put arguments into r
-       foreach my $a (@{$fn->{ELEMENTS}}) {
-               next unless (has_property($a, "in"));
-               if (Parse::Pidl::Typelist::typeIs($a->{TYPE}, "INTERFACE")) {
-                       $res .="\tNDR_CHECK(dcom_OBJREF_from_IUnknown(&r.in.$a->{NAME}.obj, $a->{NAME}));\n";
-               } else {
-                       $res .= "\tr.in.$a->{NAME} = $a->{NAME};\n";
-               }
-       }
-
-       $res .="
-       if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) {
-               NDR_PRINT_IN_DEBUG($name, &r);          
-       }
-
-       status = dcerpc_ndr_request(p, &d->ipid, &dcerpc_table_$interface->{NAME}, DCERPC_$uname, mem_ctx, &r);
-
-       if (NT_STATUS_IS_OK(status) && (p->conn->flags & DCERPC_DEBUG_PRINT_OUT)) {
-               NDR_PRINT_OUT_DEBUG($name, r);          
-       }
-
-";
-
-       # Put r info back into arguments
-       foreach my $a (@{$fn->{ELEMENTS}}) {
-               next unless (has_property($a, "out"));
-
-               if (Parse::Pidl::Typelist::typeIs($a->{TYPE}, "INTERFACE")) {
-                       $res .="\tNDR_CHECK(dcom_IUnknown_from_OBJREF(d->ctx, &$a->{NAME}, r.out.$a->{NAME}.obj));\n";
-               } else {
-                       $res .= "\t*$a->{NAME} = r.out.$a->{NAME};\n";
-               }
-
-       }
-       
-       if ($fn->{RETURN_TYPE} eq "NTSTATUS") {
-               $res .= "\tif (NT_STATUS_IS_OK(status)) status = r.out.result;\n";
-       }
-
-       $res .= 
-       "
-       return r.out.result;
-}\n\n";
-}
-
-#####################################################################
-# parse the interface definitions
-sub ParseInterface($)
-{
-       my($interface) = shift;
-       my($data) = $interface->{DATA};
-       $res = "/* DCOM proxy for $interface->{NAME} generated by pidl */\n\n";
-       foreach my $d (@{$data}) {
-               ($d->{TYPE} eq "FUNCTION") && 
-               ParseFunction($interface, $d);
-       }
-
-       ParseRegFunc($interface);
-}
-
-sub RegistrationFunction($$)
-{
-       my $idl = shift;
-       my $basename = shift;
-
-       my $res = "\n\nNTSTATUS dcom_$basename\_init(void)\n";
-       $res .= "{\n";
-       $res .="\tNTSTATUS status = NT_STATUS_OK;\n";
-       foreach my $interface (@{$idl}) {
-               next if $interface->{TYPE} ne "INTERFACE";
-               next if not has_property($interface, "object");
-
-               my $data = $interface->{DATA};
-               my $count = 0;
-               foreach my $d (@{$data}) {
-                       if ($d->{TYPE} eq "FUNCTION") { $count++; }
-               }
-
-               next if ($count == 0);
-
-               $res .= "\tstatus = dcom_$interface->{NAME}_init();\n";
-               $res .= "\tif (NT_STATUS_IS_ERR(status)) {\n";
-               $res .= "\t\treturn status;\n";
-               $res .= "\t}\n\n";
-       }
-       $res .= "\treturn status;\n";
-       $res .= "}\n\n";
-
-       return $res;
-}
-
-sub Parse($$)
-{
-       my ($pidl,$comh_filename) = @_;
-       my $res = "";
-
-       $res .= "#include \"includes.h\"\n" .
-                       "#include \"lib/com/dcom/dcom.h\"\n" .
-                       "#include \"$comh_filename\"\n";
-
-       foreach (@{$pidl}) {
-               next if ($_->{TYPE} ne "INTERFACE");
-               next if has_property($_, "local");
-               next unless has_property($_, "object");
-
-               $res .= ParseInterface($_);
-       }
-
-       return $res;
-}
-
-1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm
deleted file mode 100644 (file)
index 150acbf..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-###################################################
-# DCOM stub boilerplate generator
-# Copyright jelmer@samba.org 2004-2005
-# Copyright tridge@samba.org 2003
-# Copyright metze@samba.org 2004
-# released under the GNU GPL
-
-package Parse::Pidl::Samba4::COM::Stub;
-
-use Parse::Pidl::Util qw(has_property);
-use strict;
-
-use vars qw($VERSION);
-$VERSION = '0.01';
-
-my($res);
-
-sub pidl($)
-{
-       $res .= shift;
-}
-
-#####################################################
-# generate the switch statement for function dispatch
-sub gen_dispatch_switch($)
-{
-       my $data = shift;
-
-       my $count = 0;
-       foreach my $d (@{$data}) {
-               next if ($d->{TYPE} ne "FUNCTION");
-
-               pidl "\tcase $count: {\n";
-               if ($d->{RETURN_TYPE} && $d->{RETURN_TYPE} ne "void") {
-                       pidl "\t\tNTSTATUS result;\n";
-               }
-               pidl "\t\tstruct $d->{NAME} *r2 = r;\n";
-               pidl "\t\tif (DEBUGLEVEL > 10) {\n";
-               pidl "\t\t\tNDR_PRINT_FUNCTION_DEBUG($d->{NAME}, NDR_IN, r2);\n";
-               pidl "\t\t}\n";
-               if ($d->{RETURN_TYPE} && $d->{RETURN_TYPE} ne "void") {
-                       pidl "\t\tresult = vtable->$d->{NAME}(iface, mem_ctx, r2);\n";
-               } else {
-                       pidl "\t\tvtable->$d->{NAME}(iface, mem_ctx, r2);\n";
-               }
-               pidl "\t\tif (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {\n";
-               pidl "\t\t\tDEBUG(5,(\"function $d->{NAME} will reply async\\n\"));\n";
-               pidl "\t\t}\n";
-               pidl "\t\tbreak;\n\t}\n";
-               $count++; 
-       }
-}
-
-#####################################################
-# generate the switch statement for function reply
-sub gen_reply_switch($)
-{
-       my $data = shift;
-
-       my $count = 0;
-       foreach my $d (@{$data}) {
-               next if ($d->{TYPE} ne "FUNCTION");
-
-               pidl "\tcase $count: {\n";
-               pidl "\t\tstruct $d->{NAME} *r2 = r;\n";
-               pidl "\t\tif (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {\n";
-               pidl "\t\t\tDEBUG(5,(\"function $d->{NAME} replied async\\n\"));\n";
-               pidl "\t\t}\n";
-               pidl "\t\tif (DEBUGLEVEL > 10 && dce_call->fault_code == 0) {\n";
-               pidl "\t\t\tNDR_PRINT_FUNCTION_DEBUG($d->{NAME}, NDR_OUT | NDR_SET_VALUES, r2);\n";
-               pidl "\t\t}\n";
-               pidl "\t\tif (dce_call->fault_code != 0) {\n";
-               pidl "\t\t\tDEBUG(2,(\"dcerpc_fault %s in $d->{NAME}\\n\", dcerpc_errstr(mem_ctx, dce_call->fault_code)));\n";
-               pidl "\t\t}\n";
-               pidl "\t\tbreak;\n\t}\n";
-               $count++; 
-       }
-}
-
-#####################################################################
-# produce boilerplate code for a interface
-sub Boilerplate_Iface($)
-{
-       my($interface) = shift;
-       my($data) = $interface->{DATA};
-       my $name = $interface->{NAME};
-       my $uname = uc $name;
-       my $uuid = Parse::Pidl::Util::make_str($interface->{PROPERTIES}->{uuid});
-       my $if_version = $interface->{PROPERTIES}->{version};
-
-       pidl "
-static NTSTATUS $name\__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
-{
-#ifdef DCESRV_INTERFACE_$uname\_BIND
-       return DCESRV_INTERFACE_$uname\_BIND(dce_call,iface);
-#else
-       return NT_STATUS_OK;
-#endif
-}
-
-static void $name\__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
-{
-#ifdef DCESRV_INTERFACE_$uname\_UNBIND
-       DCESRV_INTERFACE_$uname\_UNBIND(context, iface);
-#else
-       return;
-#endif
-}
-
-static NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
-{
-       NTSTATUS status;
-       uint16_t opnum = dce_call->pkt.u.request.opnum;
-
-       dce_call->fault_code = 0;
-
-       if (opnum >= dcerpc_table_$name.num_calls) {
-               dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
-               return NT_STATUS_NET_WRITE_FAULT;
-       }
-
-       *r = talloc_size(mem_ctx, dcerpc_table_$name.calls[opnum].struct_size);
-       NT_STATUS_HAVE_NO_MEMORY(*r);
-
-        /* unravel the NDR for the packet */
-       status = dcerpc_table_$name.calls[opnum].ndr_pull(pull, NDR_IN, *r);
-       if (!NT_STATUS_IS_OK(status)) {
-               dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN,
-                                 &dce_call->pkt.u.request.stub_and_verifier);
-               dce_call->fault_code = DCERPC_FAULT_NDR;
-               return NT_STATUS_NET_WRITE_FAULT;
-       }
-
-       return NT_STATUS_OK;
-}
-
-static NTSTATUS $name\__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
-{
-       uint16_t opnum = dce_call->pkt.u.request.opnum;
-       struct GUID ipid = dce_call->pkt.u.request.object.object;
-       struct dcom_interface_p *iface = dcom_get_local_iface_p(&ipid);
-       const struct dcom_$name\_vtable *vtable = iface->vtable;
-
-       switch (opnum) {
-";
-       gen_dispatch_switch($data);
-
-pidl "
-       default:
-               dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
-               break;
-       }
-
-       if (dce_call->fault_code != 0) {
-               dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN,
-                                 &dce_call->pkt.u.request.stub_and_verifier);
-               return NT_STATUS_NET_WRITE_FAULT;
-       }
-
-       return NT_STATUS_OK;
-}
-
-static NTSTATUS $name\__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
-{
-       uint16_t opnum = dce_call->pkt.u.request.opnum;
-
-       switch (opnum) {
-";
-       gen_reply_switch($data);
-
-pidl "
-       default:
-               dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
-               break;
-       }
-
-       if (dce_call->fault_code != 0) {
-               dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN,
-                                 &dce_call->pkt.u.request.stub_and_verifier);
-               return NT_STATUS_NET_WRITE_FAULT;
-       }
-
-       return NT_STATUS_OK;
-}
-
-static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
-{
-       NTSTATUS status;
-       uint16_t opnum = dce_call->pkt.u.request.opnum;
-
-       status = dcerpc_table_$name.calls[opnum].ndr_push(push, NDR_OUT, r);
-       if (!NT_STATUS_IS_OK(status)) {
-               dce_call->fault_code = DCERPC_FAULT_NDR;
-               return NT_STATUS_NET_WRITE_FAULT;
-       }
-
-       return NT_STATUS_OK;
-}
-
-static const struct dcesrv_interface $name\_interface = {
-       .name           = \"$name\",
-       .uuid           = $uuid,
-       .if_version     = $if_version,
-       .bind           = $name\__op_bind,
-       .unbind         = $name\__op_unbind,
-       .ndr_pull       = $name\__op_ndr_pull,
-       .dispatch       = $name\__op_dispatch,
-       .reply          = $name\__op_reply,
-       .ndr_push       = $name\__op_ndr_push
-};
-
-";
-}
-
-#####################################################################
-# produce boilerplate code for an endpoint server
-sub Boilerplate_Ep_Server($)
-{
-       my($interface) = shift;
-       my $name = $interface->{NAME};
-       my $uname = uc $name;
-
-       pidl "
-static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
-{
-       int i;
-
-       for (i=0;i<dcerpc_table_$name.endpoints->count;i++) {
-               NTSTATUS ret;
-               const char *name = dcerpc_table_$name.endpoints->names[i];
-
-               ret = dcesrv_interface_register(dce_ctx, name, &$name\_interface, NULL);
-               if (!NT_STATUS_IS_OK(ret)) {
-                       DEBUG(1,(\"$name\_op_init_server: failed to register endpoint \'%s\'\\n\",name));
-                       return ret;
-               }
-       }
-
-       return NT_STATUS_OK;
-}
-
-static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version)
-{
-       if (dcerpc_table_$name.if_version == if_version &&
-               strcmp(dcerpc_table_$name.uuid, uuid)==0) {
-               memcpy(iface,&dcerpc_table_$name, sizeof(*iface));
-               return True;
-       }
-
-       return False;
-}
-
-static BOOL $name\__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
-{
-       if (strcmp(dcerpc_table_$name.name, name)==0) {
-               memcpy(iface,&dcerpc_table_$name, sizeof(*iface));
-               return True;
-       }
-
-       return False;   
-}
-       
-NTSTATUS dcerpc_server_$name\_init(void)
-{
-       NTSTATUS ret;
-       struct dcesrv_endpoint_server ep_server;
-
-       /* fill in our name */
-       ep_server.name = \"$name\";
-
-       /* fill in all the operations */
-       ep_server.init_server = $name\__op_init_server;
-
-       ep_server.interface_by_uuid = $name\__op_interface_by_uuid;
-       ep_server.interface_by_name = $name\__op_interface_by_name;
-
-       /* register ourselves with the DCERPC subsystem. */
-       ret = dcerpc_register_ep_server(&ep_server);
-
-       if (!NT_STATUS_IS_OK(ret)) {
-               DEBUG(0,(\"Failed to register \'$name\' endpoint server!\\n\"));
-               return ret;
-       }
-
-       return ret;
-}
-
-";
-}
-
-#####################################################################
-# dcom interface stub from a parsed IDL structure 
-sub ParseInterface($)
-{
-       my($interface) = shift;
-       
-       return "" if has_property($interface, "local");
-       
-       my($data) = $interface->{DATA};
-       my $count = 0;
-
-       $res = "";
-
-       if (!defined $interface->{PROPERTIES}->{uuid}) {
-               return $res;
-       }
-
-       if (!defined $interface->{PROPERTIES}->{version}) {
-               $interface->{PROPERTIES}->{version} = "0.0";
-       }
-
-       foreach my $d (@{$data}) {
-               if ($d->{TYPE} eq "FUNCTION") { $count++; }
-       }
-
-       if ($count == 0) {
-               return $res;
-       }
-
-       $res = "/* dcom interface stub generated by pidl */\n\n";
-       Boilerplate_Iface($interface);
-       Boilerplate_Ep_Server($interface);
-
-       return $res;
-}
-
-1;
index 1ce22d5180af127f5a6cec03bb15fca7cdfec71b..59dc5f001d2e6a53631e8e1b533273d9b32979e2 100644 (file)
@@ -380,7 +380,7 @@ sub EjsBitmapPull($$)
        my $name = shift;
        my $d = shift;
        my $type_fn = $d->{BASE_TYPE};
-       my($type_decl) = Parse::Pidl::Typelist::mapType($d->{BASE_TYPE});
+       my($type_decl) = Parse::Pidl::Typelist::mapTypeName($d->{BASE_TYPE});
        fn_declare($d, "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, $type_decl *r)");
        pidl "{";
        indent;
@@ -648,7 +648,7 @@ sub EjsBitmapPush($$)
        my $name = shift;
        my $d = shift;
        my $type_fn = $d->{BASE_TYPE};
-       my($type_decl) = Parse::Pidl::Typelist::mapType($d->{BASE_TYPE});
+       my($type_decl) = Parse::Pidl::Typelist::mapTypeName($d->{BASE_TYPE});
        # put the bitmap elements in the constants array
        foreach my $e (@{$d->{ELEMENTS}}) {
                if ($e =~ /^(\w*)\s*(.*)\s*$/) {
index fbc00d7c13f747f910ac1a463b36adcf8609eaca..7e52dbc2ee831cb9a5e5de61eb452e280781553a 100644 (file)
@@ -7,7 +7,7 @@
 package Parse::Pidl::Samba4::Header;
 
 use strict;
-use Parse::Pidl::Typelist qw(mapType);
+use Parse::Pidl::Typelist qw(mapTypeName);
 use Parse::Pidl::Util qw(has_property is_constant);
 use Parse::Pidl::Samba4 qw(is_intree);
 
@@ -55,7 +55,7 @@ sub HeaderElement($)
 
        pidl tabs();
        if (has_property($element, "represent_as")) {
-               pidl mapType($element->{PROPERTIES}->{represent_as})." ";
+               pidl mapTypeName($element->{PROPERTIES}->{represent_as})." ";
        } else {
                HeaderType($element, $element->{TYPE}, "");
                pidl " ";
@@ -209,7 +209,7 @@ sub HeaderType($$$)
        if (has_property($e, "charset")) {
                pidl "const char";
        } else {
-               pidl mapType($e->{TYPE});
+               pidl mapTypeName($e->{TYPE});
        }
 }
 
@@ -303,7 +303,7 @@ sub HeaderFunction($)
            HeaderFunctionInOut($fn, "out");
            HeaderFunctionInOut($fn, "inout");
            if ($fn->{RETURN_TYPE} ne "void") {
-                   pidl tabs().mapType($fn->{RETURN_TYPE}) . " result;\n";
+                   pidl tabs().mapTypeName($fn->{RETURN_TYPE}) . " result;\n";
            }
            $tab_depth--;
            pidl tabs()."} out;\n\n";
index 15618bb534d8b870a6a0729e0969bcccbf6668e6..46898e6ad857d7b6f07b4e0745f12317edcff254 100644 (file)
@@ -15,7 +15,7 @@ require Exporter;
    NeededElement NeededType);
 
 use strict;
-use Parse::Pidl::Typelist qw(hasType getType mapType);
+use Parse::Pidl::Typelist qw(hasType getType mapTypeName);
 use Parse::Pidl::Util qw(has_property ParseExpr ParseExprExt print_uuid);
 use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
 use Parse::Pidl::Samba4 qw(is_intree choose_header);
@@ -636,7 +636,7 @@ sub ParseElementPushLevel
 
                        # Allow speedups for arrays of scalar types
                        if (is_charset_array($e,$l)) {
-                               pidl "NDR_CHECK(ndr_push_charset($ndr, $ndr_flags, $var_name, $length, sizeof(" . mapType($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));";
+                               pidl "NDR_CHECK(ndr_push_charset($ndr, $ndr_flags, $var_name, $length, sizeof(" . mapTypeName($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));";
                                return;
                        } elsif (has_fast_array($e,$l)) {
                                pidl "NDR_CHECK(ndr_push_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));";
@@ -707,7 +707,7 @@ sub ParseElementPush($$$$$)
                pidl "{";
                indent;
                my $transmit_name = "_transmit_$e->{NAME}";
-               pidl mapType($e->{TYPE}) ." $transmit_name;";
+               pidl mapTypeName($e->{TYPE}) ." $transmit_name;";
                pidl "NDR_CHECK(ndr_$e->{REPRESENTATION_TYPE}_to_$e->{TYPE}($var_name, " . get_pointer_to($transmit_name) . "));";
                $var_name = $transmit_name;
        }
@@ -1014,7 +1014,7 @@ sub ParseElementPullLevel
                                if ($l->{IS_ZERO_TERMINATED}) {
                                        CheckStringTerminator($ndr, $e, $l, $length);
                                }
-                               pidl "NDR_CHECK(ndr_pull_charset($ndr, $ndr_flags, ".get_pointer_to($var_name).", $length, sizeof(" . mapType($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));";
+                               pidl "NDR_CHECK(ndr_pull_charset($ndr, $ndr_flags, ".get_pointer_to($var_name).", $length, sizeof(" . mapTypeName($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));";
                                return;
                        } elsif (has_fast_array($e, $l)) {
                                if ($l->{IS_ZERO_TERMINATED}) {
@@ -1116,7 +1116,7 @@ sub ParseElementPull($$$$$)
                $represent_name = $var_name;
                $transmit_name = "_transmit_$e->{NAME}";
                $var_name = $transmit_name;
-               pidl mapType($e->{TYPE})." $var_name;";
+               pidl mapTypeName($e->{TYPE})." $var_name;";
        }
 
        $var_name = append_prefix($e, $var_name);
@@ -1294,7 +1294,7 @@ sub ParseEnumPull($$)
 {
        my($enum,$name) = @_;
        my($type_fn) = $enum->{BASE_TYPE};
-       my($type_v_decl) = mapType($type_fn);
+       my($type_v_decl) = mapTypeName($type_fn);
 
        pidl "$type_v_decl v;";
        start_flags($enum);
@@ -1369,7 +1369,7 @@ sub ParseBitmapPull($$)
 {
        my($bitmap,$name) = @_;
        my $type_fn = $bitmap->{BASE_TYPE};
-       my($type_decl) = mapType($bitmap->{BASE_TYPE});
+       my($type_decl) = mapTypeName($bitmap->{BASE_TYPE});
 
        pidl "$type_decl v;";
        start_flags($bitmap);
@@ -1384,7 +1384,7 @@ sub ParseBitmapPull($$)
 sub ParseBitmapPrintElement($$$)
 {
        my($e,$bitmap,$name) = @_;
-       my($type_decl) = mapType($bitmap->{BASE_TYPE});
+       my($type_decl) = mapTypeName($bitmap->{BASE_TYPE});
        my($type_fn) = $bitmap->{BASE_TYPE};
        my($flag);
 
@@ -1402,7 +1402,7 @@ sub ParseBitmapPrintElement($$$)
 sub ParseBitmapPrint($$)
 {
        my($bitmap,$name) = @_;
-       my($type_decl) = mapType($bitmap->{TYPE});
+       my($type_decl) = mapTypeName($bitmap->{TYPE});
        my($type_fn) = $bitmap->{BASE_TYPE};
 
        start_flags($bitmap);
@@ -1421,7 +1421,7 @@ sub ParseBitmapPrint($$)
 sub DeclBitmap($$$)
 {
        my ($e,$t,$name) = @_;
-       return mapType(Parse::Pidl::Typelist::bitmap_type_fn($e)) . 
+       return mapTypeName(Parse::Pidl::Typelist::bitmap_type_fn($e)) . 
                ($t eq "pull"?" *":" ") . "r";
 }
 
@@ -1771,7 +1771,7 @@ sub ParseUnionPull($$)
                if (Parse::Pidl::Typelist::typeIs($switch_type, "ENUM")) {
                        $switch_type = Parse::Pidl::Typelist::enum_type_fn(getType($switch_type)->{DATA});
                }
-               pidl mapType($switch_type) . " _level;";
+               pidl mapTypeName($switch_type) . " _level;";
        }
 
        my %double_cases = ();
index 57ff007d1b27ea1f854a4992d430538bcb71c8b9..d541f318ee383a7bd829db656cc3a64f469ff1e1 100644 (file)
@@ -8,7 +8,7 @@ package Parse::Pidl::Samba4::SWIG;
 
 use vars qw($VERSION);
 use Parse::Pidl::Samba4 qw(DeclLong);
-use Parse::Pidl::Typelist qw(mapType);
+use Parse::Pidl::Typelist qw(mapTypeName);
 use Parse::Pidl::Util qw(has_property);
 $VERSION = '0.01';
 
@@ -77,7 +77,7 @@ sub ParseInterface($$)
                $name =~ s/^$if->{NAME}_//g;
                $name =~ s/^$basename\_//g;
                $args .= "TALLOC_CTX *mem_ctx = NULL";
-               pidl mapType($fn->{RETURN_TYPE}) . " $name($args)";
+               pidl mapTypeName($fn->{RETURN_TYPE}) . " $name($args)";
                pidl "{";
                indent;
                pidl "struct $fn->{NAME} r;";
index cde5da2b6b30de5d0411e7d768f56f9e4ca4dc13..f1f23bf84b9d4b0811e1e7ac7731c221ede5c9e4 100644 (file)
@@ -1,6 +1,6 @@
 ###################################################
 # Trivial Parser Generator
-# Copyright jelmer@samba.org 2005
+# Copyright jelmer@samba.org 2005-2007
 # released under the GNU GPL
 
 package Parse::Pidl::Samba4::TDR;
@@ -8,13 +8,17 @@ use Parse::Pidl qw(fatal);
 use Parse::Pidl::Util qw(has_property ParseExpr is_constant);
 use Parse::Pidl::Samba4 qw(is_intree choose_header);
 
+use Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(ParserType $ret $ret_hdr);
+
 use vars qw($VERSION);
 $VERSION = '0.01';
 
 use strict;
 
-my $ret;
-my $ret_hdr;
+our $ret;
+our $ret_hdr;
 my $tabs = "";
 
 sub indent() { $tabs.="\t"; }
@@ -117,14 +121,14 @@ sub ParserElement($$$)
 
 sub ParserStruct($$$$)
 {
-       my ($e,$n,$t,$p) = @_;
+       my ($e,$t,$p) = @_;
 
-       fn_declare($p,,"NTSTATUS tdr_$t\_$n (struct tdr_$t *tdr".typearg($t).", struct $n *v)");
+       fn_declare($p,"NTSTATUS tdr_$t\_$e->{NAME} (struct tdr_$t *tdr".typearg($t).", struct $e->{NAME} *v)");
        pidl "{"; indent;
        pidl "int i;" if (ContainsArray($e));
 
        if ($t eq "print") {
-               pidl "tdr->print(tdr, \"\%-25s: struct $n\", name);";
+               pidl "tdr->print(tdr, \"\%-25s: struct $e->{NAME}\", name);";
                pidl "tdr->level++;";
        }
 
@@ -141,16 +145,16 @@ sub ParserStruct($$$$)
        deindent; pidl "}";
 }
 
-sub ParserUnion($$$$)
+sub ParserUnion($$$)
 {
-       my ($e,$n,$t,$p) = @_;
+       my ($e,$t,$p) = @_;
 
-       fn_declare($p,"NTSTATUS tdr_$t\_$n(struct tdr_$t *tdr".typearg($t).", int level, union $n *v)");
+       fn_declare($p,"NTSTATUS tdr_$t\_$e->{NAME}(struct tdr_$t *tdr".typearg($t).", int level, union $e->{NAME} *v)");
        pidl "{"; indent;
        pidl "int i;" if (ContainsArray($e));
 
        if ($t eq "print") {
-               pidl "tdr->print(tdr, \"\%-25s: union $n\", name);";
+               pidl "tdr->print(tdr, \"\%-25s: union $e->{NAME}\", name);";
                pidl "tdr->level++;";
        }
        
@@ -174,19 +178,19 @@ sub ParserUnion($$$$)
        deindent; pidl "}";
 }
 
-sub ParserBitmap($$$$)
+sub ParserBitmap($$$)
 {
-       my ($e,$n,$t,$p) = @_;
+       my ($e,$t,$p) = @_;
        return if ($p);
-       pidl "#define tdr_$t\_$n tdr_$t\_" . Parse::Pidl::Typelist::bitmap_type_fn($e);
+       pidl "#define tdr_$t\_$e->{NAME} tdr_$t\_" . Parse::Pidl::Typelist::bitmap_type_fn($e);
 }
 
-sub ParserEnum($$$$)
+sub ParserEnum($$$)
 {
-       my ($e,$n,$t,$p) = @_;
+       my ($e,$t,$p) = @_;
        my $bt = ($e->{PROPERTIES}->{base_type} or "uint8");
        
-       fn_declare($p, "NTSTATUS tdr_$t\_$n (struct tdr_$t *tdr".typearg($t).", enum $n *v)");
+       fn_declare($p, "NTSTATUS tdr_$t\_$e->{NAME} (struct tdr_$t *tdr".typearg($t).", enum $e->{NAME} *v)");
        pidl "{";
        if ($t eq "pull") {
                pidl "\t$bt\_t r;";
@@ -201,17 +205,27 @@ sub ParserEnum($$$$)
        pidl "}";
 }
 
-sub ParserTypedef($$)
+sub ParserTypedef($$$)
+{
+       my ($e,$t,$p) = @_;
+
+       ParserType($e->{DATA},$t);
+}
+
+sub ParserType($$)
 {
        my ($e,$t) = @_;
 
        return if (has_property($e, "no$t"));
 
-       $e->{PROPERTIES} = $e->{DATA}->{PROPERTIES};
-
-       { STRUCT => \&ParserStruct, UNION => \&ParserUnion, 
-               ENUM => \&ParserEnum, BITMAP => \&ParserBitmap
-       }->{$e->{DATA}->{TYPE}}->($e->{DATA}, $e->{NAME}, $t, has_property($e, "public"));
+       my $handlers = { 
+               STRUCT => \&ParserStruct, UNION => \&ParserUnion, 
+               ENUM => \&ParserEnum, BITMAP => \&ParserBitmap,
+               TYPEDEF => \&ParserTypedef
+       };
+       
+       $handlers->{$e->{TYPE}}->($e, $t, has_property($e, "public")) 
+               if (defined($handlers->{$e->{TYPE}}));
 
        pidl "";
 }
@@ -224,10 +238,9 @@ sub ParserInterface($)
        pidl_hdr "#define __TDR_$x->{NAME}_HEADER__";
 
        foreach (@{$x->{DATA}}) {
-               next if ($_->{TYPE} ne "TYPEDEF");
-               ParserTypedef($_, "pull");
-               ParserTypedef($_, "push");
-               ParserTypedef($_, "print");
+               ParserType($_, "pull");
+               ParserType($_, "push");
+               ParserType($_, "print");
        }
 
        pidl_hdr "#endif /* __TDR_$x->{NAME}_HEADER__ */";
index 7be7e5a5c3e2bc78714311b88717a7b3ceaea6fb..a098f1ab0546520ce330ac132365b42cc18da434 100644 (file)
@@ -7,14 +7,14 @@ package Parse::Pidl::Typelist;
 
 require Exporter;
 @ISA = qw(Exporter);
-@EXPORT_OK = qw(hasType getType mapType scalar_is_reference expandAlias);
+@EXPORT_OK = qw(hasType getType mapTypeName scalar_is_reference expandAlias);
 use vars qw($VERSION);
 $VERSION = '0.01';
 
 use Parse::Pidl::Util qw(has_property);
 use strict;
 
-my %typedefs = ();
+my %types = ();
 
 my @reference_scalars = (
        "string", "string_array", "nbt_string", 
@@ -89,14 +89,14 @@ sub mapScalarType($)
 sub addType($)
 {
        my $t = shift;
-       $typedefs{$t->{NAME}} = $t;
+       $types{$t->{NAME}} = $t;
 }
 
 sub getType($)
 {
        my $t = shift;
        return undef if not hasType($t);
-       return $typedefs{$t};
+       return $types{$t};
 }
 
 sub typeIs($$)
@@ -110,7 +110,7 @@ sub typeIs($$)
 sub hasType($)
 {
        my $t = shift;
-       return 1 if defined($typedefs{$t});
+       return 1 if defined($types{$t});
        return 0;
 }
 
@@ -178,7 +178,22 @@ sub bitmap_type_fn($)
        return "uint32";
 }
 
-sub mapType($)
+sub mapType($$)
+{
+       sub mapType($$);
+       my ($t, $n) = @_;
+
+       return mapType($t->{DATA}, $n) if ($t->{TYPE} eq "TYPEDEF");
+       return mapType($t->{DATA}, $n) if ($t->{TYPE} eq "DECLARE");
+       return mapScalarType($n) if ($t->{TYPE} eq "SCALAR");
+       return "enum $n" if ($t->{TYPE} eq "ENUM");
+       return "struct $n" if ($t->{TYPE} eq "STRUCT");
+       return "union $n" if ($t->{TYPE} eq "UNION");
+       return mapScalarType(bitmap_type_fn($t)) if ($t->{TYPE} eq "BITMAP");
+       die("Unknown type $t->{TYPE}");
+}
+
+sub mapTypeName($)
 {
        my $t = shift;
        return "void" unless defined($t);
@@ -189,17 +204,8 @@ sub mapType($)
                # Best guess
                return "struct $t";
        }
-       return mapScalarType($t) if ($dt->{DATA}->{TYPE} eq "SCALAR");
-       return "enum $dt->{NAME}" if ($dt->{DATA}->{TYPE} eq "ENUM");
-       return "struct $dt->{NAME}" if ($dt->{DATA}->{TYPE} eq "STRUCT");
-       return "struct $dt->{NAME}" if ($dt->{DATA}->{TYPE} eq "INTERFACE");
-       return "union $dt->{NAME}" if ($dt->{DATA}->{TYPE} eq "UNION");
-
-       if ($dt->{DATA}->{TYPE} eq "BITMAP") {
-               return mapScalarType(bitmap_type_fn($dt->{DATA}));
-       }
 
-       die("Unknown type $dt->{DATA}->{TYPE}");
+       return mapType($dt, $dt->{NAME});
 }
 
 sub LoadIdl($)
@@ -209,17 +215,14 @@ sub LoadIdl($)
        foreach my $x (@{$idl}) {
                next if $x->{TYPE} ne "INTERFACE";
 
-               # DCOM interfaces can be types as well
-               addType({
-                       NAME => $x->{NAME},
-                       TYPE => "TYPEDEF",
-                       DATA => $x
-                       }) if (has_property($x, "object"));
-
                foreach my $y (@{$x->{DATA}}) {
                        addType($y) if (
                                $y->{TYPE} eq "TYPEDEF" 
-                            or $y->{TYPE} eq "DECLARE");
+                            or $y->{TYPE} eq "DECLARE" 
+                                or $y->{TYPE} eq "UNION"
+                                or $y->{TYPE} eq "STRUCT"
+                        or $y->{TYPE} eq "ENUM"
+                        or $y->{TYPE} eq "BITMAP");
                }
        }
 }
index 0bd841a5ff78a59705bcc05d5c8df9cf695af6d3..b04e2789028d72403f673023511d16e9ddd79ed5 100755 (executable)
@@ -17,7 +17,7 @@ pidl - An IDL compiler written in Perl
 
 pidl --help
 
-pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--dcom-proxy] [--com-header] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
+pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
 
 =head1 DESCRIPTION
 
@@ -401,7 +401,6 @@ use Getopt::Long;
 use File::Basename;
 use Parse::Pidl;
 use Parse::Pidl::Util;
-use Parse::Pidl::ODL;
 
 #####################################################################
 # save a data structure into a file
@@ -468,8 +467,6 @@ my($opt_ndr_parser);
 my($opt_tdr_parser);
 my($opt_ws_parser);
 my($opt_swig);
-my($opt_dcom_proxy);
-my($opt_com_header);
 my($opt_ejs);
 my($opt_quiet) = 0;
 my($opt_outputdir) = '.';
@@ -510,8 +507,6 @@ Samba 4 output:
  --swig[=OUTFILE]        create swig wrapper file [BASENAME.i]
  --server[=OUTFILE]      create server boilerplate [ndr_BASENAME_s.c]
  --template              print a template for a pipe
- --dcom-proxy[=OUTFILE]  create DCOM proxy [ndr_BASENAME_p.c]
- --com-header[=OUTFILE]  create header for COM [com_BASENAME.h]
 
 Samba 3 output:
  --samba3-ndr-client[=OUTF] create client calls for Samba3 
@@ -545,8 +540,6 @@ my $result = GetOptions (
            'ejs' => \$opt_ejs,
            'diff' => \$opt_diff,
            'swig:s' => \$opt_swig,
-           'dcom-proxy:s' => \$opt_dcom_proxy,
-           'com-header:s' => \$opt_com_header,
            'quiet' => \$opt_quiet,
                'verbose' => \$opt_verbose,
            'warn-compat' => \$opt_warn_compat,
@@ -602,31 +595,11 @@ sub process_file($)
                unlink($tempfile);
        }
 
-       my $comh_filename = ($opt_com_header or "$outputdir/com_$basename.h");
-       if (defined($opt_com_header)) {
-               require Parse::Pidl::Samba4::COM::Header;
-               my $res = Parse::Pidl::Samba4::COM::Header::Parse($pidl,"$outputdir/ndr_$basename.h");
-               if ($res) {
-                       FileSave($comh_filename, $res);
-               }
-       }
-
-       if (defined($opt_dcom_proxy)) {
-               require Parse::Pidl::Samba4::COM::Proxy;
-               my $res = Parse::Pidl::Samba4::COM::Proxy::Parse($pidl,$comh_filename);
-               if ($res) {
-                       my ($client) = ($opt_dcom_proxy or "$outputdir/$basename\_p.c");
-                       FileSave($client, $res);
-               }
-       }
-
        if ($opt_warn_compat) {
                require Parse::Pidl::Compat;
                Parse::Pidl::Compat::Check($pidl);
        }
 
-       $pidl = Parse::Pidl::ODL::ODL2IDL($pidl);
-
        if (defined($opt_ws_parser) or 
            defined($opt_client) or defined($opt_server) or 
            defined($opt_ndr_parser) or defined($opt_ejs) or 
@@ -679,30 +652,8 @@ sub process_file($)
 
        if (defined($opt_server)) {
                require Parse::Pidl::Samba4::NDR::Server;
-               my $dcom = "";
-
-               foreach (@{$pidl}) {
-                       next if ($_->{TYPE} ne "INTERFACE");
-
-                       if (Parse::Pidl::Util::has_property($_, "object")) {
-                               require Parse::Pidl::Samba4::COM::Stub;
-                               $dcom .= Parse::Pidl::Samba4::COM::Stub::ParseInterface($_);
-                       }
-               }
 
                FileSave(($opt_server or "$outputdir/ndr_$basename\_s.c"), Parse::Pidl::Samba4::NDR::Server::Parse($ndr,$h_filename));
-
-               if ($dcom ne "") {
-                       $dcom = "
-#include \"includes.h\"
-#include \"$h_filename\"
-#include \"rpc_server/dcerpc_server.h\"
-#include \"rpc_server/common/common.h\"
-
-$dcom
-";
-       FileSave("$outputdir/$basename\_d.c", $dcom);
-               }
        }
 
        if (defined($opt_ndr_parser)) {
diff --git a/source4/pidl/tests/tdr.pl b/source4/pidl/tests/tdr.pl
new file mode 100755 (executable)
index 0000000..35e54f5
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Samba4::TDR qw($ret $ret_hdr ParserType);
+
+ParserType({TYPE => "STRUCT", NAME => "foo", PROPERTIES => {public => 1}}, "pull");
+is($ret, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v)
+{
+       return NT_STATUS_OK;
+}
+
+");
+is($ret_hdr, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v);\n");
+
+$ret = ""; $ret_hdr = "";
+
+ParserType({TYPE => "UNION", NAME => "bar", PROPERTIES => {public => 1}}, "pull");
+is($ret, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v)
+{
+       switch (level) {
+       }
+       return NT_STATUS_OK;
+
+}
+
+");
+is($ret_hdr, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v);\n");
+
+$ret = ""; $ret_hdr = "";
+
+ParserType({TYPE => "UNION", NAME => "bar", PROPERTIES => {}}, "pull");
+is($ret, "static NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v)
+{
+       switch (level) {
+       }
+       return NT_STATUS_OK;
+
+}
+
+"); 
+is($ret_hdr, "");
index 63e6ae73b7712769cf477074c6ef4717167d7c7d..ecf665783628cc70ba786b774576f30f50dd16d6 100755 (executable)
@@ -6,7 +6,7 @@ PIDL_EXTRA_ARGS="$*"
 
 [ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
 
-PIDL="$PERL $srcdir/pidl/pidl --outputdir librpc/gen_ndr --header --ndr-parser --server --client --dcom-proxy --com-header --swig --ejs $PIDL_EXTRA_ARGS"
+PIDL="$PERL $srcdir/pidl/pidl --outputdir librpc/gen_ndr --header --ndr-parser --server --client --swig --ejs $PIDL_EXTRA_ARGS"
 
 if [ x$FULLBUILD = xFULL ]; then
       echo Rebuilding all idl files in librpc/idl
index 7366d372fece686d4807602e9151967ee92ad43b..d3a7564a5bf686042256ff70c64e06583e675eae 100644 (file)
 #include "librpc/gen_ndr/ndr_remact_c.h"
 #include "librpc/gen_ndr/epmapper.h"
 #include "torture/rpc/rpc.h"
-#include "librpc/gen_ndr/ndr_dcom.h"
 
 #define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9"
 
+const struct GUID IUnknown_uuid = {
+       0x00000000,0x0000,0x0000,{0xc0,0x00},{0x00,0x00,0x00,0x00,0x00,0x46}
+};
+
 static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint64_t *oxid, struct GUID *oid)
 {
        struct RemoteActivation r;
@@ -45,7 +48,7 @@ static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uin
        r.in.num_protseqs = 3;
        r.in.protseq = protseq;
        r.in.Interfaces = 1;
-       iids[0] = dcerpc_table_IUnknown.syntax_id.uuid;
+       iids[0] = IUnknown_uuid;
        r.in.pIIDs = iids;
        r.out.pOxid = oxid;
        r.out.ipidRemUnknown = oid;
index b893471290767fbc8078d0ae8bd14a4ca9b44e00..6222be8f30af7c2f7b6f8a241cd295eb4cc33980 100644 (file)
 #include "torture/torture.h"
 #include "librpc/gen_ndr/ndr_remact_c.h"
 #include "librpc/gen_ndr/ndr_epmapper_c.h"
-#include "librpc/gen_ndr/ndr_dcom.h"
 #include "torture/rpc/rpc.h"
 
 #define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9"
+#define DCERPC_IUNKNOWN_UUID "00000000-0000-0000-c000-000000000046"
+#define DCERPC_ICLASSFACTORY_UUID "00000001-0000-0000-c000-000000000046"
 
 static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {