Droplet
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
utils.c File Reference

Functions

char * dpl_strrstr (const char *haystack, const char *needle)
 find the last occurence of needle in haystack More...
 
unsigned int dpl_hmac_sha1 (const char *key_buf, unsigned int key_len, const char *data_buf, unsigned int data_len, char *digest_buf)
 compute HMAC-SHA1 More...
 
u_int dpl_base64_encode (const u_char *in_buf, u_int in_len, u_char *out_buf)
 base64 encode More...
 
u_int dpl_base64_decode (const u_char *in_buf, u_int in_len, u_char *out_buf)
 base64 decode More...
 
void dpl_url_encode (const char *str, char *str_ue)
 encode str into URL form. More...
 
void dpl_url_decode (char *str)
 decode an URL More...
 
void dpl_set_log_func (dpl_log_func_t logfunc)
 Set logging callback function. More...
 

Function Documentation

u_int dpl_base64_decode ( const u_char *  in_buf,
u_int  in_len,
u_char *  out_buf 
)

decode a base64-encoded buffer to the original binary data.

Parameters
in_bufinput buffer to decode
in_leninput buffer size
out_bufbase64 output buffer (must be at least of size DPL_BASE64_ORIG_LENGTH(in_len))
Returns
out_len length of decoded output
u_int dpl_base64_encode ( const u_char *  in_buf,
u_int  in_len,
u_char *  out_buf 
)

encode a binary buffer in base64.

Parameters
in_bufinput buffer to encode
in_leninput buffer size
out_bufbase64 output buffer that must be at least of size DPL_BASE64_LENGTH(in_len)
Returns
out_len length of base64 output
unsigned int dpl_hmac_sha1 ( const char *  key_buf,
unsigned int  key_len,
const char *  data_buf,
unsigned int  data_len,
char *  digest_buf 
)
Parameters
key_buf
key_len
data_buf
data_len
digest_buf
digest_lenp
Returns
digest_len
char* dpl_strrstr ( const char *  haystack,
const char *  needle 
)
Parameters
haystack
needle
Returns
void dpl_url_decode ( char *  str)
Parameters
str
void dpl_url_encode ( const char *  str,
char *  str_ue 
)

str_ue length must be at least strlen(str)*3+1

Parameters
str
str_ue
Returns