ndn::security::transform::HexEncode Class Reference

The module to perform hexadecimal encoding transformation. More...

#include <hex-encode.hpp>

+ Inheritance diagram for ndn::security::transform::HexEncode:
+ Collaboration diagram for ndn::security::transform::HexEncode:

Public Member Functions

 HexEncode (bool useUpperCase=false)
 Create a hex encoding module. More...
 
void end ()
 Close the input interface of a module. More...
 
size_t getIndex () const
 Get the module index. More...
 
bool isEnd () const
 Check if the input interface of a module is closed. More...
 
void setIndex (size_t index)
 Set the module index. More...
 
size_t write (const uint8_t *buf, size_t size)
 Accept input data and perform transformation. More...
 

Protected Types

typedef std::vector< uint8_t > OBuffer
 

Protected Member Functions

void appendChain (unique_ptr< Downstream > tail)
 connect to next transformation module More...
 
void flushAllOutput ()
 Read the all the content from output buffer and write it into next module. More...
 
void flushOutputBuffer ()
 Read the content from output buffer and write it into next module. More...
 
DownstreamgetNext ()
 
bool isOutputBufferEmpty () const
 Check if output buffer is empty. More...
 
void setOutputBuffer (unique_ptr< OBuffer > buffer)
 Set output buffer to buffer. More...
 

Protected Attributes

unique_ptr< Downstreamm_next
 

Detailed Description

The module to perform hexadecimal encoding transformation.

For example, if the input is a byte stream 0x01, 0x23, 0x45, the output will be a string "012345".

Definition at line 37 of file hex-encode.hpp.

Member Typedef Documentation

typedef std::vector<uint8_t> ndn::security::transform::Transform::OBuffer
protectedinherited

Definition at line 190 of file transform-base.hpp.

Constructor & Destructor Documentation

ndn::security::transform::HexEncode::HexEncode ( bool  useUpperCase = false)
explicit

Create a hex encoding module.

Parameters
useUpperCaseif true, use upper case letters, otherwise lower case

Definition at line 41 of file hex-encode.cpp.

Member Function Documentation

void ndn::security::transform::Upstream::appendChain ( unique_ptr< Downstream tail)
protectedinherited

connect to next transformation module

Definition at line 67 of file transform-base.cpp.

void ndn::security::transform::Downstream::end ( )
inherited

Close the input interface of a module.

This method will notify this module that there is no more input and that the module should finalize transformation.

Although end() can be invoked multiple times, only the first invocation takes effect.

Definition at line 52 of file transform-base.cpp.

void ndn::security::transform::Transform::flushAllOutput ( )
protectedinherited

Read the all the content from output buffer and write it into next module.

Postcondition
isOutputBufferEmpty() returns true.

Definition at line 96 of file transform-base.cpp.

void ndn::security::transform::Transform::flushOutputBuffer ( )
protectedinherited

Read the content from output buffer and write it into next module.

It is not guaranteed that all the content in output buffer will be flushed to next module.

Definition at line 85 of file transform-base.cpp.

size_t ndn::security::transform::Downstream::getIndex ( ) const
inlineinherited

Get the module index.

Definition at line 125 of file transform-base.hpp.

Downstream* ndn::security::transform::Upstream::getNext ( )
inlineprotectedinherited

Definition at line 173 of file transform-base.hpp.

bool ndn::security::transform::Downstream::isEnd ( ) const
inlineinherited

Check if the input interface of a module is closed.

Definition at line 107 of file transform-base.hpp.

bool ndn::security::transform::Transform::isOutputBufferEmpty ( ) const
protectedinherited

Check if output buffer is empty.

Definition at line 112 of file transform-base.cpp.

void ndn::security::transform::Downstream::setIndex ( size_t  index)
inlineinherited

Set the module index.

Definition at line 116 of file transform-base.hpp.

void ndn::security::transform::Transform::setOutputBuffer ( unique_ptr< OBuffer buffer)
protectedinherited

Set output buffer to buffer.

Definition at line 104 of file transform-base.cpp.

size_t ndn::security::transform::Downstream::write ( const uint8_t *  buf,
size_t  size 
)
inherited

Accept input data and perform transformation.

An upstream module should call this method to write data into this module. The written data will be transformed and the result will be written into the next downstream module.

An upstream module can keep calling this method to until end() is called, which indicates the end of input. After that, calling this method will cause Error.

If a Downstream implementation expects structured input (e.g., hex decoding requires byte-pair), it should not return less than size if final portion of input is not a complete record.

Returns
number of bytes that has been written into this module
Exceptions
Errorif this module is closed or transformation error happens.

Definition at line 41 of file transform-base.cpp.

Member Data Documentation

unique_ptr<Downstream> ndn::security::transform::Upstream::m_next
protectedinherited

Definition at line 179 of file transform-base.hpp.