UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches

Manage UUIDs. More...

#include <uuid.hpp>
#include <UPnPsdk/port_sock.hpp>
#include <UPnPsdk/synclog.hpp>
+ Include dependency graph for uuid.cpp:

Go to the source code of this file.

Classes

struct  anonymous_namespace{uuid.cpp}::uuid_state
 Data type for UUID generator persistent state. More...
 

Macros

#define CHECK(f1, f2)
 Macro to compare times.
 

Functions

void anonymous_namespace{uuid.cpp}::format_uuid_v1 (uuid_upnp *uid, uint16_t clock_seq, uuid_time_t timestamp, uuid_node_t node)
 Make a UUID from the timestamp, clockseq, and node ID.
 
int anonymous_namespace{uuid.cpp}::read_state (uint16_t *clockseq, uuid_time_t *timestamp, uuid_node_t *node)
 Read UUID generator state from non-volatile store.
 
void anonymous_namespace{uuid.cpp}::write_state (uint16_t clockseq, uuid_time_t timestamp, uuid_node_t node)
 Save UUID generator state back to non-volatile storage.
 
void anonymous_namespace{uuid.cpp}::get_current_time (uuid_time_t *timestamp)
 Get time as 60 bit 100ns ticks since whenever.
 
uint16_t anonymous_namespace{uuid.cpp}::true_random ()
 generate a crypto-quality random number. This sample doesn't do that.
 
void anonymous_namespace{uuid.cpp}::format_uuid_v3 (uuid_upnp *uid, unsigned char hash[16])
 Make a UUID from a (pseudo)random 128 bit number.
 
void uuidMutexInit ()
 Initialize mutex for synchronizing the uuid creation process.
 
int uuidMutexDestroy ()
 Destroy mutex for synchronizing the uuid creation process.
 
int uuid_create (uuid_upnp *uid)
 Generate a UUID.
 
void upnp_uuid_unpack (uuid_upnp *u, char *out)
 Unpack a UUID.
 
void uuid_create_from_name (uuid_upnp *uid, uuid_upnp nsid, void *name, int namelen)
 Create a UUID using a "name" from a "name space".
 
int uuid_compare (uuid_upnp *u1, uuid_upnp *u2)
 Compare two UUID's "lexically".
 

Variables

pthread_mutex_t anonymous_namespace{uuid.cpp}::uuid_mutex
 Mutex to synchronize the uuid creation process.
 
uuid_state anonymous_namespace{uuid.cpp}::st
 UUID generator persistent state.
 
int anonymous_namespace{uuid.cpp}::stateInited {0}
 Flag if UUID generator persistent state is initiated.
 

Detailed Description

Manage UUIDs.

Todo:
Remove COMPA_DEF_OPTION_SSDP. Make it always available with COMPA_DEF_DEVICE_GENA.

Definition in file uuid.cpp.


Class Documentation

◆ anonymous_namespace{uuid.cpp}::uuid_state

struct anonymous_namespace{uuid.cpp}::uuid_state

Data type for UUID generator persistent state.

Definition at line 49 of file uuid.cpp.

+ Collaboration diagram for anonymous_namespace{uuid.cpp}::uuid_state:
Class Members
uuid_time_t ts

Saved timestamp.

uuid_node_t node

Saved node ID.

uint16_t cs

Saved clock sequence.

Macro Definition Documentation

◆ CHECK

#define CHECK (   f1,
  f2 
)
Value:
if (f1 != f2) \
return f1 < f2 ? -1 : 1;

Macro to compare times.

Definition at line 191 of file uuid.cpp.

Function Documentation

◆ uuidMutexInit()

void uuidMutexInit ( )

Initialize mutex for synchronizing the uuid creation process.

Definition at line 198 of file uuid.cpp.

+ Here is the caller graph for this function:

◆ uuidMutexDestroy()

int uuidMutexDestroy ( )

Destroy mutex for synchronizing the uuid creation process.

Returns
  • On success: 0
  • On error: EBUSY

Definition at line 202 of file uuid.cpp.

+ Here is the caller graph for this function:

◆ uuid_create()

int uuid_create ( uuid_upnp uid)

Generate a UUID.

Returns
Always 1.
Parameters
[out]uidPointer to a place for the created uuid.

Definition at line 211 of file uuid.cpp.

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

◆ upnp_uuid_unpack()

void upnp_uuid_unpack ( uuid_upnp u,
char *  out 
)

Unpack a UUID.

Parameters
[in]uPacked UUID.
[out]outWill be xxxx-xx-xx-xx-xxxxxx format.

Definition at line 242 of file uuid.cpp.

+ Here is the caller graph for this function:

◆ uuid_create_from_name()

void uuid_create_from_name ( uuid_upnp uid,
uuid_upnp  nsid,
void *  name,
int  namelen 
)

Create a UUID using a "name" from a "name space".

Parameters
uidresulting UUID.
nsidUUID to serve as context, so identical names from different name spaces generate different UUIDs.
nameThe name from which to generate a UUID.
namelenThe length of the name.

Definition at line 250 of file uuid.cpp.

+ Here is the call graph for this function:

◆ uuid_compare()

int uuid_compare ( uuid_upnp u1,
uuid_upnp u2 
)

Compare two UUID's "lexically".

Returns
  • -1: u1 is lexically before u2
  •  0: u1 is equal to u2
  •  1: u1 is lexically after u2
Note
Lexical ordering is not temporal ordering!
Parameters
[in]u1
[in]u2

Definition at line 278 of file uuid.cpp.