-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Add support for UUID versioning and generation of UUIDv7. #2734
base: master
Are you sure you want to change the base?
Conversation
I have a different patch based on https://github.com/LiosK/uuidv7-h, would you like to compare with this? |
Yes, can you share? |
src/include/switch_utils.h
Outdated
@@ -1518,6 +1519,9 @@ SWITCH_DECLARE(const char *) switch_memory_usage_stream(switch_stream_handle_t * | |||
/ Compliant random number generator. Returns the value between 0 and 0x7fff (RAND_MAX). | |||
**/ | |||
SWITCH_DECLARE(int) switch_rand(void); | |||
SWITCH_DECLARE(int) switch_getentropy(void *buffer, switch_size_t length); | |||
SWITCH_DECLARE(switch_status_t) switch_uuid_generate_v7(switch_uuid_t *uuid); | |||
SWITCH_DECLARE(switch_status_t) switch_uuid_generate_v7(switch_uuid_t *uuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ar45 you declared twice switch_uuid_generate_v7 I guess one should be switch_uuid_generate_v4
This update introduces support for generating UUIDs with specific versions, including the newly implemented UUIDv7. The `create_uuid` API has been updated to accept optional version parameters. Additionally, a new utility function `switch_getentropy` was added to ensure secure random number generation.
Ensure that invalid UUID generation scenarios are correctly handled by checking the return status of `switch_uuid_generate_version`. This prevents potential incorrect formatting or uninitialized usage.
control using macro
DEFAULT_UUID_VERSION
defaults to 4This update introduces support for generating UUIDs with specific versions, including the newly implemented UUIDv7. The
create_uuid
API has been updated to accept optional version parameters. Additionally, a new utility functionswitch_getentropy
was added to ensure secure random number generation.