taskrambler  0.1.8
Web server and task management solution.
uuid.h
Go to the documentation of this file.
1 /**
2  * \file
3  * ways to create uuid variant 5. For uuid of variant 1 I use
4  * the implementation delivered with the core utils.
5  * But this is wrapped in here, so that the rest of the code
6  * can use only this implementation...this additionally has the
7  * advantage that we can implement version 1 here too for systems
8  * where the coreutils implementation is not available.
9  *
10  * \author Georg Hopp
11  *
12  * \copyright
13  * Copyright © 2012 Georg Hopp
14  *
15  * This program is free software: you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation, either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
29 #ifndef __UUID_H__
30 #define __UUID_H__
31 
32 #include <stdint.h>
33 #include <sys/types.h>
34 #include <uuid/uuid.h>
35 
36 #include "class.h"
37 #include "commons.h"
38 
39 
40 typedef char UuidString[37];
41 
42 CLASS(Uuid) {
43  union {
44  uuid_t value;
45  struct {
46  uint32_t time_low;
47  uint16_t time_mid;
48  uint16_t time_hi_version;
49  uint8_t clk_seq_hi_res;
50  uint8_t clk_seq_low;
51  unsigned char node[6];
52  } elements;
53  } uuid;
54 };
55 
56 extern Uuid uuidZero;
57 
58 /*
59  * generator functions...these are not really part of the object
60  * but generate a uuid object.
61  */
62 Uuid uuidVersion1();
63 Uuid uuidVersion3(const unsigned char *, size_t, Uuid);
64 Uuid uuidVersion5(const unsigned char *, size_t, Uuid);
65 
66 void uuidUnparse(Uuid, UuidString);
67 Uuid uuidParse(const UuidString);
68 
69 int uuidCompare(Uuid, Uuid);
70 
71 #endif // __UUID_H__
72 
73 // vim: set ts=4 sw=4:
int uuidCompare(Uuid, Uuid)
Definition: compare.c:30
Uuid uuidParse(const UuidString)
Definition: uuid/parse.c:30
void uuidUnparse(Uuid, UuidString)
Definition: unparse.c:30
CLASS(Uuid)
Definition: uuid.h:42
Uuid uuidVersion3(const unsigned char *, size_t, Uuid)
Definition: version3.c:39
Uuid uuidVersion1()
Definition: version1.c:30
Uuid uuidVersion5(const unsigned char *, size_t, Uuid)
Definition: version5.c:39
Uuid uuidZero
char UuidString[37]
Definition: uuid.h:40