26 #include <uuid/uuid.h> 119 uuid_generate_random(uuid->
uu);
139 uuid_unparse(uuid->
uu, buf);
159 res = uuid_parse(str, uuid->
uu);
175 uuid_copy(dst->
uu, src->
uu);
181 return uuid_compare(left->
uu, right->
uu);
186 uuid_clear(uuid->
uu);
191 return uuid_is_null(uuid->
uu);
216 dev_urandom_fd = open(
"/dev/urandom", O_RDONLY);
217 if (dev_urandom_fd < 0) {
218 ast_log(
LOG_WARNING,
"It appears your system does not have /dev/urandom on it. This\n" 219 "means that UUID generation will use a pseudorandom number generator. Since\n" 220 "the thread-safety of your system's random number generator cannot\n" 221 "be guaranteed, we have to synchronize UUID generation. This may result\n" 222 "in decreased performance. It is highly recommended that you set up your\n" 223 "system to have /dev/urandom\n");
226 close(dev_urandom_fd);
228 uuid_generate_random(uu);
static int dev_urandom_fd
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
String manipulation functions.
char * ast_uuid_generate_str(char *buf, size_t size)
Generate a UUID string.
Universally unique identifier support.
static void generate_uuid(struct ast_uuid *uuid)
#define ast_mutex_lock(a)
int ast_uuid_is_nil(struct ast_uuid *uuid)
Check if a UUID is a nil UUID (all 0s)
int ast_uuid_compare(struct ast_uuid *left, struct ast_uuid *right)
Compare two UUIDs.
struct ast_uuid * ast_uuid_copy(struct ast_uuid *src)
Make a copy of a UUID.
#define ast_debug(level,...)
Log a DEBUG message.
struct ast_uuid * ast_str_to_uuid(char *str)
Convert a string to a UUID.
struct ast_uuid * ast_uuid_generate(void)
Generate a UUID.
void ast_uuid_clear(struct ast_uuid *uuid)
Clear a UUID by setting it to be a nil UUID (all 0s)
#define ast_malloc(len)
A wrapper for malloc()
static force_inline char * ast_str_to_lower(char *str)
Convert a string to all lower-case.
static int has_dev_urandom
Support for logging to various files, console and syslog Configuration in file logger.conf.
static ast_mutex_t uuid_lock
char * ast_uuid_to_str(struct ast_uuid *uuid, char *buf, size_t size)
Convert a UUID to a string.
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define ast_mutex_unlock(a)
void ast_uuid_init(void)
Initialize the UUID system.