<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Fabrizio,</div><div><br></div><div>You should checkout variants of constructor of NS'3 Packet class: <a href="http://www.nsnam.org/doxygen/classns3_1_1_packet.html">http://www.nsnam.org/doxygen/classns3_1_1_packet.html</a></div><div><br></div><div>Basically, you need to create a "payload packet" which would carry the data you need.  For example, you can</div><div><br></div><div>std::string data = "foobar";</div><div>... payload = Create<Packet> (data.c_str(), data.size());</div><div><br></div><div>If you want to carry a structured data, you can also create a custom header class and then use AddHeader/RemoveHeader to get access to the data in the payload.</div><div><br></div><div>---</div><div>Alex</div><br><div><div>On Dec 22, 2013, at 7:27 AM, fabrizio saponaro <<a href="mailto:fab.batta@gmail.com">fab.batta@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Alex,<div>how can I set the contentObject of a Data manually?</div><div>In my forwarding strategy I've a SendData(Ptr<Face>) that send always the Data with a specific contentObject (for example the string "blablabla") but I don't know how to implement it.</div>
<div>I tried with:</div><div><div>        Ptr<Data> data = Create<Data> (Create<Packet> (1024));</div><div><span class="" style="white-space:pre">  </span>Ptr<Name> dataName = Create<Name> ("/dataprefix");</div>
<div><span class="" style="white-space:pre">    </span>data->SetName (dataName);<span class="" style="white-space:pre">      </span></div><div><span class="" style="white-space:pre">   </span>Ptr<Packet> payload = Create<Packet>();</div>
<div><span class="" style="white-space:pre">    </span></div><div><span class="" style="white-space:pre">   </span>data->SetPayload(payload); //payload must to contain the string "blablabla"</div></div><div><br></div>
<div>but payload of SetPayload would be a Ptr<Packet> and I don't know which field of Packet component I've to fill.</div><div><br></div><div>Could you help me?</div><div>Thanks,</div><div>Fabrizio</div></div>
</blockquote></div><br></body></html>