From e90061865467600a9d8a34f92e60a296cbf19234 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 25 Nov 2004 20:03:46 +0000 Subject: r3972: use GUID_* naming context and move GUID_* functions to one place metze (This used to be commit 523e6acf4fec5d4946fa7c0c89f40d7d712c9f3a) --- source4/librpc/ndr/ndr_basic.c | 84 ------------------------------------------ 1 file changed, 84 deletions(-) (limited to 'source4/librpc/ndr/ndr_basic.c') diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index f26c40e7b7..b790b03aa9 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -1183,90 +1183,6 @@ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name, ndr->depth--; } -/* - build a GUID from a string -*/ -NTSTATUS GUID_from_string(const char *s, struct GUID *guid) -{ - NTSTATUS status = NT_STATUS_INVALID_PARAMETER; - uint32_t time_low; - uint32_t time_mid, time_hi_and_version; - uint32_t clock_seq[2]; - uint32_t node[6]; - int i; - - if (11 == sscanf(s, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - &time_low, &time_mid, &time_hi_and_version, - &clock_seq[0], &clock_seq[1], - &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) { - status = NT_STATUS_OK; - } else if (11 == sscanf(s, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - &time_low, &time_mid, &time_hi_and_version, - &clock_seq[0], &clock_seq[1], - &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) { - status = NT_STATUS_OK; - } - - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - guid->time_low = time_low; - guid->time_mid = time_mid; - guid->time_hi_and_version = time_hi_and_version; - guid->clock_seq[0] = clock_seq[0]; - guid->clock_seq[1] = clock_seq[1]; - for (i=0;i<6;i++) { - guid->node[i] = node[i]; - } - - return NT_STATUS_OK; -} - -/* generate a random GUID */ -struct GUID GUID_random(void) -{ - struct GUID guid; - - generate_random_buffer((uint8_t *)&guid, sizeof(guid)); - - return guid; -} - -/* - its useful to be able to display these in debugging messages -*/ -char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid) -{ - return talloc_asprintf(mem_ctx, - "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->time_low, guid->time_mid, - guid->time_hi_and_version, - guid->clock_seq[0], - guid->clock_seq[1], - guid->node[0], guid->node[1], - guid->node[2], guid->node[3], - guid->node[4], guid->node[5]); -} - -char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid) -{ - return talloc_asprintf(mem_ctx, - "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - guid->time_low, guid->time_mid, - guid->time_hi_and_version, - guid->clock_seq[0], - guid->clock_seq[1], - guid->node[0], guid->node[1], - guid->node[2], guid->node[3], - guid->node[4], guid->node[5]); -} - -void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid) -{ - ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); -} - void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r) { ndr->print(ndr, "%-25s: DATA_BLOB length=%u", name, r.length); -- cgit