kaos.core.util
Class UniqueIdentifier

java.lang.Object
  extended by kaos.core.util.UniqueIdentifier

public class UniqueIdentifier
extends java.lang.Object

Internal structure of universal unique IDs (UUIDs). There are three "variants" of UUIDs that this code knows about. The variant #0 is what was defined in the 1989 HP/Apollo Network Computing Architecture (NCA) specification and implemented in NCS 1.x and DECrpc v1. Variant #1 is what was defined for the joint HP/DEC specification for the OSF (in DEC's "UID Architecture Functional Specification Version X1.0.4") and implemented in NCS 2.0, DECrpc v2, and OSF 1.0 DCE RPC. Variant #2 is defined by Microsoft. This code creates only variant #1 UUIDs. The three UUID variants can exist on the same wire because they have distinct values in the 3 MSB bits of octet 8 (see table below). Do NOT confuse the version number with these 3 bits. (Note the distinct use of the terms "version" and "variant".) Variant #0 had no version field in it. Changes to variant #1 (should any ever need to be made) can be accomodated using the current form's 4 bit version field. The UUID record structure MUST NOT contain padding between fields. The total size = 128 bits. To minimize confusion about bit assignment within octets, the UUID record definition is defined only in terms of fields that are integral numbers of octets. Depending on the network data representation, the multi-octet unsigned integer fields are subject to byte swapping when communicated between dissimilar endian machines. Note that all three UUID variants have the same record structure; this allows this byte swapping to occur. (The ways in which the contents of the fields are generated can and do vary.) The following information applies to variant #1 UUIDs: The lowest addressed octet contains the global/local bit and the unicast/multicast bit, and is the first octet of the address transmitted on an 802.3 LAN. The adjusted time stamp is split into three fields, and the clockSeq is split into two fields. |<------------------------- 32 bits -------------------------->| +--------------------------------------------------------------+ | low 32 bits of time | 0-3 .time_low +-------------------------------+------------------------------- | mid 16 bits of time | 4-5 .time_mid +-------+-----------------------+ | vers. | hi 12 bits of time | 6-7 .time_hi_and_version +-------+-------+---------------+ |Res| clkSeqHi | 8 .clock_seq_hi_and_reserved +---------------+ | clkSeqLow | 9 .clock_seq_low +---------------+----------...-----+ | node ID | 8-16 .node +--------------------------...-----+ -------------------------------------------------------------------------- The structure layout of all three UUID variants is fixed for all time. I.e., the layout consists of a 32 bit int, 2 16 bit ints, and 8 8 bit ints. The current form version field does NOT determine/affect the layout. This enables us to do certain operations safely on the variants of UUIDs without regard to variant; this increases the utility of this code even as the version number changes (i.e., this code does NOT need to check the version field). The "Res" field in the octet #8 is the so-called "reserved" bit-field and determines whether or not the uuid is a old, current or other UUID as follows: MS-bit 2MS-bit 3MS-bit Variant --------------------------------------------- 0 x x 0 (NCS 1.5) 1 0 x 1 (DCE 1.0 RPC) 1 1 0 2 (Microsoft) 1 1 1 unspecified -------------------------------------------------------------------------- Internal structure of variant #0 UUIDs The first 6 octets are the number of 4 usec units of time that have passed since 1/1/80 0000 GMT. The next 2 octets are reserved for future use. The next octet is an address family. The next 7 octets are a host ID in the form allowed by the specified address family. Note that while the family field (octet 8) was originally conceived of as being able to hold values in the range [0..255], only [0..13] were ever used. Thus, the 2 MSB of this field are always 0 and are used to distinguish old and current UUID forms. +--------------------------------------------------------------+ | high 32 bits of time | 0-3 .time_high +-------------------------------+------------------------------- | low 16 bits of time | 4-5 .time_low +-------+-----------------------+ | reserved | 6-7 .reserved +---------------+---------------+ | family | 8 .family +---------------+----------...-----+ | node ID | 9-16 .node +--------------------------...-----+

Requires:

Modifications:

See Also:
"KAoS Agent Programmer's Guide" $Revision: 1.1.1.1 $

Constructor Summary
UniqueIdentifier()
          Constructs a UniqueIdentifier - is dependent upon a hardwareAddress.dat file residing in the current working directory.
 
Method Summary
static java.lang.String GenerateUID()
          Class method to generate a unique identifier and return it's string representation.
 java.lang.String toString()
          Returns the standard string notation for the UUID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UniqueIdentifier

public UniqueIdentifier()
Constructs a UniqueIdentifier - is dependent upon a hardwareAddress.dat file residing in the current working directory. The hardwareAddress.dat must contain a single line containing a 48 bit hexidecimal which is the machines ethernet hardware address, such as 0060976ADD4C. If this file cannot be opened the 0000DEADBEEF will beused as the ethernet hardware address.

Method Detail

toString

public java.lang.String toString()
Returns the standard string notation for the UUID.

Overrides:
toString in class java.lang.Object

GenerateUID

public static java.lang.String GenerateUID()
Class method to generate a unique identifier and return it's string representation.