1
/* $Id: guid.h 4208 2012-07-18 07:52:33Z ming $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
* @brief GUID Globally Unique Identifier.
35
* @defgroup PJ_DS Data Structure.
38
* @defgroup PJ_GUID Globally Unique Identifier
42
* This module provides API to create string that is globally unique.
43
* If application doesn't require that strong requirement, it can just
44
* use #pj_create_random_string() instead.
49
* PJ_GUID_STRING_LENGTH specifies length of GUID string. The value is
50
* dependent on the algorithm used internally to generate the GUID string.
51
* If real GUID generator is used, then the length will be between 32 and
52
* 36 bytes. Application should not assume which algorithm will
53
* be used by GUID generator.
55
* Regardless of the actual length of the GUID, it will not exceed
56
* PJ_GUID_MAX_LENGTH characters.
58
* @see pj_GUID_STRING_LENGTH()
59
* @see PJ_GUID_MAX_LENGTH
61
PJ_DECL_DATA(const unsigned) PJ_GUID_STRING_LENGTH;
64
* Get #PJ_GUID_STRING_LENGTH constant.
66
PJ_DECL(unsigned) pj_GUID_STRING_LENGTH(void);
69
* PJ_GUID_MAX_LENGTH specifies the maximum length of GUID string,
70
* regardless of which algorithm to use.
72
#define PJ_GUID_MAX_LENGTH 36
75
* Create a globally unique string, which length is PJ_GUID_STRING_LENGTH
76
* characters. Caller is responsible for preallocating the storage used
79
* @param str The string to store the result.
83
PJ_DECL(pj_str_t*) pj_generate_unique_string(pj_str_t *str);
86
* Create a globally unique string in lowercase, which length is
87
* PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocating
88
* the storage used in the string.
90
* @param str The string to store the result.
94
PJ_DECL(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str);
97
* Generate a unique string.
99
* @param pool Pool to allocate memory from.
100
* @param str The string.
102
PJ_DECL(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str);
105
* Generate a unique string in lowercase.
107
* @param pool Pool to allocate memory from.
108
* @param str The string.
110
PJ_DECL(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str);
119
#endif/* __PJ_GUID_H__ */