Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef _IPXE_UUID_H
  2. #define _IPXE_UUID_H
  3. /** @file
  4. *
  5. * Universally unique IDs
  6. */
  7. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  8. #include <stdint.h>
  9. #include <byteswap.h>
  10. /** A universally unique ID */
  11. union uuid {
  12. /** Canonical form (00000000-0000-0000-0000-000000000000) */
  13. struct {
  14. /** 8 hex digits, big-endian */
  15. uint32_t a;
  16. /** 2 hex digits, big-endian */
  17. uint16_t b;
  18. /** 2 hex digits, big-endian */
  19. uint16_t c;
  20. /** 2 hex digits, big-endian */
  21. uint16_t d;
  22. /** 12 hex digits, big-endian */
  23. uint8_t e[6];
  24. } canonical;
  25. uint8_t raw[16];
  26. };
  27. /**
  28. * Change UUID endianness
  29. *
  30. * @v uuid UUID
  31. *
  32. * RFC4122 defines UUIDs as being encoded in network byte order, but
  33. * leaves some wriggle room for "explicit application or presentation
  34. * protocol specification to the contrary". PXE, EFI and SMBIOS
  35. * (versions 2.6 and above) treat the first three fields as being
  36. * little-endian.
  37. */
  38. static inline void uuid_mangle ( union uuid *uuid ) {
  39. __bswap_32s ( &uuid->canonical.a );
  40. __bswap_16s ( &uuid->canonical.b );
  41. __bswap_16s ( &uuid->canonical.c );
  42. }
  43. extern const char * uuid_ntoa ( const union uuid *uuid );
  44. #endif /* _IPXE_UUID_H */