|
libUPnP 1.18.5
|
#include "config.h"#include "uuid.h"#include "UpnpInet.h"#include "UpnpStdInt.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>
Data Structures | |
| struct | uuid_state |
Macros | |
| #define | CHECK(f1, f2) |
Functions | |
| static int | read_state (uint16_t *clockseq, uuid_time_t *timestamp, uuid_node_t *node) |
| Read UUID generator state from non-volatile store. | |
| static void | write_state (uint16_t clockseq, uuid_time_t timestamp, uuid_node_t node) |
| Save UUID generator state back to non-volatile storage. | |
| static void | 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. | |
| static void | format_uuid_v3 (uuid_upnp *uid, unsigned char hash[16]) |
| Make a UUID from a (pseudo)random 128 bit number. | |
| static void | get_current_time (uuid_time_t *timestamp) |
| Get time as 60 bit 100ns ticks since whenever. | |
| static uint16_t | true_random (void) |
| generate a crypto-quality random number. This sample doesn't do that. | |
| int | uuid_create (uuid_upnp *uid) |
| Generator of a UUID. | |
| void | upnp_uuid_unpack (uuid_upnp *u, char *out) |
| Out will be xxxx-xx-xx-xx-xxxxxx format. | |
| 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" and return. | |
Variables | |
| static uuid_state | st |
| static int | stateInited = 0 |
| #define CHECK | ( | f1, | |
| f2 ) |
|
static |
Make a UUID from the timestamp, clockseq, and node ID.
References _uuid_upnp::clock_seq_hi_and_reserved, _uuid_upnp::clock_seq_low, _uuid_upnp::node, _uuid_upnp::time_hi_and_version, _uuid_upnp::time_low, and _uuid_upnp::time_mid.
Referenced by uuid_create().
|
static |
Make a UUID from a (pseudo)random 128 bit number.
References _uuid_upnp::clock_seq_hi_and_reserved, _uuid_upnp::time_hi_and_version, _uuid_upnp::time_low, and _uuid_upnp::time_mid.
Referenced by uuid_create_from_name().
|
static |
Get time as 60 bit 100ns ticks since whenever.
Compensate for the fact that real clock resolution is less than 100ns.
References get_system_time(), and UUIDS_PER_TICK.
Referenced by uuid_create().
|
static |
Read UUID generator state from non-volatile store.
References uuid_state::cs.
Referenced by uuid_create().
|
static |
generate a crypto-quality random number. This sample doesn't do that.
References get_system_time(), and UUIDS_PER_TICK.
Referenced by uuid_create().
| void upnp_uuid_unpack | ( | uuid_upnp * | u, |
| char * | out ) |
Out will be xxxx-xx-xx-xx-xxxxxx format.
| u | . |
| out | . |
References _uuid_upnp::clock_seq_hi_and_reserved, _uuid_upnp::clock_seq_low, _uuid_upnp::node, _uuid_upnp::time_hi_and_version, _uuid_upnp::time_low, and _uuid_upnp::time_mid.
| int uuid_compare | ( | uuid_upnp * | u1, |
| uuid_upnp * | u2 ) |
Compare two UUID's "lexically" and return.
Compare two UUID's "lexically".
Note: Lexical ordering is not temporal ordering!
| u1 | . |
| u2 | . |
References _uuid_upnp::clock_seq_hi_and_reserved, _uuid_upnp::clock_seq_low, _uuid_upnp::node, _uuid_upnp::time_hi_and_version, _uuid_upnp::time_low, and _uuid_upnp::time_mid.
| int uuid_create | ( | uuid_upnp * | uid | ) |
Generator of a UUID.
Generate a UUID.
| uid | . |
References format_uuid_v1(), get_current_time(), get_ieee_node_identifier(), read_state(), true_random(), and write_state().
| 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".
| uid | resulting UUID. |
| nsid | UUID to serve as context, so identical names from different name spaces generate different UUIDs. |
| name | The name from which to generate a UUID. |
| namelen | The length of the name. |
References format_uuid_v3(), _uuid_upnp::time_hi_and_version, _uuid_upnp::time_low, and _uuid_upnp::time_mid.
|
static |
Save UUID generator state back to non-volatile storage.
Referenced by uuid_create().