26 #include "signature.hpp"
27 #include "meta-info.hpp"
28 #include "util/signed-blob.hpp"
29 #include "encoding/wire-format.hpp"
30 #include "util/change-counter.hpp"
31 #include "lite/data-lite.hpp"
94 (
const uint8_t* input,
size_t inputLength,
109 wireDecode(&input[0], input.size(), wireFormat);
131 getSignature()
const {
return signature_.get(); }
134 getSignature() {
return signature_.get(); }
137 getName()
const {
return name_.get(); }
140 getName() {
return name_.get(); }
143 getMetaInfo()
const {
return metaInfo_.get(); }
145 MetaInfo& getMetaInfo() {
return metaInfo_.get(); }
148 getContent()
const {
return content_; }
161 const_cast<Data*
>(
this)->defaultWireEncodingFormat_ = 0;
165 return defaultWireEncoding_;
184 signature_.set(signature.
clone());
205 metaInfo_.set(metaInfo);
222 setContent(
const uint8_t* content,
size_t contentLength)
243 bool changed = signature_.checkChanged();
244 changed = name_.checkChanged() || changed;
245 changed = metaInfo_.checkChanged() || changed;
249 ++
const_cast<Data*
>(
this)->changeCount_;
256 setDefaultWireEncoding
260 defaultWireEncoding_ = defaultWireEncoding;
261 defaultWireEncodingFormat_ = defaultWireEncodingFormat;
267 SharedPointerChangeCounter<Signature> signature_;
268 ChangeCounter<Name> name_;
269 ChangeCounter<MetaInfo> metaInfo_;
271 SignedBlob defaultWireEncoding_;
272 WireFormat *defaultWireEncodingFormat_;
273 uint64_t getDefaultWireEncodingChangeCount_;
274 uint64_t changeCount_;
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
virtual ~Data()
The virtual destructor.
Definition: data.cpp:55
void set(const DataLite &dataLite)
Clear this data object, and set the values by copying from dataLite.
Definition: data.cpp:85
Data()
Create a new Data object with default values and where the signature is a blank Sha256WithRsaSignatur...
Definition: data.cpp:34
Data & setSignature(const Signature &signature)
Set the signature to a copy of the given signature.
Definition: data.hpp:182
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
SignedBlob wireEncode(WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const
Encode this Data for a particular wire format.
Definition: data.cpp:113
A Signature is an abstract base class providing methods to work with the signature information in a D...
Definition: signature.hpp:35
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
virtual Data & setName(const Name &name)
Set name to a copy of the given Name.
Definition: data.cpp:105
WireFormat * getDefaultWireEncodingFormat() const
Get the WireFormat which is used by getDefaultWireEncoding().
Definition: data.hpp:174
Data & setMetaInfo(const MetaInfo &metaInfo)
Set metaInfo to a copy of the given MetaInfo.
Definition: data.hpp:203
Data & operator=(const Data &data)
The assignment operator: Copy fields and make a clone of the signature.
Definition: data.cpp:59
Data & setContent(const std::vector< uint8_t > &content)
Set the content to a copy of the data in the vector.
Definition: data.hpp:216
virtual void wireDecode(const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Decode the input using a particular wire format and update this Data.
Definition: data.cpp:132
virtual ptr_lib::shared_ptr< Signature > clone() const =0
Return a pointer to a new Signature which is a copy of this signature.
A SignedBlob extends Blob to keep the offsets of a signed portion (e.g., the bytes of Data packet)...
Definition: signed-blob.hpp:34
void wireDecode(const std::vector< uint8_t > &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
Decode the input using a particular wire format and update this Data.
Definition: data.hpp:107
A DataLite holds a NameLite and other fields to represent an NDN Data packet.
Definition: data-lite.hpp:34
uint64_t getChangeCount() const
Get the change count, which is incremented each time this object (or a child object) is changed...
Definition: data.hpp:240
const SignedBlob & getDefaultWireEncoding() const
Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat()...
Definition: data.hpp:155