base64 encoder decoder¶
base64 encoder and decoder
encoding and decoding functions for base64
-
int
base64_encode
(const void * data_in,msp430_types.h::size_t
data_in_size, unsigned char * base64_out,msp430_types.h::size_t
* base64_out_size)¶ Encodes a given datum to base64 and save the result to the given destination.
Parameters
data_in: pointer to the datum to encode data_in_size: the size of data_in
base64_out: pointer to store the encoded base64 string base64_out_size: pointer to the variable containing the size of base64_out.
This value is overwritten with the estimated size used for the encoded base64 string on BASE64_ERROR_BUFFER_OUT_SIZE. This value is overwritten with the actual used size for the encoded base64 string on BASE64_SUCCESS.Return values
- BASE64_SUCCESS on success, BASE64_ERROR_BUFFER_OUT_SIZE on insufficient size for encoding to
base64_out
, BASE64_ERROR_BUFFER_OUT ifbase64_out
equals NULL but thebase64_out_size
is sufficient, BASE64_ERROR_DATA_IN ifdata_in
equals NULL, BASE64_ERROR_DATA_IN_SIZE ifdata_in_size
is less then 1.
- BASE64_SUCCESS on success, BASE64_ERROR_BUFFER_OUT_SIZE on insufficient size for encoding to
-
int
base64_decode
(const unsigned char * base64_in,msp430_types.h::size_t
base64_in_size, void * data_out,msp430_types.h::size_t
* data_out_size)¶ Decodes a given base64 string and save the result to the given destination.
Parameters
base64_in: pointer to store the encoded base64 string base64_in_size: pointer to the variable containing the size of base64_out.
data_out: pointer to the datum to encode data_out_size: the size of data_out
. This value is overwritten with the estimated size used for the decoded string on BASE64_ERROR_BUFFER_OUT_SIZE. This value is overwritten with the actual used size for the decoded string on BASE64_SUCCESS.Return values
- BASE64_SUCCESS on success, BASE64_ERROR_BUFFER_OUT_SIZE on insufficient size for decoding to
data_out
, BASE64_ERROR_BUFFER_OUT ifdata_out
equals NULL but the size fordata_out_size
is sufficient, BASE64_ERROR_DATA_IN ifbase64_in
equals NULL, BASE64_ERROR_DATA_IN_SIZE ifbase64_in_size
is less then 4.
- BASE64_SUCCESS on success, BASE64_ERROR_BUFFER_OUT_SIZE on insufficient size for decoding to
-
BASE64_SUCCESS
¶ return value for success
1
(0)
-
BASE64_ERROR_BUFFER_OUT
¶ error value for invalid output buffer pointer
1
(-1)
-
BASE64_ERROR_BUFFER_OUT_SIZE
¶ error value for invalid output buffer size
1
(-2)
-
BASE64_ERROR_DATA_IN
¶ error value for invalid input buffer
1
(-3)
-
BASE64_ERROR_DATA_IN_SIZE
¶ error value for invalid input buffer size
1
(-4)