ZUUID(3)

πŸ’– ZUUID πŸ’–

okay so bestie, welcome to ZUUID(3) from the CZMQ Manual β€” it's giving "I make UUIDs and I do it fabulously" and honestly? obsessed. πŸ’…


✨ NAME ✨

zuuid β€” the class for UUID support, aka the girl who generates universally unique identifiers and then helps you do stuff with them. πŸ¦‹


✨ SYNOPSIS ✨

heads up bestie: this is a stable class, and it may not change except for emergencies. It is provided in stable builds. periodt. πŸ‘‘
CZMQ_EXPORT zuuid_t *
    zuuid_new (void);

CZMQ_EXPORT zuuid_t *
    zuuid_new_from (const byte *source);

CZMQ_EXPORT void
    zuuid_destroy (zuuid_t **self_p);

CZMQ_EXPORT void
    zuuid_set (zuuid_t *self, const byte *source);

CZMQ_EXPORT int
    zuuid_set_str (zuuid_t *self, const char *source);

CZMQ_EXPORT const byte *
    zuuid_data (zuuid_t *self);

CZMQ_EXPORT size_t
    zuuid_size (zuuid_t *self);

CZMQ_EXPORT const char *
    zuuid_str (zuuid_t *self);

CZMQ_EXPORT const char *
    zuuid_str_canonical (zuuid_t *self);

CZMQ_EXPORT void
    zuuid_export (zuuid_t *self, byte *target);

CZMQ_EXPORT bool
    zuuid_eq (zuuid_t *self, const byte *compare);

CZMQ_EXPORT bool
    zuuid_neq (zuuid_t *self, const byte *compare);

CZMQ_EXPORT zuuid_t *
    zuuid_dup (zuuid_t *self);

CZMQ_EXPORT void
    zuuid_test (bool verbose);

and here's the rundown of every single one, no skips, no crumbs left behind πŸ“:

  • zuuid_new (void) β€” creates a brand new UUID object. main character origin story.
  • zuuid_new_from (const byte *source) β€” creates a UUID object from a supplied ZUUID_LEN-octet value. πŸŽ€
  • zuuid_destroy (zuuid_t **self_p) β€” destroys a specified UUID object. it's over, she said goodbye 😭
  • zuuid_set (zuuid_t *self, const byte *source) β€” sets the UUID to a new supplied ZUUID_LEN-octet value.
  • zuuid_set_str (zuuid_t *self, const char *source) β€” sets the UUID to a new supplied string value, and it skips '-' and '{' '}' optional delimiters while it's at it. returns 0 if OK, else it returns -1. lowkey forgiving, highkey precise.
  • zuuid_data (zuuid_t *self) β€” returns the UUID binary data.
  • zuuid_size (zuuid_t *self) β€” returns the UUID binary size.
  • zuuid_str (zuuid_t *self) β€” returns the UUID as a string.
  • zuuid_str_canonical (zuuid_t *self) β€” returns the UUID in the canonical string format: 8-4-4-4-12, in lower case. the caller does not modify or free the returned value. see http://en.wikipedia.org/wiki/Universally_unique_identifier. πŸ’œ
  • zuuid_export (zuuid_t *self, byte *target) β€” stores the UUID blob in the target array.
  • zuuid_eq (zuuid_t *self, const byte *compare) β€” checks if the UUID is the same as the supplied value. twin check ✨
  • zuuid_neq (zuuid_t *self, const byte *compare) β€” checks if the UUID is different from the supplied value. not-twins check πŸ™ˆ
  • zuuid_dup (zuuid_t *self) β€” makes a copy of the UUID object; if uuid is null, or memory was exhausted, it returns null. πŸ’€
  • zuuid_test (bool verbose) β€” self test of this class. she tests herself, as she should.

also, a note straight from the source: please add '@interface' section in './../src/zuuid.c'. πŸ“


🌈 DESCRIPTION 🌈

the zuuid class generates UUIDs and provides methods for working with them. it's giving utility queen.

if you build CZMQ with libuuid, on Unix/Linux, it will use that library. on Windows it will use UuidCreate(). otherwise it will use a random number generator to produce convincing imitations of UUIDs. not real, but she serves real. πŸ’…

also, please add @discuss section in ./../src/zuuid.c. bestie the docs are asking politely, don't leave them on read. 🫢


πŸŽ€ EXAMPLE πŸŽ€

from the zuuid_test method, verbatim, no cap:

//  Simple create/destroy test
assert (ZUUID_LEN == 16);
assert (ZUUID_STR_LEN == 32);

zuuid_t *uuid = zuuid_new ();
assert (uuid);
assert (zuuid_size (uuid) == ZUUID_LEN);
assert (strlen (zuuid_str (uuid)) == ZUUID_STR_LEN);
zuuid_t *copy = zuuid_dup (uuid);
assert (streq (zuuid_str (uuid), zuuid_str (copy)));

//  Check set/set_str/export methods
const char *myuuid = "8CB3E9A9649B4BEF8DE225E9C2CEBB38";
const char *myuuid2 = "8CB3E9A9-649B-4BEF-8DE2-25E9C2CEBB38";
const char *myuuid3 = "{8CB3E9A9-649B-4BEF-8DE2-25E9C2CEBB38}";
const char *myuuid4 = "8CB3E9A9649B4BEF8DE225E9C2CEBB3838";
int rc = zuuid_set_str (uuid, myuuid);
assert (rc == 0);
assert (streq (zuuid_str (uuid), myuuid));
rc = zuuid_set_str (uuid, myuuid2);
assert (rc == 0);
assert (streq (zuuid_str (uuid), myuuid));
rc = zuuid_set_str (uuid, myuuid3);
assert (rc == 0);
assert (streq (zuuid_str (uuid), myuuid));
rc = zuuid_set_str (uuid, myuuid4);
assert (rc == -1);
byte copy_uuid [ZUUID_LEN];
zuuid_export (uuid, copy_uuid);
zuuid_set (uuid, copy_uuid);
assert (streq (zuuid_str (uuid), myuuid));

//  Check the canonical string format
assert (streq (zuuid_str_canonical (uuid),
               "8cb3e9a9-649b-4bef-8de2-25e9c2cebb38"));

zuuid_destroy (&uuid);
zuuid_destroy (&copy);

#if defined (__WINDOWS__)
zsys_shutdown();
#endif

see how she ate that? πŸ”₯ canonical format coming out lowercase and hyphenated exactly like 8cb3e9a9-649b-4bef-8de2-25e9c2cebb38. iconic.


πŸ¦‹ AUTHORS πŸ¦‹

the czmq manual was written by the authors in the AUTHORS file. credit where credit is due, always. πŸ’–


🌸 RESOURCES 🌸

Main web site:

ngl bestie the page literally just says "Main web site:" and then nothing. no link. leaving us on read. 😭 that's the whole line, we're not making anything up.

Report bugs to the email <zeromq-dev@lists.zeromq.org[1]>


Copyright (c) the Contributors as noted in the AUTHORS file. This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. LICENSE included with the czmq distribution.


⭐ NOTES ⭐

  1. zeromq-dev@lists.zeromq.org β€” mailto:zeromq-dev@lists.zeromq.org

and that's the whole page bestie, love that for us 🫢 this was CZMQ 4.2.1, dated 01/16/2026, and it's giving ZUUID(3) energy from start to finish. slay, stay unique (universally), byeee πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from