[ndnSIM] Problems
Spyridon (Spyros) Mastorakis
mastorakis at cs.ucla.edu
Thu May 11 20:20:49 PDT 2017
Hi,
you have to modify the wireEncode and wireDecode methods to encode/decode the newly added field in the appropriate way.
Thanks,
Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
Internet Research Laboratory
Computer Science Department
UCLA
> On May 9, 2017, at 7:00 PM, 16120054 at bjtu.edu.cn wrote:
>
>
>
> 16120054 at bjtu.edu.cn <mailto:16120054 at bjtu.edu.cn>
>
> 发件人: 16120054 at bjtu.edu.cn <mailto:16120054 at bjtu.edu.cn>
> 发送时间: 2017-05-10 09:29
> 收件人: nfd-dev <mailto:nfd-dev at lists.cs.ucla.edu>
> 主题: 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 <mailto:16120168 at bjtu.edu.cn>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170511/0cf6c824/attachment.html>
More information about the ndnSIM
mailing list