Changeset 5667:7bc121d15d0e in roaraudio
- Timestamp:
- 09/23/12 11:59:39 (12 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/uuid.h
r5665 r5667 55 55 int roar_uuid2str(char * str, const roar_uuid_t uuid, ssize_t len); 56 56 int roar_str2uuid(roar_uuid_t uuid, const char * str); 57 58 // returns UUIDs for common namespaces. 59 const roar_uuid_t * roar_uuid_get_ns_real(const char * ns); 60 #define roar_uuid_get_ns(ns) (*roar_uuid_get_ns_real(ns)) 61 57 62 int roar_uuid_gen(roar_uuid_t uuid, enum roar_uuid_type type, const roar_uuid_t ns, const void * argp, ssize_t arglen); 58 63 #define roar_uuid_gen_null(uuid) roar_uuid_gen(uuid, ROAR_UUID_TYPE_NULL, NULL, NULL, -1) 59 64 #define roar_uuid_gen_time(uuid) roar_uuid_gen(uuid, ROAR_UUID_TYPE_TIME, NULL, NULL, -1) 60 65 #define roar_uuid_gen_random(uuid) roar_uuid_gen(uuid, ROAR_UUID_TYPE_RANDOM, NULL, NULL, -1) 66 #define roar_uuid_gen_fromstr(uuid,str,ns) roar_uuid_gen(uuid, ROAR_UUID_TYPE_SHA1, roar_uuid_get_ns(ns), str, roar_mm_strlen(str)) 61 67 #define roar_uuid_clear(uuid) roar_uuid_gen_null(uuid) 62 68 -
libroar/uuid.c
r5666 r5667 85 85 } 86 86 87 const roar_uuid_t * roar_uuid_get_ns_real(const char * ns) { 88 static const roar_uuid_t * __null = NULL, 89 dns = {0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, 90 url = {0x6b, 0xa7, 0xb8, 0x11, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, 91 oid = {0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, 92 x500 = {0x6b, 0xa7, 0xb8, 0x14, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}; 93 94 if ( ns == NULL ) { 95 roar_err_set(ROAR_ERROR_FAULT); 96 return __null; 97 } 98 99 if ( !strcasecmp(ns, "dns") ) { 100 return &dns; 101 } else if ( !strcasecmp(ns, "url") ) { 102 return &url; 103 } else if ( !strcasecmp(ns, "iso oid") || !strcasecmp(ns, "oid") ) { 104 return &oid; 105 } else if ( !strcasecmp(ns, "X.500 DN") || !strcasecmp(ns, "X500 DN") || !strcasecmp(ns, "x500") ) { 106 return &x500; 107 } 108 109 roar_err_set(ROAR_ERROR_NOENT); 110 return __null; 111 } 112 87 113 int roar_uuid_gen(roar_uuid_t uuid, enum roar_uuid_type type, const roar_uuid_t ns, const void * argp, ssize_t arglen) { 88 114 unsigned char digest[20];
Note: See TracChangeset
for help on using the changeset viewer.