X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=internal.c;h=ef0115b86db6e6e383d019d981ac1c88425077b3;hb=90879c5836f9db9e60b248d787ef0ee138f2e637;hp=0fe696278a5b45993994c3bfedc5d9dd1b4454aa;hpb=c7e13d717c38e528ae241bf5facb51bca63f323c;p=uuid diff --git a/internal.c b/internal.c index 0fe6962..ef0115b 100644 --- a/internal.c +++ b/internal.c @@ -186,7 +186,6 @@ static uint64_t current_node(struct pd_uuid_state *st) { continue; } if (ioctl(s, SIOCGIFHWADDR, req) == 0) { - int j; data = (unsigned char *)req->ifr_hwaddr.sa_data; node = data[0]; node = node << 8; node += data[1]; @@ -458,3 +457,48 @@ int pd_uuid_set_string(pd_uuid_t *uuid, char *s) { } return 1; } + +/* pre-defined namespace uuids */ + +pd_uuid_t pd_uuid_ns_dns = { + { + 0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8 + } +}; + +pd_uuid_t pd_uuid_ns_url = { + { + 0x6b, 0xa7, 0xb8, 0x11, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8 + } +}; + +pd_uuid_t pd_uuid_ns_oid = { + { + 0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8 + } +}; + +pd_uuid_t pd_uuid_ns_x500 = { + { + 0x6b, 0xa7, 0xb8, 0x14, 0x9d, 0xad, 0x11, 0xd1, + 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8 + } +}; + +int pd_uuid_copy(pd_uuid_t *src, pd_uuid_t *dst) { + if (src && dst) { + memcpy(dst->data, src->data, 16); + return 1; + } + return 0; +} + +int pd_uuid_cmp(pd_uuid_t *a, pd_uuid_t *b) { + if (a && b) { + return memcmp(a, b, 16); + } + return 1; +}