r7552: Use ParseExpr() for [value] attributes; allows
authorJelmer Vernooij <jelmer@samba.org>
Mon, 13 Jun 2005 22:22:51 +0000 (22:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:07 +0000 (13:18 -0500)
us somewhat cleaner IDL.
(This used to be commit b7b01bccd101654d1f5ec83cba9dea7e9431d6ce)

15 files changed:
source4/build/pidl/TODO
source4/build/pidl/ndr_parser.pm
source4/build/pidl/validator.pm
source4/librpc/idl/drsblobs.idl
source4/librpc/idl/epmapper.idl
source4/librpc/idl/eventlog.idl
source4/librpc/idl/initshutdown.idl
source4/librpc/idl/lsa.idl
source4/librpc/idl/nbt.idl
source4/librpc/idl/netlogon.idl
source4/librpc/idl/samr.idl
source4/librpc/idl/security.idl
source4/librpc/idl/spoolss.idl
source4/librpc/idl/winreg.idl
source4/librpc/idl/winsrepl.idl

index 2f45c2d11ab0b0b7327e663d4ce2b83bc9c87273..d63fb4af7eb8800c471d231940307136ee225466 100644 (file)
@@ -3,10 +3,10 @@
  [string] attribute. Pidl itself would support a couple of extra 
  attributes for it's own use while being compatible with other IDL 
  compilers. 
- Proposed extensions for pidl:
+ Proposed extensions for pidl (to arrays):
    [convert(t)] attribute for forcing conversions from CH_UCS2, etc to UTF8
-   [noterm] attribute
-   [nullterm] attribute
+   [noterm] attribute -> Indicating there is no terminating character
+   [nullterm] attribute -> Indicating the string is null terminated
 
 The various flags for strings would change as follows:
  
@@ -16,7 +16,7 @@ LIBNDR_FLAG_STR_SIZE4             -> [size_is()] or if needed [conformant]
 LIBNDR_FLAG_STR_NOTERM             -> [noterm]
 LIBNDR_FLAG_STR_NULLTERM            -> [nullterm]
 LIBNDR_FLAG_STR_SIZE2              -> uint16 length; [string] char data[length]
-LIBNDR_FLAG_STR_BYTESIZE            -> ???
+LIBNDR_FLAG_STR_BYTESIZE            -> uint16 length; [string] char data[length]
 LIBNDR_FLAG_STR_FIXLEN32            -> [32]
 LIBNDR_FLAG_STR_CONFORMANT          -> no longer needed
 LIBNDR_FLAG_STR_CHARLEN                    -> ???
index 0dd1289d80dddabbeb3111a326b45d1b3a750387..7beefbf95dea2b7431bcc01200d51692c6403147 100644 (file)
@@ -704,7 +704,7 @@ sub ParseElementPush($$$$$$)
        start_flags($e);
 
        if (my $value = util::has_property($e, "value")) {
-               pidl "$var_name = $value;";
+               pidl "$var_name = " . ParseExpr($value, $env) . ";";
        }
 
        ParseElementPushLevel($e, $e->{LEVELS}[0], $ndr, $var_name, $env, $primitives, $deferred);
@@ -748,7 +748,7 @@ sub ParseElementPrint($$$)
 
        if (my $value = util::has_property($e, "value")) {
                pidl "if (ndr->flags & LIBNDR_PRINT_SET_VALUES) {";
-               pidl "\t$var_name = $value;";
+               pidl "\t$var_name = " . ParseExpr($value,$env) . ";";
                pidl "}";
        }
 
index 6bd31db621d13e4d04b52e05ef5a3b1839ca8c1d..ebe811598517e343fa6da0457cd9f0111e6c021f 100644 (file)
@@ -130,6 +130,7 @@ my %property_list = (
        # array
        "range"                 => ["ELEMENT"],
        "size_is"               => ["ELEMENT"],
+       "string"        => ["ELEMENT"],
        "length_is"             => ["ELEMENT"],
 );
 
index c7d1a5fb48adf3e0a2562202a8fec75e664730a7..311d8120de34625a607311989852416abe46416b 100644 (file)
@@ -96,7 +96,7 @@ interface drsblobs {
                NTTIME_1sec last_attempt;
                WERROR result_last_attempt;
                [relative] repsFromTo1OtherInfo *other_info;
-               [value(ndr_size_repsFromTo1OtherInfo(r->other_info, ndr->flags))] uint32 other_info_length;
+               [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
                drsuapi_DsReplicaNeighbourFlags replica_flags;
                uint8 schedule[84];
                uint32 reserved;
index 766b867a3566babf475f2922de59c9facff6987d..fc3981bf389adef6345c39d0c4364dafee402b8d 100644 (file)
@@ -217,7 +217,7 @@ interface epmapper
        } epm_tower;
 
        typedef struct {
-               [value(ndr_size_epm_tower(&r->tower, ndr->flags))] uint32  tower_length;
+               [value(ndr_size_epm_tower(&tower, ndr->flags))] uint32  tower_length;
                [subcontext(4)] epm_tower tower;
        } epm_twr_t;
 
index 60ef1460557b9e0b45617bd4bd763035382ed9d5..48cc9f3a5428c5fd43753a67a37ad21e7a88c5c4 100644 (file)
@@ -17,8 +17,8 @@
        } eventlog_OpenUnknown0;
 
        typedef struct {
-               [value(2*strlen_m(r->name))] uint16 name_len;
-               [value(r->name_len)]       uint16 name_size;
+               [value(2*strlen_m(name))] uint16 name_len;
+               [value(name_len)]       uint16 name_size;
                unistr_noterm *name;
        } eventlog_String;
 
index f4f1f93f5ed91c4d8e8278da937304d02ea0ab99..4cdffe75eb2684086e69c24c8644094112424c94 100644 (file)
@@ -14,7 +14,7 @@
 ] interface initshutdown
 {
        typedef struct {
-               [value(strlen_m_term(r->name))] uint32 name_size;
+               [value(strlen_m_term(name))] uint32 name_size;
                [flag(STR_LEN4|STR_NOTERM)] string name;
        } initshutdown_String_sub;
 
index 9df146f5f5cafdd992da84ba233e22a5079e9915..32c7abd33208e2040f6f7c02cc6bffee6687ca94 100644 (file)
@@ -31,8 +31,8 @@
        /* Function: 0x02 */
 
        typedef struct {
-               [value(2*strlen_m(r->string))] uint16 length;
-               [value(r->length)] uint16 size;
+               [value(2*strlen_m(string))] uint16 length;
+               [value(length)] uint16 size;
                unistr_noterm *string;
        } lsa_String;
 
index a7a52567526e6d07bb31fa1d1b093b915a9f2e05..f67509ec5e3e2dc3f59cc163ac23a47a87fbd50d 100644 (file)
        } nbt_status_name;
 
        typedef struct {
-               [value(r->num_names * 18 + 47)] uint16 length;
+               [value(num_names * 18 + 47)] uint16 length;
                uint8 num_names;
                nbt_status_name names[num_names];
                nbt_statistics  statistics;
                uint16                      opcode;
                uint16                      priority;
                uint16                      class;
-               [value(strlen(r->mailslot_name)+1+r->data.length)] 
+               [value(strlen(mailslot_name)+1+r->data.length)] 
                      uint16                byte_count;
                astring                     mailslot_name;
                [flag(NDR_REMAINING)]       DATA_BLOB data;
                nstring          unicode_domain;
                uint32           db_count;
                nbt_db_change    dbchange[db_count];
-               [value(ndr_size_dom_sid(&r->sid))] uint32 sid_size;
+               [value(ndr_size_dom_sid(&sid))] uint32 sid_size;
                [flag(NDR_ALIGN4)] DATA_BLOB _pad2;
                dom_sid          sid;
                uint32           nt_version;
                nstring              user_name;
                astring              mailslot_name;
                uint32               acct_control;
-               [value(ndr_size_dom_sid(&r->sid))] uint32 sid_size;
+               [value(ndr_size_dom_sid(&sid))] uint32 sid_size;
                [flag(NDR_ALIGN4)]   DATA_BLOB _pad;
                dom_sid              sid;
                uint32               nt_version;
                LocalMasterAnnouncement         = 15
        } nbt_browse_opcode;
 
