[ndnSIM] 转发: Problems

16120054 at bjtu.edu.cn 16120054 at bjtu.edu.cn
Tue May 9 19:00:31 PDT 2017





16120054 at bjtu.edu.cn
 
发件人: 16120054 at bjtu.edu.cn
发送时间: 2017-05-10 09:29
收件人: nfd-dev
主题: Problems
Hello!
    I add a data parket field in the data.cpp ,such as
  template<encoding::Tag TAG>
size_t
Data::wireEncode(EncodingImpl<TAG>& encoder, bool unsignedPortion/* = false*/) const
{
  size_t totalLength = 0;

  // Data ::= DATA-TLV TLV-LENGTH
  //            Name
  //            MetaInfo
  //            Content
  //            Signature
  //         Digest

  // (reverse encoding)

  if (!unsignedPortion && !m_signature)
  {
      BOOST_THROW_EXCEPTION(Error("Requested wire format, but data packet has not been signed yet"));
  }

  // Digest
  totalLength += encoder.prependBlock(getDigest());

  if (!unsignedPortion)
  {
      // SignatureValue
      totalLength += encoder.prependBlock(m_signature.getValue());
  }

  // SignatureInfo
  totalLength += encoder.prependBlock(m_signature.getInfo());

  // Content
  totalLength += encoder.prependBlock(getContent());

  // MetaInfo
  totalLength += getMetaInfo().wireEncode(encoder);

  // Name
  totalLength += getName().wireEncode(encoder);


  if (!unsignedPortion)
    {
      totalLength += encoder.prependVarNumber(totalLength);
      totalLength += encoder.prependVarNumber(tlv::Data);
    }
  return totalLength;
}

  const Block&
Data::getDigest() const
{
  if (m_fullName1.empty())
    m_fullName1 = makeEmptyBlock(tlv::Digest);

  if (!m_fullName1.hasWire())
    m_fullName1.encode();
  return m_fullName1;
}

Data&
Data::setDigest(const Block& fullname)
{
  onChanged();
  if (fullname.type() == tlv::Digest)
      m_fullName1 = fullname;
  else {
       m_fullName1 = Block(tlv::Digest, fullname);
  }
  return *this;
}


Data&
Data::setDigest(const uint8_t* fullname, size_t fullnameLength)
{
   onChanged();

   m_fullName1 = makeBinaryBlock(tlv::Digest, fullname, fullnameLength);

   return *this;
 }


 But, program always shows that "terminated with signal SIGSEGV",I don't konw how to solve it.




研究生
下一代互联网国家工程实验室
北京交通大学
寸怡鹏

Mob: (+86) 13238752918
Email: cunyipeng at bjtu.edu.cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170510/fa41412b/attachment.html>


More information about the ndnSIM mailing list