subcontext() Re: bitmaps as special enums?

Stefan (metze) Metzmacher metze at samba.org
Sat Feb 24 11:21:57 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jelmer Vernooij schrieb:
> On Fri, Feb 23, 2007 at 10:05:45AM +0100, Stefan (metze) Metzmacher wrote:
>> Jelmer Vernooij schrieb:
>>> On Fri, 2007-02-23 at 08:59 +0100, Stefan (metze) Metzmacher wrote:
>>>> Andrew Bartlett schrieb:
>>>>> On Wed, 2007-02-21 at 14:26 +0000, Jelmer Vernooij wrote:
>>>>>> Bitmaps and enums are similar in a lot of cases. I'd like to merge them
>>>>>> into one type but have an attribute of some sort to indicate that
>>>>>> multiple values can be used. In other words, I'd like to make bitmaps a
>>>>>> special kind of enums.
>>>>> Perhaps you could give an example on how the IDL would change as a
>>>>> result of this?  I kind of like the bitmap syntax, being very clear that
>>>>> this is a bitmap.
>>>> can you demonstrate it with nbt_operation from nbt.idl please
> 
>>>> I'm interested in the IDL and output change.
>>> So, what we have now is :
>>>     typedef [bitmap16bit] bitmap {
>>>         NBT_RCODE                   = 0x000F,
>>>         NBT_FLAG_BROADCAST          = 0x0010,
>>>         NBT_FLAG_RECURSION_AVAIL    = 0x0080,
>>>         NBT_FLAG_RECURSION_DESIRED  = 0x0100,
>>>         NBT_FLAG_TRUNCATION         = 0x0200,
>>>         NBT_FLAG_AUTHORITIVE        = 0x0400,
>>>         NBT_OPCODE                  = 0x7800,
>>>         NBT_FLAG_REPLY              = 0x8000
>>>     } nbt_operation;
> 
>>> what I'm proposing to change it to would be something like:
> 
>>>     typedef [bitmap,enum16bit] enum {
>>>         NBT_RCODE                   = 0x000F,
>>>         NBT_FLAG_BROADCAST          = 0x0010,
>>>         NBT_FLAG_RECURSION_AVAIL    = 0x0080,
>>>         NBT_FLAG_RECURSION_DESIRED  = 0x0100,
>>>         NBT_FLAG_TRUNCATION         = 0x0200,
>>>         NBT_FLAG_AUTHORITIVE        = 0x0400,
>>>         NBT_OPCODE                  = 0x7800,
>>>         NBT_FLAG_REPLY              = 0x8000
>>>     } nbt_operation;
> 
>>> Of course, we could use a different name for the attribute (perhaps
>>> "flags"?). 
>> I like [bitmap,enum16bit] if the output isn't changed,
> Cool, thanks! I'll have a look at that stuff once I get represent_as()
> fixed up to be able to replace subcontext().

Hi Jelmer,

please, don't change any existing subcontext() usages yet.

There're often very nasty details in the encoding and we some are
not tested in "make test".

Maybe try to start with the spoolss stuff only and make sure it still
works:
- - against windows
- - with ndrdump --dump --validate
- - and our new ndr tests

Also it would be very nice if we can avoid touching the callers of the
api.

metze
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFF4B/Vm70gjA5TCD8RAtwnAJ4h9UIKvnpj3N8gEONRzu6BY0yVOACeKdAj
9zVWc7LoEm+nSPp3p9F3EJU=
=JxDy
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list