xref: /netbsd-src/include/uuid.h (revision f983e71d70cfccf7b3de601eb4d998b2d886ede4)
1*f983e71dSplunky /*	$NetBSD: uuid.h,v 1.2 2008/04/23 07:52:32 plunky Exp $	*/
2de1dfb12Sthorpej 
3de1dfb12Sthorpej /*-
4de1dfb12Sthorpej  * Copyright (c) 2002 Marcel Moolenaar
5de1dfb12Sthorpej  * Copyright (c) 2002 Hiten Mahesh Pandya
6de1dfb12Sthorpej  * All rights reserved.
7de1dfb12Sthorpej  *
8de1dfb12Sthorpej  * Redistribution and use in source and binary forms, with or without
9de1dfb12Sthorpej  * modification, are permitted provided that the following conditions
10de1dfb12Sthorpej  * are met:
11de1dfb12Sthorpej  * 1. Redistributions of source code must retain the above copyright
12de1dfb12Sthorpej  *    notice, this list of conditions and the following disclaimer.
13de1dfb12Sthorpej  * 2. Redistributions in binary form must reproduce the above copyright
14de1dfb12Sthorpej  *    notice, this list of conditions and the following disclaimer in the
15de1dfb12Sthorpej  *    documentation and/or other materials provided with the distribution.
16de1dfb12Sthorpej  *
17de1dfb12Sthorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18de1dfb12Sthorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19de1dfb12Sthorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20de1dfb12Sthorpej  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21de1dfb12Sthorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22de1dfb12Sthorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23de1dfb12Sthorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24de1dfb12Sthorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25de1dfb12Sthorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26de1dfb12Sthorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27de1dfb12Sthorpej  * SUCH DAMAGE.
28de1dfb12Sthorpej  *
29de1dfb12Sthorpej  * $FreeBSD: src/include/uuid.h,v 1.2 2002/11/05 10:55:16 jmallett Exp $
30de1dfb12Sthorpej  */
31de1dfb12Sthorpej 
32de1dfb12Sthorpej #ifndef _UUID_H_
33de1dfb12Sthorpej #define	_UUID_H_
34de1dfb12Sthorpej 
35de1dfb12Sthorpej #include <sys/types.h>
36de1dfb12Sthorpej #include <sys/uuid.h>
37de1dfb12Sthorpej 
38de1dfb12Sthorpej /* Status codes returned by the functions. */
39de1dfb12Sthorpej #define	uuid_s_ok			0
40de1dfb12Sthorpej #define	uuid_s_bad_version		1
41de1dfb12Sthorpej #define	uuid_s_invalid_string_uuid	2
42de1dfb12Sthorpej #define	uuid_s_no_memory		3
43de1dfb12Sthorpej 
44de1dfb12Sthorpej __BEGIN_DECLS
45*f983e71dSplunky int32_t	uuid_compare(const uuid_t *, const uuid_t *, uint32_t *);
46de1dfb12Sthorpej void	uuid_create(uuid_t *, uint32_t *);
47de1dfb12Sthorpej void	uuid_create_nil(uuid_t *, uint32_t *);
48*f983e71dSplunky int32_t	uuid_equal(const uuid_t *, const uuid_t *, uint32_t *);
49de1dfb12Sthorpej void	uuid_from_string(const char *, uuid_t *, uint32_t *);
50*f983e71dSplunky uint16_t uuid_hash(const uuid_t *, uint32_t *);
51*f983e71dSplunky int32_t	uuid_is_nil(const uuid_t *, uint32_t *);
52*f983e71dSplunky void	uuid_to_string(const uuid_t *, char **, uint32_t *);
53de1dfb12Sthorpej 
54de1dfb12Sthorpej void	uuid_enc_le(void *, const uuid_t *);
55de1dfb12Sthorpej void	uuid_dec_le(const void *, uuid_t *);
56de1dfb12Sthorpej void	uuid_enc_be(void *, const uuid_t *);
57de1dfb12Sthorpej void	uuid_dec_be(const void *, uuid_t *);
58de1dfb12Sthorpej __END_DECLS
59de1dfb12Sthorpej 
60de1dfb12Sthorpej #endif	/* _UUID_H_ */
61