00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00049 #ifndef B64_INCL_B64_H_B64
00050 #define B64_INCL_B64_H_B64
00051
00052
00053
00054
00055
00056 #ifndef B64_DOCUMENTATION_SKIP_SECTION
00057 # define B64_VER_B64_H_B64_MAJOR 1
00058 # define B64_VER_B64_H_B64_MINOR 5
00059 # define B64_VER_B64_H_B64_REVISION 3
00060 # define B64_VER_B64_H_B64_EDIT 27
00061 #endif
00062
00079 #ifndef B64_DOCUMENTATION_SKIP_SECTION
00080 # define B64_VER_1_0_1 0x01000100
00081 # define B64_VER_1_0_2 0x01000200
00082 # define B64_VER_1_0_3 0x01000300
00083 # define B64_VER_1_1_1 0x01010100
00084 # define B64_VER_1_1_2 0x01010200
00085 # define B64_VER_1_1_3 0x01010300
00086 # define B64_VER_1_2_1 0x01020100
00087 # define B64_VER_1_2_2 0x01020200
00088 # define B64_VER_1_2_3 0x01020300
00089 # define B64_VER_1_2_4 0x01020400
00090 # define B64_VER_1_2_5 0x01020500
00091 # define B64_VER_1_2_6 0x01020600
00092 # define B64_VER_1_2_7 0x01020700
00093 # define B64_VER_1_3_1 0x010301ff
00094 # define B64_VER_1_3_2 0x010302ff
00095 # define B64_VER_1_3_3 0x010303ff
00096
00097 # define B64_VER B64_VER_1_3_3
00098 #else
00099 # define B64_VER 0x010303ff
00100 #endif
00101
00102 #define B64_VER_MAJOR 1
00103 #define B64_VER_MINOR 3
00104 #define B64_VER_REVISION 3
00105
00106
00107
00108
00109
00110 #include <stddef.h>
00111
00112
00113
00114
00115
00116 #if !defined(B64_NO_NAMESPACE) && \
00117 !defined(__cplusplus)
00118 # define B64_NO_NAMESPACE
00119 #endif
00120
00121 #ifdef B64_NAMESPACE
00122 # undef B64_NAMESPACE
00123 #endif
00124
00125 #ifdef B64_NAMESPACE_QUALIFIER
00126 # undef B64_NAMESPACE_QUALIFIER
00127 #endif
00128
00129
00130 #ifndef B64_NO_NAMESPACE
00131
00132 # ifdef B64_CUSTOM_NAMESPACE
00133 # define B64_NAMESPACE B64_CUSTOM_NAMESPACE
00134 # else
00135 # define B64_NAMESPACE b64
00136 # endif
00137
00138 # if defined(B64_CUSTOM_NAMESPACE) && \
00139 defined(B64_CUSTOM_NAMESPACE_QUALIFIER)
00140 # define B64_NAMESPACE_QUALIFIER B64_CUSTOM_NAMESPACE_QUALIFIER
00141 # else
00142 # define B64_NAMESPACE_QUALIFIER ::B64_NAMESPACE
00143 # endif
00144
00145
00154 namespace B64_NAMESPACE
00155 {
00156 #endif
00157
00158
00159
00160
00161
00164 enum B64_RC
00165 {
00166 B64_RC_OK = 0
00167 , B64_RC_INSUFFICIENT_BUFFER = 1
00168 , B64_RC_TRUNCATED_INPUT = 2
00169 , B64_RC_DATA_ERROR = 3
00170 #ifndef B64_DOCUMENTATION_SKIP_SECTION
00171 , B64_max_RC_value
00172 #endif
00173 };
00174
00175 #ifndef __cplusplus
00176 typedef enum B64_RC B64_RC;
00177 #endif
00178
00181 enum B64_FLAGS
00182 {
00183 B64_F_LINE_LEN_USE_PARAM = 0x0000
00184 , B64_F_LINE_LEN_INFINITE = 0x0001
00185 , B64_F_LINE_LEN_64 = 0x0002
00186 , B64_F_LINE_LEN_76 = 0x0003
00187 , B64_F_LINE_LEN_MASK = 0x000f
00188 , B64_F_STOP_ON_NOTHING = 0x0000
00189 , B64_F_STOP_ON_UNKNOWN_CHAR = 0x0100
00190 , B64_F_STOP_ON_UNEXPECTED_WS = 0x0200
00191 , B64_F_STOP_ON_BAD_CHAR = 0x0300
00192 };
00193
00194 #ifndef __cplusplus
00195 typedef enum B64_FLAGS B64_FLAGS;
00196 #endif
00197
00198
00199
00200
00201
00202 #ifdef __cplusplus
00203 extern "C" {
00204 #endif
00205
00229 size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen);
00230
00259 size_t b64_encode2( void const *src
00260 , size_t srcSize
00261 , char *dest
00262 , size_t destLen
00263 , unsigned flags
00264 , int lineLen
00265 , B64_RC *rc );
00266
00300 size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize);
00301
00342 size_t b64_decode2( char const *src
00343 , size_t srcLen
00344 , void *dest
00345 , size_t destSize
00346 , unsigned flags
00347 , char const **badChar
00348 , B64_RC *rc );
00349
00350
00355 char const *b64_getErrorString(B64_RC code);
00356
00363 size_t b64_getErrorStringLength(B64_RC code);
00364
00365
00366 #ifdef __cplusplus
00367 }
00368 #endif
00369
00370
00371
00372
00373
00374 #ifndef B64_NO_NAMESPACE
00375 }
00376
00377 # ifndef B64_DOCUMENTATION_SKIP_SECTION
00378
00379 namespace stlsoft
00380 {
00381
00382 inline char const *c_str_data_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
00383 {
00384 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00385 }
00386 inline char const *c_str_data( B64_NAMESPACE_QUALIFIER::B64_RC code)
00387 {
00388 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00389 }
00390
00391 inline size_t c_str_len_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
00392 {
00393 return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);
00394 }
00395 inline size_t c_str_len( B64_NAMESPACE_QUALIFIER::B64_RC code)
00396 {
00397 return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);
00398 }
00399
00400 inline char const *c_str_ptr_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
00401 {
00402 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00403 }
00404 inline char const *c_str_ptr( B64_NAMESPACE_QUALIFIER::B64_RC code)
00405 {
00406 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00407 }
00408
00409 }
00410
00411 # endif
00412
00413 #endif
00414
00415
00416
00417 #endif
00418
00419