00001 /***************************** License ********************************** 00002 00003 Copyright (C) 2008 by Communicative Machines 00004 http://www.cmlabs.com All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 ************************************************************************/ 00021 #include "copyrt.h" 00022 #undef uuid__t 00023 00024 typedef struct _uuid__t { 00025 unsigned32 time_low; 00026 unsigned16 time_mid; 00027 unsigned16 time_hi_and_version; 00028 unsigned8 clock_seq_hi_and_reserved; 00029 unsigned8 clock_seq_low; 00030 byte node[6]; 00031 } uuid__t; 00032 00033 /* uuid_create -- generate a UUID */ 00034 int uuid_create(uuid__t * uuid); 00035 00036 /* uuid_create_from_name -- create a UUID using a "name" 00037 from a "name space" */ 00038 void uuid_create_from_name( 00039 uuid__t * uuid, /* resulting UUID */ 00040 uuid__t nsid, /* UUID to serve as context, so identical 00041 names from different name spaces generate 00042 different UUIDs */ 00043 void * name, /* the name from which to generate a UUID */ 00044 int namelen /* the length of the name */ 00045 ); 00046 00047 /* uuid_compare -- Compare two UUID's "lexically" and return 00048 -1 u1 is lexically before u2 00049 0 u1 is equal to u2 00050 1 u1 is lexically after u2 00051 Note: lexical ordering is not temporal ordering! 00052 */ 00053 int uuid_compare(uuid__t *u1, uuid__t *u2);