1

I have some information I want to include in the packets, and I hope to achieve this by extending the UDPBasicApp application, sending out the packet, and updating it at every switch node in the network.

First, I made the following definitionsExtendedPacket.msg:

import inet.common.packet.chunk.Chunk; import inet.common.packet.Packet; namespace inet; class ExtendedPacket extends FieldsChunk { double delayDev; // Cumulative packet delay variance. } 

Subsequently, in udpBasicApp.cc:

void UdpBasicApp::sendPacket() { std::ostringstream str; str << packetName << "-" << numSent; Packet *packet = new Packet(str.str().c_str()); const auto& payload = makeShared<ExtendedPacket>(); payload->setChunkLength(B(par("messageLength"))); payload->setSequenceNumber(numSent); payload->addTag<CreationTimeTag>()->setCreationTime(simTime()); payload->setDelayDev(par("delayDev")); packet->insertAtBack(payload); L3Address destAddr = chooseDestAddr(); emit(packetSentSignal, packet); socket.sendTo(packet, destAddr, destPort); } 

And this is how I modified it:

 const auto& oldPayload = packet->peekData<ExtendedPacket>(); auto newPayload = makeShared<ExtendedPacket>(); newPayload = oldPayload->dup(); newPayload->setDelayDev(delayDev); packet->removeAtBack<ExtendedPacket>(packet->getDataLength()); packet->insertAtBack(newPayload); 

Now, I’m facing the issue that my sending end seems unable to send out the packet.

How can this be resolved? Aside from this, are there any other issues with my code above?

1 Answer 1

1

This is quite confusing. You are including some data in an application level chunk (The ExtendedPacket name is debatable as it is NOT a packet, only the applayer level payload). Apart from the naming, this is fine. This is a custom UDP application.

BUT! you can't modify this data in a Switch because switches are layer 2 devices (they don't even have IP layer, not to say transport layer (UDP)). So the data inside the UDP inside the IP inside the Ethernet frame is opaque to the switch. It is just a chunk of bytes included in the ethernet frame. To modify the data, you must pass it upwards to IP which should pass up the UDP which should pass it to your modified UDPApp. At that point you could create a NEW app level chunk with the new data and you could send it out on an UDP socket to a new host.

So, if you have indeed several switches between the endpoints, then you can't modify the data at applayer level. If you have a modified UDPApp at each intermediary node, then those are not switches and they cannot route traffic.

I'm not sure why you want to do this, but the same think could not be done in a real network either.

NOTE: If you want to measure some kind of end-to-end statistic (judging from the name of the parameter), INET already has a built-in facility for this: https://inet.omnetpp.org/docs/showcases/measurement/index.html

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much for your answer. I originally intended to add this field in the header, similar to the UDP header, but it seemed very cumbersome to do so. Therefore, I added this information as payload. Additionally, OMNeT provides methods to modify the content of the data part in terms of chunks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.