CalPack
CalPack copied to clipboard
As a User, it would be nice to be able to create packets that are of variable size.
There are times where packets are encountered that are variable in length. In these cases, there is typically a length field that correlates the size of the packet and may even depict how many data fields there may be. It would be nice to have something like this:
class variable_packet(models.Packet):
pkt_id = models.IntField8()
pkt_type = models.IntField8()
data_length = models.IntField16()
data_entries = models.ArrayField(
models.IntField32(),
data_length
)
Where changes to data_length
would directly apply to the number of data entries.
It should also be noted that a case might arrive like this:
class variable_packet(models.Packet):
pkt_id = models.IntField8()
pkt_type = models.IntField8()
data_length = models.IntField16()
data_entries = models.ArrayField(
models.IntField32(),
data_length
)
terminator = models.IntField32()
Where the variable size is actually found embedded within the packet and not at the end.
This shouldn't be that difficult to do. We would need to re-create the internal packet structure but that's ok. Need to look into this a little further.