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"
96 (
const uint8_t* input,
size_t inputLength,
111 wireDecode(&input[0], input.size(), wireFormat);
133 getSignature()
const {
return signature_.get(); }
136 getSignature() {
return signature_.get(); }
139 getName()
const {
return name_.get(); }
142 getName() {
return name_.get(); }
145 getMetaInfo()
const {
return metaInfo_.get(); }
147 MetaInfo& getMetaInfo() {
return metaInfo_.get(); }
150 getContent()
const {
return content_; }
170 const_cast<Data*
>(
this)->defaultWireEncodingFormat_ = 0;
174 return defaultWireEncoding_;
193 signature_.set(signature.
clone());
214 metaInfo_.set(metaInfo);
231 setContent(
const uint8_t* content,
size_t contentLength)
254 lpPacket_ = lpPacket;
267 bool changed = signature_.checkChanged();
268 changed = name_.checkChanged() || changed;
269 changed = metaInfo_.checkChanged() || changed;
273 ++
const_cast<Data*
>(
this)->changeCount_;
280 setDefaultWireEncoding
284 defaultWireEncoding_ = defaultWireEncoding;
285 defaultWireEncodingFormat_ = defaultWireEncodingFormat;
291 SharedPointerChangeCounter<Signature> signature_;
292 ChangeCounter<Name> name_;
293 ChangeCounter<MetaInfo> metaInfo_;
295 SignedBlob defaultWireEncoding_;
296 WireFormat *defaultWireEncodingFormat_;
297 uint64_t getDefaultWireEncodingChangeCount_;
298 ptr_lib::shared_ptr<LpPacket> lpPacket_;
299 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:58
void set(const DataLite &dataLite)
Clear this data object, and set the values by copying from dataLite.
Definition: data.cpp:98
Data()
Create a new Data object with default values and where the signature is a blank Sha256WithRsaSignatur...
Definition: data.cpp:37
uint64_t getIncomingFaceId() const
Get the incoming face ID according to the incoming packet header.
Definition: data.cpp:79
Data & setSignature(const Signature &signature)
Set the signature to a copy of the given signature.
Definition: data.hpp:191
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:130
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:122
WireFormat * getDefaultWireEncodingFormat() const
Get the WireFormat which is used by getDefaultWireEncoding().
Definition: data.hpp:183
Data & setMetaInfo(const MetaInfo &metaInfo)
Set metaInfo to a copy of the given MetaInfo.
Definition: data.hpp:212
Data & operator=(const Data &data)
The assignment operator: Copy fields and make a clone of the signature.
Definition: data.cpp:62
Data & setContent(const std::vector< uint8_t > &content)
Set the content to a copy of the data in the vector.
Definition: data.hpp:225
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:149
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:109
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:264
Data & setLpPacket(const ptr_lib::shared_ptr< LpPacket > &lpPacket)
An internal library method to set the LpPacket for an incoming packet.
Definition: data.hpp:252
const SignedBlob & getDefaultWireEncoding() const
Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat()...
Definition: data.hpp:164