From e79e6bc4726dc96d553e245e34e94e39de7c2da3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 22 Nov 2003 22:09:10 +0000 Subject: added support for 'const' in IDL files. This makes it easy to define symbolic names for bitfields etc. (This used to be commit 344a6e1682cc1afab24735e73d05cf15f6eb9816) --- source4/build/pidl/header.pm | 18 ++++++++++++++---- source4/build/pidl/idl.gram | 12 +++++++++++- source4/librpc/idl/samr.idl | 16 ++++++++-------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm index 25f0fecd47..751383a2b3 100644 --- a/source4/build/pidl/header.pm +++ b/source4/build/pidl/header.pm @@ -75,7 +75,7 @@ sub HeaderStruct($$) { my($struct) = shift; my($name) = shift; - $res .= "struct $name {\n"; + $res .= "\nstruct $name {\n"; $tab_depth++; if (defined $struct->{ELEMENTS}) { foreach my $e (@{$struct->{ELEMENTS}}) { @@ -143,7 +143,15 @@ sub HeaderTypedef($) { my($typedef) = shift; HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}); - $res .= ";\n\n"; + $res .= ";\n"; +} + +##################################################################### +# parse a typedef +sub HeaderConst($) +{ + my($const) = shift; + $res .= "#define $const->{NAME}\t( $const->{VALUE} )\n"; } ##################################################################### @@ -165,7 +173,7 @@ sub HeaderFunctionInOut($$) sub HeaderFunction($) { my($fn) = shift; - $res .= "struct $fn->{NAME} {\n"; + $res .= "\nstruct $fn->{NAME} {\n"; $tab_depth++; tabs(); $res .= "struct {\n"; @@ -208,7 +216,7 @@ sub HeaderInterface($) foreach my $d (@{$data}) { if ($d->{TYPE} eq "FUNCTION") { my $u_name = uc $d->{NAME}; - $res .= "#define DCERPC_$u_name $count\n"; + $res .= "#define DCERPC_$u_name " . sprintf("0x%02x", $count) . "\n"; $count++; } } @@ -216,6 +224,8 @@ sub HeaderInterface($) $res .= "\n\n"; foreach my $d (@{$data}) { + ($d->{TYPE} eq "CONST") && + HeaderConst($d); ($d->{TYPE} eq "TYPEDEF") && HeaderTypedef($d); ($d->{TYPE} eq "FUNCTION") && diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram index ac373a5260..70d1c36b5e 100644 --- a/source4/build/pidl/idl.gram +++ b/source4/build/pidl/idl.gram @@ -28,6 +28,16 @@ interface: 'interface' identifier '{' definition(s?) '}' definition : cpp_prefix | typedef { $item[1] } | function { $item[1] } + | const { $item[1] } + +const : 'const' identifier identifier '=' constant ';' + {{ + "TYPE" => "CONST", + "DTYPE" => $item[3], + "NAME" => $item[4], + "VALUE" => $item{constant} + }} + | typedef : 'typedef' type identifier array_len(?) ';' {{ @@ -165,7 +175,7 @@ anytext: text2 '(' anytext ')' anytext call: expression '(' expression ')' {{ "$item[1]($item[4])" }} -constant: /-?\d+/ +constant: /-?[\dx]+/ | '*' cpp_prefix: '#' /.*/ diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index f73ad9a8ea..8b349123fb 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -732,16 +732,16 @@ /************************/ /* Function 0x2c */ -/* -const ULONG DOMAIN_PASSWORD_COMPLEX = 0x00000001; -const ULONG DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002; -const ULONG DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004; -const ULONG DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010; -const ULONG DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020; -*/ + /* password properties flags */ + const uint32 DOMAIN_PASSWORD_COMPLEX = 0x00000001; + const uint32 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002; + const uint32 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004; + const uint32 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010; + const uint32 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020; + typedef struct { uint16 min_pwd_len; - uint32 passwd_properties; + uint32 password_properties; } samr_PwInfo; NTSTATUS samr_GetUserPwInfo( -- cgit