Group PJ_GUID

group PJ_GUID

This module provides API to create string that is globally unique. If application doesn’t require that strong requirement, it can just use pj_create_random_string() instead.

Defines

PJ_GUID_MAX_LENGTH

PJ_GUID_MAX_LENGTH specifies the maximum length of GUID string, regardless of which algorithm to use.

Functions

unsigned pj_GUID_STRING_LENGTH(void)

Get PJ_GUID_STRING_LENGTH constant.

pj_str_t *pj_generate_unique_string(pj_str_t *str)

Create a globally unique string, which length is PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocating the storage used in the string.

Parameters:

str – The string to store the result.

Returns:

The string.

pj_str_t *pj_generate_unique_string_lower(pj_str_t *str)

Create a globally unique string in lowercase, which length is PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocating the storage used in the string.

Parameters:

str – The string to store the result.

Returns:

The string.

void pj_create_unique_string(pj_pool_t *pool, pj_str_t *str)

Generate a unique string.

Parameters:
  • pool – Pool to allocate memory from.

  • str – The string.

void pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str)

Generate a unique string in lowercase.

Parameters:
  • pool – Pool to allocate memory from.

  • str – The string.

Variables

const unsigned PJ_GUID_STRING_LENGTH

PJ_GUID_STRING_LENGTH specifies length of GUID string. The value is dependent on the algorithm used internally to generate the GUID string. If real GUID generator is used, then the length will be between 32 and 36 bytes. Application should not assume which algorithm will be used by GUID generator.

Regardless of the actual length of the GUID, it will not exceed PJ_GUID_MAX_LENGTH characters.