1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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 31bed62a9a)
This commit is contained in:
Jelmer Vernooij 2005-02-12 23:03:26 +00:00 committed by Gerald (Jerry) Carter
parent 51a6f7b227
commit e90c93402b
23 changed files with 135 additions and 14 deletions

View 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";
}

View 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) {

View File

@ -1,6 +1,7 @@
[
uuid("0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53"),
version(1.0),
pointer_default(unique),
helpstring("Audio Server")
] interface audiosrv
{

View 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

View File

@ -1,6 +1,7 @@
[
uuid("1d55b526-c137-46c5-ab79-638f2a68e869"),
version(1.0),
pointer_default(unique),
helpstring("Remote IDL debugger")
] interface dbgidl
{

View 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 {

View 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")
]

View 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 {

View 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
{

View 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")
]

View File

@ -1,6 +1,7 @@
[
uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"),
version(1.0),
pointer_default(unique),
helpstring("Encrypted File System")
] interface efs
{

View 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
{

View 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")
]

View 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")
]

View File

@ -4,6 +4,10 @@
miscellaneous IDL structures
*/
[
pointer_default(unique)
]
interface misc
{
typedef [public,noprint,gensize] struct {

View File

@ -3,6 +3,7 @@
[
uuid("17fdd703-1827-4e34-79d4-24a55c53bb37"),
version(1.0),
pointer_default(unique),
helpstring("Messaging Service")
] interface msgsvc
{

View File

@ -3,6 +3,7 @@
[
uuid("d335b8f6-cb31-11d0-b0f9-006097ba4e54"),
version(1.5),
pointer_default(unique),
helpstring("IPSec Policy Agent")
] interface policyagent
{

View 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

View File

@ -5,6 +5,7 @@
[
uuid("93149ca2-973b-11d1-8c39-00c04fb984f9"),
version(0.0),
pointer_default(unique),
helpstring("Security Configuration Editor")
]
interface scerpc

View File

@ -4,6 +4,9 @@
security IDL structures
*/
[
pointer_default(unique)
]
interface security
{
/*

View File

@ -5,6 +5,7 @@
[
uuid("300f3532-38cc-11d0-a3f0-0020af6b0add"),
version(1.2),
pointer_default(unique),
helpstring("Distributed Key Tracking Service")
]
interface trkwks

View 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

View File

@ -9,7 +9,8 @@
*/
[
depends(security)
depends(security),
pointer_default(unique)
]
interface xattr
{