186d7f5d3SJohn Marino.\" Copyright (c) 2002 Marcel Moolenaar 286d7f5d3SJohn Marino.\" Copyright (c) 2002 Hiten Mahesh Pandya 386d7f5d3SJohn Marino.\" All rights reserved. 486d7f5d3SJohn Marino.\" 586d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without 686d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions 786d7f5d3SJohn Marino.\" are met: 886d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 986d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer. 1086d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 1186d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 1286d7f5d3SJohn Marino.\" documentation and/or other materials provided with the distribution. 1386d7f5d3SJohn Marino.\" 1486d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1586d7f5d3SJohn Marino.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1686d7f5d3SJohn Marino.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1786d7f5d3SJohn Marino.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1886d7f5d3SJohn Marino.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 1986d7f5d3SJohn Marino.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 2086d7f5d3SJohn Marino.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2186d7f5d3SJohn Marino.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2286d7f5d3SJohn Marino.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2386d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2486d7f5d3SJohn Marino.\" SUCH DAMAGE. 2586d7f5d3SJohn Marino.\" 2686d7f5d3SJohn Marino.\" $FreeBSD: src/lib/libc/uuid/uuid.3,v 1.7 2008/08/14 22:23:16 emax Exp $ 2786d7f5d3SJohn Marino.\" $DragonFly: src/lib/libc/uuid/uuid.3,v 1.8 2008/08/21 21:41:55 swildner Exp $ 2886d7f5d3SJohn Marino.\" 2986d7f5d3SJohn Marino.Dd August 13, 2008 3086d7f5d3SJohn Marino.Dt UUID 3 3186d7f5d3SJohn Marino.Os 3286d7f5d3SJohn Marino.Sh NAME 3386d7f5d3SJohn Marino.Nm uuid_addr_lookup , 3486d7f5d3SJohn Marino.Nm uuid_compare , 3586d7f5d3SJohn Marino.Nm uuid_create , 3686d7f5d3SJohn Marino.Nm uuid_create_nil , 3786d7f5d3SJohn Marino.Nm uuid_equal , 3886d7f5d3SJohn Marino.Nm uuid_from_string , 3986d7f5d3SJohn Marino.Nm uuid_hash , 4086d7f5d3SJohn Marino.Nm uuid_is_nil , 4186d7f5d3SJohn Marino.Nm uuid_name_lookup , 4286d7f5d3SJohn Marino.Nm uuid_reset_lookup , 4386d7f5d3SJohn Marino.Nm uuid_to_string 4486d7f5d3SJohn Marino.Nd DCE 1.1 compliant UUID functions 4586d7f5d3SJohn Marino.Sh LIBRARY 4686d7f5d3SJohn Marino.Lb libc 4786d7f5d3SJohn Marino.Sh SYNOPSIS 4886d7f5d3SJohn Marino.In uuid.h 4986d7f5d3SJohn Marino.Ft void 5086d7f5d3SJohn Marino.Fn uuid_addr_lookup "const uuid_t *u" "char **strp" "uint32_t *status" 5186d7f5d3SJohn Marino.Ft int32_t 5286d7f5d3SJohn Marino.Fn uuid_compare "const uuid_t *uuid1" "const uuid_t *uuid2" "uint32_t *status" 5386d7f5d3SJohn Marino.Ft void 5486d7f5d3SJohn Marino.Fn uuid_create "uuid_t *uuid" "uint32_t *status" 5586d7f5d3SJohn Marino.Ft void 5686d7f5d3SJohn Marino.Fn uuid_create_nil "uuid_t *uuid" "uint32_t *status" 5786d7f5d3SJohn Marino.Ft int32_t 5886d7f5d3SJohn Marino.Fn uuid_equal "const uuid_t *uuid1" "const uuid_t *uuid2" "uint32_t *status" 5986d7f5d3SJohn Marino.Ft void 6086d7f5d3SJohn Marino.Fn uuid_from_string "const char *str" "uuid_t *uuid" "uint32_t *status" 6186d7f5d3SJohn Marino.Ft uint16_t 6286d7f5d3SJohn Marino.Fn uuid_hash "const uuid_t *uuid" "uint32_t *status" 6386d7f5d3SJohn Marino.Ft int32_t 6486d7f5d3SJohn Marino.Fn uuid_is_nil "const uuid_t *uuid" "uint32_t *status" 6586d7f5d3SJohn Marino.Ft void 6686d7f5d3SJohn Marino.Fn uuid_name_lookup "uuid_t *u" "const char *str" "uint32_t *status" 6786d7f5d3SJohn Marino.Ft void 6886d7f5d3SJohn Marino.Fn uuid_reset_lookup "void" 6986d7f5d3SJohn Marino.Ft void 7086d7f5d3SJohn Marino.Fn uuid_to_string "const uuid_t *uuid" "char **str" "uint32_t *status" 7186d7f5d3SJohn Marino.Ft void 7286d7f5d3SJohn Marino.Fn uuid_enc_le "void *buf" "const uuid_t *uuid" 7386d7f5d3SJohn Marino.Ft void 7486d7f5d3SJohn Marino.Fn uuid_dec_le "const void *buf" "uuid_t *" 7586d7f5d3SJohn Marino.Ft void 7686d7f5d3SJohn Marino.Fn uuid_enc_be "void *buf" "const uuid_t *uuid" 7786d7f5d3SJohn Marino.Ft void 7886d7f5d3SJohn Marino.Fn uuid_dec_be "const void *buf" "uuid_t *" 7986d7f5d3SJohn Marino.Sh DESCRIPTION 8086d7f5d3SJohn MarinoThe family of DCE 1.1 compliant UUID functions allow applications to operate 8186d7f5d3SJohn Marinoon universally unique identifiers, or UUIDs. 8286d7f5d3SJohn MarinoThe 8386d7f5d3SJohn Marino.Fn uuid_create 8486d7f5d3SJohn Marinoand 8586d7f5d3SJohn Marino.Fn uuid_create_nil 8686d7f5d3SJohn Marinofunctions create UUIDs. 8786d7f5d3SJohn MarinoThe 8886d7f5d3SJohn Marino.Fn uuid_compare , 8986d7f5d3SJohn Marino.Fn uuid_equal 9086d7f5d3SJohn Marinoand 9186d7f5d3SJohn Marino.Fn uuid_is_nil 9286d7f5d3SJohn Marinofunctions can be used to test UUIDs. 9386d7f5d3SJohn MarinoTo convert from the binary representation to the string representation or 9486d7f5d3SJohn Marinovice versa, use 9586d7f5d3SJohn Marino.Fn uuid_to_string 9686d7f5d3SJohn Marinoor 9786d7f5d3SJohn Marino.Fn uuid_from_string 9886d7f5d3SJohn Marinorespectively. 9986d7f5d3SJohn MarinoA 16-bit hash value can be obtained by calling 10086d7f5d3SJohn Marino.Fn uuid_hash . 10186d7f5d3SJohn Marino.Pp 10286d7f5d3SJohn MarinoString equivalents to UUIDs may be available. 10386d7f5d3SJohn MarinoThe 10486d7f5d3SJohn Marino.Fn uuid_addr_lookup 10586d7f5d3SJohn Marinofunction will lookup the symbolic name given a UUID. 10686d7f5d3SJohn MarinoThe variable 10786d7f5d3SJohn Marino.Fa *strp 10886d7f5d3SJohn Marinoshould be initialized to 10986d7f5d3SJohn Marino.Dv NULL . 11086d7f5d3SJohn MarinoSuccessive calls to 11186d7f5d3SJohn Marino.Fn uuid_addr_lookup 11286d7f5d3SJohn Marinowill free the previous contents prior to doing the lookup. 11386d7f5d3SJohn MarinoThe last string may be freed by calling the function with a 11486d7f5d3SJohn Marino.Dv NULL 11586d7f5d3SJohn MarinoUUID. 11686d7f5d3SJohn MarinoIf a lookup fails, 11786d7f5d3SJohn Marino.Fa *strp 11886d7f5d3SJohn Marinowill be set to 11986d7f5d3SJohn Marino.Dv NULL 12086d7f5d3SJohn Marinoand 12186d7f5d3SJohn Marino.Fa *status 12286d7f5d3SJohn Marino(if 12386d7f5d3SJohn Marino.Fa status 12486d7f5d3SJohn Marinois not 12586d7f5d3SJohn Marino.Dv NULL ) 12686d7f5d3SJohn Marinowill be set to 12786d7f5d3SJohn Marino.Dv uuid_s_not_found . 12886d7f5d3SJohn MarinoOtherwise 12986d7f5d3SJohn Marino.Fa *strp 13086d7f5d3SJohn Marinowill be assigned to the symbolic name and 13186d7f5d3SJohn Marino.Fa *status 13286d7f5d3SJohn Marinowill be set to 13386d7f5d3SJohn Marino.Dv uuid_s_ok . 13486d7f5d3SJohn Marino.Pp 13586d7f5d3SJohn MarinoThe 13686d7f5d3SJohn Marino.Fn uuid_name_lookup 13786d7f5d3SJohn Marinofunction will lookup a UUID given a symbolic name. 13886d7f5d3SJohn MarinoThe contents of the uuid will be zeroed out if a lookup fails. 13986d7f5d3SJohn Marino.Pp 14086d7f5d3SJohn MarinoThe 14186d7f5d3SJohn Marino.Fn uuid_reset_lookup 14286d7f5d3SJohn Marinofunction will clear its in-memory cache of UUID<->NAME conversions. 14386d7f5d3SJohn MarinoThe next lookup will reload the cache. 14486d7f5d3SJohn Marino.Pp 14586d7f5d3SJohn MarinoThe 14686d7f5d3SJohn Marino.Fn uuid_enc_le 14786d7f5d3SJohn Marinoand 14886d7f5d3SJohn Marino.Fn uuid_enc_be 14986d7f5d3SJohn Marinofunctions encode a binary representation of a UUID into an octet stream 15086d7f5d3SJohn Marinoin little-endian and big-endian byte-order, respectively. 15186d7f5d3SJohn MarinoThe destination buffer must be pre-allocated by the caller, and must be 15286d7f5d3SJohn Marinolarge enough to hold the 16-octet binary UUID. 15386d7f5d3SJohn MarinoThese routines are not part of the DCE RPC API. 15486d7f5d3SJohn MarinoThey are provided for convenience. 15586d7f5d3SJohn Marino.Pp 15686d7f5d3SJohn MarinoThe 15786d7f5d3SJohn Marino.Fn uuid_dec_le 15886d7f5d3SJohn Marinoand 15986d7f5d3SJohn Marino.Fn uuid_dec_be 16086d7f5d3SJohn Marinofunctions decode a UUID from an octet stream in little-endian and 16186d7f5d3SJohn Marinobig-endian byte-order, respectively. 16286d7f5d3SJohn MarinoThese routines are not part of the DCE RPC API. 16386d7f5d3SJohn MarinoThey are provided for convenience. 16486d7f5d3SJohn Marino.Sh RETURN VALUES 16586d7f5d3SJohn MarinoThe successful or unsuccessful completion of the function is returned in the 16686d7f5d3SJohn Marino.Fa status 16786d7f5d3SJohn Marinoargument. 16886d7f5d3SJohn MarinoPossible values are: 16986d7f5d3SJohn Marino.Bl -tag -width ".Dv uuid_s_invalid_string_uuid" 17086d7f5d3SJohn Marino.It Dv uuid_s_ok 17186d7f5d3SJohn MarinoThe function completed successfully. 17286d7f5d3SJohn Marino.It Dv uuid_s_bad_version 17386d7f5d3SJohn MarinoThe UUID does not have a known version. 17486d7f5d3SJohn Marino.It Dv uuid_s_invalid_string_uuid 17586d7f5d3SJohn MarinoThe string representation of an UUID is not valid. 17686d7f5d3SJohn Marino.It Dv uuid_s_no_memory 17786d7f5d3SJohn MarinoThe meaning of the code escaped the writers mind. 17886d7f5d3SJohn Marino.It Dv uuid_s_not_found 17986d7f5d3SJohn MarinoA UUID lookup failed. 18086d7f5d3SJohn Marino.El 18186d7f5d3SJohn Marino.Sh FILES 18286d7f5d3SJohn Marino.Bl -tag -width ".Pa /etc/defaults/uuids" 18386d7f5d3SJohn Marino.It Pa /etc/defaults/uuids 18486d7f5d3SJohn MarinoA list of UUIDs and their symbolic names provided by the OS vendor. 18586d7f5d3SJohn Marino.It Pa /etc/uuids 18686d7f5d3SJohn MarinoA list of UUIDs and their symbolic names provided by the system administrator. 18786d7f5d3SJohn Marino.El 18886d7f5d3SJohn Marino.Sh SEE ALSO 18986d7f5d3SJohn Marino.Xr uuidgen 1 , 19086d7f5d3SJohn Marino.Xr uuidgen 2 , 19186d7f5d3SJohn Marino.Xr uuids 5 19286d7f5d3SJohn Marino.Sh STANDARDS 19386d7f5d3SJohn MarinoThe UUID functions conform to the DCE 1.1 RPC specification. 194