00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _UUID_UUID_H
00036 #define _UUID_UUID_H
00037
00038 #include <sys/types.h>
00039 #include <sys/time.h>
00040 #include <time.h>
00041
00042 typedef unsigned char uuid_t[16];
00043
00044
00045 #define UUID_VARIANT_NCS 0
00046 #define UUID_VARIANT_DCE 1
00047 #define UUID_VARIANT_MICROSOFT 2
00048 #define UUID_VARIANT_OTHER 3
00049
00050
00051 #define UUID_TYPE_DCE_TIME 1
00052 #define UUID_TYPE_DCE_RANDOM 4
00053
00054
00055 #ifdef __GNUC__
00056 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
00057 static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
00058 #else
00059 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
00060 static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
00061 #endif
00062
00063 #ifdef __cplusplus
00064 extern "C" {
00065 #endif
00066
00067
00068 void uuid_clear(uuid_t uu);
00069
00070
00071 int uuid_compare(const uuid_t uu1, const uuid_t uu2);
00072
00073
00074 void uuid_copy(uuid_t dst, const uuid_t src);
00075
00076
00077 void uuid_generate(uuid_t out);
00078 void uuid_generate_random(uuid_t out);
00079 void uuid_generate_time(uuid_t out);
00080
00081
00082 int uuid_is_null(const uuid_t uu);
00083
00084
00085 int uuid_parse(const char *in, uuid_t uu);
00086
00087
00088 void uuid_unparse(const uuid_t uu, char *out);
00089 void uuid_unparse_lower(const uuid_t uu, char *out);
00090 void uuid_unparse_upper(const uuid_t uu, char *out);
00091
00092
00093 time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
00094 int uuid_type(const uuid_t uu);
00095 int uuid_variant(const uuid_t uu);
00096
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100
00101 #endif