uuid.h

00001 /*
00002  * Public include file for the UUID library
00003  * 
00004  * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
00005  *
00006  * %Begin-Header%
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, and the entire permission notice in its entirety,
00012  *    including the disclaimer of warranties.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. The name of the author may not be used to endorse or promote
00017  *    products derived from this software without specific prior
00018  *    written permission.
00019  * 
00020  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
00021  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00022  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
00023  * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
00024  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00025  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00026  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
00027  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00028  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00030  * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
00031  * DAMAGE.
00032  * %End-Header%
00033  */
00034 
00035 #ifndef _UUID_UUID_H
00036 #define _UUID_UUID_H
00037 
00038 #include <sys/types.h>
00039 #include <sys/time.h>
00040 #include <time.h>
00041 
00042 typedef unsigned char uuid_t[16];
00043 
00044 /* UUID Variant definitions */
00045 #define UUID_VARIANT_NCS        0
00046 #define UUID_VARIANT_DCE        1
00047 #define UUID_VARIANT_MICROSOFT  2
00048 #define UUID_VARIANT_OTHER      3
00049 
00050 /* UUID Type definitions */
00051 #define UUID_TYPE_DCE_TIME   1
00052 #define UUID_TYPE_DCE_RANDOM 4
00053 
00054 /* Allow UUID constants to be defined */
00055 #ifdef __GNUC__
00056 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
00057         static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
00058 #else
00059 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
00060         static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
00061 #endif
00062 
00063 #ifdef __cplusplus
00064 extern "C" {
00065 #endif
00066 
00067 /* clear.c */
00068 void uuid_clear(uuid_t uu);
00069 
00070 /* compare.c */
00071 int uuid_compare(const uuid_t uu1, const uuid_t uu2);
00072 
00073 /* copy.c */
00074 void uuid_copy(uuid_t dst, const uuid_t src);
00075 
00076 /* gen_uuid.c */
00077 void uuid_generate(uuid_t out);
00078 void uuid_generate_random(uuid_t out);
00079 void uuid_generate_time(uuid_t out);
00080 
00081 /* isnull.c */
00082 int uuid_is_null(const uuid_t uu);
00083 
00084 /* parse.c */
00085 int uuid_parse(const char *in, uuid_t uu);
00086 
00087 /* unparse.c */
00088 void uuid_unparse(const uuid_t uu, char *out);
00089 void uuid_unparse_lower(const uuid_t uu, char *out);
00090 void uuid_unparse_upper(const uuid_t uu, char *out);
00091 
00092 /* uuid_time.c */
00093 time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
00094 int uuid_type(const uuid_t uu);
00095 int uuid_variant(const uuid_t uu);
00096 
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100 
00101 #endif /* _UUID_UUID_H */

Generated on Sun Sep 24 20:10:49 2006 for WvStreams by  doxygen 1.4.7