NUGU SDK Linux  1.7.6
nugu_uuid.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NUGU_UUID_H__
18 #define __NUGU_UUID_H__
19 
20 #include <time.h>
21 #include <nugu.h>
22 #include <glib.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
40 #define NUGU_BASE_TIMESTAMP_SEC 1546300800
41 
47 #define NUGU_BASE_TIMESTAMP_MSEC 1546300800000
48 
52 #define NUGU_MAX_UUID_SIZE 16
53 
57 #define NUGU_MAX_UUID_STRING_SIZE (NUGU_MAX_UUID_SIZE * 2)
58 
63 NUGU_API char *nugu_uuid_generate_time(void);
64 
75 NUGU_API int nugu_uuid_convert_bytes(const char *base16, size_t base16_len,
76  unsigned char *out, size_t out_len);
77 
88 NUGU_API int nugu_uuid_convert_base16(const unsigned char *bytes,
89  size_t bytes_len, char *out,
90  size_t out_len);
91 
101 NUGU_API int nugu_uuid_convert_msec(const unsigned char *bytes,
102  size_t bytes_len, gint64 *msec);
103 
112 NUGU_API int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len);
113 
125 NUGU_API int nugu_uuid_fill(gint64 msec, const unsigned char *hash,
126  size_t hash_len, unsigned char *out,
127  size_t out_len);
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif
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.
NUGU_API char * nugu_uuid_generate_time(void)
Generate time based UUID.
NUGU_API int nugu_uuid_convert_msec(const unsigned char *bytes, size_t bytes_len, gint64 *msec)
Convert byte array to base16-encoded string.
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.
NUGU_API int nugu_uuid_fill_random(unsigned char *dest, size_t dest_len)
Generate random bytes and fill to destination buffer.
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.