00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00027 #ifndef GLOBUS_UUID_H
00028 #define GLOBUS_UUID_H
00029
00030 #include "globus_common_include.h"
00031 #include "globus_libc.h"
00032
00033
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
00038 #define GLOBUS_UUID_TEXTLEN 36
00039
00040 #define GLOBUS_UUID_VERSION(uuid) ((uuid).binary.bytes[6] >> 4)
00041 #define GLOBUS_UUID_VERSION_TIME 1
00042 #define GLOBUS_UUID_VERSION_DCE 2
00043 #define GLOBUS_UUID_VERSION_NAME 3
00044 #define GLOBUS_UUID_VERSION_RANDOM 4
00045
00046 #define GLOBUS_UUID_MATCH(u1, u2) \
00047 (memcmp((u1).binary.bytes, (u2).binary.bytes, 16) == 0)
00048
00049 typedef struct
00050 {
00051 uint32_t time_low;
00052 uint16_t time_mid;
00053 uint16_t time_hi_and_version;
00054 uint8_t clock_seq_hi_and_reserved;
00055 uint8_t clock_seq_low;
00056 uint8_t node[6];
00057 } globus_uuid_fields_t;
00058
00059 typedef struct
00060 {
00061 union
00062 {
00063 uint8_t bytes[16];
00064
00065 globus_uuid_fields_t fields;
00066 } binary;
00067
00068 char text[GLOBUS_UUID_TEXTLEN + 1];
00069 } globus_uuid_t;
00070
00077 int
00078 globus_uuid_create(
00079 globus_uuid_t * uuid);
00080
00091 int
00092 globus_uuid_import(
00093 globus_uuid_t * uuid,
00094 const char * str);
00095
00105 int
00106 globus_uuid_fields(
00107 globus_uuid_t * uuid,
00108 globus_uuid_fields_t * uuid_fields);
00109
00110 #ifdef __cplusplus
00111 }
00112 #endif
00113
00114 #endif