uuid-generic.cpp revision 521c7fe44ae783845c97a99e64bd15dab0035fa0
/* $Id$ */
/** @file
* IPRT - UUID, Generic.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
/*******************************************************************************
* Global Variables *
*******************************************************************************/
/** Conversion table used by the conversion functions.
* 0xff if not a hex number, otherwise the value. */
{
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 0..0f */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 10..1f */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 20..2f */
0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07, 0x08,0x09,0xff,0xff, 0xff,0xff,0xff,0xff, /* 30..3f */
0xff,0x0a,0x0b,0x0c, 0x0d,0x0e,0x0f,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 40..4f */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 50..5f */
0xff,0x0a,0x0b,0x0c, 0x0d,0x0e,0x0f,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 60..6f */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 70..7f */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 80..8f */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 90..9f */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* a0..af */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* b0..bf */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* d0..df */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* e0..ef */
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* f0..ff */
};
/** Conversion to string. */
/* WARNING: This implementation ASSUMES little endian. Does not work on big endian! */
/* Remember, the time fields in the UUID must be little endian. */
{
return VINF_SUCCESS;
}
{
AssertPtrReturn(pUuid, true);
}
{
/*
* Special cases.
*/
return 0;
if (!pUuid1)
if (!pUuid2)
/*
* Standard cases.
*/
return 0;
}
{
int rc;
/* check params */
/*
* Try convert the string to a UUID and then compare the two.
*/
}
{
unsigned u;
/* validate parameters */
/*
* RTStrPrintf(,,"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
* pUuid->Gen.u32TimeLow,
* pUuid->Gen.u16TimeMin,
* pUuid->Gen.u16TimeHiAndVersion,
* pUuid->Gen.u16ClockSeq & 0xff,
* pUuid->Gen.u16ClockSeq >> 8,
* pUuid->Gen.au8Node[0],
* pUuid->Gen.au8Node[1],
* pUuid->Gen.au8Node[2],
* pUuid->Gen.au8Node[3],
* pUuid->Gen.au8Node[4],
* pUuid->Gen.au8Node[5]);
*/
return VINF_SUCCESS;
}
{
/*
* Validate parameters.
*/
/*
* Inverse of RTUuidToStr (see above).
*/
return VINF_SUCCESS;
}
{
unsigned u;
/* validate parameters */
/*
* RTStrPrintf(,,"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
* pUuid->Gen.u32TimeLow,
* pUuid->Gen.u16TimeMin,
* pUuid->Gen.u16TimeHiAndVersion,
* pUuid->Gen.u16ClockSeq & 0xff,
* pUuid->Gen.u16ClockSeq >> 8,
* pUuid->Gen.au8Node[0],
* pUuid->Gen.au8Node[1],
* pUuid->Gen.au8Node[2],
* pUuid->Gen.au8Node[3],
* pUuid->Gen.au8Node[4],
* pUuid->Gen.au8Node[5]);
*/
return VINF_SUCCESS;
}
{
/*
* Validate parameters.
*/
/*
* Inverse of RTUuidToUtf8 (see above).
*/
return VINF_SUCCESS;
}