I have to calculate the delay in my application, so I need the generation time of the packet that I insert with a chunk in the packet. But then, when I receive the packet, I don't know how to pick the generation time from the chunk.
This is the chunk.
class AppPacket extends FieldChunk {
simtime_t appGenPacket;
int seqNo;
}
This is the trasmission function.
auto data = makeShared<ByteCountChunk>(B(payload));
Packet *pkt=new Packet("DataPacket", data);
auto pktData = makeShared<AppPacket>();
pktData->setAppGenPacket(simtime());
pkt->insertAtBack(pktData);
send(pkt, "lowerLayerOut");
Now when I receive the packet I have to get appGenPacket to calculate the delay, but I don't know hot to do this. Help me pls!