src/b64.c File Reference

Data Structures

struct  endif

Functions

size_t b64_encode (void const *src, size_t srcSize, char *dest, size_t destLen)
 Encodes a block of binary data into Base-64.
size_t b64_encode2 (void const *src, size_t srcSize, char *dest, size_t destLen, unsigned flags, int lineLen, B64_RC *rc)
size_t b64_decode (char const *src, size_t srcLen, void *dest, size_t destSize)
 Decodes a sequence of Base-64 into a block of binary data.
size_t b64_decode2 (char const *src, size_t srcLen, void *dest, size_t destSize, unsigned flags, char const **badChar, B64_RC *rc)
char const * b64_getErrorString (B64_RC code)
size_t b64_getErrorStringLength (B64_RC code)

Variables

struct b64ErrorString_t_ else
typedef struct
b64ErrorString_t_ 
b64ErrorString_t_

Detailed Description

Implementation file for the b64 library


Function Documentation

size_t b64_decode ( char const *  src,
size_t  srcLen,
void *  dest,
size_t  destSize 
)

Decodes a sequence of Base-64 into a block of binary data.

Parameters:
src Pointer to the Base-64 block to be decoded. May not be NULL, except when dest is NULL, in which case it is ignored. If dest is NULL, and src is not NULL, then the returned value is calculated exactly, otherwise a value is returned that is guaranteed to be large enough to hold the decoded block.
srcLen Length of block to be encoded. Must be an integral of 4, the Base-64 encoding quantum, otherwise the Base-64 block is assumed to be invalid
dest Pointer to the buffer into which the result is to be written. May be NULL, in which case the function returns the required length
destSize Length of the buffer into which the result is to be written. Must be at least as large as that indicated by the return value from b64_decode(src, srcSize, NULL, 0), even in the case where the encoded form contains a number of characters that will be ignored, resulting in a lower total length of converted form.
Returns:
0 if the size of the buffer was insufficient, or the length of the converted buffer was longer than destSize
Note:
The function returns the required length if dest is NULL. The returned size might be larger than the actual required size, but will never be smaller.
The behaviour of both b64_encode2() and b64_decode2() are undefined if the line length is not a multiple of 4.
Threading: The function is fully re-entrant.
See also:
b64::decode()

References B64_NAMESPACE::B64_F_STOP_ON_NOTHING.

size_t b64_encode ( void const *  src,
size_t  srcSize,
char *  dest,
size_t  destLen 
)

Encodes a block of binary data into Base-64.

Parameters:
src Pointer to the block to be encoded. May not be NULL, except when dest is NULL, in which case it is ignored.
srcSize Length of block to be encoded
dest Pointer to the buffer into which the result is to be written. May be NULL, in which case the function returns the required length
destLen Length of the buffer into which the result is to be written. Must be at least as large as that indicated by the return value from b64_encode(NULL, srcSize, NULL, 0).
Returns:
0 if the size of the buffer was insufficient, or the length of the converted buffer was longer than destLen
Note:
The function returns the required length if dest is NULL
The function returns the required length if dest is NULL. The returned size might be larger than the actual required size, but will never be smaller.
Threading: The function is fully re-entrant.
See also:
b64::encode()

Generated on Sun Aug 30 13:05:38 2009 for oRTP by  doxygen 1.6.1