- union_offset = self.size - p.size
- r.append(p.unpack(data, offset + union_offset))
- return self.tuple._make(r)
+ x, size = p.unpack(data, offset)
+ if size > maxsize:
+ maxsize = size
+ r.append(x)
+ return self.tuple._make(r), maxsize
+
+
+def VPPTypeAlias(name, msgdef):
+ t = vpp_get_type(msgdef['type'])
+ if not t:
+ raise ValueError()
+ if 'length' in msgdef:
+ if msgdef['length'] == 0:
+ raise ValueError()
+ if msgdef['type'] == 'u8':
+ types[name] = FixedList_u8(name, msgdef['type'],
+ msgdef['length'])
+ else:
+ types[name] = FixedList(name, msgdef['type'], msgdef['length'])
+ else:
+ types[name] = t