guid.h revision 7c681809344b880aae61e99b6ab74ae19945ff9e
e09c7dc961cb9cab04ec7cc79215c2f6318fbde0Timo Sirainen/* Generate a GUID (contains host name) */
23878bd03d1de531e3261a25598beec621351910Timo Sirainenconst char *guid_generate(void);
23878bd03d1de531e3261a25598beec621351910Timo Sirainen/* Generate 128 bit GUID */
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* Returns TRUE if GUID is empty (not set / unknown). */
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainenbool guid_128_is_empty(const guid_128_t guid) ATTR_PURE;
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainenstatic inline void guid_128_empty(guid_128_t guid)
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* Returns TRUE if two GUIDs are equal. */
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenbool guid_128_equals(const guid_128_t guid1, const guid_128_t guid2) ATTR_PURE;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* Copy GUID */
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenstatic inline void guid_128_copy(guid_128_t dest, const guid_128_t src)
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* Returns GUID as a hex string. */
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenconst char *guid_128_to_string(const guid_128_t guid);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* Parse GUID from a string. Returns 0 if ok, -1 if GUID isn't valid. */
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenint guid_128_from_string(const char *str, guid_128_t guid_r);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* Returns GUID as a UUID hex string. */
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenconst char *guid_128_to_uuid_string(const guid_128_t guid, enum uuid_format format);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* Parse GUID from a UUID string. Returns 0 if ok, -1 if UIID isn't valid. */
7358272563d8ef77366447708ab0e58c0cff4151Timo Sirainenint guid_128_from_uuid_string(const char *str, guid_128_t guid_r);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen/* guid_128 hash/cmp functions for hash.h */
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenunsigned int guid_128_hash(const guid_128_t guid) ATTR_PURE;
7358272563d8ef77366447708ab0e58c0cff4151Timo Sirainenint guid_128_cmp(const guid_128_t guid1, const guid_128_t guid2) ATTR_PURE;
97437f768d1a3e6134fed1971202803fd250eef2Timo Sirainen/* Return the hash of host used by guid_128_generate(). */