Next: libgui, Previous: mod-gl, Up: C API

### 5.20 libglb

#### 5.20.1 Overview

View lcov test coverage results on http://www.gnu.org/software/liquidwar6/coverage/src/lib/glb/index.html.

#### 5.20.2 API

— Function: char * lw6glb_base64_encode_bin (char * buf, int size)

> buf: the data to encode

> size: the size of data to encode

> Encodes data into base64. Memory allocation is done automatically.

> Return value: newly allocated string.

— Function: char * lw6glb_base64_decode_bin (int * size, char * base64_str)

> size: the size of the decoded data

> base64_str: the string to decode

> Decodes data from base64. Memory allocation is done automatically. Note that this function only works for strings, other data might not be handled correctly.

> Return value: newly allocated pointer, NULL on error.

— Function: char * lw6glb_base64_encode_str (char * str)

> str: the string to encode

> Encodes a string into base64.

> Return value: newly allocated string.

— Function: char * lw6glb_base64_decode_str (char * str)

> str: the string to decode

> Decodes a string from base64.

> Return value: newly allocated string, NULL on error.

— Function: char * lw6glb_base64_encode_bin_prefix (char * buf, int size, char * prefix)

> buf: the data to encode

> size: the size of data to encode

> prefix: a prefix string

> Encodes data into base64. Memory allocation is done automatically. The encoded string will be prefixed with `prefix`.

> Return value: newly allocated string.

— Function: char * lw6glb_base64_decode_bin_prefix (int * size, char * base64_str, char * prefix)

> size: the size of the decoded data

> base64_str: the string to decode

> prefix: a prefix string

> Decodes data from base64. Memory allocation is done automatically. Note that this function only works for strings, other data might not be handled correctly. The encoded is expected to start with prefix `prefix` and then contain base64 data.

> Return value: newly allocated pointer, NULL on error.

— Function: char * lw6glb_base64_encode_str_prefix (char * str, char * prefix)

> str: the string to encode

> prefix: a prefix string

> Encodes a string into base64. The encoded string will be prefixed with `prefix`.

> Return value: newly allocated string.

— Function: char * lw6glb_base64_decode_str_prefix (char * str, char * prefix)

> str: the string to decode

> prefix: a prefix string

> Decodes a string from base64. The encoded is expected to start with prefix `prefix` and then contain base64 data.

> Return value: newly allocated string, NULL on error.

— Function: char * lw6glb_sha1_hmac_80_bin (char * key, int key_size, char * buf, int buf_size)

> key: the key buffer `key_size`

> buf: the data to analyse

> buf_size: the size of data to analyse

> Calculates an SHA-1 sum of buffer, using key to seed calc.

> Return value: newly allocated string, containing 20 chars checksum.

— Function: char * lw6glb_sha1_hmac_80_str (char * key, char * str)

> key: a key (string)

> str: the string to calculate the checksum for

> Calculates an SHA-1 sum of a string, using key to seed calc.

> Return value: newly allocated string, containing 20 chars checksum.

— Function: u_int32_t lw6glb_sha1_hmac_32_bin (char * key, int key_size, char * buf, int buf_size)

> key: the key buffer `key_size`

> buf: the data to analyse

> buf_size: the size of data to analyse

> Calculates an SHA-1 sum of buffer, using key to seed calc.

> Return value: a 32-bit unsigned integer

— Function: u_int32_t lw6glb_sha1_hmac_32_str (char * key, char * str)

> key: a key (string)

> str: the string to calculate the checksum for

> Calculates an SHA-1 sum of a string, using key to seed calc.

> Return value: a 32-bit unsigned integer

— Function: int lw6glb_test (int mode)

> mode: 0 for check only, 1 for full test

> Runs the `glb` module test suite.

> Return value: 1 if test is successfull, 0 on error.