<div dir="ltr">Hi Guys,<div><br></div><div>Thanks for your prompt answer. Yes, the <span style="color:rgb(80,0,80);font-size:14px">Ptr<ndn::pit::Entry> entry = pit->Find(ns3::ndn::Name("/</span><wbr style="color:rgb(80,0,80);font-size:14px"><span style="color:rgb(80,0,80);font-size:14px">prefix")); </span>part returns a NULL since Find uses a exact match, there is no exact "/prefix" in my PIT.</div><div><br></div><div>Regards,</div><div><br></div><div>Lu Zhang</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-21 15:25 GMT+09:00 John Baugh <span dir="ltr"><<a href="mailto:jpbaugh@umich.edu" target="_blank">jpbaugh@umich.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Try checking if name is nullptr:</p><span class="">
<p dir="ltr">ns3::ndn::Name name = entry-> GetPrefix();</p>
</span><p dir="ltr">if(name != nullptr)<br>
  name.toUri();<br>
else<br>
  cout<<"ooops!"<<endl;</p>
<div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Nov 21, 2016 1:18 AM, "Alex Afanasyev" <<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><br>
> On Nov 20, 2016, at 10:15 PM, ZHANG, Lu <<a href="mailto:lu.zhang@fuji.waseda.jp" target="_blank">lu.zhang@fuji.waseda.jp</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> I would like to print out the prefix name in PIT on to screen by using the toUri() function in Name class. The topology is simple as below:<br>
><br>
><br>
>  *      +----------+     10Mbps      +--------+     10Mbps    +----------+<br>
>  *      | consumer | <------------> | router | <------------> | producer |<br>
>  *      +----------+         10ms      +--------+          10ms   +----------+<br>
>  *<br>
><br>
><br>
> Part of my program is like below:<br>
><br>
>   Ptr<ndn::Pit> pit = nodes.Get(1)->GetObject<ndn::P<wbr>it> ();<br>
>   Ptr<ndn::pit::Entry> entry = pit->Find(ns3::ndn::Name("/pre<wbr>fix"));<br>
>   ns3::ndn::Name name = entry-> GetPrefix();<br>
>   name.toUri();<br>
><br>
> When executing compile command ./waf --run 1 --vis I got below output:<br>
><br>
> Command ['/home/11/ndnSIM/ns-3/build/s<wbr>cratch/1', '--SimulatorImplementationType<wbr>=ns3::VisualSimulatorImpl'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").<br>
><br>
> Any one have clue on why this happens or how should I use the toUri() function?<br>
<br>
You can check to run the scenario in the debugger using the suggested command, but I would suspect that you're simply getting a segfault because there is no "/prefix" entry in the PIT (Find returns NULL and then you're dereferencing NULL).<br>
<br>
---<br>
Alex<br>
<br>
<br></div></div>
______________________________<wbr>_________________<br>
ndnSIM mailing list<br>
<a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br>
<a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/m<wbr>ailman/listinfo/ndnsim</a><br>
</blockquote></div></div>
</blockquote></div><br></div>