CalPack icon indicating copy to clipboard operation
CalPack copied to clipboard

As a User, it would be nice to be able to create packets that are of variable size.

Open mertzjames opened this issue 7 years ago • 2 comments

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.

mertzjames avatar Dec 12 '17 21:12 mertzjames

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.

mertzjames avatar Dec 12 '17 21:12 mertzjames

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.

mertzjames avatar Feb 20 '18 15:02 mertzjames