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 2
00060 # define B64_VER_B64_H_B64_EDIT 26
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
00096 # define B64_VER B64_VER_1_3_2
00097 #else
00098 # define B64_VER 0x010302ff
00099 #endif
00100
00101 #define B64_VER_MAJOR 1
00102 #define B64_VER_MINOR 3
00103 #define B64_VER_REVISION 2
00104
00105
00106
00107
00108
00109 #include <stddef.h>
00110
00111
00112
00113
00114
00115 #if !defined(B64_NO_NAMESPACE) && \
00116 !defined(__cplusplus)
00117 # define B64_NO_NAMESPACE
00118 #endif
00119
00120 #ifdef B64_NAMESPACE
00121 # undef B64_NAMESPACE
00122 #endif
00123
00124 #ifdef B64_NAMESPACE_QUALIFIER
00125 # undef B64_NAMESPACE_QUALIFIER
00126 #endif
00127
00128
00129 #ifndef B64_NO_NAMESPACE
00130
00131 # ifdef B64_CUSTOM_NAMESPACE
00132 # define B64_NAMESPACE B64_CUSTOM_NAMESPACE
00133 # else
00134 # define B64_NAMESPACE b64
00135 # endif
00136
00137 # if defined(B64_CUSTOM_NAMESPACE) && \
00138 defined(B64_CUSTOM_NAMESPACE_QUALIFIER)
00139 # define B64_NAMESPACE_QUALIFIER B64_CUSTOM_NAMESPACE_QUALIFIER
00140 # else
00141 # define B64_NAMESPACE_QUALIFIER ::B64_NAMESPACE
00142 # endif
00143
00144
00153 namespace B64_NAMESPACE
00154 {
00155 #endif
00156
00157
00158
00159
00160
00163 enum B64_RC
00164 {
00165 B64_RC_OK = 0
00166 , B64_RC_INSUFFICIENT_BUFFER = 1
00167 , B64_RC_TRUNCATED_INPUT = 2
00168 , B64_RC_DATA_ERROR = 3
00169 #ifndef B64_DOCUMENTATION_SKIP_SECTION
00170 , B64_max_RC_value
00171 #endif
00172 };
00173
00174 #ifndef __cplusplus
00175 typedef enum B64_RC B64_RC;
00176 #endif
00177
00180 enum B64_FLAGS
00181 {
00182 B64_F_LINE_LEN_USE_PARAM = 0x0000
00183 , B64_F_LINE_LEN_INFINITE = 0x0001
00184 , B64_F_LINE_LEN_64 = 0x0002
00185 , B64_F_LINE_LEN_76 = 0x0003
00186 , B64_F_LINE_LEN_MASK = 0x000f
00187 , B64_F_STOP_ON_NOTHING = 0x0000
00188 , B64_F_STOP_ON_UNKNOWN_CHAR = 0x0100
00189 , B64_F_STOP_ON_UNEXPECTED_WS = 0x0200
00190 , B64_F_STOP_ON_BAD_CHAR = 0x0300
00191 };
00192
00193 #ifndef __cplusplus
00194 typedef enum B64_FLAGS B64_FLAGS;
00195 #endif
00196
00197
00198
00199
00200
00201 #ifdef __cplusplus
00202 extern "C" {
00203 #endif
00204
00228 size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen);
00229
00258 size_t b64_encode2( void const *src
00259 , size_t srcSize
00260 , char *dest
00261 , size_t destLen
00262 , unsigned flags
00263 , int lineLen
00264 , B64_RC *rc );
00265
00299 size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize);
00300
00341 size_t b64_decode2( char const *src
00342 , size_t srcLen
00343 , void *dest
00344 , size_t destSize
00345 , unsigned flags
00346 , char const **badChar
00347 , B64_RC *rc );
00348
00349
00354 char const *b64_getErrorString(B64_RC code);
00355
00362 size_t b64_getErrorStringLength(B64_RC code);
00363
00364
00365 #ifdef __cplusplus
00366 }
00367 #endif
00368
00369
00370
00371
00372
00373 #ifndef B64_NO_NAMESPACE
00374 }
00375
00376 # ifndef B64_DOCUMENTATION_SKIP_SECTION
00377
00378 namespace stlsoft
00379 {
00380
00381 inline char const *c_str_data_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
00382 {
00383 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00384 }
00385 inline char const *c_str_data( B64_NAMESPACE_QUALIFIER::B64_RC code)
00386 {
00387 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00388 }
00389
00390 inline size_t c_str_len_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
00391 {
00392 return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);
00393 }
00394 inline size_t c_str_len( B64_NAMESPACE_QUALIFIER::B64_RC code)
00395 {
00396 return B64_NAMESPACE_QUALIFIER::b64_getErrorStringLength(code);
00397 }
00398
00399 inline char const *c_str_ptr_a( B64_NAMESPACE_QUALIFIER::B64_RC code)
00400 {
00401 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00402 }
00403 inline char const *c_str_ptr( B64_NAMESPACE_QUALIFIER::B64_RC code)
00404 {
00405 return B64_NAMESPACE_QUALIFIER::b64_getErrorString(code);
00406 }
00407
00408 }
00409
00410 # endif
00411
00412 #endif
00413
00414
00415
00416 #endif
00417
00418