mcs::B64_Codec Class Reference

#include <mcs.hh>

List of all members.


Detailed Description

A Base 64 encoder/decoder.

For an example on how to use this class see the b64codec.cc file.

Definition at line 7997 of file mcs.hh.


Public Member Functions

 B64_Codec ()
 Constructor.
char * buffer ()
unsigned int bufUsed ()
unsigned int decode (char *buf_in, int Length, char *par_buf_out=NULL)
 Decode a block of data.
unsigned int encode (char *buf_in, int Length, char *par_buf_out=NULL, unsigned int linesize=72)
 Encode a block of data.
 ~B64_Codec ()
 Destructor.

Private Member Functions

void decodeblock (unsigned char in[4], unsigned char out[3])
 Decode a block of 4'Base64' bytes into 3 binary bytes.
void encodeblock (unsigned char in[3], unsigned char out[4], int len)
 Encode a block of 3 binary bytes into 4 'Base64' bytes.
bool eob ()
 Tell if we are at the end of input buffer.
void freeBuffer ()
 Free internal buffer.
unsigned char readData ()
 Read one byte from input buffer.
void requireSpace (unsigned int Length)
 Allocate "Length" bytes in internal buffer.
void writeData (unsigned char d)
 Write one byte to output buffer.

Private Attributes

unsigned int blocksout
 Blocks of base64 data already written.
char * buf_out
 Pointer to output buffer.
char * bufAllocated
 Pointer to allocated internal buffer.
unsigned int bufsize
 Size of allocated buffer.
unsigned int bufused
 Size of data in output buffer.
char * EOIB
 Pointer to the end of input buffer.
unsigned int linesize
 Required linesize (when encoding).
char * pin
 Cursor for input buffer.
char * pout
 Cursor for output buffer.
unsigned char precData [4]
int precDataCount

Static Private Attributes

static const char * cb64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
static const char * cd64 = "|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"

Constructor & Destructor Documentation

mcs::B64_Codec::B64_Codec (  ) 

Constructor.

Definition at line 454 of file Utils.cc.

mcs::B64_Codec::~B64_Codec (  ) 

Destructor.

Definition at line 461 of file Utils.cc.


Member Function Documentation

unsigned int mcs::B64_Codec::decode ( char *  buf_in,
int  Length,
char *  par_buf_out = NULL 
)

Decode a block of data.

If par_buf_out is NULL an internal buffer will be automatically allocated for decoded data. This buffer can be reached through the buffer() method.

If buffers pointed by buf_in and par_buf_out overlaps the result are unpredictable.

Definition at line 609 of file Utils.cc.

void mcs::B64_Codec::decodeblock ( unsigned char  in[4],
unsigned char  out[3] 
) [private]

Decode a block of 4'Base64' bytes into 3 binary bytes.

Definition at line 680 of file Utils.cc.

unsigned int mcs::B64_Codec::encode ( char *  buf_in,
int  Length,
char *  par_buf_out = NULL,
unsigned int  linesize = 72 
)

Encode a block of data.

If par_buf_out is NULL an internal buffer will be automatically allocated for encoded data. This buffer can be reached through the buffer() method.

If buffers pointed by buf_in and par_buf_out overlaps the result are unpredictable.

Definition at line 523 of file Utils.cc.

void mcs::B64_Codec::encodeblock ( unsigned char  in[3],
unsigned char  out[4],
int  len 
) [private]

Encode a block of 3 binary bytes into 4 'Base64' bytes.

Definition at line 672 of file Utils.cc.

bool mcs::B64_Codec::eob (  )  [private]

Tell if we are at the end of input buffer.

Definition at line 491 of file Utils.cc.

void mcs::B64_Codec::freeBuffer (  )  [private]

Free internal buffer.

Definition at line 481 of file Utils.cc.

unsigned char mcs::B64_Codec::readData (  )  [private]

Read one byte from input buffer.

Definition at line 499 of file Utils.cc.

void mcs::B64_Codec::requireSpace ( unsigned int  Length  )  [private]

Allocate "Length" bytes in internal buffer.

Definition at line 467 of file Utils.cc.

void mcs::B64_Codec::writeData ( unsigned char  d  )  [private]

Write one byte to output buffer.

Definition at line 513 of file Utils.cc.


Member Data Documentation

unsigned int mcs::B64_Codec::blocksout [private]

Blocks of base64 data already written.

Definition at line 8040 of file mcs.hh.

char* mcs::B64_Codec::buf_out [private]

Pointer to output buffer.

Definition at line 8022 of file mcs.hh.

char* mcs::B64_Codec::bufAllocated [private]

Pointer to allocated internal buffer.

Definition at line 8010 of file mcs.hh.

unsigned int mcs::B64_Codec::bufsize [private]

Size of allocated buffer.

Definition at line 8013 of file mcs.hh.

unsigned int mcs::B64_Codec::bufused [private]

Size of data in output buffer.

Definition at line 8025 of file mcs.hh.

char* mcs::B64_Codec::EOIB [private]

Pointer to the end of input buffer.

Definition at line 8034 of file mcs.hh.

unsigned int mcs::B64_Codec::linesize [private]

Required linesize (when encoding).

Definition at line 8037 of file mcs.hh.

char* mcs::B64_Codec::pin [private]

Cursor for input buffer.

Definition at line 8028 of file mcs.hh.

char* mcs::B64_Codec::pout [private]

Cursor for output buffer.

Definition at line 8031 of file mcs.hh.


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

MCS (My Customizable Server) ver. 0.3.3-alpha3
Documentation generated on Thu Mar 22 13:22:23 UTC 2012