From e90c93402bc916d85653c8f6340655184a6a5789 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 12 Feb 2005 23:03:26 +0000 Subject: r5362: Add pointer_default() support to pidl. pointer_default() 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) --- source4/build/pidl/ndr.pm | 85 ++++++++++++++++++++++++++++++++------ source4/build/pidl/validator.pm | 6 +++ source4/librpc/idl/audiosrv.idl | 1 + source4/librpc/idl/browser.idl | 1 + source4/librpc/idl/dbgidl.idl | 1 + source4/librpc/idl/dcerpc.idl | 3 ++ source4/librpc/idl/dcom.idl | 15 +++++++ source4/librpc/idl/drsblobs.idl | 1 + source4/librpc/idl/dsbackup.idl | 2 + source4/librpc/idl/echo.idl | 1 + source4/librpc/idl/efs.idl | 1 + source4/librpc/idl/exchange.idl | 14 +++++++ source4/librpc/idl/keysvc.idl | 1 + source4/librpc/idl/mgmt.idl | 1 + source4/librpc/idl/misc.idl | 4 ++ source4/librpc/idl/msgsvc.idl | 1 + source4/librpc/idl/policyagent.idl | 1 + source4/librpc/idl/rot.idl | 1 + source4/librpc/idl/scerpc.idl | 1 + source4/librpc/idl/security.idl | 3 ++ source4/librpc/idl/trkwks.idl | 1 + source4/librpc/idl/w32time.idl | 1 + source4/librpc/idl/xattr.idl | 3 +- 23 files changed, 135 insertions(+), 14 deletions(-) (limited to 'source4') diff --git a/source4/build/pidl/ndr.pm b/source4/build/pidl/ndr.pm index 345141285d..f910be623a 100644 --- a/source4/build/pidl/ndr.pm +++ b/source4/build/pidl/ndr.pm @@ -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"; } diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm index d496a02309..73e05ed433 100644 --- a/source4/build/pidl/validator.pm +++ b/source4/build/pidl/validator.pm @@ -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) { diff --git a/source4/librpc/idl/audiosrv.idl b/source4/librpc/idl/audiosrv.idl index 625eb5ae25..9b9399ffee 100644 --- a/source4/librpc/idl/audiosrv.idl +++ b/source4/librpc/idl/audiosrv.idl @@ -1,6 +1,7 @@ [ uuid("0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53"), version(1.0), + pointer_default(unique), helpstring("Audio Server") ] interface audiosrv { diff --git a/source4/librpc/idl/browser.idl b/source4/librpc/idl/browser.idl index 19b413f1ba..5cc2475119 100644 --- a/source4/librpc/idl/browser.idl +++ b/source4/librpc/idl/browser.idl @@ -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 diff --git a/source4/librpc/idl/dbgidl.idl b/source4/librpc/idl/dbgidl.idl index 28b2b67e1f..8d2133d81f 100644 --- a/source4/librpc/idl/dbgidl.idl +++ b/source4/librpc/idl/dbgidl.idl @@ -1,6 +1,7 @@ [ uuid("1d55b526-c137-46c5-ab79-638f2a68e869"), version(1.0), + pointer_default(unique), helpstring("Remote IDL debugger") ] interface dbgidl { diff --git a/source4/librpc/idl/dcerpc.idl b/source4/librpc/idl/dcerpc.idl index b5f9fbf466..3ffe14d453 100644 --- a/source4/librpc/idl/dcerpc.idl +++ b/source4/librpc/idl/dcerpc.idl @@ -8,6 +8,9 @@ see http://www.opengroup.org/onlinepubs/9629399/chap12.htm for packet layouts */ +[ +pointer_default(unique) +] interface dcerpc { typedef [public] struct { diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl index ad2963c905..a29d38dac1 100644 --- a/source4/librpc/idl/dcom.idl +++ b/source4/librpc/idl/dcom.idl @@ -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") ] diff --git a/source4/librpc/idl/drsblobs.idl b/source4/librpc/idl/drsblobs.idl index b2d38b27d3..9f3e27827f 100644 --- a/source4/librpc/idl/drsblobs.idl +++ b/source4/librpc/idl/drsblobs.idl @@ -3,6 +3,7 @@ [ uuid("38578646-4566-4564-2244-275796345667"), version(0.0), + pointer_default(unique), helpstring("Active Directory Replication LDAP Blobs") ] interface drsblobs { diff --git a/source4/librpc/idl/dsbackup.idl b/source4/librpc/idl/dsbackup.idl index d91fc45f0f..c4f3d3cded 100644 --- a/source4/librpc/idl/dsbackup.idl +++ b/source4/librpc/idl/dsbackup.idl @@ -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 { diff --git a/source4/librpc/idl/echo.idl b/source4/librpc/idl/echo.idl index c73de8cc7b..e563dc41c8 100644 --- a/source4/librpc/idl/echo.idl +++ b/source4/librpc/idl/echo.idl @@ -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") ] diff --git a/source4/librpc/idl/efs.idl b/source4/librpc/idl/efs.idl index 9ec826287c..9a97223e6a 100644 --- a/source4/librpc/idl/efs.idl +++ b/source4/librpc/idl/efs.idl @@ -1,6 +1,7 @@ [ uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"), version(1.0), + pointer_default(unique), helpstring("Encrypted File System") ] interface efs { diff --git a/source4/librpc/idl/exchange.idl b/source4/librpc/idl/exchange.idl index 82e783a0dc..119de7dfb0 100644 --- a/source4/librpc/idl/exchange.idl +++ b/source4/librpc/idl/exchange.idl @@ -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 { diff --git a/source4/librpc/idl/keysvc.idl b/source4/librpc/idl/keysvc.idl index 8ab13463c9..9d05f7d8dc 100644 --- a/source4/librpc/idl/keysvc.idl +++ b/source4/librpc/idl/keysvc.idl @@ -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") ] diff --git a/source4/librpc/idl/mgmt.idl b/source4/librpc/idl/mgmt.idl index 95d39a05a8..b649e0db29 100644 --- a/source4/librpc/idl/mgmt.idl +++ b/source4/librpc/idl/mgmt.idl @@ -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") ] diff --git a/source4/librpc/idl/misc.idl b/source4/librpc/idl/misc.idl index 13306b6876..935032f305 100644 --- a/source4/librpc/idl/misc.idl +++ b/source4/librpc/idl/misc.idl @@ -4,6 +4,10 @@ miscellaneous IDL structures */ + +[ + pointer_default(unique) +] interface misc { typedef [public,noprint,gensize] struct { diff --git a/source4/librpc/idl/msgsvc.idl b/source4/librpc/idl/msgsvc.idl index 956f1524d6..09878ac7a4 100644 --- a/source4/librpc/idl/msgsvc.idl +++ b/source4/librpc/idl/msgsvc.idl @@ -3,6 +3,7 @@ [ uuid("17fdd703-1827-4e34-79d4-24a55c53bb37"), version(1.0), + pointer_default(unique), helpstring("Messaging Service") ] interface msgsvc { diff --git a/source4/librpc/idl/policyagent.idl b/source4/librpc/idl/policyagent.idl index fbd15a552a..6da5cbb8f4 100644 --- a/source4/librpc/idl/policyagent.idl +++ b/source4/librpc/idl/policyagent.idl @@ -3,6 +3,7 @@ [ uuid("d335b8f6-cb31-11d0-b0f9-006097ba4e54"), version(1.5), + pointer_default(unique), helpstring("IPSec Policy Agent") ] interface policyagent { diff --git a/source4/librpc/idl/rot.idl b/source4/librpc/idl/rot.idl index 3b3bd6e987..28aae60036 100644 --- a/source4/librpc/idl/rot.idl +++ b/source4/librpc/idl/rot.idl @@ -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 diff --git a/source4/librpc/idl/scerpc.idl b/source4/librpc/idl/scerpc.idl index 91373a6685..2c3c4f865f 100644 --- a/source4/librpc/idl/scerpc.idl +++ b/source4/librpc/idl/scerpc.idl @@ -5,6 +5,7 @@ [ uuid("93149ca2-973b-11d1-8c39-00c04fb984f9"), version(0.0), + pointer_default(unique), helpstring("Security Configuration Editor") ] interface scerpc diff --git a/source4/librpc/idl/security.idl b/source4/librpc/idl/security.idl index 3782d984f7..71929cd843 100644 --- a/source4/librpc/idl/security.idl +++ b/source4/librpc/idl/security.idl @@ -4,6 +4,9 @@ security IDL structures */ +[ + pointer_default(unique) +] interface security { /* diff --git a/source4/librpc/idl/trkwks.idl b/source4/librpc/idl/trkwks.idl index 4b3fafe723..8f8c759d17 100644 --- a/source4/librpc/idl/trkwks.idl +++ b/source4/librpc/idl/trkwks.idl @@ -5,6 +5,7 @@ [ uuid("300f3532-38cc-11d0-a3f0-0020af6b0add"), version(1.2), + pointer_default(unique), helpstring("Distributed Key Tracking Service") ] interface trkwks diff --git a/source4/librpc/idl/w32time.idl b/source4/librpc/idl/w32time.idl index bdf4b5d118..c3c6e014de 100644 --- a/source4/librpc/idl/w32time.idl +++ b/source4/librpc/idl/w32time.idl @@ -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 diff --git a/source4/librpc/idl/xattr.idl b/source4/librpc/idl/xattr.idl index afcefe49bc..f133402d27 100644 --- a/source4/librpc/idl/xattr.idl +++ b/source4/librpc/idl/xattr.idl @@ -9,7 +9,8 @@ */ [ - depends(security) + depends(security), + pointer_default(unique) ] interface xattr { -- cgit