--- as_uuid.h 2003/01/21 14:41:15 1.1
+++ as_uuid.h 2003/01/22 11:37:22 1.2
@@ -44,6 +44,7 @@
#else
?==Error: Undefined 8 bit type
#endif // __u8
+
#if (SIZEOF_SHORT == 2)
typedef unsigned short __u16;
#elif (SIZEOF_INT == 2)
@@ -53,6 +54,7 @@
#else
?==Error: Undefined 16 bit type
#endif // __u16
+
#if (SIZEOF_SHORT == 4)
typedef unsigned short __u32;
#elif (SIZEOF_INT == 4)
@@ -62,6 +64,7 @@
#else
?==Error: Undefined 32 bit type
#endif // __u32
+
#if (SIZEOF_SHORT == 8)
typedef unsigned short __u64;
#elif (SIZEOF_INT == 8)
@@ -73,8 +76,8 @@
#else
?==Error: Undefined 64 bit type
#endif // __u64
-#endif // SIZEOF_INT
-#else // HAVE_CONFIG_H
+
+#else // HAVE_CONFIG_H (not defined)
typedef unsigned char __u8;
#if (4 == 8)
typedef unsigned int __u64;
@@ -106,20 +109,32 @@
#endif // HAVE_CONFIG_H
+typedef unsigned char uuid_t[16];
+
+struct uuid {
+ __u32 time_low;
+ __u16 time_mid;
+ __u16 time_hi_and_version;
+ __u16 clock_seq;
+ __u8 node[6];
+};
+
class Uuid
{
public:
- static int get_random_fd(void);
- static void get_random_bytes(void *, int);
- static int get_node_id(unsigned char *);
- static int get_clock(__u32 *, __u32 *, __u16 *);
- void uuid_generate_time(uuid_t);
- void uuid_generate_random(uuid_t);
- void uuid_generate(uuid_t);
- void uuid_pack(const struct uuid *, uuid_t);
- void uuid_unpack(const uuid_t, struct uuid *);
- void uuid_unparse(const uuid_t, char *);
+ void genTime(uuid_t);
+ void genRand(uuid_t);
+ void genId(uuid_t);
+
+ void packId(const uuid *, uuid_t);
+ void unpackId(const uuid_t, uuid *);
+ void unparseId(const uuid_t, char *);
+
private:
+ int getRandfd(void);
+ void getRandbytes(void *, int);
+ int getNodeid(unsigned char *);
+ int getClock(__u32 *, __u32 *, __u16 *);
};
#endif // UUIDGEN_H
|