Closed m-peko closed 5 years ago
That's the intended behavior. This is basically to reinterpret that one layer as something else. If it retained it, then you could have 2 different PDUs having the same parent, which would lead to confusing behavior.
You can call inner_pdu
to attach the re-interpreted one to its parent so you replace the RawPDU with whatever you converted it to.
Yes, your suggestion might work but I think it's far from pretty. It would look like this:
auto raw_pdu = sctp_pdu.rfind_pdu<Tins::RawPDU>();
auto foo_pdu = raw_pdu.to<Tins::FooProtocol>();
sctp_pdu.inner_pdu(foo_pdu);
which is too much error prone because the one that uses the library and is not so familiar with it could easily miss one of the above steps.
But, anyway, I will go with your suggestion.
Hi there,
I would like to ask if, when converting from
RawPDU
object to another specific PDU (let's sayFooPDU
), it is possible to retain reference to parent PDU.Following function doesn't do that
Is this a bug or wanted behaviour?
The reason why I am asking this is because I have a special situation with SCTP protocol when SCTP packet is let's say fragmented like this:
Thank you and regards, Marin