r5362: Add pointer_default() support to pidl. pointer_default()
authorJelmer Vernooij <jelmer@samba.org>
Sat, 12 Feb 2005 23:03:26 +0000 (23:03 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:46 +0000 (13:09 -0500)
is assumed to be "ptr" if not specified (just like midl).

The validator will warn when "ptr" is used at the moment, because
pidl only supports unique, ref and relative at the moment.
(This used to be commit 31bed62a9a6f7830f523d509b67970648d40aaef)

23 files changed:
source4/build/pidl/ndr.pm
source4/build/pidl/validator.pm
source4/librpc/idl/audiosrv.idl
source4/librpc/idl/browser.idl
source4/librpc/idl/dbgidl.idl
source4/librpc/idl/dcerpc.idl
source4/librpc/idl/dcom.idl
source4/librpc/idl/drsblobs.idl
source4/librpc/idl/dsbackup.idl
source4/librpc/idl/echo.idl
source4/librpc/idl/efs.idl
source4/librpc/idl/exchange.idl
source4/librpc/idl/keysvc.idl
source4/librpc/idl/mgmt.idl
source4/librpc/idl/misc.idl
source4/librpc/idl/msgsvc.idl
source4/librpc/idl/policyagent.idl
source4/librpc/idl/rot.idl
source4/librpc/idl/scerpc.idl
source4/librpc/idl/security.idl
source4/librpc/idl/trkwks.idl
source4/librpc/idl/w32time.idl
source4/librpc/idl/xattr.idl

index 345141285d2f8d858351fcab9a289ed7f64ad243..f910be623aa3717e3c4c112fa4458a0a5fc8578b 100644 (file)
@@ -62,16 +62,34 @@ sub is_scalar_type($)
     return 0;
 }
 
