Get Ipv4Interface from Ipv4InterfaceContainer

45 views
Skip to first unread message

Irek Szczesniak

unread,
Oct 15, 2014, 8:45:20 AM10/15/14
to ns-3-...@googlegroups.com
Hi,

I have this code:

  ns3::Ptr<ns3::Node> server, olt;
  ns3::Ptr<ns3::NetDevice> server_dev, olt_dev;
  ns3::Ptr<ns3::Ipv4Interface> server_iface, olt_iface;

  // Create the point-to-point link.
  NodeContainer nodes (olt, server);
  PointToPointHelper pointToPoint;
  NetDeviceContainer devs = pointToPoint.Install (nodes);
  server_dev = devs.Get(0);

  // Create IPv4 interfaces.
  NetDeviceContainer devs(server_dev, olt_wan_dev);
  Ipv4AddressHelper ah;
  ah.SetBase ("160.0.0.1", "255.255.255.252");
  Ipv4InterfaceContainer ifaces = ah.Assign (devs);
  server_iface = ifaces.Get(0);
  olt_wan_iface = ifaces.Get(1);

The problem is in the two last lines.  It doesn't want to compile, because Get returns:

std::pair< Ptr< Ipv4 >, uint32_t >

And I want to assign it to Ipv4Interface.

How can I get Ipv4Interface?


Thanks & best,
Irek
Reply all
Reply to author
Forward
0 new messages