globus_common  17.9
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_uuid.h
Go to the documentation of this file.
1 
12 #ifndef GLOBUS_UUID_H
13 #define GLOBUS_UUID_H
14 
15 #include "globus_common_include.h"
16 #include "globus_libc.h"
17 
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define GLOBUS_UUID_TEXTLEN 36
24 
25 #define GLOBUS_UUID_VERSION(uuid) ((uuid).binary.bytes[6] >> 4)
26 #define GLOBUS_UUID_VERSION_TIME 1
27 #define GLOBUS_UUID_VERSION_DCE 2
28 #define GLOBUS_UUID_VERSION_NAME 3
29 #define GLOBUS_UUID_VERSION_RANDOM 4
30 
31 #define GLOBUS_UUID_MATCH(u1, u2) \
32  (memcmp((u1).binary.bytes, (u2).binary.bytes, 16) == 0)
33 
34 typedef struct
35 {
36  uint32_t time_low;
37  uint16_t time_mid;
38  uint16_t time_hi_and_version;
39  uint8_t clock_seq_hi_and_reserved;
40  uint8_t clock_seq_low;
41  uint8_t node[6];
42 } globus_uuid_fields_t;
43 
44 typedef struct
45 {
46  union
47  {
48  uint8_t bytes[16];
49  /* all multibyte fields in network byte order */
50  globus_uuid_fields_t fields;
51  } binary;
52 
53  char text[GLOBUS_UUID_TEXTLEN + 1];
54 } globus_uuid_t;
55 
62 int
64  globus_uuid_t * uuid);
65 
76 int
78  globus_uuid_t * uuid,
79  const char * str);
80 
90 int
92  globus_uuid_t * uuid,
93  globus_uuid_fields_t * uuid_fields);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* GLOBUS_UUID_H */
int globus_uuid_create(globus_uuid_t *uuid)
Create UUIDCreates a time based, Leach-Salz variant uuid, using the mac address when available...
Definition: globus_uuid.c:202
int globus_uuid_import(globus_uuid_t *uuid, const char *str)
Import a UUIDImport a string in the text UUID format into a globus_uuid_t value.
Definition: globus_uuid.c:270
int globus_uuid_fields(globus_uuid_t *uuid, globus_uuid_fields_t *uuid_fields)
Extract fields from UUIDCopy the fields from uuid to uuid_fields in host byte order.
Definition: globus_uuid.c:329
Thread-safe libc macros, function prototypes.
Include System Headers.