[ndnSIM] Create Custom Interest Packet, Send it & Examine It

Xinyu Ma bitmxy at gmail.com
Sat Nov 3 15:14:17 PDT 2018


Hello, Daneshmand,

I think you do not need to convert an interest into Packet manually before you send it.
There are functions directly deal with an interest.
If your application class inherits from non::App, then:
m_appLink->onReceiveInterest(*interest);
If your application uses a ndn-cxx face, you can call expressInterest function.

Best wishes,
Xinyu Ma.

> On Nov 3, 2018, at 9:25 AM, Arash Daneshmand <arash.outline at gmail.com> wrote:
> 
> Dear Spyridon,
> Thank you for replying to my problem.
> I've checked the example section in ndnSim website and all of them use the class ndn::AppHelper to create a consumer and producer.
> what I'm trying to do is build a custom interest ,convert it to a packet and send it to the network. I've made the interest using these commands :
> 
>     shared_ptr<Interest> interest3 = make_shared<Interest>();
>     interest3->setNonce(6);
>     interest3->setName("interest3");
>     time::milliseconds interestLifeTime(2);
>     interest3->setInterestLifetime(interestLifeTime);
> 
> now I want to convert the interest to a packet. ndnSim used to have a class (in versions 2.2 & before) called ns3::ndn::Convert that did the job using these functions : 
> 
> ns3::ndn::Convert::ToPacket< Data >(const T & pkt)     
> ns3::ndn::Convert::FromPacket< Data > (Ptr< Packet > packet)
> 
> what I need now is these exact functions to convert interest to packets.
> 
> Thank You In Advance for your Kind help.
> 
> On Sat, Nov 3, 2018 at 7:13 PM Spyridon (Spyros) Mastorakis <mastorakis at cs.ucla.edu> wrote:
> Arash,
> 
> we have a number of simulation examples and applications on the ndnSIM website:
> 
> http://ndnsim.net/current/
> 
> Thanks,
> 
> Spyridon (Spyros) Mastorakis
> Personal Website: http://cs.ucla.edu/~mastorakis/
> Internet Research Laboratory
> Computer Science Department
> UCLA
> 
>> On Nov 3, 2018, at 1:33 AM, Arash Daneshmand <arash.outline at gmail.com> wrote:
>> 
>> Hello Again,
>> 
>> What I'm trying to do is create a custom interest with a prefix in the consumer, convert it to a packet, send it through a socket connection to the producer.
>> when the producer received the custom interest packet, extract it's prefix and check if the requested data is available , and then create a custom data , convert it to a packet and send it back to the consumer through a socket connection.
>> 
>> some examples or pieces of c++ codes to do such a thing would help me a lot.
>> 
>> Is it possible to create such a scenario and do the whole thing manually? 
>> 
>> Thanks,
>> Arash
>> 
>> On Fri, Nov 2, 2018 at 9:27 PM Arash Daneshmand <arash.outline at gmail.com> wrote:
>> Dear Junxiao Shi,
>> 
>> what are the required includes for these functions?
>> I got no setParameter() and  getParameters() for my created interest.
>> 
>> Thanks,
>> Arash
>> 
>> On Fri, Nov 2, 2018 at 4:09 PM Junxiao Shi <shijunxiao at email.arizona.edu> wrote:
>> Hi Arash
>> 
>> Interest interest("/A"); // create Interest
>> interest.setParameters("C0C1C2C3"_block); // add payload
>> face.expressInterest(interest, onData, onNack, onTimeout); // send Interest
>> std::cout << interest.getParameters(); // examine payload
>> 
>> Yours, Junxiao
>> 
>> On Fri, Nov 2, 2018 at 08:25 Arash Daneshmand <arash.outline at gmail.com> wrote:
>> Greetings,
>> 
>> I want to create a custom interest packet with my custom payload and send it through the consumer. I want to be able to examine the interest and response packets in the consumer and producer. 
>> I was hoping you could help me with some examples or pieces of c++ codes.
>> 
>> Thank You In Advance,
>> Arash Daneshmand
>> 
> 
> _______________________________________________
> 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