Extension to Samba IDL.

Christopher R. Hertel crh at nts.umn.edu
Fri Jun 16 21:40:31 GMT 2000


I want bitfields.

I'm told that we don't have these yet.  If that's not correct, would someone
point me at them please?  Otherwise...

I'm trying to write an IDL source for NBT, and it uses bitfields quite a bit.
(Bit of a pun, there.)

Take the example of the NetBIOS Name.  The first two bits of the first byte are
a flag.  If 00, then the next six bits are a label length, followed by length
bytes of label.  If the flag is set to 11, then the next 14 bits are an offset
into the record.

This is how I'd like to do it (I'm still learning IDL, so please let me know if
something here--in addition to my syntax extension--is messed up):

typedef struct {
  uint:6 len;
  uint8  label[len];
}  NBT_Label;

typedef union switch( uint:2 flags ) {
  case 0: NBT_Label lbl;
  case 3: uint:14   offset;
} NBT_LabelFlags;

How does this look to folks?

Chris -)-----

-- 
Christopher R. Hertel -)-----                   University of Minnesota
crh at nts.umn.edu              Networking and Telecommunications Services


More information about the samba-technical mailing list