libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
codecs.h File Reference
#include <onion/types.h>
#include <stdbool.h>

Functions

char * onion_base64_decode (const char *orig, int *length)
 Decodes a base64 into a new char* (must be freed later).
char * onion_base64_encode (const char *orig, int length)
 Encodes a byte array to a base64 into a new char* (must be freed later).
void onion_unquote_inplace (char *str)
 Performs URL unquoting.
char * onion_quote_new (const char *str)
 Performs URL quoting, memory is allocated and has to be freed.
int onion_quote (const char *str, char *res, int maxlength)
 Performs URL quoting, uses auxiliary res, with maxlength size. If more, do up to where I can, and cut it with \0.
char * onion_c_quote_new (const char *str)
 Performs C quotation: changes " for \". Usefull when sending data to be interpreted as JSON.
char * onion_c_quote (const char *str, char *ret, int l)
 Performs the C quotation on the ret str. Max length is l.
void onion_sha1 (const char *data, int length, char *result)
 Calculates the sha1 checksum.
char * onion_html_quote (const char *str)
 Calculates the HTML encoding of a string. Returned value must be freed. If no encoding needed, returns NULL.
const char * onion_html_quote_dup (const char *str)
 Always return a freshly allocated string, to be later freed.
void onion_json_quote_add (onion_block *block, const char *str)
 Generates JSON string encoding and adds it to an existing block.
ssize_t onion_json_unquote_add (onion_block *block, const char *str)
 Adds to the block the quoted string; converts "\\n" to "\n".