-       typedef bitmap {
-               SV_TYPE_WORKSTATION             = 0x00000001,
-               SV_TYPE_SERVER                  = 0x00000002,
-               SV_TYPE_SQLSERVER               = 0x00000004,
-               SV_TYPE_DOMAIN_CTRL             = 0x00000008,
-               SV_TYPE_DOMAIN_BAKCTRL          = 0x00000010,
-               SV_TYPE_TIME_SOURCE             = 0x00000020,
-               SV_TYPE_AFP                     = 0x00000040,
-               SV_TYPE_NOVELL                  = 0x00000080,
-               SV_TYPE_DOMAIN_MEMBER           = 0x00000100,
-               SV_TYPE_PRINTQ_SERVER           = 0x00000200,
-               SV_TYPE_DIALIN_SERVER           = 0x00000400,
-               SV_TYPE_XENIX_SERVER            = 0x00000800,
-               SV_TYPE_NT                      = 0x00001000,
-               SV_TYPE_POTENTIAL_BROWSER       = 0x00010000,
-               SV_TYPE_BACKUP_BROWSER          = 0x00020000,
-               SV_TYPE_MASTER_BROWSER          = 0x00040000,
-               SV_TYPE_DOMAIN_MASTER           = 0x00080000,
-               SV_TYPE_LOCAL_LIST_ONLY         = 0x40000000,
-               SV_TYPE_DOMAIN_ENUM             = 0x80000000
-       } nbt_browse_server_type;
-
        typedef struct {
                uint8 update_count;
                uint32 ttl;
index 35666381d4bd2ca9b9b9b40d9548c028baad8111..9d32c102e880ca5725821c1f248ba72683e3fa48 100644 (file)
@@ -20,8 +20,8 @@ interface netlogon
        declare bitmap samr_AcctFlags;
 
        typedef [public] struct {
-               [value(strlen_m(r->string)*2)]  uint16 size;
-               [value(r->size)]                uint16 length;
+               [value(strlen_m(string)*2)]  uint16 size;
+               [value(size)]                uint16 length;
                unistr_noterm *string;
        } netr_String;
        
@@ -108,7 +108,7 @@ interface netlogon
 
        typedef [flag(NDR_PAHEX)] struct {
                uint16 length;
-               [value(r->length)] uint16 size;
+               [value(length)] uint16 size;
                [size_is(size),length_is(length)] uint8 *data;
        } netr_ChallengeResponse;
 
@@ -314,7 +314,7 @@ interface netlogon
 
        typedef struct {
                uint16 length;
-               [value(r->length)] uint16 size;
+               [value(length)] uint16 size;
                uint32 flags;
                samr_Password pwd;
        } netr_USER_KEY16;
index ba862071098b70eacc8d05ffe879ac7eed15f077..c399ee4fb8ecc195645fdfab99fff1823a66104c 100644 (file)
@@ -78,8 +78,8 @@
        /******************/
        /* Function: 0x05 */
        typedef struct {
-               [value(2*strlen_m(r->string))] uint16 length;
-               [value(r->length)] uint16 size;
+               [value(2*strlen_m(string))] uint16 length;
+               [value(length)] uint16 size;
                unistr_noterm *string;
        } samr_String;  
 
        } samr_DispInfoFull;
 
        typedef struct {
-               [value(strlen_m(r->string))] uint16 length;
-               [value(strlen_m(r->string))] uint16 size;
+               [value(strlen_m(string))] uint16 length;
+               [value(strlen_m(string))] uint16 size;
                ascstr_noterm *string;
        } samr_AsciiName;       
 
