bool
Data::operator==(const Data& other) const
{
  return getName() == other.getName() &&
    getMetaInfo() == other.getMetaInfo() &&
    getContent() == other.getContent() &&
    getSignature() == other.getSignature();
}
示例#2
0
void
Link::wireDecode(const Blob& input, WireFormat& wireFormat)
{
  Data::wireDecode(input, wireFormat);
  if (getMetaInfo().getType() != ndn_ContentType_LINK)
    throw runtime_error
      ("Link::wireDecode: MetaInfo ContentType is not LINK.");

  delegations_.wireDecode(getContent());
}
示例#3
0
Link::Link(const Data& data)
  : Data(data)
{
  if (!getContent().isNull()) {
    try {
      delegations_.wireDecode(getContent());
      getMetaInfo().setType(ndn_ContentType_LINK);
    }
    catch (...) {
      delegations_.clear();
    }
  }
}
示例#4
0
size_t
Data::wireEncode(EncodingImpl<TAG>& encoder, bool unsignedPortion/* = false*/) const
{
  size_t totalLength = 0;

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

  // (reverse encoding)

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

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

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

  // Deletion token
  size_t newLength = encoder.prependBlock(m_token);
  totalLength += newLength;

  // 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;
}
示例#5
0
        Ptr<LispObject> create(StackPtr<LispObject> pParent,
                               StackPtr<LispObject> pName)
        {
            LCPP_LogBlock("env::create");

            if(!isNil(pParent)) typeCheck(pParent, Type::Environment);
            typeCheck(pName, Type::Symbol);

            auto pInstance = object::create<Data>(getMetaInfo());

            LCPP_GC_PreventCollectionInScope;

            auto& data = pInstance->getData<Data>();

            data.m_pName = pName.get();
            data.m_pParent = pParent.get();

            return pInstance;
        }