Closed douniwan5788 closed 1 month ago
For very complex cases such as this one, you'll likely have to do a custom field.
That's not a complex scenario. I believe it's a very common variant of the TLV format pattern for protocols with optional fields. Rewriting custom fields similar to PacketListField/FieldListField requires considerable effort and becomes hard to maintain. Would it be considered if I were to submit a PR for this change?
Sorry I read that too quickly. In your case the payload PacketListField can use the pkt.parent
attribute to go back one layer and get the size.
Yes, the payloadPacket
can retrieve PacketListFields
through the parent
, but cannot determine its size if it is unable to locate its index within the PacketListFields
.
You can use next_cb_cls
which contains the current "list", therefore the index.
Please note that this is not a forum but a bugtracker. Please ask your question on stack overflow or on the gitter. Thanks for your understanding
I have two
PacketListFields
, one foroffsets
andsizes
and the other forpayloads
. However, thepayload
Packet cannot determine its size if it is unable to locate its index within thePacketListFields
.If adding an
index
attribute similar toparent
to Field/Packet is necessary, I can make a PR