index 714dd76e8deae65b9b1f70913819f38c08e10b21..9a18189993b41839f9a14df18738801a4f7052b8 100644 (file)
@@ -314,7 +314,7 @@ interface security
        } security_descriptor;
 
        typedef [public] struct {
-               [range(0,0x40000),value(ndr_size_security_descriptor(r->sd))] uint32 sd_size;
+               [range(0,0x40000),value(ndr_size_security_descriptor(sd))] uint32 sd_size;
                [subcontext(4)] security_descriptor *sd;
        } sec_desc_buf;
 }
index db8633784895a9c437a4e0d55288c13450c34f97..3a3921b261eda9df9dc4771d3c5d9be3a474efc9 100644 (file)
@@ -91,7 +91,7 @@
                uint32 reserved2;
                uint32 panningwidth;
                uint32 panningheight;
-               [subcontext_size(r->__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
+               [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
        } spoolss_DeviceMode;
 
        typedef [public] bitmap {
                [in] unistr value_name,
                [in] spoolss_PrinterDataType type,
                [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
-               [in,value(ndr_size_spoolss_PrinterData(&r->in.data,r->in.type,flags))] uint32 _buf_size
+               [in,value(ndr_size_spoolss_PrinterData(&data,type,flags))] uint32 _buf_size
        );
 
        /******************/
index 277cf548623a226ded3617f6d7bfc7a80241c890..327e6834f832df3c0348106a4d5e46b1634e9720 100644 (file)
@@ -15,8 +15,8 @@
 ] interface winreg
 {
        typedef struct {
-               [value(strlen_m_term(r->name)*2)] uint16 name_len;
-               [value(r->name_len)]              uint16 name_size;
+               [value(strlen_m_term(name)*2)] uint16 name_len;
+               [value(name_len)]              uint16 name_size;
                unistr *name;
        } winreg_String;
 
index 8bcea421aae53cdc85e9633f8ef5dda126fcc6e8..13da5a9c26609e995fe6d3770419720742916e27 100644 (file)
@@ -126,7 +126,7 @@ interface wrepl
        } wrepl_packet;
 
        typedef [flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
-               [value(ndr_size_wrepl_packet(&r->packet, ndr->flags))] uint32 size;
+               [value(ndr_size_wrepl_packet(&packet, ndr->flags))] uint32 size;
                wrepl_packet    packet;
        } wrepl_wrap;