diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-06-13 22:22:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:07 -0500 |
commit | c420c5a4c4bc2185f123058027f8328ade0d0a4e (patch) | |
tree | b47081275005af23d7ad962063d83cf4da2987fc /source4 | |
parent | 9ef145424afe44e6c0acccf95faad357868a46f3 (diff) | |
download | samba-c420c5a4c4bc2185f123058027f8328ade0d0a4e.tar.gz samba-c420c5a4c4bc2185f123058027f8328ade0d0a4e.tar.bz2 samba-c420c5a4c4bc2185f123058027f8328ade0d0a4e.zip |
r7552: Use ParseExpr() for [value] attributes; allows
us somewhat cleaner IDL.
(This used to be commit b7b01bccd101654d1f5ec83cba9dea7e9431d6ce)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/TODO | 8 | ||||
-rw-r--r-- | source4/build/pidl/ndr_parser.pm | 4 | ||||
-rw-r--r-- | source4/build/pidl/validator.pm | 1 | ||||
-rw-r--r-- | source4/librpc/idl/drsblobs.idl | 2 | ||||
-rw-r--r-- | source4/librpc/idl/epmapper.idl | 2 | ||||
-rw-r--r-- | source4/librpc/idl/eventlog.idl | 4 | ||||
-rw-r--r-- | source4/librpc/idl/initshutdown.idl | 2 | ||||
-rw-r--r-- | source4/librpc/idl/lsa.idl | 4 | ||||
-rw-r--r-- | source4/librpc/idl/nbt.idl | 30 | ||||
-rw-r--r-- | source4/librpc/idl/netlogon.idl | 8 | ||||
-rw-r--r-- | source4/librpc/idl/samr.idl | 8 | ||||
-rw-r--r-- | source4/librpc/idl/security.idl | 2 | ||||
-rw-r--r-- | source4/librpc/idl/spoolss.idl | 4 | ||||
-rw-r--r-- | source4/librpc/idl/winreg.idl | 4 | ||||
-rw-r--r-- | source4/librpc/idl/winsrepl.idl | 2 |
15 files changed, 32 insertions, 53 deletions
diff --git a/source4/build/pidl/TODO b/source4/build/pidl/TODO index 2f45c2d11a..d63fb4af7e 100644 --- a/source4/build/pidl/TODO +++ b/source4/build/pidl/TODO @@ -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 -> ??? diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm index 0dd1289d80..7beefbf95d 100644 --- a/source4/build/pidl/ndr_parser.pm +++ b/source4/build/pidl/ndr_parser.pm @@ -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 "}"; } diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm index 6bd31db621..ebe8115985 100644 --- a/source4/build/pidl/validator.pm +++ b/source4/build/pidl/validator.pm @@ -130,6 +130,7 @@ my %property_list = ( # array "range" => ["ELEMENT"], "size_is" => ["ELEMENT"], + "string" => ["ELEMENT"], "length_is" => ["ELEMENT"], ); diff --git a/source4/librpc/idl/drsblobs.idl b/source4/librpc/idl/drsblobs.idl index c7d1a5fb48..311d8120de 100644 --- a/source4/librpc/idl/drsblobs.idl +++ b/source4/librpc/idl/drsblobs.idl @@ -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; diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl index 766b867a35..fc3981bf38 100644 --- a/source4/librpc/idl/epmapper.idl +++ b/source4/librpc/idl/epmapper.idl @@ -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; diff --git a/source4/librpc/idl/eventlog.idl b/source4/librpc/idl/eventlog.idl index 60ef146055..48cc9f3a54 100644 --- a/source4/librpc/idl/eventlog.idl +++ b/source4/librpc/idl/eventlog.idl @@ -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; diff --git a/source4/librpc/idl/initshutdown.idl b/source4/librpc/idl/initshutdown.idl index f4f1f93f5e..4cdffe75eb 100644 --- a/source4/librpc/idl/initshutdown.idl +++ b/source4/librpc/idl/initshutdown.idl @@ -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; diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index 9df146f5f5..32c7abd332 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -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; diff --git a/source4/librpc/idl/nbt.idl b/source4/librpc/idl/nbt.idl index a7a5256752..f67509ec5e 100644 --- a/source4/librpc/idl/nbt.idl +++ b/source4/librpc/idl/nbt.idl @@ -148,7 +148,7 @@ } 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; @@ -256,7 +256,7 @@ 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; @@ -425,7 +425,7 @@ 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; @@ -544,7 +544,7 @@ 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; @@ -587,28 +587,6 @@ 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; diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index 35666381d4..9d32c102e8 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -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; diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index ba86207109..c399ee4fb8 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -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; @@ -860,8 +860,8 @@ } 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; diff --git a/source4/librpc/idl/security.idl b/source4/librpc/idl/security.idl index 714dd76e8d..9a18189993 100644 --- a/source4/librpc/idl/security.idl +++ b/source4/librpc/idl/security.idl @@ -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; } diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl index db86337848..3a3921b261 100644 --- a/source4/librpc/idl/spoolss.idl +++ b/source4/librpc/idl/spoolss.idl @@ -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 { @@ -746,7 +746,7 @@ [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 ); /******************/ diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl index 277cf54862..327e6834f8 100644 --- a/source4/librpc/idl/winreg.idl +++ b/source4/librpc/idl/winreg.idl @@ -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; diff --git a/source4/librpc/idl/winsrepl.idl b/source4/librpc/idl/winsrepl.idl index 8bcea421aa..13da5a9c26 100644 --- a/source4/librpc/idl/winsrepl.idl +++ b/source4/librpc/idl/winsrepl.idl @@ -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; |