NUGU SDK Linux  1.7.6

UUID generation functions. More...

+ Collaboration diagram for UUID:

Macros

#define NUGU_BASE_TIMESTAMP_MSEC   1546300800000
 Milliseconds for base timestamp: 2019/1/1 00:00:00.000 (GMT) More...
 
#define NUGU_BASE_TIMESTAMP_SEC   1546300800
 Seconds for base timestamp: 2019/1/1 00:00:00 (GMT)
 
#define NUGU_MAX_UUID_SIZE   16
 Maximum byte array UUID size.
 
#define NUGU_MAX_UUID_STRING_SIZE   (NUGU_MAX_UUID_SIZE * 2)
 Maximum base16 encoded UUID string size.
 

Functions

NUGU_API int nugu_uuid_convert_base16 (const unsigned char *bytes, size_t bytes_len, char *out, size_t out_len)
 Convert byte array to base16-encoded string. More...
 
NUGU_API int nugu_uuid_convert_bytes (const char *base16, size_t base16_len, unsigned char *out, size_t out_len)
 Convert base16-encoded string to byte array. More...
 
NUGU_API int nugu_uuid_convert_msec (const unsigned char *bytes, size_t bytes_len, gint64 *msec)
 Convert byte array to base16-encoded string. More...
 
NUGU_API int nugu_uuid_fill (gint64 msec, const unsigned char *hash, size_t hash_len, unsigned char *out, size_t out_len)
 Fill to output buffer with NUGU UUID format using parameters. More...
 
NUGU_API int nugu_uuid_fill_random (unsigned char *dest, size_t dest_len)
 Generate random bytes and fill to destination buffer. More...
 
NUGU_API char * nugu_uuid_generate_time (void)
 Generate time based UUID. More...
 

Detailed Description

UUID generation functions.

Macro Definition Documentation

◆ NUGU_BASE_TIMESTAMP_MSEC

#define NUGU_BASE_TIMESTAMP_MSEC   1546300800000

Milliseconds for base timestamp: 2019/1/1 00:00:00.000 (GMT)

This value must be treated as 64 bits.

Function Documentation

◆ nugu_uuid_generate_time()

NUGU_API char* nugu_uuid_generate_time ( void  )

Generate time based UUID.

Returns
memory allocated UUID string. Developer must free the data manually.

◆ nugu_uuid_convert_bytes()

NUGU_API int nugu_uuid_convert_bytes ( const char *  base16,
size_t  base16_len,
unsigned char *  out,
size_t  out_len 
)

Convert base16-encoded string to byte array.

Parameters
[in]base16base16-encoded string
[in]base16_lenlength
[out]outmemory allocated output buffer
[in]out_lensize of output buffer
Returns
Result of conversion success or failure
Return values
0Success
-1Failure

◆ nugu_uuid_convert_base16()

NUGU_API int nugu_uuid_convert_base16 ( const unsigned char *  bytes,
size_t  bytes_len,
char *  out,
size_t  out_len 
)

Convert byte array to base16-encoded string.

Parameters
[in]bytesbyte array
[in]bytes_lenlength
[out]outmemory allocated output buffer
[in]out_lensize of output buffer
Returns
Result of conversion success or failure
Return values
0Success
-1Failure

◆ nugu_uuid_convert_msec()

NUGU_API int nugu_uuid_convert_msec ( const unsigned char *  bytes,
size_t  bytes_len,
gint64 *  msec 
)

Convert byte array to base16-encoded string.

Parameters
[in]bytesbyte array
[in]bytes_lenlength
[out]msecmilliseconds
Returns
Result of conversion success or failure
Return values
0Success
-1Failure

◆ nugu_uuid_fill_random()

NUGU_API int nugu_uuid_fill_random ( unsigned char *  dest,
size_t  dest_len 
)

Generate random bytes and fill to destination buffer.

Parameters
[in]destdestination buffer
[in]dest_lenlength of buffer
Returns
Result
Return values
0Success
-1Failure

◆ nugu_uuid_fill()

NUGU_API int nugu_uuid_fill ( gint64  msec,
const unsigned char *  hash,
size_t  hash_len,
unsigned char *  out,
size_t  out_len 
)

Fill to output buffer with NUGU UUID format using parameters.

Parameters
[in]msecmilliseconds
[in]hashhash value(e.g. SHA1(token))
[in]hash_lenlength of hash value
[out]outmemory allocated output buffer
[in]out_lensize of output buffer
Returns
Result
Return values
0Success
-1Failure