libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
codecs.c File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "low.h"
#include "log.h"
#include "codecs.h"
#include "block.h"
#include "utils.h"

Functions

void printf_bin (const char c, int n)
char * onion_base64_decode (const char *orig, int *length)
 Decodes a base64 into a new char* (must be freed later).At length, if not NULL we set the final length of the decoded base.
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 unquote inplace.It can be inplace as char position is always at least in the same on the destination than in the origin.
char * onion_quote_new (const char *str)
 Performs URL quoting, memory is allocated and has to be freed.As size neccesary is difficult to measure, it first check how many should be encoded, and on a second round it encodes it.
int onion_quote (const char *str, char *res, int maxlength)
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)
void onion_sha1 (const char *data, int length, char *result)
 Calculates the SHA1 checksum of a given data.
char * onion_html_add_enc (char c, char *p)
int onion_html_encoding_size (char c)
char * onion_html_quote (const char *str)
 Calculates the HTML encoding of a given stringIf needs encoding returns a new string that should be deallocated, if not, returns NULL.
const char * onion_html_quote_dup (const char *str)
 Calculates as a freshly allocated string the HTML encoding of a given stringReturns a new string that should be freed, or else NULL when given a null argument.
void onion_json_quote_add (onion_block *block, const char *str)
 Generates JSON string encoding and adds it to an existing blockConverts from "\n" to "\\n".
ssize_t onion_json_unquote_add (onion_block *block, const char *str)
 Adds to the block the quoted string; converts "\\n" to "\n"If the str starts with ", expects a " to finish, else \0.

Function Documentation

void printf_bin ( const char  c,
int  n 
)