How to create a trigger for a simulation?

41 views
Skip to first unread message

Avinash Sridhar

unread,
Apr 19, 2014, 5:06:01 PM4/19/14
to ns-3-...@googlegroups.com
Hi All,

I have a query based on how we can create a trigger for starting an application. Here is my scenario:

When I get port and IP values in a specific header on my 802.11 for a call preservation field, I would like to use these ports and IPs and immediately generate UDP traffic.

Generally, we configure all the simulation parameters under main(). However, I would like to create a scenario such that the WIFI MAC layer simulation begins and when the new header with ip and port values arrive, we automatically begin UDP traffic generation. Is this possible through event based trigger?

In simple, is there a way to create a trigger to make the nodes start a UDP application based on the values it gets from a specific packet?

~Avinash

Tommaso Pecorella

unread,
Apr 19, 2014, 5:48:34 PM4/19/14
to ns-3-...@googlegroups.com
Hi,

the sort answer is: yes, you can. No, it's not simple.

The long answer.
To start an application you have to have a "startable" application. E.g., UdpClient.
void UdpClient::StartApplication (void)

This is a private method, but you can have your own application with a similar (public) method.

How to call it ? That's the hard part. You need another application :)
Make another application, and have it listen to a specific port (I'd suggest to use an UDP port, and not raw IP packets). In the packet, have the relevant data, e.g., the peer's port, address and so on.
Then iterate the applications in the node, find the one you want, pass the relevant parameters to it and let it start.

Can be done. It's not impossible. It's not easy either.

Cheers,

T.

Avinash Sridhar

unread,
Apr 19, 2014, 6:06:59 PM4/19/14
to ns-3-...@googlegroups.com

Thanks Tomasso,

I had a reply typed, but looks like it didn't come through into this group.

So here is what I am doing:

1) Initially we are working on layer-2 802.11 to get associated with AP.
2) Once station receives Assoc_Response from the access point, we are not reading the contents of a new header I have added called "CallPreserve" which has source and destination ports entries.
3) When the station reads these ports, it is now triggering a new application to generate UDP traffic to these ports.

So basically, my UDP application would get triggered, only once I read this port value from Association_Response header ( sta-wifi-mac.cc ).

Is this possible? It would be helpful if an approach to implementing this could be provided.

~Avinash

Avinash Sridhar

unread,
Apr 19, 2014, 6:08:36 PM4/19/14
to ns-3-...@googlegroups.com
Correction, point 2 is "2) Once station receives Assoc_Response from the access point, we are * now * reading the contents of a new header I have added called "CallPreserve" which has source and destination ports entries."

~Avinash

Avinash Sridhar

unread,
Apr 19, 2014, 11:20:45 PM4/19/14
to ns-3-...@googlegroups.com

Hi Tomasso,

Thanks for the tip. I was doing some more read up on call back to see if this implementation would help me achieve my objective.

Correct me if I am wrong,

1) I have a function on sta-wifi-mac.cc that compares if the header is a 802.11 ASSOCIATION_RESPONSE. When it is, I extract the CallPreserve Header from this successfully.

2) I now implement a call back to my Master Application, so that based on the header I would accordingly trigger this master application.. The master application will start the UDP traffic generation.

I understand everything here so far. But my doubt is, when I initially start my application, I will only have layer 2 involved.

a) So how would this wifi application switch from only layer 2 to (layer 2 + layer 3)?
b) Where could I begin the simulation from if I implement this method?

In the mean while, I am trying to implement a basic model of this call back of the same too.

~Avinash
Reply all
Reply to author
Forward
0 new messages