1 /* 2 ** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. 3 ** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & 4 ** Digital Equipment Corporation, Maynard, Mass. 5 ** Copyright (c) 1998 Microsoft. 6 ** To anyone who acknowledges that this file is provided "AS IS" 7 ** without any express or implied warranty: permission to use, copy, 8 ** modify, and distribute this file for any purpose is hereby 9 ** granted without fee, provided that the above copyright notices and 10 ** this notice appears in all source code copies, and that none of 11 ** the names of Open Software Foundation, Inc., Hewlett-Packard 12 ** Company, or Digital Equipment Corporation be used in advertising 13 ** or publicity pertaining to distribution of the software without 14 ** specific, written prior permission. Neither Open Software 15 ** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment 16 ** Corporation makes any representations about the suitability of 17 ** this software for any purpose. 18 */ 19 20 typedef struct _uuid_upnp { 21 unsigned32 time_low; 22 unsigned16 time_mid; 23 unsigned16 time_hi_and_version; 24 unsigned8 clock_seq_hi_and_reserved; 25 unsigned8 clock_seq_low; 26 byte node[6]; 27 } uuid_upnp; 28 29 /* uuid_create -- generate a UUID */ 30 int uuid_create(uuid_upnp * id); 31 void uuid_unpack(uuid_upnp *u, char *out); // out will be xxxx-xx-xx-xx-xxxxxx format 32 33 /* uuid_create_from_name -- create a UUID using a "name" 34 from a "name space" */ 35 void uuid_create_from_name( 36 uuid_upnp * uid, /* resulting UUID */ 37 uuid_upnp nsid, /* UUID to serve as context, so identical 38 names from different name spaces generate 39 different UUIDs */ 40 void * name, /* the name from which to generate a UUID */ 41 int namelen /* the length of the name */ 42 ); 43 44 /* uuid_compare -- Compare two UUID's "lexically" and return 45 -1 u1 is lexically before u2 46 0 u1 is equal to u2 47 1 u1 is lexically after u2 48 Note: lexical ordering is not temporal ordering! 49 */ 50 int uuid_compare(uuid_upnp *u1, uuid_upnp *u2); 51