--- uuid.h 2004/01/19 12:19:25 1.16
+++ uuid.h 2004/01/19 14:11:50 1.17
@@ -30,72 +30,75 @@
#ifndef __UUID_H__
#define __UUID_H__
-/* OSSP uuid version (compile-time information) */
-#define UUID_VERSION 0x009204
+/* required system headers */
+#include <string.h>
/* minimum C++ support */
#ifdef __cplusplus
#define DECLARATION_BEGIN extern "C" {
#define DECLARATION_END }
#else
-#define DECLARATION_BEGIN /*nop*/
-#define DECLARATION_END /*nop*/
+#define DECLARATION_BEGIN
+#define DECLARATION_END
#endif
DECLARATION_BEGIN
+/* OSSP uuid version (compile-time information) */
+#define UUID_VERSION 0x009204
+
/* encoding octet stream lengths */
-#define UUID_LEN_BIN (128 / 8 /*bytes*/)
-#define UUID_LEN_STR (128 / 4 /*nibbles*/ + 4 /*hyphens*/)
+#define UUID_LEN_BIN (128 /*bit*/ / 8 /*bytes*/)
+#define UUID_LEN_STR (128 /*bit*/ / 4 /*nibbles*/ + 4 /*hyphens*/)
-/* return codes */
+/* API return codes */
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_OK = 0, /* everything ok */
+ UUID_RC_ARG = 1, /* invalid argument */
+ UUID_RC_MEM = 2, /* out of memory */
+ UUID_RC_SYS = 3, /* system error */
+ UUID_RC_INT = 4, /* internal error */
+ UUID_RC_IMP = 5 /* not implemented */
} uuid_rc_t;
-/* generation mode flags */
+/* UUID make modes */
enum {
- UUID_VERSION1 = (1 << 0),
- UUID_VERSION3 = (1 << 1),
- UUID_VERSION4 = (1 << 2),
- UUID_MCASTRND = (1 << 3)
+ UUID_MAKE_V1 = (1 << 0), /* DCE 1.1 v1 UUID */
+ UUID_MAKE_V3 = (1 << 1), /* DCE 1.1 v3 UUID */
+ UUID_MAKE_V4 = (1 << 2), /* DCE 1.1 v4 UUID */
+ UUID_MAKE_MC = (1 << 3) /* enforce multi-cast MAC address */
};
-/* import/export formats */
+/* UUID import/export formats */
typedef enum {
- UUID_FMT_BIN = 0, /* import/export */
- UUID_FMT_STR = 1, /* import/export */
- UUID_FMT_TXT = 2 /* export only */
+ UUID_FMT_BIN = 0, /* binary representation (import/export) */
+ UUID_FMT_STR = 1, /* string representation (import/export) */
+ UUID_FMT_TXT = 2 /* textual description (export only) */
} uuid_fmt_t;
-/* abstract data type */
+/* UUID abstract data type */
struct uuid_st;
typedef struct uuid_st uuid_t;
-/* object handling */
-extern uuid_rc_t uuid_create (uuid_t **_uuid);
-extern uuid_rc_t uuid_destroy (uuid_t *_uuid);
+/* UUID object handling */
+extern uuid_rc_t uuid_create (uuid_t **_uuid);
+extern uuid_rc_t uuid_destroy (uuid_t *_uuid);
/* UUID generation */
-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_load (uuid_t *_uuid, const char *_name);
+extern uuid_rc_t uuid_make (uuid_t *_uuid, unsigned int _mode, ...);
/* UUID comparison */
-extern uuid_rc_t uuid_isnil (uuid_t *_uuid, int *_result);
-extern uuid_rc_t uuid_compare (uuid_t *_uuid, uuid_t *_uuid2, int *_result);
+extern uuid_rc_t uuid_isnil (uuid_t *_uuid, int *_result);
+extern uuid_rc_t uuid_compare (uuid_t *_uuid, uuid_t *_uuid2, int *_result);
/* UUID import/export */
-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 (uuid_t *_uuid, uuid_fmt_t _fmt, void **_data_ptr, size_t *_data_len);
+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 (uuid_t *_uuid, uuid_fmt_t _fmt, void **_data_ptr, size_t *_data_len);
-/* library error handling */
-extern char *uuid_error (uuid_rc_t _rc);
-extern unsigned long uuid_version (void);
+/* library utilities */
+extern char *uuid_error (uuid_rc_t _rc);
+extern unsigned long uuid_version (void);
DECLARATION_END
|