Merge branch 'vendor/OPENSSH'
[dragonfly.git] / lib / libc / uuid / uuid.3
1 .\" Copyright (c) 2002 Marcel Moolenaar
2 .\" Copyright (c) 2002 Hiten Mahesh Pandya
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
21 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD: src/lib/libc/uuid/uuid.3,v 1.7 2008/08/14 22:23:16 emax Exp $
27 .\" $DragonFly: src/lib/libc/uuid/uuid.3,v 1.8 2008/08/21 21:41:55 swildner Exp $
28 .\"
29 .Dd August 13, 2008
30 .Dt UUID 3
31 .Os
32 .Sh NAME
33 .Nm uuid_addr_lookup ,
34 .Nm uuid_compare ,
35 .Nm uuid_create ,
36 .Nm uuid_create_nil ,
37 .Nm uuid_equal ,
38 .Nm uuid_from_string ,
39 .Nm uuid_hash ,
40 .Nm uuid_is_nil ,
41 .Nm uuid_name_lookup ,
42 .Nm uuid_reset_lookup ,
43 .Nm uuid_to_string
44 .Nd DCE 1.1 compliant UUID functions
45 .Sh LIBRARY
46 .Lb libc
47 .Sh SYNOPSIS
48 .In uuid.h
49 .Ft void
50 .Fn uuid_addr_lookup "const uuid_t *u" "char **strp" "uint32_t *status"
51 .Ft int32_t
52 .Fn uuid_compare "const uuid_t *uuid1" "const uuid_t *uuid2" "uint32_t *status"
53 .Ft void
54 .Fn uuid_create "uuid_t *uuid" "uint32_t *status"
55 .Ft void
56 .Fn uuid_create_nil "uuid_t *uuid" "uint32_t *status"
57 .Ft int32_t
58 .Fn uuid_equal "const uuid_t *uuid1" "const uuid_t *uuid2" "uint32_t *status"
59 .Ft void
60 .Fn uuid_from_string "const char *str" "uuid_t *uuid" "uint32_t *status"
61 .Ft uint16_t
62 .Fn uuid_hash "const uuid_t *uuid" "uint32_t *status"
63 .Ft int32_t
64 .Fn uuid_is_nil "const uuid_t *uuid" "uint32_t *status"
65 .Ft void
66 .Fn uuid_name_lookup "uuid_t *u" "const char *str" "uint32_t *status"
67 .Ft void
68 .Fn uuid_reset_lookup "void"
69 .Ft void
70 .Fn uuid_to_string "const uuid_t *uuid" "char **str" "uint32_t *status"
71 .Ft void
72 .Fn uuid_enc_le "void *buf" "const uuid_t *uuid"
73 .Ft void
74 .Fn uuid_dec_le "const void *buf" "uuid_t *"
75 .Ft void
76 .Fn uuid_enc_be "void *buf" "const uuid_t *uuid"
77 .Ft void
78 .Fn uuid_dec_be "const void *buf" "uuid_t *"
79 .Sh DESCRIPTION
80 The family of DCE 1.1 compliant UUID functions allow applications to operate
81 on universally unique identifiers, or UUIDs.
82 The
83 .Fn uuid_create
84 and
85 .Fn uuid_create_nil
86 functions create UUIDs.
87 The
88 .Fn uuid_compare ,
89 .Fn uuid_equal
90 and
91 .Fn uuid_is_nil
92 functions can be used to test UUIDs.
93 To convert from the binary representation to the string representation or
94 vice versa, use
95 .Fn uuid_to_string
96 or
97 .Fn uuid_from_string
98 respectively.
99 A 16-bit hash value can be obtained by calling
100 .Fn uuid_hash .
101 .Pp
102 String equivalents to UUIDs may be available.
103 The
104 .Fn uuid_addr_lookup
105 function will lookup the symbolic name given a UUID.
106 The variable
107 .Fa *strp
108 should be initialized to
109 .Dv NULL .
110 Successive calls to
111 .Fn uuid_addr_lookup
112 will free the previous contents prior to doing the lookup.
113 The last string may be freed by calling the function with a
114 .Dv NULL
115 UUID.
116 If a lookup fails,
117 .Fa *strp
118 will be set to
119 .Dv NULL
120 and
121 .Fa *status
122 (if
123 .Fa status
124 is not
125 .Dv NULL )
126 will be set to
127 .Dv uuid_s_not_found .
128 Otherwise
129 .Fa *strp
130 will be assigned to the symbolic name and
131 .Fa *status
132 will be set to
133 .Dv uuid_s_ok .
134 .Pp
135 The
136 .Fn uuid_name_lookup
137 function will lookup a UUID given a symbolic name.
138 The contents of the uuid will be zeroed out if a lookup fails.
139 .Pp
140 The
141 .Fn uuid_reset_lookup
142 function will clear its in-memory cache of UUID<->NAME conversions.
143 The next lookup will reload the cache.
144 .Pp
145 The
146 .Fn uuid_enc_le
147 and
148 .Fn uuid_enc_be
149 functions encode a binary representation of a UUID into an octet stream
150 in little-endian and big-endian byte-order, respectively.
151 The destination buffer must be pre-allocated by the caller, and must be
152 large enough to hold the 16-octet binary UUID.
153 These routines are not part of the DCE RPC API.
154 They are provided for convenience.
155 .Pp
156 The
157 .Fn uuid_dec_le
158 and
159 .Fn uuid_dec_be
160 functions decode a UUID from an octet stream in little-endian and
161 big-endian byte-order, respectively.
162 These routines are not part of the DCE RPC API.
163 They are provided for convenience.
164 .Sh FILES
165 .Bl -tag -width ".Pa /etc/defaults/uuids"
166 .It Pa /etc/defaults/uuids
167 A list of UUIDs and their symbolic names provided by the OS vendor.
168 .It Pa /etc/uuids
169 A list of UUIDs and their symbolic names provided by the system administrator.
170 .El
171 .Sh RETURN VALUES
172 The successful or unsuccessful completion of the function is returned in the
173 .Fa status
174 argument.
175 Possible values are:
176 .Bl -tag -width ".Dv uuid_s_invalid_string_uuid"
177 .It Dv uuid_s_ok
178 The function completed successfully.
179 .It Dv uuid_s_bad_version
180 The UUID does not have a known version.
181 .It Dv uuid_s_invalid_string_uuid
182 The string representation of an UUID is not valid.
183 .It Dv uuid_s_no_memory
184 The meaning of the code escaped the writers mind.
185 .It Dv uuid_s_not_found
186 A UUID lookup failed.
187 .El
188 .Sh SEE ALSO
189 .Xr uuidgen 1 ,
190 .Xr uuidgen 2 ,
191 .Xr uuids 5
192 .Sh STANDARDS
193 The UUID functions conform to the DCE 1.1 RPC specification.