[ndnSIM] Replacement for NetDeviceFace / Accessing physical bitrate of Face

Alex Afanasyev aa at CS.UCLA.EDU
Fri Mar 17 15:05:22 PDT 2017


The code in 2.3 would look very similarly to old one, you will just need to case not the face, but transport element that you get from the face:

...  if (NetDeviceTransport *transport = dynamic_cast< NetDeviceTransport*>(&face->getTransport())) {
...
      transport->getNetDevice()....
      // rest the same
}

> On Mar 17, 2017, at 2:21 AM, Philipp Moll <philipp.moll at itec.aau.at> wrote:
> 
> Dear all,
> 
> I'm trying to port software originated for ndnSIM 2.0 to the current version of ndnSIM. The software used the NetDeviceFace class, which was removed in Version 2.2, for accessing the physical bit-rate of the underlying link with the following code:
> 
> // shared_ptr< Face > face
> 
> if(ns3::ndn::NetDeviceFace *netf = dynamic_cast<ns3::ndn::NetDeviceFace*>(&(*face)))
>  {
>    ns3::Ptr<ns3::PointToPointNetDevice> nd1 = netf->GetNetDevice()->GetNode ()->GetDevice(netf->getId () - 256)->GetObject<ns3::PointToPointNetDevice>();
>    ns3::DataRateValue dv;
>    nd1->GetAttribute("DataRate", dv);
>    ns3::DataRate d = dv.Get();
>    return d.GetBitRate();
> }
> 
> Unfortunately, I could not find a method for accessing the bitrate without casting Face to NetDeviceFace. Maybe someone was already faced with the same problem and solved it already.
> 
> Thanks!
> Philipp Moll
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim




More information about the ndnSIM mailing list