annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/uuid/uuid.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /*
jpayne@69 2 * Public include file for the UUID library
jpayne@69 3 *
jpayne@69 4 * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
jpayne@69 5 *
jpayne@69 6 * %Begin-Header%
jpayne@69 7 * Redistribution and use in source and binary forms, with or without
jpayne@69 8 * modification, are permitted provided that the following conditions
jpayne@69 9 * are met:
jpayne@69 10 * 1. Redistributions of source code must retain the above copyright
jpayne@69 11 * notice, and the entire permission notice in its entirety,
jpayne@69 12 * including the disclaimer of warranties.
jpayne@69 13 * 2. Redistributions in binary form must reproduce the above copyright
jpayne@69 14 * notice, this list of conditions and the following disclaimer in the
jpayne@69 15 * documentation and/or other materials provided with the distribution.
jpayne@69 16 * 3. The name of the author may not be used to endorse or promote
jpayne@69 17 * products derived from this software without specific prior
jpayne@69 18 * written permission.
jpayne@69 19 *
jpayne@69 20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
jpayne@69 21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
jpayne@69 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
jpayne@69 23 * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
jpayne@69 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
jpayne@69 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
jpayne@69 26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
jpayne@69 27 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
jpayne@69 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
jpayne@69 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
jpayne@69 30 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
jpayne@69 31 * DAMAGE.
jpayne@69 32 * %End-Header%
jpayne@69 33 */
jpayne@69 34
jpayne@69 35 #ifndef _UL_LIBUUID_UUID_H
jpayne@69 36 #define _UL_LIBUUID_UUID_H
jpayne@69 37
jpayne@69 38 #include <sys/types.h>
jpayne@69 39 #ifndef _WIN32
jpayne@69 40 #include <sys/time.h>
jpayne@69 41 #endif
jpayne@69 42 #include <time.h>
jpayne@69 43
jpayne@69 44 typedef unsigned char uuid_t[16];
jpayne@69 45
jpayne@69 46 /* UUID Variant definitions */
jpayne@69 47 #define UUID_VARIANT_NCS 0
jpayne@69 48 #define UUID_VARIANT_DCE 1
jpayne@69 49 #define UUID_VARIANT_MICROSOFT 2
jpayne@69 50 #define UUID_VARIANT_OTHER 3
jpayne@69 51
jpayne@69 52 #define UUID_VARIANT_SHIFT 5
jpayne@69 53 #define UUID_VARIANT_MASK 0x7
jpayne@69 54
jpayne@69 55 /* UUID Type definitions */
jpayne@69 56 #define UUID_TYPE_DCE_NIL 0
jpayne@69 57 #define UUID_TYPE_DCE_TIME 1
jpayne@69 58 #define UUID_TYPE_DCE_SECURITY 2
jpayne@69 59 #define UUID_TYPE_DCE_MD5 3
jpayne@69 60 #define UUID_TYPE_DCE_RANDOM 4
jpayne@69 61 #define UUID_TYPE_DCE_SHA1 5
jpayne@69 62
jpayne@69 63 #define UUID_TYPE_SHIFT 4
jpayne@69 64 #define UUID_TYPE_MASK 0xf
jpayne@69 65
jpayne@69 66 #define UUID_STR_LEN 37
jpayne@69 67
jpayne@69 68 /* Allow UUID constants to be defined */
jpayne@69 69 #ifdef __GNUC__
jpayne@69 70 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
jpayne@69 71 static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
jpayne@69 72 #else
jpayne@69 73 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
jpayne@69 74 static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
jpayne@69 75 #endif
jpayne@69 76
jpayne@69 77 #ifdef __cplusplus
jpayne@69 78 extern "C" {
jpayne@69 79 #endif
jpayne@69 80
jpayne@69 81 /* clear.c */
jpayne@69 82 extern void uuid_clear(uuid_t uu);
jpayne@69 83
jpayne@69 84 /* compare.c */
jpayne@69 85 extern int uuid_compare(const uuid_t uu1, const uuid_t uu2);
jpayne@69 86
jpayne@69 87 /* copy.c */
jpayne@69 88 extern void uuid_copy(uuid_t dst, const uuid_t src);
jpayne@69 89
jpayne@69 90 /* gen_uuid.c */
jpayne@69 91 extern void uuid_generate(uuid_t out);
jpayne@69 92 extern void uuid_generate_random(uuid_t out);
jpayne@69 93 extern void uuid_generate_time(uuid_t out);
jpayne@69 94 extern int uuid_generate_time_safe(uuid_t out);
jpayne@69 95
jpayne@69 96 extern void uuid_generate_md5(uuid_t out, const uuid_t ns, const char *name, size_t len);
jpayne@69 97 extern void uuid_generate_sha1(uuid_t out, const uuid_t ns, const char *name, size_t len);
jpayne@69 98
jpayne@69 99 /* isnull.c */
jpayne@69 100 extern int uuid_is_null(const uuid_t uu);
jpayne@69 101
jpayne@69 102 /* parse.c */
jpayne@69 103 extern int uuid_parse(const char *in, uuid_t uu);
jpayne@69 104 extern int uuid_parse_range(const char *in_start, const char *in_end, uuid_t uu);
jpayne@69 105
jpayne@69 106 /* unparse.c */
jpayne@69 107 extern void uuid_unparse(const uuid_t uu, char *out);
jpayne@69 108 extern void uuid_unparse_lower(const uuid_t uu, char *out);
jpayne@69 109 extern void uuid_unparse_upper(const uuid_t uu, char *out);
jpayne@69 110
jpayne@69 111 /* uuid_time.c */
jpayne@69 112 extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
jpayne@69 113 extern int uuid_type(const uuid_t uu);
jpayne@69 114 extern int uuid_variant(const uuid_t uu);
jpayne@69 115
jpayne@69 116 /* predefined.c */
jpayne@69 117 extern const uuid_t *uuid_get_template(const char *alias);
jpayne@69 118
jpayne@69 119 #ifdef __cplusplus
jpayne@69 120 }
jpayne@69 121 #endif
jpayne@69 122
jpayne@69 123 #endif /* _UL_LIBUUID_UUID_H */