Obtain nodes informations in the sink connected with the packet-sink trace source "rx"

96 views
Skip to first unread message

Andrea Gorrieri

unread,
Apr 9, 2014, 5:17:39 AM4/9/14
to ns-3-...@googlegroups.com
Hi everyone,
is it possible to get the position of the receiving node in the trace-sink function connected to the "rx" trace-source of the sink-application?

More in detail i have the sink function:

void
pckRx(Ptr<const Packet> pkt, const Address &addr)
{
 ...
}

which is connected to the "rx" trace source of the sink-application in this way:

Config::ConnectWithoutContext("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx",MakeCallback(&pckRx));

I tried to use the attributes pkt and addr but they are defined "const", so how can i get the receiving node position in the trace-sink function?

Is the modification of the "rx" trace source the unique solution?

Thanks in advance,

Andrea

Tommaso Pecorella

unread,
Apr 9, 2014, 4:35:31 PM4/9/14
to ns-3-...@googlegroups.com
Hi,

what do you mean by "position" ? The (x,y) node position ?
If this is the question, then you will have to add a tag to the packet. Or to use a "G. Mode" location service. Mind that usually the Rx node doesn't know the position of the sender node, so...

Cheers,

T.

Andrea Gorrieri

unread,
Apr 10, 2014, 6:01:40 AM4/10/14
to ns-3-...@googlegroups.com
Hi Tommaso,
thank you for the reply, 
first of all for "position" i mean the (x,y) node position. Sorry, maybe I was not clear in the explanation.

Surely the Rx node doesn't know the position of the sender node, however i'm trying to get the Rx position (not the sender position) in the trace sink. 
In other world when a node receives a packet (and the trace-sink function is triggered) i want to get the position of the receiving node.

Thank you and sorry for the misunderstanding.

Andrea

Tommaso Pecorella

unread,
Apr 10, 2014, 2:48:56 PM4/10/14
to ns-3-...@googlegroups.com
Hi Andrea,

sorry for the misunderstanding. Not a biggie, the method is working anyway. My remark was just to remark that using "G. Mode" location based systems comes with a price.

Anyway, feel free to poke the node's position in the way I told. It should work. If it doesn't, let me know.

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages