A Discrete-Event Network Simulator
API
ns3::UUID Class Reference

Universally unique identifier (UUID) More...

#include "uuid.h"

+ Collaboration diagram for ns3::UUID:

Public Member Functions

 UUID ()
 Default constructor. More...
 
 UUID (const std::array< uint8_t, 16 > &data)
 Initialize UUID with a given 16 bytes data buffer. More...
 
 UUID (const std::string &uuid)
 Initialize UUID with a given string. More...
 
 UUID (const UUID &)=default
 
 UUID (UUID &&) noexcept=default
 
 ~UUID ()=default
 
const std::array< uint8_t, 16 > & data () const noexcept
 Get the UUID data buffer. More...
 
std::array< uint8_t, 16 > & data () noexcept
 Get the UUID data buffer. More...
 
 operator bool () const noexcept
 Check if the UUID is nil UUID0 (all bits set to zero) More...
 
UUIDoperator= (const std::array< uint8_t, 16 > &data)
 
UUIDoperator= (const std::string &uuid)
 
UUIDoperator= (const UUID &)=default
 
UUIDoperator= (UUID &&) noexcept=default
 
std::string string () const
 Get string from the current UUID in format "00000000-0000-0000-0000-000000000000". More...
 
void swap (UUID &uuid) noexcept
 Swap two instances. More...
 

Static Public Member Functions

static UUID Nil ()
 Generate nil UUID0 (all bits set to zero) More...
 
static UUID Random ()
 Generate random UUID4 (randomly or pseudo-randomly generated version) More...
 
static UUID Sequential ()
 Generate sequential UUID1 (time based version) More...
 

Private Attributes

std::array< uint8_t, 16 > _data
 

Friends

bool operator!= (const UUID &uuid1, const UUID &uuid2)
 
bool operator< (const UUID &uuid1, const UUID &uuid2)
 
std::ostream & operator<< (std::ostream &os, const UUID &uuid)
 Output instance into the given output stream. More...
 
bool operator<= (const UUID &uuid1, const UUID &uuid2)
 
bool operator== (const UUID &uuid1, const UUID &uuid2)
 
bool operator> (const UUID &uuid1, const UUID &uuid2)
 
bool operator>= (const UUID &uuid1, const UUID &uuid2)
 
void swap (UUID &uuid1, UUID &uuid2) noexcept
 

Detailed Description

Universally unique identifier (UUID)

A universally unique identifier (UUID) is an identifier standard used in software construction. This implementation generates the following UUID types:

  • Nil UUID0 (all bits set to zero)
  • Sequential UUID1 (time based version)
  • Random UUID4 (randomly or pseudo-randomly generated version)

A UUID is simply a 128-bit value: "123e4567-e89b-12d3-a456-426655440000"

Not thread-safe.

https://en.wikipedia.org/wiki/Universally_unique_identifier https://www.ietf.org/rfc/rfc4122.txt

Definition at line 34 of file uuid.h.

Constructor & Destructor Documentation

◆ UUID() [1/5]

ns3::UUID::UUID ( )
inline

Default constructor.

Definition at line 38 of file uuid.h.

References _data.

Referenced by Nil(), and operator=().

+ Here is the caller graph for this function:

◆ UUID() [2/5]

ns3::UUID::UUID ( const std::string &  uuid)
explicit

Initialize UUID with a given string.

Parameters
uuid- UUID string

Definition at line 37 of file uuid.cc.

References _data, and NS_FATAL_ERROR.

◆ UUID() [3/5]

ns3::UUID::UUID ( const std::array< uint8_t, 16 > &  data)
inlineexplicit

Initialize UUID with a given 16 bytes data buffer.

Parameters
data- UUID 16 bytes data buffer

Definition at line 48 of file uuid.h.

◆ UUID() [4/5]

ns3::UUID::UUID ( const UUID )
default

◆ UUID() [5/5]

ns3::UUID::UUID ( UUID &&  )
defaultnoexcept

◆ ~UUID()

ns3::UUID::~UUID ( )
default

Member Function Documentation

◆ data() [1/2]

const std::array<uint8_t, 16>& ns3::UUID::data ( ) const
inlinenoexcept

Get the UUID data buffer.

Definition at line 80 of file uuid.h.

References _data.

◆ data() [2/2]

std::array<uint8_t, 16>& ns3::UUID::data ( )
inlinenoexcept

Get the UUID data buffer.

Definition at line 78 of file uuid.h.

References _data.

Referenced by operator=().

+ Here is the caller graph for this function:

◆ Nil()

static UUID ns3::UUID::Nil ( )
inlinestatic

Generate nil UUID0 (all bits set to zero)

Definition at line 86 of file uuid.h.

References UUID().

Referenced by operator bool(), and ns3::QKDKeyManagerSystemApplication::RegisterApplicationEntry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator bool()

ns3::UUID::operator bool ( ) const
inlineexplicitnoexcept

Check if the UUID is nil UUID0 (all bits set to zero)

Definition at line 75 of file uuid.h.

References Nil().

+ Here is the call graph for this function:

◆ operator=() [1/4]

UUID& ns3::UUID::operator= ( const std::array< uint8_t, 16 > &  data)
inline

Definition at line 55 of file uuid.h.

References _data, and data().

+ Here is the call graph for this function:

◆ operator=() [2/4]

UUID& ns3::UUID::operator= ( const std::string &  uuid)
inline

Definition at line 53 of file uuid.h.

References UUID(), and _data.

+ Here is the call graph for this function:

◆ operator=() [3/4]

UUID& ns3::UUID::operator= ( const UUID )
default

◆ operator=() [4/4]

UUID& ns3::UUID::operator= ( UUID &&  )
defaultnoexcept

◆ Random()

UUID ns3::UUID::Random ( )
static

◆ Sequential()

UUID ns3::UUID::Sequential ( )
static

Generate sequential UUID1 (time based version)

Definition at line 92 of file uuid.cc.

References NS_FATAL_ERROR, and test-ns3::result.

Referenced by ns3::QKDApp004::SendMaliciousRequestToKMS().

+ Here is the caller graph for this function:

◆ string()

std::string ns3::UUID::string ( ) const

Get string from the current UUID in format "00000000-0000-0000-0000-000000000000".

Definition at line 74 of file uuid.cc.

References _data, and test-ns3::result.

Referenced by ns3::QKDConnectionRegister::AddKeyAssociationEntry(), ns3::QKDKeyManagerSystemApplication::AddNewLink(), ns3::QKDApp004::CreateKeyQueues(), ns3::QKDApp014::DataPacketReceivedFromApp(), ns3::QKDKeyManagerSystemApplication::GenerateKeyId(), ns3::QKDKeyManagerSystemApplication::GenerateKsid(), ns3::QKDApp014::GetKeysFromKMS(), ns3::QKDApp014::GetStatusFromKMS(), ns3::QKDKeyManagerSystemApplication::NegotiateKeysForAssociation(), ns3::QKDApp004::OpenConnect(), ns3::QKDKeyManagerSystemApplication::ProcessAddKeysRequest(), ns3::QKDKeyManagerSystemApplication::ProcessAddKeysResponse(), ns3::QKDKeyManagerSystemApplication::ProcessCloseRequest(), ns3::QKDKeyManagerSystemApplication::ProcessGetKey004Request(), ns3::QKDKeyManagerSystemApplication::ProcessNewAppRequest(), ns3::QKDKeyManagerSystemApplication::ProcessNewAppResponse(), ns3::QKDKeyManagerSystemApplication::ProcessOpenConnectRequest(), ns3::QKDKeyManagerSystemApplication::ProcessQoSRequest(), ns3::QKDKeyManagerSystemApplication::ProcessRequest(), ns3::QKDKeyManagerSystemApplication::ProcessTransformRequest(), ns3::QKDKeyManagerSystemApplication::ProcessTransformResponse(), ns3::QKDKeyManagerSystemApplication::RegisterApplicationEntry(), ns3::QKDControl::RegisterQKDApplications(), ns3::QKDKeyManagerSystemApplication::ReleaseAssociation(), ns3::QKDApp004::SendKsidRequest(), ns3::QKDApp004::SendMaliciousRequestToKMS(), ns3::QKDApp014::SendPacket(), ns3::QKDKeyManagerSystemApplication::SendQKDLinkStatusToSDN(), and ns3::QKDKeyManagerSystemApplication::TransformKeys().

+ Here is the caller graph for this function:

◆ swap()

void ns3::UUID::swap ( UUID uuid)
inlinenoexcept

Swap two instances.

Definition at line 205 of file uuid.cc.

References ns3::swap().

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const UUID uuid1,
const UUID uuid2 
)
friend

Definition at line 63 of file uuid.h.

◆ operator<

bool operator< ( const UUID uuid1,
const UUID uuid2 
)
friend

Definition at line 65 of file uuid.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const UUID uuid 
)
friend

Output instance into the given output stream.

Definition at line 93 of file uuid.h.

◆ operator<=

bool operator<= ( const UUID uuid1,
const UUID uuid2 
)
friend

Definition at line 69 of file uuid.h.

◆ operator==

bool operator== ( const UUID uuid1,
const UUID uuid2 
)
friend

Definition at line 61 of file uuid.h.

◆ operator>

bool operator> ( const UUID uuid1,
const UUID uuid2 
)
friend

Definition at line 67 of file uuid.h.

◆ operator>=

bool operator>= ( const UUID uuid1,
const UUID uuid2 
)
friend

Definition at line 71 of file uuid.h.

◆ swap

void swap ( UUID uuid1,
UUID uuid2 
)
friend

Definition at line 212 of file uuid.cc.

Member Data Documentation

◆ _data

std::array<uint8_t, 16> ns3::UUID::_data
private

Definition at line 101 of file uuid.h.

Referenced by UUID(), data(), operator=(), and string().


The documentation for this class was generated from the following files: