1 /* 2 ** OSSP uuid - Universally Unique Identifier 3 ** Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com> 4 ** Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/> 5 ** 6 ** This file is part of OSSP uuid, a library for the generation 7 ** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ 8 ** 9 ** Permission to use, copy, modify, and distribute this software for 10 ** any purpose with or without fee is hereby granted, provided that 11 ** the above copyright notice and this permission notice appear in all 12 ** copies. 13 ** 14 ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 15 ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 18 ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 21 ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 ** SUCH DAMAGE. 26 ** 27 ** uuid_dce.h: DCE 1.1 compatibility API definition 28 */ 29 30 #ifndef __UUID_DCE_H___ 31 #define __UUID_DCE_H___ 32 33 /* sanity check usage */ 34 #ifdef __UUID_H__ 35 #error the regular OSSP uuid API and the DCE 1.1 backward compatibility API are mutually exclusive -- you cannot use them at the same time. 36 #endif 37 38 /* resolve namespace conflicts (at linking level) with regular OSSP uuid API */ 39 #define uuid_create uuid_dce_create 40 #define uuid_create_nil uuid_dce_create_nil 41 #define uuid_is_nil uuid_dce_is_nil 42 #define uuid_compare uuid_dce_compare 43 #define uuid_equal uuid_dce_equal 44 #define uuid_from_string uuid_dce_from_string 45 #define uuid_to_string uuid_dce_to_string 46 #define uuid_hash uuid_dce_hash 47 48 /* DCE 1.1 uuid_t type */ 49 typedef struct { 50 #if 0 51 /* stricter but unportable version */ 52 uuid_uint32_t time_low; 53 uuid_uint16_t time_mid; 54 uuid_uint16_t time_hi_and_version; 55 uuid_uint8_t clock_seq_hi_and_reserved; 56 uuid_uint8_t clock_seq_low; 57 uuid_uint8_t node[6]; 58 #else 59 /* sufficient and portable version */ 60 unsigned char data[16]; 61 #endif 62 } uuid_t; 63 typedef uuid_t *uuid_p_t; 64 65 /* DCE 1.1 uuid_vector_t type */ 66 typedef struct { 67 unsigned int count; 68 uuid_t *uuid[1]; 69 } uuid_vector_t; 70 71 /* DCE 1.1 UUID API status codes */ 72 enum { 73 uuid_s_ok = 0, /* standardized */ 74 uuid_s_error = 1 /* implementation specific */ 75 }; 76 77 /* DCE 1.1 UUID API functions */ 78 extern void uuid_create (uuid_t *, int *); 79 extern void uuid_create_nil (uuid_t *, int *); 80 extern int uuid_is_nil (uuid_t *, int *); 81 extern int uuid_compare (uuid_t *, uuid_t *, int *); 82 extern int uuid_equal (uuid_t *, uuid_t *, int *); 83 extern void uuid_from_string (const char *, uuid_t *, int *); 84 extern void uuid_to_string (uuid_t *, char **, int *); 85 extern unsigned int uuid_hash (uuid_t *, int *); 86 87 #endif /* __UUID_DCE_H___ */ 88 89