<div dir="auto"><div>Hi Samar</div><div dir="auto"><br></div><div dir="auto">You can't add new packet fields. Instead, place the field as part of the payload.</div><div dir="auto"><br></div><div dir="auto">Example:</div><div dir="auto"><br></div><div dir="auto">// sender</div><div dir="auto">uint64_t myNumber = 2020;</div><div dir="auto">ndn::Data data;</div><div dir="auto">data.setContent(reinterpret_cast<const uint_t*>(&myNumber), sizeof(myNumber));</div><div dir="auto"><br></div><div dir="auto">// receiver</div><div dir="auto">uint64_t readNumber;</div><div dir="auto">auto payload = data.getContent();</div><div dir="auto">if (payload.value_size() == sizeof(readNumber)) {</div><div dir="auto">  std::copy(payload.value_begin(), payload.value_end(), reinterpret_cast<uint8_t*>(&readNumber));</div><div dir="auto">}</div><div dir="auto"><br></div><div dir="auto">Note: sender and receiver must use same endianness. This requirement is met in ns-3.</div><div dir="auto"><br></div><div dir="auto">Yours, Junxiao<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Wed, Jan 1, 2020, 09:14 Samar Alduayji via ndnSIM <<a href="mailto:ndnsim@lists.cs.ucla.edu">ndnsim@lists.cs.ucla.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="padding:20px 0px 0px;font-size:0.875rem;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><span style="background-color:transparent;font-family:Arial,Helvetica,sans-serif;font-size:small;text-align:center;font-weight:inherit;white-space:nowrap">Dear all,</span></div><div style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div id="m_-944640979101944009gmail-:3pt" style="font-size:0.875rem;direction:ltr;margin:8px 0px 0px;padding:0px"><div id="m_-944640979101944009gmail-:3ps" style="overflow:hidden;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif"><div dir="ltr"><div>I'm trying to add a new field( type is uint32_t) to data packet so the producer can set this field while creating the packet. I modified tlv, tags, and fields header files to include a new tag for it. I also edited generic-link-service.cpp file</div><div><br></div><div>I declared the field in the producer.hpp file and in the producer.cpp file I added the field using .addAttribute(....), and tried to set it using data->setTag<fieldName>(std::make_shared<fieldName>(m_field));</div><div>but I got an errors while compiling the OnInterest method:</div><div>1-that this new field was not declared in this scope.</div><div>2- the value is not usable in a constant expression and was not declared constexp. </div><div>3- no matching function for call to make_shared(uint32_t)</div><div><br></div><div>Does the setTag is not applicable to be used here? Should I write specific set and get function in the data.cpp file? what other modifications shall I add to be able to set this field and use it?</div><div><br></div><div>Your help is really appreciated</div><div><br></div><div>Regards, </div><div>Samar</div><span><font color="#888888"><br></font></span></div></div></div></div></div><br>
</blockquote></div></div></div>