"1.4": 0x05,
"1.5": 0x06}
-TYPES = {"u8": 1,
- "be16": 2,
- "be32": 4,
- "MAC": 6,
- "be64": 8,
- "IPv6": 16}
+TYPES = {"u8": (1, False),
+ "be16": (2, False),
+ "be32": (4, False),
+ "MAC": (6, False),
+ "be64": (8, False),
+ "IPv6": (16, False)}
FORMATTING = {"decimal": ("MFS_DECIMAL", 1, 8),
"hexadecimal": ("MFS_HEXADECIMAL", 1, 127),
type_ = m.group(1)
if type_ not in TYPES:
fatal("%s: unknown type %s" % (mff, d['Type']))
- f['n_bytes'] = TYPES[type_]
+
+ f['n_bytes'] = TYPES[type_][0]
if m.group(2):
f['n_bits'] = int(m.group(2))
if f['n_bits'] > f['n_bytes'] * 8:
% (mff, f['n_bits'], 8 * f['n_bytes']))
else:
f['n_bits'] = 8 * f['n_bytes']
+ f['variable'] = TYPES[type_][1]
if d['Maskable'] == 'no':
f['mask'] = 'MFM_NONE'
output += [" \"%s\", \"%s\"," % (f['name'], f['extra_name'])]
else:
output += [" \"%s\", NULL," % f['name']]
- output += [" %d, %d," % (f['n_bytes'], f['n_bits'])]
+
+ if f['variable']:
+ variable = 'true'
+ else:
+ variable = 'false'
+ output += [" %d, %d, %s," % (f['n_bytes'], f['n_bits'], variable)]
if f['writable']:
rw = 'true'
*/
unsigned int n_bytes; /* Width of the field in bytes. */
unsigned int n_bits; /* Number of significant bits in field. */
+ bool variable_len; /* Length is variable, if so width is max. */
/* Properties. */
enum mf_maskable maskable;