Public Member Functions | List of all members
ndn::Data Class Reference
Inheritance diagram for ndn::Data:
ndn::Certificate ndn::Link ndn::IdentityCertificate

Public Member Functions

 Data ()
 Create a new Data object with default values and where the signature is a blank Sha256WithRsaSignature.
 
 Data (const Name &name)
 Create a new Data object with the given name and default values and where the signature is a blank Sha256WithRsaSignature. More...
 
 Data (const Data &data)
 The copy constructor: Create a deep copy of the given data object, including a clone of the signature object. More...
 
virtual ~Data ()
 The virtual destructor.
 
Dataoperator= (const Data &data)
 The assignment operator: Copy fields and make a clone of the signature. More...
 
SignedBlob wireEncode (WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const
 Encode this Data for a particular wire format. More...
 
virtual void wireDecode (const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Data. More...
 
void wireDecode (const uint8_t *input, size_t inputLength, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Data. More...
 
void wireDecode (const std::vector< uint8_t > &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Decode the input using a particular wire format and update this Data. More...
 
void get (DataLite &dataLite) const
 Set dataLite to point to the values in this Data object, without copying any memory. More...
 
void set (const DataLite &dataLite)
 Clear this data object, and set the values by copying from dataLite. More...
 
const SignaturegetSignature () const
 
SignaturegetSignature ()
 
const NamegetName () const
 
NamegetName ()
 
const MetaInfogetMetaInfo () const
 
MetaInfogetMetaInfo ()
 
const BlobgetContent () const
 
uint64_t getIncomingFaceId () const
 Get the incoming face ID according to the incoming packet header. More...
 
const SignedBlobgetDefaultWireEncoding () const
 Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat(). More...
 
WireFormatgetDefaultWireEncodingFormat () const
 Get the WireFormat which is used by getDefaultWireEncoding(). More...
 
DatasetSignature (const Signature &signature)
 Set the signature to a copy of the given signature. More...
 
virtual DatasetName (const Name &name)
 Set name to a copy of the given Name. More...
 
DatasetMetaInfo (const MetaInfo &metaInfo)
 Set metaInfo to a copy of the given MetaInfo. More...
 
DatasetContent (const std::vector< uint8_t > &content)
 Set the content to a copy of the data in the vector. More...
 
DatasetContent (const uint8_t *content, size_t contentLength)
 
DatasetContent (const Blob &content)
 
DatasetLpPacket (const ptr_lib::shared_ptr< LpPacket > &lpPacket)
 An internal library method to set the LpPacket for an incoming packet. More...
 
uint64_t getChangeCount () const
 Get the change count, which is incremented each time this object (or a child object) is changed. More...
 

Constructor & Destructor Documentation

ndn::Data::Data ( const Name name)

Create a new Data object with the given name and default values and where the signature is a blank Sha256WithRsaSignature.

Parameters
nameA reference to the name which is copied.
ndn::Data::Data ( const Data data)

The copy constructor: Create a deep copy of the given data object, including a clone of the signature object.

Parameters
dataThe data object to copy.

Member Function Documentation

void ndn::Data::get ( DataLite dataLite) const

Set dataLite to point to the values in this Data object, without copying any memory.

WARNING: The resulting pointers in dataLite are invalid after a further use of this object which could reallocate memory.

Parameters
dataLitea DataLite object where the name components array is already allocated.
uint64_t ndn::Data::getChangeCount ( ) const
inline

Get the change count, which is incremented each time this object (or a child object) is changed.

Returns
The change count.
const SignedBlob& ndn::Data::getDefaultWireEncoding ( ) const
inline

Return a reference to the defaultWireEncoding, which was encoded with getDefaultWireEncodingFormat().

The SignedBlob may have a null pointer.

WireFormat* ndn::Data::getDefaultWireEncodingFormat ( ) const
inline

Get the WireFormat which is used by getDefaultWireEncoding().

Returns
The WireFormat, which is only meaningful if the getDefaultWireEncoding() does not have a null pointer.
uint64_t ndn::Data::getIncomingFaceId ( ) const

Get the incoming face ID according to the incoming packet header.

Returns
The incoming face ID. If not specified, return (uint64_t)-1.
Data & ndn::Data::operator= ( const Data data)

The assignment operator: Copy fields and make a clone of the signature.

Parameters
dataThe other object to copy from.
Returns
A reference to this object.
void ndn::Data::set ( const DataLite dataLite)

Clear this data object, and set the values by copying from dataLite.

Parameters
dataLiteA DataLite object.
Data& ndn::Data::setContent ( const std::vector< uint8_t > &  content)
inline

Set the content to a copy of the data in the vector.

Parameters
contentA vector whose contents are copied.
Returns
This Data so that you can chain calls to update values.
Data& ndn::Data::setLpPacket ( const ptr_lib::shared_ptr< LpPacket > &  lpPacket)
inline

An internal library method to set the LpPacket for an incoming packet.

The application should not call this.

Parameters
lpPacketThe LpPacket. This does not make a copy.
Returns
This Data so that you can chain calls to update values.
Note
This is an experimental feature. This API may change in the future.
Data& ndn::Data::setMetaInfo ( const MetaInfo metaInfo)
inline

Set metaInfo to a copy of the given MetaInfo.

Parameters
metaInfoThe MetaInfo which is copied.
Returns
This Data so that you can chain calls to update values.
Data & ndn::Data::setName ( const Name name)
virtual

Set name to a copy of the given Name.

This is virtual so that a subclass can override to validate the name.

Parameters
nameThe Name which is copied.
Returns
This Data so that you can chain calls to update values.

Reimplemented in ndn::IdentityCertificate.

Data& ndn::Data::setSignature ( const Signature signature)
inline

Set the signature to a copy of the given signature.

Parameters
signatureThe signature object which is cloned.
Returns
This Data so that you can chain calls to update values.
void ndn::Data::wireDecode ( const Blob input,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
virtual

Decode the input using a particular wire format and update this Data.

If wireFormat is the default wire format, also set the defaultWireEncoding to another pointer to the input Blob.

Parameters
inputThe input byte array to be decoded as an immutable Blob.
wireFormatA WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().

Reimplemented in ndn::IdentityCertificate, ndn::Link, and ndn::Certificate.

void ndn::Data::wireDecode ( const uint8_t *  input,
size_t  inputLength,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Decode the input using a particular wire format and update this Data.

If wireFormat is the default wire format, also set the defaultWireEncoding field to a copy of the input. (To not copy the input, see wireDecode(Blob).)

Parameters
inputThe input byte array to be decoded.
inputLengthThe length of input.
wireFormatA WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
void ndn::Data::wireDecode ( const std::vector< uint8_t > &  input,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Decode the input using a particular wire format and update this Data.

If wireFormat is the default wire format, also set the defaultWireEncoding field to a copy of the input. (To not copy the input, see wireDecode(Blob).)

Parameters
inputThe input byte array to be decoded.
wireFormatA WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
SignedBlob ndn::Data::wireEncode ( WireFormat wireFormat = *WireFormat::getDefaultWireFormat()) const

Encode this Data for a particular wire format.

If wireFormat is the default wire format, also set the defaultWireEncoding field to the encoded result. Even though this is const, if wireFormat is the default wire format we update the defaultWireEncoding.

Parameters
wireFormatA WireFormat object used to encode the input. If omitted, use WireFormat getDefaultWireFormat().
Returns
The encoded byte array.

The documentation for this class was generated from the following files: