libglb - Liquid War 6
Description: Liquid War 6

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

### 5.25 libglb

#### 5.25.1 Overview

View lcov test coverage results on http://www.ufoot.org/liquidwar/v6/doc/coverage/src/lib/glb/index.html.

#### 5.25.2 API

— Function: char * lw6glb_base64_encode_bin (const 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, const 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 (const char * str)

> str: the string to encode

> Encodes a string into base64.

> Return value: newly allocated string.

— Function: char * lw6glb_base64_decode_str (const 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 (const char * buf, int size, const 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, const char * base64_str, const 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 (const char * str, const 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 (const char * str, const 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 (const char * key, int key_size, const 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 (const char * key, const 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 (const char * key, int key_size, const 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 (const char * key, const 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_register (int mode)

> mode: test mode (bitmask)

> Registers all tests for the libglb module.

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

— Function: int lw6glb_test_run (int mode)

> mode: test mode (bitmask)

> Runs the `glb` module test suite, testing most (if not all...) functions.

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