about the internetstackHelper

117 views
Skip to first unread message

Victor

unread,
Mar 28, 2014, 9:36:49 PM3/28/14
to ns-3-...@googlegroups.com
Dear all,

I am currently getting confused with a problem on InternetstackHelper class. I found in many example files, that the InternetstackHelper should be attached on multiple nodes. For example: InternetStackHelper stack; stack.Install (nodes)  etc.. 

However, the problem I have is that, I defined several classes that all have the private members of both node and device type, i.e. Ptr<Node> m_node and also the Ptr<NetDevice> m_device; I cannot gather all of these nodes together and use a common InternetstackHelper attach on all of them. I am just wondering here, is it possible if I attach this stack to each individual node in each separate class? Can I achieve the same effect (making connections) as the groups of nodes. In other words, it is that: InternetStackHelper stack; stack.Install (node1); stack. Install(node2), where node1 and node2 are individual node coming from different classes. 

My overall objective is to assign IPV4 address to all of these nodes (devices), so that I can test the packet transmission between the nodes of interest that I want. For instances, for the vehicle applications, I may have car, truck, motor. Each class of vehicles will eventually be assigned with the IP addresses, and I want to test if it is feasible to set up the communication connection by testing the packet transmission, for example, from the 1st vehicle in car class to the 2nd vehicle in truck class.

Thanks for the help.

Victor 

Konstantinos

unread,
Mar 29, 2014, 7:27:22 AM3/29/14
to ns-3-...@googlegroups.com


On Saturday, March 29, 2014 1:36:49 AM UTC, Victor wrote:
Dear all,

I am currently getting confused with a problem on InternetstackHelper class. I found in many example files, that the InternetstackHelper should be attached on multiple nodes. For example: InternetStackHelper stack; stack.Install (nodes)  etc.. 

However, the problem I have is that, I defined several classes that all have the private members of both node and device type, i.e. Ptr<Node> m_node and also the Ptr<NetDevice> m_device;

The fact that these classes have an internal variable for Ptr<Node> does not mean anything. Is that node 'created' within that class or not? 
 
I cannot gather all of these nodes together and use a common InternetstackHelper attach on all of them.

Why not? You could create a method to retrieve the node (a simple getter) and gather all the nodes in a node-container.

e.g.
Nodes n1, n2 are either from the getter or you create them previously
Ptr<Node> n1;
Ptr<Node> n2;
NodeContainer nodes;
nodes
.Add(n1);
nodes
.Add(n2);

Now you can do whatever you like with 'nodes'. You have not created additional, you just gathered pointers of those nodes in a container.
 
I am just wondering here, is it possible if I attach this stack to each individual node in each separate class? Can I achieve the same effect (making connections) as the groups of nodes. In other words, it is that: InternetStackHelper stack; stack.Install (node1); stack. Install(node2), where node1 and node2 are individual node coming from different classes. 


Yes.

Victor

unread,
Mar 29, 2014, 8:54:21 AM3/29/14
to ns-3-...@googlegroups.com
Hi,

Thanks for your help. Yes, I have made it work perfectly now. 

Regards,
Victor

在 2014年3月29日星期六UTC上午11时27分22秒,Konstantinos写道:
Reply all
Reply to author
Forward
0 new messages