#include "config.h"#include "Base64.h"Include dependency graph for Base64.cc:

Go to the source code of this file.
Functions | |
| void | init_base64_table () |
| BroString * | decode_base64 (BroString *s) |
Variables | |
| int | base64_table [256] |
|
|
Definition at line 147 of file Base64.cc. References BroString, BroString::Bytes(), Base64Decoder::Decode(), Base64Decoder::Done(), and BroString::Len().
00148 {
00149 int rlen;
00150 char* rbuf = 0;
00151 int rlen2;
00152 char* rbuf2 = 0;
00153
00154 Base64Decoder dec(0);
00155 if ( dec.Decode(s->Len(), (const char*) s->Bytes(), &rlen, &rbuf) == -1 )
00156 goto err;
00157
00158 if ( dec.Done(&rlen2, &rbuf2) < 0 )
00159 goto err;
00160
00161 rbuf[rlen] = '\0';
00162 return new BroString(1, (u_char*) rbuf, rlen);
00163
00164 err:
00165 delete [] rbuf;
00166 delete [] rbuf2;
00167 return 0;
00168 }
|
|
|
Definition at line 8 of file Base64.cc. References base64_table, and int. Referenced by Base64Decoder::Base64Decoder().
00009 {
00010 static int table_initialized = 0;
00011
00012 if ( ++table_initialized > 1 )
00013 return;
00014
00015 int i;
00016 for ( i = 0; i < 256; ++i )
00017 base64_table[i] = -1;
00018
00019 for ( i = 0; i < 26; ++i )
00020 {
00021 base64_table['A' + i] = i;
00022 base64_table['a' + i] = i + 26;
00023 }
00024
00025 for ( i = 0; i < 10; ++i )
00026 base64_table['0' + i] = i + 52;
00027
00028 // Casts to avoid compiler warnings.
00029 base64_table[int('+')] = 62;
00030 base64_table[int('/')] = 63;
00031 base64_table[int('=')] = 0;
00032 }
|
|
|
Definition at line 6 of file Base64.cc. Referenced by Base64Decoder::Decode(), and init_base64_table(). |
1.3.5