[ndnSIM] the face of a node

bouchrit leila bouchritleila at gmail.com
Sun Jul 21 02:17:45 PDT 2019


i solve it thanks *Muhammad Atif Ur Rehman*.
best regard.

Le dim. 21 juil. 2019 à 11:00, bouchrit leila <bouchritleila at gmail.com> a
écrit :

> Thank you very much *Muhammad Atif Ur Rehman* for reply,
> i exexute your code but it show me this error :
> ./src/ndnSIM/examples/HashStrategy1/HashForwardingStrategy.cpp:32:53:
> fatal error: ns-3/src/ndnSIM/model/ndn-l3-protocol.hpp: Aucun fichier ou
> dossier de ce type
>  #include "ns-3/src/ndnSIM/model/ndn-l3-protocol.hpp"
>                                                      ^
> compilation terminated.
> Waf: Leaving directory `/home/leila/ndnSIM/ns-3/build'
> Build failed
>  -> task in 'HashStrategy1' failed with exit status 1 (run with -v to
> display more information)
>
> yet I have written the includes:
> #include "ns-3/ndnSIM/model/ndn-l3-protocol.hpp"
>
>
>
> Le dim. 21 juil. 2019 à 08:52, Atif Rehman via ndnSIM <
> ndnsim at lists.cs.ucla.edu> a écrit :
>
>> Hello Bouchrit,
>>
>> I think you are looking for the following code.
>>
>>
>> // Following includes are mandatory in order to get node and its faces
>>
>> #include <ns3/node-list.h>
>> #include <ns3/node.h>
>> #include "../../../model/ndn-l3-protocol.hpp"
>>
>>
>>  // Code
>> if (ns3::Simulator::GetContext() < 1000) // this check prevents 4535459
>> value of Context, I am not sure why it returns 4535459
>> {
>>     ns3::Ptr<ns3::Node> node =
>> ns3::NodeList::GetNode(ns3::Simulator::GetContext()); // Get Current node
>> from simulator context
>>     ns3::Ptr<ns3::ndn::L3Protocol> l3Object =
>> node->GetObject<ns3::ndn::L3Protocol>(); // Getting l3 Object
>>
>>     std::cout << "Node Id :" << node->GetId() << std::endl;
>>
>>     // iteratation over face table
>>     for (auto & face : l3Object->getForwarder()->getFaceTable())
>>     {
>>
>>        // here you can play with "face" object (current node face)
>>
>>     }
>> }
>>
>> I executed the above code in Forwarder class and it was working fine for
>> me.
>>
>>
>> *Regards *
>>
>>
>>
>> *Muhammad Atif Ur Rehman* *(Ph.D. Student)*
>> _______________________________________________
>> ndnSIM mailing list
>> ndnSIM at lists.cs.ucla.edu
>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20190721/8033fac7/attachment-0001.html>


More information about the ndnSIM mailing list