uuid.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef UUID_H
  2. #define UUID_H
  3. /*
  4. * Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
  5. * Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
  6. * Digital Equipment Corporation, Maynard, Mass.
  7. * Copyright (c) 1998 Microsoft.
  8. * To anyone who acknowledges that this file is provided "AS IS"
  9. * without any express or implied warranty: permission to use, copy,
  10. * modify, and distribute this file for any purpose is hereby
  11. * granted without fee, provided that the above copyright notices and
  12. * this notice appears in all source code copies, and that none of
  13. * the names of Open Software Foundation, Inc., Hewlett-Packard
  14. * Company, or Digital Equipment Corporation be used in advertising
  15. * or publicity pertaining to distribution of the software without
  16. * specific, written prior permission. Neither Open Software
  17. * Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
  18. * Corporation makes any representations about the suitability of
  19. * this software for any purpose.
  20. */
  21. #include "sysdep.h"
  22. /*! . */
  23. typedef struct _uuid_upnp {
  24. /*! . */
  25. uint32_t time_low;
  26. /*! . */
  27. uint16_t time_mid;
  28. /*! . */
  29. uint16_t time_hi_and_version;
  30. /*! . */
  31. uint8_t clock_seq_hi_and_reserved;
  32. /*! . */
  33. uint8_t clock_seq_low;
  34. /*! . */
  35. uint8_t node[6];
  36. } uuid_upnp;
  37. /*!
  38. * \brief Generate a UUID.
  39. */
  40. int uuid_create(
  41. /*! . */
  42. uuid_upnp * id);
  43. /*!
  44. * \brief Out will be xxxx-xx-xx-xx-xxxxxx format.
  45. */
  46. void uuid_unpack(
  47. /*! . */
  48. uuid_upnp * u,
  49. /*! . */
  50. char *out);
  51. /*!
  52. * \brief Create a UUID using a "name" from a "name space"
  53. */
  54. void uuid_create_from_name(
  55. /*! Resulting UUID. */
  56. uuid_upnp * uid,
  57. /*! UUID to serve as context, so identical names from different name
  58. * spaces generate different UUIDs. */
  59. uuid_upnp nsid,
  60. /*! The name from which to generate a UUID. */
  61. void *name,
  62. /*! The length of the name. */
  63. int namelen);
  64. /*!
  65. * \brief Compare two UUID's "lexically".
  66. *
  67. * \return
  68. * -1 u1 is lexically before u2
  69. * 0 u1 is equal to u2
  70. * 1 u1 is lexically after u2
  71. *
  72. * \note Lexical ordering is not temporal ordering!
  73. */
  74. int uuid_compare(
  75. /*! . */
  76. uuid_upnp * u1,
  77. /*! . */
  78. uuid_upnp * u2);
  79. #endif /* UUID_H */