#include <stdio.h>
#include <string.h>
#include "sofia-sip/base64.h"
Include dependency graph for base64.c:
Functions | |
int | base64_d (char buf[], int bsiz, char const *b64s) |
Decode a BASE64-encoded string. | |
int | base64_e (char buf[], int bsiz, void *data, int dsiz) |
Encode data with BASE64. |
int base64_d | ( | char | buf[], | |
int | bsiz, | |||
char const * | b64s | |||
) |
Decode a BASE64-encoded string.
The function base64_d() decodes a string b64s encoded with BASE64. It stores the result in the buffer buf of bsiz bytes.
If the buf is NULL, the function just returns the length of decoded data. In any case, no decoded data is stored in buf beyond bsiz. The function always returns the full length of decodable data.
buf | Buffer to store decoded data | |
bsiz | Size of buf | |
b64s | Base64-encoded string. |
int base64_e | ( | char | buf[], | |
int | bsiz, | |||
void * | data, | |||
int | dsiz | |||
) |
Encode data with BASE64.
The function base64_e() encodes dsiz bytes of data into buf.
NUL
.
If encoded string is longer than that bsiz, the function terminates string with NUL
at buf[bsiz-1], but returns the length of encoding as usual.
buf | buffer for encoded data | |
bsiz | size of buffer | |
data | data to be encoded | |
dsiz | size of data |