LibreOffice
LibreOffice 7.4 SDK C/C++ API Reference
Macros | Functions
uuid.h File Reference

Specification (from draft-leach-uuids-guids-01.txt ) More...

#include "sal/config.h"
#include "rtl/string.h"
#include "sal/saldllapi.h"
#include "sal/types.h"

Go to the source code of this file.

Macros

#define RTL_UUID_NAMESPACE_DNS
 namespace DNS More...
 
#define RTL_UUID_NAMESPACE_URL
 namespace URL More...
 
#define RTL_UUID_NAMESPACE_OID
 namespace oid More...
 
#define RTL_UUID_NAMESPACE_X500
 namespace X500 More...
 

Functions

SAL_DLLPUBLIC void rtl_createUuid (sal_uInt8 *pTargetUUID, const sal_uInt8 *pPredecessorUUID, sal_Bool bUseEthernetAddress)
 Generates a new Version 4 (random number based) UUID (Universally Unique IDentifier). More...
 
SAL_DLLPUBLIC sal_Int32 rtl_compareUuid (const sal_uInt8 *pUUID1, const sal_uInt8 *pUUID2)
 Compare two UUID's lexically. More...
 
SAL_DLLPUBLIC void rtl_createNamedUuid (sal_uInt8 *pTargetUUID, const sal_uInt8 *pNameSpaceUUID, const rtl_String *pName)
 Creates named UUIDs. More...
 

Detailed Description

Specification (from draft-leach-uuids-guids-01.txt )

A UUID is an identifier that is unique across both space and time, with respect to the space of all UUIDs. To be precise, the UUID consists of a finite bit space. Thus, collision cannot be avoided in principle. A UUID can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects across a network.

The generation of UUIDs does not require that a registration authority be contacted for each identifier. Instead, Version 4 UUIDs are generated from (pseudo unique) sequences of (pseudo) random bits.

Macro Definition Documentation

◆ RTL_UUID_NAMESPACE_DNS

#define RTL_UUID_NAMESPACE_DNS
Value:
{\
0x6b,0xa7,0xb8,0x10,\
0x9d,0xad,\
0x11,0xd1,\
0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
}

namespace DNS

(Use them the following way : sal_uInt8 aNsDNS[16]) = RTL_UUID_NAMESPACE_DNS;

6ba7b810-9dad-11d1-80b4-00c04fd430c8

◆ RTL_UUID_NAMESPACE_OID

#define RTL_UUID_NAMESPACE_OID
Value:
{\
0x6b, 0xa7, 0xb8, 0x12,\
0x9d, 0xad,\
0x11, 0xd1,\
0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
}

namespace oid

6ba7b812-9dad-11d1-80b4-00c04fd430c8

◆ RTL_UUID_NAMESPACE_URL

#define RTL_UUID_NAMESPACE_URL
Value:
{ \
0x6b, 0xa7, 0xb8, 0x11,\
0x9d, 0xad,\
0x11, 0xd1,\
0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
}

namespace URL

6ba7b811-9dad-11d1-80b4-00c04fd430c8

◆ RTL_UUID_NAMESPACE_X500

#define RTL_UUID_NAMESPACE_X500
Value:
{\
0x6b, 0xa7, 0xb8, 0x14,\
0x9d, 0xad,\
0x11, 0xd1,\
0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
}

namespace X500

6ba7b814-9dad-11d1-80b4-00c04fd430c8

Function Documentation

◆ rtl_compareUuid()

SAL_DLLPUBLIC sal_Int32 rtl_compareUuid ( const sal_uInt8 pUUID1,
const sal_uInt8 pUUID2 
)

Compare two UUID's lexically.

Note: lexical ordering is not temporal ordering!

Note: For equalnesschecking, a memcmp(pUUID1,pUUID2,16) is more efficient

Returns
  • -1 u1 is lexically before u2
  • 0 u1 is equal to u2
  • 1 u1 is lexically after u2

◆ rtl_createNamedUuid()

SAL_DLLPUBLIC void rtl_createNamedUuid ( sal_uInt8 pTargetUUID,
const sal_uInt8 pNameSpaceUUID,
const rtl_String *  pName 
)

Creates named UUIDs.

The version 3 UUID is meant for generating UUIDs from names that are drawn from, and unique within, some name space. Some examples of names (and, implicitly, name spaces) might be DNS names, URLs, ISO Object IDs (OIDs), reserved words in a programming language, or X.500 Distinguished Names (DNs); thus, the concept of name and name space should be broadly construed, and not limited to textual names.

The requirements for such UUIDs are as follows:

  • The UUIDs generated at different times from the same name in the same namespace MUST be equal

  • The UUIDs generated from two different names in the same namespace should be different (with very high probability)

  • The UUIDs generated from the same name in two different namespaces should be different with (very high probability)

  • If two UUIDs that were generated from names are equal, then they were generated from the same name in the same namespace (with very high probability).
Parameters
pTargetUUIDpointer to at least 16 bytes of memory. After the call it contains the newly generated uuid in network byte order.
pNameSpaceUUIDThe namespace uuid. Below are some predefined ones, but any arbitrary uuid can be used as namespace.
pNamethe name

◆ rtl_createUuid()

SAL_DLLPUBLIC void rtl_createUuid ( sal_uInt8 pTargetUUID,
const sal_uInt8 pPredecessorUUID,
sal_Bool  bUseEthernetAddress 
)

Generates a new Version 4 (random number based) UUID (Universally Unique IDentifier).

Parameters
pTargetUUIDpointer to at least 16 bytes of memory. After the call it contains the newly generated uuid in network byte order.
pPredecessorUUIDignored (was used when this function returned Version 1 instead of Version 4 UUIDs).
bUseEthernetAddressignored (was used when this function returned Version 1 instead of Version 4 UUIDs).