10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*1388Sgz161490 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_UUID_H 280Sstevel@tonic-gate #define _SYS_UUID_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * The copyright in this file is taken from the original Leach 380Sstevel@tonic-gate * & Salz UUID specification, from which this implementation 390Sstevel@tonic-gate * is derived. 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. 440Sstevel@tonic-gate * Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & 450Sstevel@tonic-gate * Digital Equipment Corporation, Maynard, Mass. Copyright (c) 1998 460Sstevel@tonic-gate * Microsoft. To anyone who acknowledges that this file is provided 470Sstevel@tonic-gate * "AS IS" without any express or implied warranty: permission to use, 480Sstevel@tonic-gate * copy, modify, and distribute this file for any purpose is hereby 490Sstevel@tonic-gate * granted without fee, provided that the above copyright notices and 500Sstevel@tonic-gate * this notice appears in all source code copies, and that none of the 510Sstevel@tonic-gate * names of Open Software Foundation, Inc., Hewlett-Packard Company, 520Sstevel@tonic-gate * or Digital Equipment Corporation be used in advertising or 530Sstevel@tonic-gate * publicity pertaining to distribution of the software without 540Sstevel@tonic-gate * specific, written prior permission. Neither Open Software 550Sstevel@tonic-gate * Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital 560Sstevel@tonic-gate * Equipment Corporation makes any representations about the 570Sstevel@tonic-gate * suitability of this software for any purpose. 580Sstevel@tonic-gate */ 590Sstevel@tonic-gate 600Sstevel@tonic-gate #include <sys/types.h> 610Sstevel@tonic-gate #include <sys/byteorder.h> 620Sstevel@tonic-gate 630Sstevel@tonic-gate typedef struct { 640Sstevel@tonic-gate uint8_t nodeID[6]; 650Sstevel@tonic-gate } uuid_node_t; 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* 680Sstevel@tonic-gate * The uuid type used throughout when referencing uuids themselves 690Sstevel@tonic-gate */ 700Sstevel@tonic-gate struct uuid { 710Sstevel@tonic-gate uint32_t time_low; 720Sstevel@tonic-gate uint16_t time_mid; 730Sstevel@tonic-gate uint16_t time_hi_and_version; 740Sstevel@tonic-gate uint8_t clock_seq_hi_and_reserved; 750Sstevel@tonic-gate uint8_t clock_seq_low; 760Sstevel@tonic-gate uint8_t node_addr[6]; 770Sstevel@tonic-gate }; 780Sstevel@tonic-gate 790Sstevel@tonic-gate #define UUID_LEN 16 800Sstevel@tonic-gate 81*1388Sgz161490 #define UUID_PRINTABLE_STRING_LENGTH 37 82*1388Sgz161490 830Sstevel@tonic-gate typedef uchar_t uuid_t[UUID_LEN]; 840Sstevel@tonic-gate 850Sstevel@tonic-gate /* 860Sstevel@tonic-gate * Convert a uuid to/from little-endian format 870Sstevel@tonic-gate */ 880Sstevel@tonic-gate #define UUID_LE_CONVERT(dest, src) \ 890Sstevel@tonic-gate { \ 900Sstevel@tonic-gate (dest) = (src); \ 910Sstevel@tonic-gate (dest).time_low = LE_32((dest).time_low); \ 920Sstevel@tonic-gate (dest).time_mid = LE_16((dest).time_mid); \ 930Sstevel@tonic-gate (dest).time_hi_and_version = LE_16((dest).time_hi_and_version); \ 940Sstevel@tonic-gate } 950Sstevel@tonic-gate 960Sstevel@tonic-gate #ifdef __cplusplus 970Sstevel@tonic-gate } 980Sstevel@tonic-gate #endif 990Sstevel@tonic-gate 1000Sstevel@tonic-gate #endif /* _SYS_UUID_H */ 101