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"
95 (
const uint8_t* input,
size_t inputLength,
110 wireDecode(&input[0], input.size(), wireFormat);
119 get(
struct ndn_Data& dataStruct)
const;
129 getSignature()
const {
return signature_.get(); }
132 getSignature() {
return signature_.get(); }
135 getName()
const {
return name_.get(); }
138 getName() {
return name_.get(); }
141 getMetaInfo()
const {
return metaInfo_.get(); }
143 MetaInfo& getMetaInfo() {
return metaInfo_.get(); }
146 getContent()
const {
return content_; }
159 const_cast<Data*
>(
this)->defaultWireEncodingFormat_ = 0;
163 return defaultWireEncoding_;
182 signature_.set(signature.
clone());
203 metaInfo_.set(metaInfo);
241 bool changed = signature_.checkChanged();
242 changed = name_.checkChanged() || changed;
243 changed = metaInfo_.checkChanged() || changed;
247 ++
const_cast<Data*
>(
this)->changeCount_;
254 setDefaultWireEncoding
258 defaultWireEncoding_ = defaultWireEncoding;
259 defaultWireEncodingFormat_ = defaultWireEncodingFormat;
265 SharedPointerChangeCounter<Signature> signature_;
266 ChangeCounter<Name> name_;
267 ChangeCounter<MetaInfo> metaInfo_;
269 SignedBlob defaultWireEncoding_;
270 WireFormat *defaultWireEncodingFormat_;
271 uint64_t getDefaultWireEncodingChangeCount_;
272 uint64_t changeCount_;
Copyright (C) 2013-2015 Regents of the University of California.
Definition: common.hpp:35
virtual ~Data()
The virtual destructor.
Definition: data.cpp:55
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:180
Definition: data-types.h:86
struct ndn_Blob content
A Blob with a pointer to the content.
Definition: data-types.h:90
void set(const struct ndn_Data &dataStruct)
Clear this data object, and set the values by copying from the ndn_Data struct.
Definition: data.cpp:85
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:42
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:36
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:172
Data & setMetaInfo(const MetaInfo &metaInfo)
Set metaInfo to a copy of the given MetaInfo.
Definition: data.hpp:201
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:214
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:108
uint64_t getChangeCount() const
Get the change count, which is incremented each time this object (or a child object) is changed...
Definition: data.hpp:238
const SignedBlob & getDefaultWireEncoding() const
Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat()...
Definition: data.hpp:153