* @{
*/
-static void
-init_guid (DBusGUID *guid)
-{
- long now;
- char *p;
- int ts_size;
-
- _dbus_get_current_time (&now, NULL);
-
- guid->as_uint32s[0] = now;
-
- ts_size = sizeof (guid->as_uint32s[0]);
- p = ((char*)guid->as_bytes) + ts_size;
-
- _dbus_generate_random_bytes_buffer (p,
- sizeof (guid->as_bytes) - ts_size);
-}
-
/* this is a little fragile since it assumes the address doesn't
* already have a guid, but it shouldn't
*/
const DBusServerVTable *vtable,
const DBusString *address)
{
- DBusString guid_raw;
-
server->vtable = vtable;
server->refcount.value = 1;
if (!_dbus_string_init (&server->guid_hex))
return FALSE;
- init_guid (&server->guid);
+ _dbus_generate_uuid (&server->guid);
- _dbus_string_init_const_len (&guid_raw, (signed char*) server->guid.as_bytes,
- sizeof (server->guid.as_bytes));
- if (!_dbus_string_hex_encode (&guid_raw, 0,
- &server->guid_hex,
- _dbus_string_get_length (&server->guid_hex)))
+ if (!_dbus_uuid_encode (&server->guid, &server->guid_hex))
goto failed;
server->address = copy_address_with_guid_appended (address,