Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Static Public Member Functions
Arc::Base64 Class Reference

#include <Base64.h>

List of all members.

Public Member Functions

 Base64 ()
 ~Base64 ()

Static Public Member Functions

static int encode_len (int len)
static int encode (char *encoded, const char *string, int len)
static int decode_len (const char *bufcoded)
static int decode (char *bufplain, const char *bufcoded)

Detailed Description

Definition at line 29 of file Base64.h.


Constructor & Destructor Documentation


Member Function Documentation

int Arc::Base64::decode ( char *  bufplain,
const char *  bufcoded 
) [static]

Definition at line 192 of file Base64.cpp.

                                                         {
    int len;
    len = base64_decode_binary((unsigned char*)bufplain, bufcoded);
    bufplain[len] = '\0';
    return len;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int Arc::Base64::decode_len ( const char *  bufcoded) [static]

Definition at line 178 of file Base64.cpp.

                                             {
    int nbytesdecoded;
    register const unsigned char *bufin;
    register int nprbytes;

    bufin = (const unsigned char*)bufcoded;
    while (pr2six[*(bufin++)] <= 63) {}

    nprbytes = (bufin - (const unsigned char*)bufcoded) - 1;
    nbytesdecoded = ((nprbytes + 3) / 4) * 3;

    return nbytesdecoded + 1;
  }
int Arc::Base64::encode ( char *  encoded,
const char *  string,
int  len 
) [static]

Definition at line 203 of file Base64.cpp.

                                                               {
  #ifndef CHARSET_EBCDIC
    return base64_encode_binary(encoded, (const unsigned char*)string, len);
  #else /* CHARSET_EBCDIC */
    int i;
    char *p;

    p = encoded;
    for (i = 0; i < len - 2; i += 3) {
      *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
      *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
                      ((int)(os_toascii[string[i + 1]] & 0xF0) >> 4)];
      *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
                      ((int)(os_toascii[string[i + 2]] & 0xC0) >> 6)];
      *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
    }
    if (i < len) {
      *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
      if (i == (len - 1)) {
        *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
        *p++ = '=';
      }
      else {
        *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
                        ((int)(os_toascii[string[i + 1]] & 0xF0) >> 4)];
        *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
      }
      *p++ = '=';
    }

    *p++ = '\0';
    return p - encoded;
  #endif                /* CHARSET_EBCDIC */
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int Arc::Base64::encode_len ( int  len) [static]

Definition at line 199 of file Base64.cpp.

                                {
    return ((len + 2) / 3 * 4) + 1;
  }

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