| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef __UUID_H__ |
| #define __UUID_H__ |
|
|
| |
| #define uuid_t __vendor_uuid_t |
| #define uuid_create __vendor_uuid_create |
| #define uuid_compare __vendor_uuid_compare |
| #include <sys/types.h> |
| #include <unistd.h> |
| #undef uuid_t |
| #undef uuid_create |
| #undef uuid_compare |
|
|
| |
| #include <string.h> |
|
|
| |
| #ifdef __cplusplus |
| #define DECLARATION_BEGIN extern "C" { |
| #define DECLARATION_END } |
| #else |
| #define DECLARATION_BEGIN |
| #define DECLARATION_END |
| #endif |
|
|
| DECLARATION_BEGIN |
|
|
| |
| #define UUID_VERSION 0x106202 |
|
|
| |
| #define UUID_LEN_BIN (128 / 8 ) |
| #define UUID_LEN_STR (128 / 4 + 4 ) |
| #define UUID_LEN_SIV (39 ) |
|
|
| |
| typedef enum { |
| UUID_RC_OK = 0, |
| UUID_RC_ARG = 1, |
| UUID_RC_MEM = 2, |
| UUID_RC_SYS = 3, |
| UUID_RC_INT = 4, |
| UUID_RC_IMP = 5 |
| } uuid_rc_t; |
|
|
| |
| enum { |
| UUID_MAKE_V1 = (1 << 0), |
| UUID_MAKE_V3 = (1 << 1), |
| UUID_MAKE_V4 = (1 << 2), |
| UUID_MAKE_V5 = (1 << 3), |
| UUID_MAKE_MC = (1 << 4) |
| }; |
|
|
| |
| typedef enum { |
| UUID_FMT_BIN = 0, |
| UUID_FMT_STR = 1, |
| UUID_FMT_SIV = 2, |
| UUID_FMT_TXT = 3 |
| } uuid_fmt_t; |
|
|
| |
| struct uuid_st; |
| typedef struct uuid_st uuid_t; |
|
|
| |
| extern uuid_rc_t uuid_create ( uuid_t **_uuid); |
| extern uuid_rc_t uuid_destroy ( uuid_t *_uuid); |
| extern uuid_rc_t uuid_clone (const uuid_t *_uuid, uuid_t **_clone); |
|
|
| |
| extern uuid_rc_t uuid_load ( uuid_t *_uuid, const char *_name); |
| extern uuid_rc_t uuid_make ( uuid_t *_uuid, unsigned int _mode, ...); |
|
|
| |
| extern uuid_rc_t uuid_isnil (const uuid_t *_uuid, int *_result); |
| extern uuid_rc_t uuid_compare (const uuid_t *_uuid, const uuid_t *_uuid2, int *_result); |
|
|
| |
| extern uuid_rc_t uuid_import ( uuid_t *_uuid, uuid_fmt_t _fmt, const void *_data_ptr, size_t _data_len); |
| extern uuid_rc_t uuid_export (const uuid_t *_uuid, uuid_fmt_t _fmt, void *_data_ptr, size_t *_data_len); |
|
|
| |
| extern char *uuid_error (uuid_rc_t _rc); |
| extern unsigned long uuid_version (void); |
|
|
| DECLARATION_END |
|
|
| #endif |
|
|
|
|