Debian Codegraph @

Xpjproject/pjlib/include/pj/guid.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #ifndef __PJ_GUID_H__
20 #define __PJ_GUID_H__
21
22
23 /**
24 * @file guid.h
25 * @brief GUID Globally Unique Identifier.
26 */
27 #include <pj/types.h>
28
29
30 PJ_BEGIN_DECL
31
32
33 /**
34 * @defgroup PJ_DS Data Structure.
35 */
36 /**
37 * @defgroup PJ_GUID Globally Unique Identifier
38 * @ingroup PJ_DS
39 * @{
40 *
41 * This module provides API to create string that is globally unique.
42 * If application doesn't require that strong requirement, it can just
43 * use #pj_create_random_string() instead.
44 */
45
46
47 /**
48 * PJ_GUID_STRING_LENGTH specifies length of GUID string. The value is
49 * dependent on the algorithm used internally to generate the GUID string.
50 * If real GUID generator is used, then the length will be between 32 and
51 * 36 bytes. Application should not assume which algorithm will
52 * be used by GUID generator.
53 *
54 * Regardless of the actual length of the GUID, it will not exceed
55 * PJ_GUID_MAX_LENGTH characters.
56 *
57 * @see pj_GUID_STRING_LENGTH()
58 * @see PJ_GUID_MAX_LENGTH
59 */
60 PJ_DECL_DATA(const unsigned) PJ_GUID_STRING_LENGTH;
61
62 /**
63 * Get #PJ_GUID_STRING_LENGTH constant.
64 */
65 PJ_DECL(unsigned) pj_GUID_STRING_LENGTH(void);
66
67 /**
68 * PJ_GUID_MAX_LENGTH specifies the maximum length of GUID string,
69 * regardless of which algorithm to use.
70 */
71 #define PJ_GUID_MAX_LENGTH 36
72
73 /**
74 * Create a globally unique string, which length is PJ_GUID_STRING_LENGTH
75 * characters. Caller is responsible for preallocating the storage used
76 * in the string.
77 *
78 * @param str The string to store the result.
79 *
80 * @return The string.
81 */
82 PJ_DECL(pj_str_t*) pj_generate_unique_string(pj_str_t *str);
83
84 /**
85 * Create a globally unique string in lowercase, which length is
86 * PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocating
87 * the storage used in the string.
88 *
89 * @param str The string to store the result.
90 *
91 * @return The string.
92 */
93 PJ_DECL(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str);
94
95 /**
96 * Generate a unique string.
97 *
98 * @param pool Pool to allocate memory from.
99 * @param str The string.
100 */
101 PJ_DECL(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str);
102
103 /**
104 * Generate a unique string in lowercase.
105 *
106 * @param pool Pool to allocate memory from.
107 * @param str The string.
108 */
109 PJ_DECL(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str);
110
111
112 /**
113 * @}
114 */
115
116 PJ_END_DECL
117
118 #endif/* __PJ_GUID_H__ */
119