Loading...
Searching...
No Matches
orcania.h
Go to the documentation of this file.
#ifndef __ORCANIA_H__
#define __ORCANIA_H__
#ifdef __cplusplus
extern "C"
{
#endif
#include "orcania-cfg.h"
#include <stdio.h>
#include <stdlib.h>
struct _o_datum {
size_t size;
unsigned char * data;
};
char * str_replace(const char * source, const char * str_old, const char * str_new);
char * o_strdup(const char * source);
char * o_strndup(const char * source, size_t len);
int o_strcmp(const char * p1, const char * p2);
int o_strncmp(const char * p1, const char * p2, size_t n);
char * o_strcpy(char * p1, const char * p2);
char * o_strncpy(char * p1, const char * p2, size_t n);
int o_strcasecmp(const char * p1, const char * p2);
int o_strncasecmp(const char * p1, const char * p2, size_t n);
char * o_strstr(const char * haystack, const char * needle);
char * o_strnstr(const char * haystack, const char * needle, size_t len);
char * o_strcasestr(const char * haystack, const char * needle);
char * o_strchr(const char * haystack, int c);
const char * o_strnchr(const char * haystack, size_t len, char c);
char * o_strrchr(const char * haystack, int c);
const char * o_strrnchr(const char * haystack, size_t len, char c);
int o_strnullempty(const char * s);
size_t o_strlen(const char * s);
const char * trimwhitespace(char * str);
char * trimcharacter(char * str, char to_remove);
char * msprintf(const char * message, ...);
char * mstrcatf(char * source, const char * message, ...);
size_t split_string(const char * string, const char * separator, char *** return_array);
void free_string_array(char ** array);
size_t string_array_size(char ** array);
int string_array_has_value(const char ** array, const char * needle);
int string_array_has_value_case(const char ** array, const char * needle);
int string_array_has_value_n(const char ** array, const char * needle, size_t len);
int string_array_has_value_ncase(const char ** array, const char * needle, size_t len);
int string_array_has_trimmed_value(const char ** array, const char * needle);
char * string_array_join(const char ** array, const char * separator);
struct _pointer_list {
size_t size; /* size of the list */
void ** list; /* list of pointers */
};
void pointer_list_init(struct _pointer_list * pointer_list);
void pointer_list_clean(struct _pointer_list * pointer_list);
void pointer_list_clean_free(struct _pointer_list * pointer_list, void (* free_function)(void * elt));
size_t pointer_list_size(struct _pointer_list * pointer_list);
int pointer_list_append(struct _pointer_list * pointer_list, void * element);
void * pointer_list_get_at(struct _pointer_list * pointer_list, size_t index);
int pointer_list_remove_at(struct _pointer_list * pointer_list, size_t index);
int pointer_list_remove_at_free(struct _pointer_list * pointer_list, size_t index, void (* free_function)(void * elt));
int pointer_list_insert_at(struct _pointer_list * pointer_list, void * element, size_t index);
int pointer_list_remove_pointer(struct _pointer_list * pointer_list, void * element);
int pointer_list_remove_pointer_free(struct _pointer_list * pointer_list, void * element, void (* free_function)(void * elt));
/* C89 allows these to be macros */
#undef malloc
#undef realloc
#undef free
typedef void *(*o_malloc_t)(size_t);
typedef void *(*o_realloc_t)(void *, size_t);
typedef void (*o_free_t)(void *);
void * o_malloc(size_t size);
void * o_realloc(void * ptr, size_t size);
void o_free(void * ptr);
void o_set_alloc_funcs(o_malloc_t malloc_fn, o_realloc_t realloc_fn, o_free_t free_fn);
void o_get_alloc_funcs(o_malloc_t * malloc_fn, o_realloc_t * realloc_fn, o_free_t * free_fn);
int o_base64_encode(const unsigned char * src, size_t len, unsigned char * out, size_t * out_len);
int o_base64_decode(const unsigned char *src, size_t len, unsigned char * out, size_t * out_len);
int o_base64url_encode(const unsigned char * src, size_t len, unsigned char * out, size_t * out_len);
int o_base64url_decode(const unsigned char *src, size_t len, unsigned char * out, size_t * out_len);
int o_base64url_2_base64(const unsigned char *src, size_t len, unsigned char * out, size_t * out_len);
int o_base64_2_base64url(const unsigned char *src, size_t len, unsigned char * out, size_t * out_len);
int o_base64_encode_alloc(const unsigned char * src, size_t len, struct _o_datum * dat);
int o_base64_decode_alloc(const unsigned char * src, size_t len, struct _o_datum * dat);
int o_base64url_encode_alloc(const unsigned char * src, size_t len, struct _o_datum * dat);
int o_base64url_decode_alloc(const unsigned char * src, size_t len, struct _o_datum * dat);
int o_base64url_2_base64_alloc(const unsigned char * src, size_t len, struct _o_datum * dat);
int o_base64_2_base64url_alloc(const unsigned char * src, size_t len, struct _o_datum * dat);
#ifdef __cplusplus
}
#endif
#endif // __ORCANIA_H__
o_base64url_encode
int o_base64url_encode(const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
Definition base64.c:181
o_base64url_decode
int o_base64url_decode(const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
Definition base64.c:185
o_base64_encode
int o_base64_encode(const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
Definition base64.c:173
o_base64_encode_alloc
int o_base64_encode_alloc(const unsigned char *src, size_t len, struct _o_datum *dat)
Definition base64.c:239
o_base64url_2_base64_alloc
int o_base64url_2_base64_alloc(const unsigned char *src, size_t len, struct _o_datum *dat)
Definition base64.c:307
o_base64_decode
int o_base64_decode(const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
Definition base64.c:177
o_base64url_2_base64
int o_base64url_2_base64(const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
Definition base64.c:189
o_base64url_encode_alloc
int o_base64url_encode_alloc(const unsigned char *src, size_t len, struct _o_datum *dat)
Definition base64.c:273
o_base64_2_base64url
int o_base64_2_base64url(const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
Definition base64.c:216
o_base64_2_base64url_alloc
int o_base64_2_base64url_alloc(const unsigned char *src, size_t len, struct _o_datum *dat)
Definition base64.c:325
o_base64url_decode_alloc
int o_base64url_decode_alloc(const unsigned char *src, size_t len, struct _o_datum *dat)
Definition base64.c:290
o_base64_decode_alloc
int o_base64_decode_alloc(const unsigned char *src, size_t len, struct _o_datum *dat)
Definition base64.c:256
o_malloc_t
void *(* o_malloc_t)(size_t)
Definition orcania.h:482
o_set_alloc_funcs
void o_set_alloc_funcs(o_malloc_t malloc_fn, o_realloc_t realloc_fn, o_free_t free_fn)
Definition memory.c:43
o_realloc
void * o_realloc(void *ptr, size_t size)
Definition memory.c:27
o_malloc
void * o_malloc(size_t size)
Definition memory.c:19
o_free
void o_free(void *ptr)
Definition memory.c:35
o_realloc_t
void *(* o_realloc_t)(void *, size_t)
Definition orcania.h:483
o_free_t
void(* o_free_t)(void *)
Definition orcania.h:484
o_get_alloc_funcs
void o_get_alloc_funcs(o_malloc_t *malloc_fn, o_realloc_t *realloc_fn, o_free_t *free_fn)
Definition memory.c:49
pointer_list_remove_at
int pointer_list_remove_at(struct _pointer_list *pointer_list, size_t index)
Definition orcania.c:605
pointer_list_remove_pointer
int pointer_list_remove_pointer(struct _pointer_list *pointer_list, void *element)
Definition orcania.c:652
pointer_list_get_at
void * pointer_list_get_at(struct _pointer_list *pointer_list, size_t index)
Definition orcania.c:597
pointer_list_append
int pointer_list_append(struct _pointer_list *pointer_list, void *element)
Definition orcania.c:580
pointer_list_clean_free
void pointer_list_clean_free(struct _pointer_list *pointer_list, void(*free_function)(void *elt))
Definition orcania.c:562
pointer_list_size
size_t pointer_list_size(struct _pointer_list *pointer_list)
Definition orcania.c:572
pointer_list_remove_at_free
int pointer_list_remove_at_free(struct _pointer_list *pointer_list, size_t index, void(*free_function)(void *elt))
Definition orcania.c:624
pointer_list_remove_pointer_free
int pointer_list_remove_pointer_free(struct _pointer_list *pointer_list, void *element, void(*free_function)(void *elt))
Definition orcania.c:666
pointer_list_insert_at
int pointer_list_insert_at(struct _pointer_list *pointer_list, void *element, size_t index)
Definition orcania.c:633
pointer_list_init
void pointer_list_init(struct _pointer_list *pointer_list)
Definition orcania.c:546
pointer_list_clean
void pointer_list_clean(struct _pointer_list *pointer_list)
Definition orcania.c:553
string_array_has_value
int string_array_has_value(const char **array, const char *needle)
Definition orcania.c:464
string_array_has_value_case
int string_array_has_value_case(const char **array, const char *needle)
Definition orcania.c:478
string_array_size
size_t string_array_size(char **array)
Definition orcania.c:396
string_array_join
char * string_array_join(const char **array, const char *separator)
Definition orcania.c:404
split_string
size_t split_string(const char *string, const char *separator, char ***return_array)
Definition orcania.c:351
free_string_array
void free_string_array(char **array)
Definition orcania.c:385
string_array_has_value_n
int string_array_has_value_n(const char **array, const char *needle, size_t len)
Definition orcania.c:492
string_array_has_value_ncase
int string_array_has_value_ncase(const char **array, const char *needle, size_t len)
Definition orcania.c:506
string_array_has_trimmed_value
int string_array_has_trimmed_value(const char **array, const char *needle)
Definition orcania.c:520
o_strncpy
char * o_strncpy(char *p1, const char *p2, size_t n)
Definition orcania.c:204
o_strrchr
char * o_strrchr(const char *haystack, int c)
Definition orcania.c:268
o_strndup
char * o_strndup(const char *source, size_t len)
Definition orcania.c:155
o_strcmp
int o_strcmp(const char *p1, const char *p2)
Definition orcania.c:172
o_strcasestr
char * o_strcasestr(const char *haystack, const char *needle)
Definition orcania.c:331
msprintf
char * msprintf(const char *message,...)
Definition orcania.c:99
o_strcpy
char * o_strcpy(char *p1, const char *p2)
Definition orcania.c:196
o_strstr
char * o_strstr(const char *haystack, const char *needle)
Definition orcania.c:236
o_strlen
size_t o_strlen(const char *s)
Definition orcania.c:339
o_strrnchr
const char * o_strrnchr(const char *haystack, size_t len, char c)
Definition orcania.c:276
mstrcatf
char * mstrcatf(char *source, const char *message,...)
Definition orcania.c:120
trimcharacter
char * trimcharacter(char *str, char to_remove)
Definition orcania.c:443
o_strcasecmp
int o_strcasecmp(const char *p1, const char *p2)
Definition orcania.c:212
trimwhitespace
const char * trimwhitespace(char *str)
Definition orcania.c:422
o_strdup
char * o_strdup(const char *source)
Definition orcania.c:151
o_strchr
char * o_strchr(const char *haystack, int c)
Definition orcania.c:244
o_strnullempty
int o_strnullempty(const char *s)
Definition orcania.c:347
o_strncasecmp
int o_strncasecmp(const char *p1, const char *p2, size_t n)
Definition orcania.c:224
str_replace
char * str_replace(const char *source, const char *str_old, const char *str_new)
Definition orcania.c:55
o_strnchr
const char * o_strnchr(const char *haystack, size_t len, char c)
Definition orcania.c:252
o_strncmp
int o_strncmp(const char *p1, const char *p2, size_t n)
Definition orcania.c:184
o_strnstr
char * o_strnstr(const char *haystack, const char *needle, size_t len)
Definition orcania.c:323
_o_datum
Definition orcania.h:41
_o_datum::data
unsigned char * data
Definition orcania.h:43
_o_datum::size
size_t size
Definition orcania.h:42
_pointer_list
Definition orcania.h:363
_pointer_list::size
size_t size
Definition orcania.h:364
_pointer_list::list
void ** list
Definition orcania.h:365