uuid.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // uuid.h :
  2. //
  3. #if !defined(AGD_UUID_H__E2CBFDC3_1EA5_4220_8D44_D0C26219B529__INCLUDED_)
  4. #define AGD_UUID_H__E2CBFDC3_1EA5_4220_8D44_D0C26219B529__INCLUDED_
  5. #include <inttypes.h>
  6. #include <stdlib.h>
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif // __cplusplus
  10. /////////////////////////////////////////////////////////////////////////////
  11. // uuid.h - Declarations:
  12. #ifdef __linux__
  13. typedef struct _UUID
  14. {
  15. uint32_t Data1;
  16. uint16_t Data2;
  17. uint16_t Data3;
  18. uint8_t Data4[8];
  19. }UUID;
  20. #define uuid_t UUID
  21. #else // __linux__
  22. #ifdef _MSC_VER
  23. #include <guiddef.h>
  24. #ifndef uuid_t
  25. #define uuid_t GUID
  26. #endif // uuid_t
  27. #endif // _MSC_VER
  28. #endif // __linux__
  29. #define DEFINE_UUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  30. const uuid_t name = {l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}
  31. #define DECLARE_UUID(v) extern const uuid_t v
  32. #define _UUID_STRING_LEN 36
  33. /////////////////////////////////////////////////////////////////////////////
  34. DECLARE_UUID(UUID_NULL);
  35. /////////////////////////////////////////////////////////////////////////////
  36. int _uuid_parse (const char *pszIn, uuid_t *uuid);
  37. int _uuid_unparse (const uuid_t *uuid, char *pszOut, size_t nCChOut);
  38. int _uuid_compare (const uuid_t *uuid1, const uuid_t *uuid2);
  39. void _uuid_copy (uuid_t *uuDest, const uuid_t *uuSrc);
  40. int _uuid_is_null (const uuid_t *uuid);
  41. /////////////////////////////////////////////////////////////////////////////
  42. #ifdef __cplusplus
  43. }
  44. #endif // __cplusplus
  45. #endif // !defined(AGD_UUID_H__E2CBFDC3_1EA5_4220_8D44_D0C26219B529__INCLUDED_)