xref: /freebsd/include/uuid.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
165393a86SMarcel Moolenaar /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3e58eb3c4SPedro F. Giffuni  *
41d1b40feSMarcel Moolenaar  * Copyright (c) 2002,2005 Marcel Moolenaar
565393a86SMarcel Moolenaar  * Copyright (c) 2002 Hiten Mahesh Pandya
665393a86SMarcel Moolenaar  * All rights reserved.
765393a86SMarcel Moolenaar  *
865393a86SMarcel Moolenaar  * Redistribution and use in source and binary forms, with or without
965393a86SMarcel Moolenaar  * modification, are permitted provided that the following conditions
1065393a86SMarcel Moolenaar  * are met:
1165393a86SMarcel Moolenaar  * 1. Redistributions of source code must retain the above copyright
1265393a86SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer.
1365393a86SMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
1465393a86SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
1565393a86SMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
1665393a86SMarcel Moolenaar  *
1765393a86SMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1865393a86SMarcel Moolenaar  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1965393a86SMarcel Moolenaar  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2065393a86SMarcel Moolenaar  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2165393a86SMarcel Moolenaar  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2265393a86SMarcel Moolenaar  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2365393a86SMarcel Moolenaar  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2465393a86SMarcel Moolenaar  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2565393a86SMarcel Moolenaar  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2665393a86SMarcel Moolenaar  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2765393a86SMarcel Moolenaar  * SUCH DAMAGE.
2865393a86SMarcel Moolenaar  */
2965393a86SMarcel Moolenaar 
3065393a86SMarcel Moolenaar #ifndef _UUID_H_
3165393a86SMarcel Moolenaar #define	_UUID_H_
3265393a86SMarcel Moolenaar 
3365393a86SMarcel Moolenaar #include <sys/types.h>
3465393a86SMarcel Moolenaar #include <sys/uuid.h>
3565393a86SMarcel Moolenaar 
3665393a86SMarcel Moolenaar /*
3765393a86SMarcel Moolenaar  * This implementation mostly conforms to the DCE 1.1 specification.
3865393a86SMarcel Moolenaar  * See Also:
3965393a86SMarcel Moolenaar  *	uuidgen(1), uuidgen(2), uuid(3)
4065393a86SMarcel Moolenaar  */
4165393a86SMarcel Moolenaar 
4265393a86SMarcel Moolenaar /* Status codes returned by the functions. */
4365393a86SMarcel Moolenaar #define	uuid_s_ok			0
4465393a86SMarcel Moolenaar #define	uuid_s_bad_version		1
4565393a86SMarcel Moolenaar #define	uuid_s_invalid_string_uuid	2
4665393a86SMarcel Moolenaar #define	uuid_s_no_memory		3
4765393a86SMarcel Moolenaar 
487a9b006dSJuli Mallett __BEGIN_DECLS
491d1b40feSMarcel Moolenaar int32_t	uuid_compare(const uuid_t *, const uuid_t *, uint32_t *);
5065393a86SMarcel Moolenaar void	uuid_create(uuid_t *, uint32_t *);
5165393a86SMarcel Moolenaar void	uuid_create_nil(uuid_t *, uint32_t *);
521d1b40feSMarcel Moolenaar int32_t	uuid_equal(const uuid_t *, const uuid_t *, uint32_t *);
5365393a86SMarcel Moolenaar void	uuid_from_string(const char *, uuid_t *, uint32_t *);
541d1b40feSMarcel Moolenaar uint16_t uuid_hash(const uuid_t *, uint32_t *);
551d1b40feSMarcel Moolenaar int32_t	uuid_is_nil(const uuid_t *, uint32_t *);
561d1b40feSMarcel Moolenaar void	uuid_to_string(const uuid_t *, char **, uint32_t *);
578e1daad9SMaksim Yevmenkin void	uuid_enc_le(void *, const uuid_t *);
588e1daad9SMaksim Yevmenkin void	uuid_dec_le(const void *, uuid_t *);
598e1daad9SMaksim Yevmenkin void	uuid_enc_be(void *, const uuid_t *);
608e1daad9SMaksim Yevmenkin void	uuid_dec_be(const void *, uuid_t *);
617a9b006dSJuli Mallett __END_DECLS
6265393a86SMarcel Moolenaar 
6365393a86SMarcel Moolenaar #endif	/* _UUID_H_ */
64