With particular regards to Ieee80211
in INet library, I have a question about what happens when a cPacket
/cMessage
is sent across multiple stations.
It is possible that this is not strictly about INet, but a general behavior of OmNet++. Here's the question:
When sending a
cPacket
/cMessage
and it is received by multiple stations/modules, is it copied or all receivers get a pointer to the same instance?
So, in such a network:
Station A
is sending a cMessage
which is received by all the other stations. Of course only one station is the receiver, everyone else will drop the packet. So if B
is the receiver and C
, D
, E
and F
go:
void handleMessage(cMessage *msg) {
if (this->isNotForUs())
delete msg;
}
Will it cause B
to have its frame destroyed?
In OMNeT++/INET
sending a cMessage
to multiple receivers is modelled by creating multiple copies of this message and sending one copy to one receiver. There is dup()
method that creates an exact copy of the message. For example:
cMessage *msg2 = msg->dup();
As a consequence, every receiver will receive a new instance of cMessage
object, and it can remove or process it in any way. Therefore, in your example deleting a message by C
,D
,E
, and F
does not affect the message received by B
.