Loading...
Searching...
No Matches
uuid.h File Reference

RFC 4122 UUID functions More...

Detailed Description

RFC 4122 UUID functions

Author
Koen Zandberg koen@.nosp@m.berg.nosp@m.zand..nosp@m.net

Definition in file uuid.h.

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "byteorder.h"
+ Include dependency graph for uuid.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  uuid_t
 UUID layout. More...
 

Macros

#define UUID_NODE_LEN   (6U)
 Size of the node identifier in bytes.
 
#define UUID_STR_LEN   (36U)
 Size of a string UUID without null character.
 

Functions

void uuid_v3 (uuid_t *uuid, const uuid_t *ns, const uint8_t *name, size_t len)
 Generate a version 3(md5 based) UUID from a namespace and a byte array.
 
void uuid_v4 (uuid_t *uuid)
 Generate a version 4(Full random) UUID.
 
void uuid_v5 (uuid_t *uuid, const uuid_t *ns, const uint8_t *name, size_t len)
 Generate a version 5(sha1 based) UUID from a namespace and a byte array.
 
static unsigned uuid_version (const uuid_t *uuid)
 Retrieve the type number of a UUID.
 
static bool uuid_equal (const uuid_t *uuid1, const uuid_t *uuid2)
 Compare two UUID's.
 
void uuid_to_string (const uuid_t *uuid, char *str)
 Generate an UUID string from an UUID structure.
 
int uuid_from_string (uuid_t *uuid, const char *str)
 Populate an UUID structure from an UUID string.
 

UUID version identifiers

#define UUID_V1   (0x01)
 Type 1 UUID - timestamp based

 
#define UUID_V2   (0x02)
 Type 2 UUID - DCE Security version.
 
#define UUID_V3   (0x03)
 Type 3 UUID - Name based with MD5

 
#define UUID_V4   (0x04)
 Type 4 UUID - Random generated

 
#define UUID_V5   (0x05)
 Type 5 UUID - Name based with SHA1.
 

Version part of the time_hi field

#define UUID_VERSION_MASK   (0xF000)
 

Namespace IDs from RFC4122

Copied from rfc4122 Appendix C

const uuid_t uuid_namespace_dns
 DNS namespace UUID.
 
const uuid_t uuid_namespace_url
 URL namespace UUID.
 
const uuid_t uuid_namespace_iso
 ISO OID namespace UUID.
 
const uuid_t uuid_namespace_x500
 X.500 DN namespace UUID.