+sub pointer_type($)
+{
+       my $e = shift;
+
+       return undef unless $e->{POINTERS};
+       
+       return "ref" if (util::has_property($e, "ref"));
+       return "ptr" if (util::has_property($e, "ptr"));
+       return "unique" if (util::has_property($e, "unique"));
+       return "relative" if (util::has_property($e, "relative"));
+
+       return undef;
+}
+
 # determine if an element needs a reference pointer on the wire
 # in its NDR representation
 sub need_wire_pointer($)
 {
        my $e = shift;
-       if ($e->{POINTERS} && 
-           !util::has_property($e, "ref")) {
-               return $e->{POINTERS};
+       my $pt;
+       
+       return 0 unless ($pt = pointer_type($e));
+
+       if ($pt ne "ref") {
+               return 1;
+       } else {
+               return 0;
        }
-       return undef;
 }
 
 # determine if an element is a pure scalar. pure scalars do not
@@ -1828,15 +1846,6 @@ sub ParseInterface($)
        my($interface) = shift;
        my($data) = $interface->{DATA};
 
-       foreach my $d (@{$data}) {
-               if ($d->{TYPE} eq "DECLARE") {
-                   $typedefs{$d->{NAME}} = $d;
-               }
-               if ($d->{TYPE} eq "TYPEDEF") {
-                   $typedefs{$d->{NAME}} = $d;
-               }
-       }
-
        # Push functions
        foreach my $d (@{$data}) {
                ($d->{TYPE} eq "TYPEDEF") &&
@@ -1904,6 +1913,54 @@ sub RegistrationFunction($$)
        pidl "}\n\n";
 }
 
+sub CheckPointerTypes($$)
+{
+       my $s = shift;
+       my $default = shift;
+
+       foreach my $e (@{$s->{ELEMENTS}}) {
+               if ($e->{POINTERS}) {
+                       if (not defined(pointer_type($e))) {
+                               $e->{PROPERTIES}->{$default} = 1;
+                       }
+
+                       if (pointer_type($e) eq "ptr") {
+                               print "Warning: ptr is not supported by pidl yet\n";
+                       }
+               }
+       }
+}
+
+sub LoadInterface($)
+{
+       my $x = shift;
+
+       if (not util::has_property($x, "pointer_default")) {
+               $x->{PROPERTIES}->{pointer_default} = "ptr";
+       }
+
+       foreach my $d (@{$x->{DATA}}) {
+               if ($d->{TYPE} eq "DECLARE" or $d->{TYPE} eq "TYPEDEF") {
+                   $typedefs{$d->{NAME}} = $d;
+                       if ($d->{DATA}->{TYPE} eq "STRUCT" or $d->{DATA}->{TYPE} eq "UNION") {
+                               CheckPointerTypes($d->{DATA}, $x->{PROPERTIES}->{pointer_default});
+                       }
+               }
+               if ($d->{TYPE} eq "FUNCTION") {
+                       CheckPointerTypes($d, $x->{PROPERTIES}->{pointer_default});
+               }
+       }
+}
+
+sub Load($)
+{
+       my $idl = shift;
+
+       foreach my $x (@{$idl}) {
+               LoadInterface($x);
+       }
+}
+
 #####################################################################
 # parse a parsed IDL structure back into an IDL file
 sub Parse($$)
@@ -1913,6 +1970,8 @@ sub Parse($$)
        my $h_filename = $filename;
        $res = "";
 
+       Load($idl);
+
        if ($h_filename =~ /(.*)\.c/) {
                $h_filename = "$1.h";
        }
index d496a02309406babd7245b242d8123a0660be2df..73e05ed433e0f73d434ae08f033dc18cf7181d42 100644 (file)
@@ -55,6 +55,7 @@ sub ValidElement($)
        if (!$e->{POINTERS} && (
                util::has_property($e, "ptr") or
                util::has_property($e, "unique") or
+               util::has_property($e, "relative") or
                util::has_property($e, "ref"))) {
                fatal(el_name($e) . " : pointer properties on non-pointer element\n");  
        }
@@ -137,6 +138,11 @@ sub ValidInterface($)
        my($interface) = shift;
        my($data) = $interface->{DATA};
 
+       if (util::has_property($interface, "pointer_default") && 
+               $interface->{PROPERTIES}->{pointer_default} eq "ptr") {
+               fatal "Full pointers are not supported yet\n";
+       }
+
        if (util::has_property($interface, "object")) {
        if(util::has_property($interface, "version") && 
                        $interface->{PROPERTIES}->{version} != 0) {
index 625eb5ae251a2933ba5cdbd1ecfc890a374a8a04..9b9399ffee2103d0721a1bef402a72dc2b6048df 100644 (file)
@@ -1,6 +1,7 @@
 [
        uuid("0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53"),
        version(1.0),
+       pointer_default(unique),
        helpstring("Audio Server")
 ] interface audiosrv
 {
index 19b413f1ba4d196858bc489e8d59a896d6463b46..5cc2475119f109bd2f089aa81cf7c905abc753cc 100644 (file)
@@ -2,6 +2,7 @@
   uuid("6bffd098-a112-3610-9833-012892020162"),
   version(0.0), 
   helpstring("Browsing"),
+  pointer_default(unique),
   endpoint("ncacn_np:[\\pipe\\browser]", "ncacn_ip_tcp:", "ncalrpc:")
 ] 
 interface browser
index 28b2b67e1f6046d8af06bbd4e0580ab98f1f5670..8d2133d81f230b467425efa91291d4f7e7dfaa3d 100644 (file)
@@ -1,6 +1,7 @@
 [
        uuid("1d55b526-c137-46c5-ab79-638f2a68e869"),
        version(1.0),
+    pointer_default(unique),
        helpstring("Remote IDL debugger")
 ] interface dbgidl 
 {
index b5f9fbf466890cb077c27a9c6e95cd58a144fb5f..3ffe14d453968940d3d99d929a4d5f49767f4eea 100644 (file)
@@ -8,6 +8,9 @@
   see http://www.opengroup.org/onlinepubs/9629399/chap12.htm for packet
   layouts
 */
+[
+pointer_default(unique)
+]
 interface dcerpc
 {
        typedef [public] struct {
index ad2963c905d3c898b39c1a9cf7b71187a5001bf9..a29d38dac1a08fffe6bf5b090c7899cdeedda5e2 100644 (file)
@@ -9,6 +9,7 @@
 
 [
        uuid("18f70770-8e64-11cf-9af1-0020af6e72f4"),
+       pointer_default(unique),
        version(0.0)
 ] interface dcom_Unknown
 {
@@ -17,6 +18,9 @@
        void UpdateResolverBindings();
 }
 
+[
+       pointer_default(unique)
+]
 interface ObjectRpcBaseTypes
 {
        /* COM_MINOR_VERSION = 1 (NT4.0, SP1, SP2, DCOM95). */
@@ -216,6 +220,7 @@ interface ObjectRpcBaseTypes
 [
        object,
        uuid("00000000-0000-0000-C000-000000000046"),
+       pointer_default(unique),
        helpstring("Base interface for all COM interfaces")
 ]
 interface IUnknown
@@ -266,6 +271,7 @@ interface IUnknown
 [
        uuid("00000131-0000-0000-C000-000000000046"),
        object,
+       pointer_default(unique),
        helpstring("Remote version of IUnknown")
 ]
 interface IRemUnknown : IUnknown
@@ -306,6 +312,7 @@ interface IRemUnknown : IUnknown
 
 [
        uuid("00000140-0000-0000-c000-000000000046"),
+       pointer_default(unique),
        object
 ] interface IClassActivator : IUnknown
 {
@@ -318,6 +325,7 @@ interface IRemUnknown : IUnknown
 
 [
        uuid("00000136-0000-0000-c000-000000000046"),
+       pointer_default(unique),
        object
 ] interface ISCMLocalActivator : IClassActivator
 {
@@ -325,6 +333,7 @@ interface IRemUnknown : IUnknown
 }
 
 [
+       pointer_default(unique),
        uuid("c6f3ee72-ce7e-11d1-b71e-00c04fc3111a")
 ] interface IMachineLocalActivator 
 {
@@ -332,6 +341,7 @@ interface IRemUnknown : IUnknown
 }
 
 [
+       pointer_default(unique),
        uuid("e60c73e6-88f9-11cf-9af1-0020af6e72f4")
 ] interface ILocalObjectExporter
 {
@@ -342,6 +352,7 @@ interface IRemUnknown : IUnknown
    System.Activator class */
 [
        uuid("000001a0-0000-0000-c000-000000000046"),
+       pointer_default(unique),
        object
 ]
        interface ISystemActivator : IClassActivator
@@ -360,6 +371,7 @@ interface IRemUnknown : IUnknown
 /* marshaled interface packets. */
 [
        object,
+       pointer_default(unique),
        uuid("00000143-0000-0000-C000-000000000046")
 ]
 
@@ -376,6 +388,7 @@ interface IRemUnknown2 : IRemUnknown
 
 [
 object,
+       pointer_default(unique),
        uuid("00000136-0000-0000-C000-000000000046")
        ] interface ISCMActivator : IClassActivator
 {
@@ -384,6 +397,7 @@ object,
 
 [
        object,
+       pointer_default(unique),
        uuid("00020400-0000-0000-C000-000000000046")
        ] interface IDispatch : IUnknown
 {
@@ -467,6 +481,7 @@ uuid(DB7C21F8-FE33-4C11-AEA5-CEB56F076FBB),
 
 [
        object,
+       pointer_default(unique),
        uuid("0000000C-0000-0000-C000-000000000046"),
        helpstring("Stream")
 ]
index b2d38b27d3b3d598da9b1f771abe88356b9f74d9..9f3e27827feb2f57a63083728e600eb0b2b066c7 100644 (file)
@@ -3,6 +3,7 @@
 [
   uuid("38578646-4566-4564-2244-275796345667"),
   version(0.0),
+  pointer_default(unique),
   helpstring("Active Directory Replication LDAP Blobs")
 ]
 interface drsblobs {
index d91fc45f0f29b8dfc7c61149e26b3e0af3d931cf..c4f3d3cded5866617912b0ee45a2f39ea5e9245f 100644 (file)
@@ -1,6 +1,7 @@
 [
        uuid("ecec0d70-a603-11d0-96b1-00a0c91ece30"),
        version(1.0),
+    pointer_default(unique),
        helpstring("Backup support for Active Directory")
 ] interface ad_backup
 {
@@ -18,6 +19,7 @@
 [
        uuid("16e0cf3a-a604-11d0-96b1-00a0c91ece30"),
        version(1.0),
+    pointer_default(unique),
        helpstring("Restoring Active Directory backups")
 ] interface ad_restore
 {
index c73de8cc7b5a4516a6ca07fed653cfccf3f951c8..e563dc41c8132d1f0535f094a28f7196a55ed178 100644 (file)
@@ -4,6 +4,7 @@
 [
   uuid("60a15ec5-4de8-11d7-a637-005056a20182"),
   endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:", "ncalrpc:"),
+  pointer_default(unique),
   version(1.0),
   helpstring("Simple echo pipe")
 ]
index 9ec826287ca6dcc7f1bdb798d97d9f243daceabd..9a97223e6ad8bde20bd677fb3de763cd73b19f53 100644 (file)
@@ -1,6 +1,7 @@
 [
        uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"),
        version(1.0),
+    pointer_default(unique),
        helpstring("Encrypted File System")
 ] interface efs 
 {
index 82e783a0dcab7cfa392faf35362123672dba203f..119de7dfb001a94013c03996a97e8b559fd73a6d 100644 (file)
@@ -7,6 +7,7 @@
 
 [
        uuid("99e64010-b032-11d0-97a4-00c04fd6551d"),
+    pointer_default(unique),
        version(3.0)
 ] interface exchange_store_admin3
 {
@@ -16,6 +17,7 @@
 
 [
        uuid("89742ace-a9ed-11cf-9c0c-08002be7ae86"),
+    pointer_default(unique),
        version(2.0)
 ] interface exchange_store_admin2
 {
@@ -24,6 +26,7 @@
 
 [
        uuid("a4f1db00-ca47-1067-b31e-00dd010662da"),
+    pointer_default(unique),
        version(1.0)
 ] interface exchange_store_admin1
 {
@@ -33,6 +36,7 @@
 
 [
        uuid("1544f5e0-613c-11d1-93df-00c04fd7bd09"),
+    pointer_default(unique),
        version(1.0),
        helpstring("Exchange 2003 Directory Request For Response")
 ] interface exchange_ds_rfr
@@ -49,6 +53,7 @@
 [
        uuid("f930c514-1215-11d3-99a5-00a0c9b61b04"),
        helpstring("System Attendant Cluster Interface"),
+    pointer_default(unique),
        version(1.0)
 ] interface exchange_sysatt_cluster
 {
@@ -62,6 +67,7 @@ System Attendant Private Interface
 
 [
        uuid("469d6ec0-0d87-11ce-b13f-00aa003bac6c"),
+    pointer_default(unique),
        helpstring("Exchange 5.5 System Attendant Request for Response")
 ] interface exchange_system_attendant
 {
@@ -70,6 +76,7 @@ System Attendant Private Interface
 
 [
        uuid("9e8ee830-4559-11ce-979b-00aa005ffebe"),
+    pointer_default(unique),
        version(2.0),
        helpstring("Exchange 5.5 MTA")
 ] interface exchange_mta
@@ -85,6 +92,7 @@ System Attendant Private Interface
 
 [
        uuid("f5cc59b4-4264-101a-8c59-08002b2f8426"),
+    pointer_default(unique),
        version(21.0),
        helpstring("Exchange 5.5 DRS")
 ] interface exchange_drs
@@ -123,6 +131,7 @@ System Attendant Private Interface
 [
        uuid("f5cc5a7c-4264-101a-8c59-08002b2f8426"),
        version(21.0),
+    pointer_default(unique),
        helpstring("Exchange 5.5 XDS")
 ] interface exchange_xds
 {
@@ -131,6 +140,7 @@ System Attendant Private Interface
 
 [
        uuid("38a94e72-a9bc-11d2-8faf-00c04fa378ff"),
+    pointer_default(unique),
        version(1.0)
 ] interface exchange_mta_qadmin
 {
@@ -140,6 +150,7 @@ System Attendant Private Interface
 
 [
        uuid("0e4a0156-dd5d-11d2-8c2f-00c04fb6bcde"),
+    pointer_default(unique),
        version(1.0)
 ] interface exchange_store_information
 {
@@ -148,6 +159,7 @@ System Attendant Private Interface
 
 [
        uuid("f5cc5a18-4264-101a-8c59-08002b2f8426"),
+    pointer_default(unique),
        version(56.0),
        helpstring("Exchange 5.5 Name Service Provider")
 ] interface exchange_nsp
@@ -177,6 +189,7 @@ System Attendant Private Interface
 
 [
        uuid("a4f1db00-ca47-1067-b31f-00dd010662da"),
+    pointer_default(unique),
        version(0.81),
        helpstring("Exchange 5.5 EMSMDB")
 ] interface exchange_emsmdb
@@ -224,6 +237,7 @@ System Attendant Private Interface
 
 [
        uuid("c840a7dc-42c0-1a10-b4b9-08002b2fe182"),
+    pointer_default(unique),
        helpstring("Unknown")
 ] interface exchange_unknown
 {
index 8ab13463c972ae9fdec41abd38c5adb07e37928b..9d05f7d8dc59102661c193f9a9da58e4eae18ddd 100644 (file)
@@ -6,6 +6,7 @@
 /* Also seen as: 0d72a7d4-6148-11d1-b4aa-00c04fb66ea0 */
 [
   uuid("8d0ffe72-d252-11d0-bf8f-00c04fd9126b"),
+  pointer_default(unique),
   version(1.0),
   helpstring("Cryptographic Key Services")
 ]
index 95d39a05a8d053d7bbed850b4a00db330a002aac..b649e0db29aa1bec0cd0eb1ad7d45ed1dde09ef2 100644 (file)
@@ -7,6 +7,7 @@
 [
   uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"), 
   version(1.0),
+  pointer_default(unique),
   endpoint("ncalrpc:[EPMAPPER]", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"),
   helpstring("DCE/RPC Remote Management")
 ] 
index 13306b687627637047e481e464bb36694d52dd60..935032f30575ab5b08b7cee325b06d2cc4406bbe 100644 (file)
@@ -4,6 +4,10 @@
   miscellaneous IDL structures
 */
 
+
+[
+       pointer_default(unique)
+]
 interface misc
 {
        typedef [public,noprint,gensize] struct {
index 956f1524d6830f9e64e17883fc5844ddad69f1a1..09878ac7a493bb46ac92d37b7bbed4155dadcb44 100644 (file)
@@ -3,6 +3,7 @@
 [
        uuid("17fdd703-1827-4e34-79d4-24a55c53bb37"),
        version(1.0),
+       pointer_default(unique),
        helpstring("Messaging Service")
 ] interface msgsvc
 {
index fbd15a552a6c173e712c23b2d0a4c3d6de2b92a1..6da5cbb8f46c85293fbb612fb6b72d554f2c5657 100644 (file)
@@ -3,6 +3,7 @@
 [
        uuid("d335b8f6-cb31-11d0-b0f9-006097ba4e54"),
        version(1.5),
+    pointer_default(unique),
        helpstring("IPSec Policy Agent")
 ] interface policyagent
 {
index 3b3bd6e98790f39f367a81c410ff2ff49129a0b9..28aae600368c354b270991bc60b61dbc273a7094 100644 (file)
@@ -3,6 +3,7 @@
 [
        uuid("b9e79e60-3d52-11ce-aaa1-00006901293f"),
        version(0.2),
+    pointer_default(unique),
        endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", 
                  "ncalrpc:[EPMAPPER]", "ncacn_unix_stream:[/tmp/epmapper]")
 ] interface rot
index 91373a668527a45784063531bbb98b55ffaabfa3..2c3c4f865f430e28ad11aa3a6d2444fdac8f2d8a 100644 (file)
@@ -5,6 +5,7 @@
 [
   uuid("93149ca2-973b-11d1-8c39-00c04fb984f9"),
   version(0.0),
+  pointer_default(unique),
   helpstring("Security Configuration Editor")
 ]
 interface scerpc
index 3782d984f71827363be17ca0dd0298c5c386bc80..71929cd8435ef02e427a1e58bf53ef3682d7c593 100644 (file)
@@ -4,6 +4,9 @@
   security IDL structures
 */
 
+[
+       pointer_default(unique)
+]
 interface security
 {
        /*
index 4b3fafe723ba9306688af4350dee15468ae6d315..8f8c759d1772d91d13ee43947adfb6a189ee4bbf 100644 (file)
@@ -5,6 +5,7 @@
 [
        uuid("300f3532-38cc-11d0-a3f0-0020af6b0add"),
        version(1.2),
+    pointer_default(unique),
        helpstring("Distributed Key Tracking Service")
 ]
 interface trkwks
index bdf4b5d1181b49de6e688c69ffd46a7d345e3a7b..c3c6e014de01f65e31f80b03ca085e8992c8743b 100644 (file)
@@ -6,6 +6,7 @@
   uuid("8fb6d884-2388-11d0-8c35-00c04fda2795"),
   endpoint("ncacn_np:[\\pipe\\srvsvc]","ncacn_np:[\\pipe\\atsvc]","ncacn_np:[\\pipe\\browser]","ncacn_np:[\\pipe\\keysvc]","ncacn_np:[\\pipe\\wkssvc]"),
   version(4.1),
+  pointer_default(unique),
   helpstring("Win32 Time Server")
 ]
 interface w32time
index afcefe49bc7d39c24bfc9cce1aaab7db922a0501..f133402d27b7f2a1a9381eb4103d24e3fc77759d 100644 (file)
@@ -9,7 +9,8 @@
 */
 
 [
-  depends(security)
+  depends(security),
+  pointer_default(unique)
 ]
 interface xattr
 {