Public Member Functions | List of all members
ndn::SignedBlob Class Reference

A SignedBlob extends Blob to keep the offsets of a signed portion (e.g., the bytes of Data packet). More...

#include <signed-blob.hpp>

Inheritance diagram for ndn::SignedBlob:
ndn::Blob

Public Member Functions

 SignedBlob ()
 Create a new SignedBlob with a null pointer.
 
 SignedBlob (const Blob &blob, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
 Create a new SignedBlob and take another pointer to the given blob's buffer. More...
 
 SignedBlob (const uint8_t *value, size_t valueLength, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
 Create a new SignedBlob with an immutable copy of the given array. More...
 
 SignedBlob (const std::vector< uint8_t > &value, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
 Create a new SignedBlob with an immutable copy of the array in the given vector. More...
 
 SignedBlob (const ptr_lib::shared_ptr< std::vector< uint8_t > > &value, bool copy, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
 Create a new SignedBlob to point to an existing byte array. More...
 
 SignedBlob (const ptr_lib::shared_ptr< const std::vector< uint8_t > > &value, bool copy, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
 
DEPRECATED_IN_NDN_CPP SignedBlob (const ptr_lib::shared_ptr< std::vector< uint8_t > > &value, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
 Create a new SignedBlob to point to an existing byte array. More...
 
DEPRECATED_IN_NDN_CPP SignedBlob (const ptr_lib::shared_ptr< const std::vector< uint8_t > > &value, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
 
size_t signedSize () const
 Return the length of the signed portion of the immutable byte array, or 0 of the pointer to the array is null.
 
const uint8_t * signedBuf () const
 Return a const pointer to the first byte of the signed portion of the immutable byte array, or 0 if the pointer to the array is null.
 
size_t getSignedPortionBeginOffset () const
 Return the offset in the array of the beginning of the signed portion.
 
size_t getSignedPortionEndOffset () const
 Return the offset in the array of the end of the signed portion.
 
- Public Member Functions inherited from ndn::Blob
 Blob ()
 Create a new Blob with a null pointer.
 
 Blob (const uint8_t *value, size_t valueLength)
 Create a new Blob with an immutable copy of the given array. More...
 
 Blob (const std::vector< uint8_t > &value)
 Create a new Blob with an immutable copy of the array in the given vector. More...
 
 Blob (const struct ndn_Blob &blobStruct)
 Create a new Blob with an immutable copy of the array in the given Blob struct. More...
 
 Blob (const BlobLite &blobLite)
 Create a new Blob with an immutable copy of the array in blobLite. More...
 
 Blob (const Blob &blob)
 Create a new Blob and take another pointer to the given blob's buffer. More...
 
 Blob (const ptr_lib::shared_ptr< std::vector< uint8_t > > &value, bool copy)
 Create a new Blob to point to an existing byte array. More...
 
 Blob (const ptr_lib::shared_ptr< const std::vector< uint8_t > > &value, bool copy)
 
DEPRECATED_IN_NDN_CPP Blob (const ptr_lib::shared_ptr< std::vector< uint8_t > > &value)
 Create a new Blob to point to an existing byte array. More...
 
DEPRECATED_IN_NDN_CPP Blob (const ptr_lib::shared_ptr< const std::vector< uint8_t > > &value)
 
size_t size () const
 Return the length of the immutable byte array.
 
const uint8_t * buf () const
 Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null.
 
bool isNull () const
 Check if the array pointer is null. More...
 
std::string toHex () const
 Return the hex representation of the bytes in array. More...
 
std::string toRawStr () const
 Return the bytes of the byte array as a raw str of the same length. More...
 
bool equals (const Blob &other) const
 Check if the value of this Blob equals the other blob. More...
 
void get (struct ndn_Blob &blobStruct) const
 Set the blobStruct to point to this Blob's byte array, without copying any memory. More...
 
 operator const BlobLite () const
 

Detailed Description

A SignedBlob extends Blob to keep the offsets of a signed portion (e.g., the bytes of Data packet).

Constructor & Destructor Documentation

ndn::SignedBlob::SignedBlob ( const Blob blob,
size_t  signedPortionBeginOffset,
size_t  signedPortionEndOffset 
)
inline

Create a new SignedBlob and take another pointer to the given blob's buffer.

Parameters
blobThe Blob from which we take another pointer to the same buffer.
signedPortionBeginOffsetThe offset in the encoding of the beginning of the signed portion.
signedPortionEndOffsetThe offset in the encoding of the end of the signed portion.
ndn::SignedBlob::SignedBlob ( const uint8_t *  value,
size_t  valueLength,
size_t  signedPortionBeginOffset,
size_t  signedPortionEndOffset 
)
inline

Create a new SignedBlob with an immutable copy of the given array.

Parameters
valueA pointer to the byte array which is copied.
valueLengthThe length of value.
signedPortionBeginOffsetThe offset in the encoding of the beginning of the signed portion.
signedPortionEndOffsetThe offset in the encoding of the end of the signed portion.
ndn::SignedBlob::SignedBlob ( const std::vector< uint8_t > &  value,
size_t  signedPortionBeginOffset,
size_t  signedPortionEndOffset 
)
inline

Create a new SignedBlob with an immutable copy of the array in the given vector.

If you want to transfer the array without copying, the the vector has to start as a ptr_lib::shared_ptr<std::vector<uint8_t> > and you can use the SignedBlob constructor with this type.

Parameters
valueA reference to a vector which is copied.
signedPortionBeginOffsetThe offset in the encoding of the beginning of the signed portion.
signedPortionEndOffsetThe offset in the encoding of the end of the signed portion.
ndn::SignedBlob::SignedBlob ( const ptr_lib::shared_ptr< std::vector< uint8_t > > &  value,
bool  copy,
size_t  signedPortionBeginOffset,
size_t  signedPortionEndOffset 
)
inline

Create a new SignedBlob to point to an existing byte array.

IMPORTANT: If copy is false, after calling this constructor, if you keep a pointer to the array then you must treat the array as immutable and promise not to change it.

Parameters
valueA pointer to a vector with the byte array.
copyIf true, copy the value into a new vector. Otherwise, take another reference and do not copy the bytes.
signedPortionBeginOffsetThe offset in the array of the beginning of the signed portion.
signedPortionEndOffsetThe offset in the array of the end of the signed portion.
DEPRECATED_IN_NDN_CPP ndn::SignedBlob::SignedBlob ( const ptr_lib::shared_ptr< std::vector< uint8_t > > &  value,
size_t  signedPortionBeginOffset,
size_t  signedPortionEndOffset 
)
inline

Create a new SignedBlob to point to an existing byte array.

Deprecated:
Use the constructor with an explicit copy parameter.

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