From b7d06edf30057c5143da1bf8c22f899a5c52c09b Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Wed, 23 Oct 2013 00:12:40 +0100 Subject: [PATCH] start of an own uuid class. This will simply wrap existing code for random uuids and add code to generate uuid for namespace unique items. --- include/uuid.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 include/uuid.h diff --git a/include/uuid.h b/include/uuid.h new file mode 100644 index 0000000..b3bde29 --- /dev/null +++ b/include/uuid.h @@ -0,0 +1,56 @@ +/** + * \file + * ways to create uuid variant 5. For uuid of variant 1 I use + * the implementation delivered with the core utils. + * But this is wrapped in here, so that the rest of the code + * can use only this implementation...this additionally has the + * advantage that we can implement version 1 here too for systems + * where the coreutils implementation is not available. + * + * \author Georg Hopp + * + * \copyright + * Copyright © 2012 Georg Hopp + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __UUID_H__ +#define __UUID_H__ + +#include +#include + +#include "class.h" +#include "commons.h" + + +CLASS(Uuid) { + union { + uuid_t value; + struct { + uint32_t time_low; + uint16_t time_mid; + uint16_t time_low_version; + uint8_t clk_seq_hi_res; + uint8_t clk_seq_low; + uint16_t node_hi; + uint32_t node_low; + } elements; + } uuid; +}; + +#endif // __ASSET_H__ + +// vim: set ts=4 sw=4: