[ndnSIM] Accessing net device faces

Alex Afanasyev aa at CS.UCLA.EDU
Fri Feb 26 00:46:22 PST 2016


> On Feb 21, 2016, at 11:19 PM, Ayush Agarwal <ayush0071 at gmail.com> wrote:
> 
> Hello everyone,
> 
> I am trying to access all the net device interfaces associated to a face.
> Firstly I am getting the object of ndnNetDeviceFace and then with its help I am accessing the net devices associated to it.
> 
> I am also handling the NULL cases for the ndnNetDeviceFace to avoid segmentation faults. But due to this I am unable to access the net devices with id 0.
> The code I am using is as follows:
> 
>  Ptr<NetDeviceFace> netDeviceFace = DynamicCast<NetDeviceFace> (inFace);
>   //std::cout << "device id is" << netDeviceFace->GetTypeId() << "\n";
>   if (netDeviceFace == NULL)
>   {
>       std::cout<<"null\n"
>   }
>   if(netDeviceFace!=NULL)
>   {
>   Ptr<NetDevice> nd = netDeviceFace->GetNetDevice ();
>   ------------
>   ------------
>   }
> 
> Please help me in a solution so that I can access all the net devices without any segmentation faults.

I'm not quite sure what you mean by "unable to access the net devices with id 0".  If the DynamicCast returns null, then the face is not NetDeviceFace.  For example, it can be internal NFD face or it can be AppFace.

---
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160226/e978c6d3/attachment.bin>


More information about the ndnSIM mailing list