EVE 1.0
base64 encoder/decoder
Collaboration diagram for base64 encoder/decoder:

Data Structures

struct  base64_dec_state_t
 
struct  base64_enc_state_t
 

Macros

#define BASE64_DEC_INIT   {.step = 0,}
 
#define BASE64_ENC_INIT   {.step = 0,}
 

Enumerations

Functions

void base64_dec_init (struct base64_dec_state_t *s)
 
enum base64_rc_t base64_dec (struct base64_dec_state_t *s, uint8_t ch)
 
void base64_enc_init (struct base64_enc_state_t *s)
 
enum base64_rc_t base64_enc (struct base64_enc_state_t *s, uint8_t ch)
 
enum base64_rc_t base64_enc_eof (struct base64_enc_state_t *s)
 

Detailed Description

Macro Definition Documentation

#define BASE64_DEC_INIT   {.step = 0,}

Static initializer of the base64 decoder structure

Definition at line 49 of file base64.h.

#define BASE64_ENC_INIT   {.step = 0,}

Static initializer of the base64 encoder structure

Definition at line 53 of file base64.h.

Enumeration Type Documentation

base64 encoder/decoder return codes

Enumerator
BASE64_STATE_IDLE 

No output was produced

BASE64_STATE_RDY 

A one byte output was produced, available as encoded[0] or decoded

BASE64_STATE_ERROR 

An error occured

BASE64_STATE_RDY2 

Two bytes output was produced, available as encoded[1], encoded[0]

Definition at line 57 of file base64.h.

Function Documentation

void base64_dec_init ( struct base64_dec_state_t s)

Initializes the base64 decoder structure.

Parameters
spointer to the base64 decoder structure
enum base64_rc_t base64_dec ( struct base64_dec_state_t s,
uint8_t  ch 
)

Feeds the decoder with a single character.

Parameters
spointer to the base64 decoder structure
chthe character to be fed to the decoder
Returns
BASE64_STATE_IDLE when the character was accepted, but no output was produced
BASE64_STATE_ERROR when the character was not accepted
BASE64_STATE_RDY whan the character was accepted and one byte of decoded data was produced
void base64_enc_init ( struct base64_enc_state_t s)

Initializes the base64 encoder structure.

Parameters
spointer to the base64 encoder structure
enum base64_rc_t base64_enc ( struct base64_enc_state_t s,
uint8_t  ch 
)

Feeds the encoder with a single character.

Parameters
spointer to the base64 encoder structure
chthe character to be fed to the encoder
Returns
BASE64_STATE_ERROR when the character was not accepted
BASE64_STATE_RDY whan the character was accepted and one byte of encoded data was set in encoded[0]
BASE64_STATE_RDY2 whan the character was accepted and two bytes of encoded data were set in encoded[1], encoded[0]
enum base64_rc_t base64_enc_eof ( struct base64_enc_state_t s)

Tells the encoder about end of input data.

Parameters
spointer to the base64 encoder structure
Returns
BASE64_STATE_IDLE when no additional data bytes were produced
BASE64_STATE_RDY whan one byte of encoded data was set in encoded[0]
BASE64_STATE_RDY2 whan two bytes of encoded data were set in encoded[1], encoded[0]