ndn::security::transform::Base64Decode Class Referencefinal

The module to perform Base64 decoding transformation. More...

#include <ndn-cxx/security/transform/base64-decode.hpp>

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

Public Member Functions

 Base64Decode (bool expectNewlineEvery64Bytes=true)
 Create a base64 decoding module. More...
 
 ~Base64Decode () final
 
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 (span< const uint8_t > buf)
 Accept input data and perform transformation. More...
 

Protected Types

using OBuffer = std::vector< uint8_t >
 

Protected Member Functions

void appendChain (unique_ptr< Downstream > tail)
 Connect to the 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 Base64 decoding transformation.

Definition at line 34 of file base64-decode.hpp.

Member Typedef Documentation

◆ OBuffer

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

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

Constructor & Destructor Documentation

◆ Base64Decode()

ndn::security::transform::Base64Decode::Base64Decode ( bool  expectNewlineEvery64Bytes = true)
explicit

Create a base64 decoding module.

Parameters
expectNewlineEvery64BytesIf true, expect newline after every 64 bytes, otherwise expect all input to be in a single line. Output is undefined if input does not conform to the requirement.

Definition at line 57 of file base64-decode.cpp.

◆ ~Base64Decode()

ndn::security::transform::Base64Decode::~Base64Decode ( )
finaldefault

Member Function Documentation

◆ appendChain()

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

Connect to the next transformation module.

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

◆ end()

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 46 of file transform-base.cpp.

◆ flushAllOutput()

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 78 of file transform-base.cpp.

◆ flushOutputBuffer()

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 68 of file transform-base.cpp.

◆ getIndex()

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

Get the module index.

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

◆ getNext()

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

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

◆ isEnd()

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

Check if the input interface of a module is closed.

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

◆ isOutputBufferEmpty()

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

Check if output buffer is empty.

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

◆ setIndex()

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

Set the module index.

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

◆ setOutputBuffer()

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

Set output buffer to buffer.

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

◆ write()

size_t ndn::security::transform::Downstream::write ( span< const uint8_t >  buf)
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 have been written into this module.
Exceptions
Errorif this module is closed or transformation error happens.

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

Member Data Documentation

◆ m_next

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

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