head 1.19; access; symbols UUID_0_9_5:1.17 UUID_0_9_4:1.17 UUID_0_9_3:1.11 UUID_0_9_2:1.11 UUID_0_9_1:1.10 UUID_0_9_0:1.7; locks; strict; comment @ * @; 1.19 date 2004.02.10.20.00.13; author rse; state dead; branches; next 1.18; 1.18 date 2004.02.10.19.59.13; author rse; state Exp; branches; next 1.17; 1.17 date 2004.01.19.14.11.50; author rse; state Exp; branches; next 1.16; 1.16 date 2004.01.19.12.19.25; author rse; state Exp; branches; next 1.15; 1.15 date 2004.01.19.12.15.05; author rse; state Exp; branches; next 1.14; 1.14 date 2004.01.18.20.19.23; author rse; state Exp; branches; next 1.13; 1.13 date 2004.01.18.19.59.12; author rse; state Exp; branches; next 1.12; 1.12 date 2004.01.18.19.22.54; author rse; state Exp; branches; next 1.11; 1.11 date 2004.01.15.12.32.26; author rse; state Exp; branches; next 1.10; 1.10 date 2004.01.13.14.35.59; author rse; state Exp; branches; next 1.9; 1.9 date 2004.01.11.18.32.38; author rse; state Exp; branches; next 1.8; 1.8 date 2004.01.11.12.14.19; author rse; state Exp; branches; next 1.7; 1.7 date 2004.01.10.12.16.03; author rse; state Exp; branches; next 1.6; 1.6 date 2004.01.09.16.11.40; author rse; state Exp; branches; next 1.5; 1.5 date 2004.01.09.11.28.56; author rse; state Exp; branches; next 1.4; 1.4 date 2004.01.09.09.06.25; author rse; state Exp; branches; next 1.3; 1.3 date 2004.01.08.21.31.47; author rse; state Exp; branches; next 1.2; 1.2 date 2004.01.06.20.29.51; author rse; state Exp; branches; next 1.1; 1.1 date 2004.01.06.20.14.28; author rse; state Exp; branches; next ; desc @@ 1.19 log @remove generated file @ text @/* ** OSSP uuid - Universally Unique Identifier ** Copyright (c) 2004 Ralf S. Engelschall ** Copyright (c) 2004 The OSSP Project ** ** This file is part of OSSP uuid, a library for the generation ** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ ** ** Permission to use, copy, modify, and distribute this software for ** any purpose with or without fee is hereby granted, provided that ** the above copyright notice and this permission notice appear in all ** copies. ** ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ** SUCH DAMAGE. ** ** uuid.h: library API definition */ #ifndef __UUID_H__ #define __UUID_H__ /* required system headers */ #include /* minimum C++ support */ #ifdef __cplusplus #define DECLARATION_BEGIN extern "C" { #define DECLARATION_END } #else #define DECLARATION_BEGIN #define DECLARATION_END #endif DECLARATION_BEGIN /* OSSP uuid version (compile-time information) */ #define UUID_VERSION 0x009205 /* encoding octet stream lengths */ #define UUID_LEN_BIN (128 /*bit*/ / 8 /*bytes*/) #define UUID_LEN_STR (128 /*bit*/ / 4 /*nibbles*/ + 4 /*hyphens*/) /* API return codes */ typedef enum { UUID_RC_OK = 0, /* everything ok */ UUID_RC_ARG = 1, /* invalid argument */ UUID_RC_MEM = 2, /* out of memory */ UUID_RC_SYS = 3, /* system error */ UUID_RC_INT = 4, /* internal error */ UUID_RC_IMP = 5 /* not implemented */ } uuid_rc_t; /* UUID make modes */ enum { UUID_MAKE_V1 = (1 << 0), /* DCE 1.1 v1 UUID */ UUID_MAKE_V3 = (1 << 1), /* DCE 1.1 v3 UUID */ UUID_MAKE_V4 = (1 << 2), /* DCE 1.1 v4 UUID */ UUID_MAKE_MC = (1 << 3) /* enforce multi-cast MAC address */ }; /* UUID import/export formats */ typedef enum { UUID_FMT_BIN = 0, /* binary representation (import/export) */ UUID_FMT_STR = 1, /* string representation (import/export) */ UUID_FMT_TXT = 2 /* textual description (export only) */ } uuid_fmt_t; /* UUID abstract data type */ struct uuid_st; typedef struct uuid_st uuid_t; /* UUID object handling */ extern uuid_rc_t uuid_create (uuid_t **_uuid); extern uuid_rc_t uuid_destroy (uuid_t *_uuid); /* UUID generation */ extern uuid_rc_t uuid_load (uuid_t *_uuid, const char *_name); extern uuid_rc_t uuid_make (uuid_t *_uuid, unsigned int _mode, ...); /* UUID comparison */ extern uuid_rc_t uuid_isnil (uuid_t *_uuid, int *_result); extern uuid_rc_t uuid_compare (uuid_t *_uuid, uuid_t *_uuid2, int *_result); /* UUID import/export */ extern uuid_rc_t uuid_import (uuid_t *_uuid, uuid_fmt_t _fmt, const void *_data_ptr, size_t _data_len); extern uuid_rc_t uuid_export (uuid_t *_uuid, uuid_fmt_t _fmt, void **_data_ptr, size_t *_data_len); /* library utilities */ extern char *uuid_error (uuid_rc_t _rc); extern unsigned long uuid_version (void); DECLARATION_END #endif /* __UUID_H__ */ @ 1.18 log @flush pending change @ text @@ 1.17 log @flush more pending cleanups @ text @d48 1 a48 1 #define UUID_VERSION 0x009204 @ 1.16 log @fix building (I've changed the generated file last time) @ text @d33 2 a34 2 /* OSSP uuid version (compile-time information) */ #define UUID_VERSION 0x009204 d41 2 a42 2 #define DECLARATION_BEGIN /*nop*/ #define DECLARATION_END /*nop*/ d47 3 d51 2 a52 2 #define UUID_LEN_BIN (128 / 8 /*bytes*/) #define UUID_LEN_STR (128 / 4 /*nibbles*/ + 4 /*hyphens*/) d54 1 a54 1 /* return codes */ d56 6 a61 6 UUID_RC_OK = 0, UUID_RC_ARG = 1, UUID_RC_MEM = 2, UUID_RC_SYS = 3, UUID_RC_INT = 4, UUID_RC_IMP = 5 d64 1 a64 1 /* generation mode flags */ d66 4 a69 4 UUID_VERSION1 = (1 << 0), UUID_VERSION3 = (1 << 1), UUID_VERSION4 = (1 << 2), UUID_MCASTRND = (1 << 3) d72 1 a72 1 /* import/export formats */ d74 3 a76 3 UUID_FMT_BIN = 0, /* import/export */ UUID_FMT_STR = 1, /* import/export */ UUID_FMT_TXT = 2 /* export only */ d79 1 a79 1 /* abstract data type */ d83 3 a85 3 /* object handling */ extern uuid_rc_t uuid_create (uuid_t **_uuid); extern uuid_rc_t uuid_destroy (uuid_t *_uuid); d88 2 a89 2 extern uuid_rc_t uuid_load (uuid_t *_uuid, const char *_name); extern uuid_rc_t uuid_make (uuid_t *_uuid, unsigned int _mode, ...); d92 2 a93 2 extern uuid_rc_t uuid_isnil (uuid_t *_uuid, int *_result); extern uuid_rc_t uuid_compare (uuid_t *_uuid, uuid_t *_uuid2, int *_result); d96 2 a97 2 extern uuid_rc_t uuid_import (uuid_t *_uuid, uuid_fmt_t _fmt, const void *_data_ptr, size_t _data_len); extern uuid_rc_t uuid_export (uuid_t *_uuid, uuid_fmt_t _fmt, void **_data_ptr, size_t *_data_len); d99 3 a101 3 /* library error handling */ extern char *uuid_error (uuid_rc_t _rc); extern unsigned long uuid_version (void); @ 1.15 log @o Include in uuid.h because of size_t usage. o INCOMPATIBILITY: Refactor the API and rename uuid_generate() to uuid_make() and use a "uuid_t" pointer for the namespace on UUID_VERSION3 generation. To allow access to the internal pre-defined namespace UUIDs, provide a new uuid_load() function. Because uuid_load() now also allows the loading of the "nil" UUID, remove uuid_nil() from the API. After this second refactoring the API is now the one we originally wished for the forthcoming version 1.0 of OSSP uuid. @ text @a32 3 /* required system headers */ #include @ 1.14 log @Add version support to API via UUID_VERSION (compile-time) and uuid_version() (link-time). @ text @d33 3 d88 2 a89 2 extern uuid_rc_t uuid_nil (uuid_t *_uuid); extern uuid_rc_t uuid_generate (uuid_t *_uuid, unsigned int _mode, ...); @ 1.13 log @- Refactor the API by merging uuid_{unpack,pack,parse,format,dump}() functions into unified uuid_{import,export}() functions. This allows us to easily add support for other formats (e.g. XML) in the future without having the change the API in principle. - Document what DCE 1.1 UUID versions exist and what they are intended for. @ text @d33 3 d98 1 @ 1.12 log @- Cleanup the C code to also pass warning-free a C++ compiler. - Support C++ by enclosing the C API declarations in 'extern "C" {...}' within uuid.h. Submitted by: Guerry Semones @ text @d54 2 a55 1 UUID_RC_INT = 4 d66 7 d80 2 d83 1 d89 3 a91 11 /* UUID binary representation handling */ extern uuid_rc_t uuid_unpack (uuid_t *_uuid, const void *_buf); extern uuid_rc_t uuid_pack (uuid_t *_uuid, void **_buf); /* UUID string representation handling */ extern uuid_rc_t uuid_parse (uuid_t *_uuid, const char *_str); extern uuid_rc_t uuid_format (uuid_t *_uuid, char **_str); /* UUID generation and dumping */ extern uuid_rc_t uuid_generate (uuid_t *_uuid, unsigned int _mode, ...); extern uuid_rc_t uuid_dump (uuid_t *_uuid, char **_str); d93 1 a93 1 /* error handling */ @ 1.11 log @Fixed portability by replacing accidentally introduced uint{8,16,32}_t with the portable uuid_uint{8,16,32}_t. Prefix all variable symbols in uuid.h with underscores to avoid namespace conflicts. Submitted by: Guerry Semones @ text @d33 11 d92 2 @ 1.10 log @no need to duplicate here what is also in the API manpage @ text @d59 3 a61 3 extern uuid_rc_t uuid_create (uuid_t **uuid); extern uuid_rc_t uuid_destroy (uuid_t *uuid); extern uuid_rc_t uuid_nil (uuid_t *uuid); d64 2 a65 2 extern uuid_rc_t uuid_isnil (uuid_t *uuid, int *result); extern uuid_rc_t uuid_compare (uuid_t *uuid, uuid_t *uuid2, int *result); d68 2 a69 2 extern uuid_rc_t uuid_unpack (uuid_t *uuid, const void *buf); extern uuid_rc_t uuid_pack (uuid_t *uuid, void **buf); d72 2 a73 2 extern uuid_rc_t uuid_parse (uuid_t *uuid, const char *str); extern uuid_rc_t uuid_format (uuid_t *uuid, char **str); d76 2 a77 2 extern uuid_rc_t uuid_generate (uuid_t *uuid, unsigned int mode, ...); extern uuid_rc_t uuid_dump (uuid_t *uuid, char **str); d80 1 a80 1 extern char *uuid_error (uuid_rc_t rc); @ 1.9 log @clarify comment @ text @a32 37 /* * UUID Binary Representation: * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * 0| time_low | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * 1| time_mid | time_hi_and_version | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * 2|clk_seq_hi_res | clk_seq_low | node (0-1) | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * 3| node (2-5) | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * UUID ASCII String Representation: * * uuid = "-" "-" * "-" * * "-" * time_low = 4* * time_mid = 2* * time_high_and_version = 2* * clock_seq_and_reserved = * clock_seq_low = * node = 6* * hexOctet = * hexDigit = "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9" * |"a"|"b"|"c"|"d"|"e"|"f" * |"A"|"B"|"C"|"D"|"E"|"F" * * Example string representation of a UUID: * * "f81d4fae-7dec-11d0-a765-00a0c91e6bf6" */ @ 1.8 log @more documentation @ text @d104 1 a104 1 /* binary representation handling */ d108 1 a108 1 /* string representation handling */ @ 1.7 log @move out PRNG into own object and attach a PRNG and MD5 object for reuse into the UUID object @ text @d101 1 a102 1 extern uuid_rc_t uuid_isnil (uuid_t *uuid, int *result); @ 1.6 log @use format instead of unparse and fix pack/unpack usage @ text @d79 2 a80 1 UUID_RC_SYS = 3 @ 1.5 log @flush work of this forenoon @ text @d109 1 a109 1 extern uuid_rc_t uuid_unparse (uuid_t *uuid, char **str); @ 1.4 log @use 'nil' instead of 'null' because the standards name the special zeroed UUID 'nil' @ text @d72 1 a72 1 #define UUID_LEN_STR (128 / 4 /*nibbles*/ + 4 /*hyphens*/ + 1 /*nul*/) d97 1 a97 1 extern uuid_rc_t uuid_null (uuid_t *uuid); d103 3 a105 2 /* UUID generation */ extern uuid_rc_t uuid_generate (uuid_t *uuid, unsigned int mode, ...); d109 1 a109 1 extern uuid_rc_t uuid_format (uuid_t *uuid, char **str); d111 2 a112 5 /* binary representation handling */ extern uuid_rc_t uuid_read (uuid_t *uuid, const void *buf); extern uuid_rc_t uuid_write (uuid_t *uuid, void **buf); /* UUID dumping */ @ 1.3 log @introduce UUID versioning into API @ text @d101 1 a101 1 extern uuid_rc_t uuid_isnull (uuid_t *uuid, int *result); @ 1.2 log @simplify API @ text @d82 8 d104 1 a104 1 extern uuid_rc_t uuid_generate (uuid_t *uuid); d113 3 @ 1.1 log @import the first cut for our forthcoming OSSP uuid library @ text @d70 3 a72 5 /* encoding lengths */ #define UUID_LEN_BIN_BIT 128 #define UUID_LEN_BIN_CHR (UUID_LEN_BIN_BIT / 8 /*bytes*/) #define UUID_LEN_STR_CHR (UUID_LEN_BIN_BIT / 4 /*nibbles*/ + 4 /*hyphens*/ + 1 /*nul*/) #define UUID_LEN_STR_BIT (UUID_LEN_STR_CHR * 8) @