Add ndr_syntax_id_equal()
authorVolker Lendecke <vl@samba.org>
Wed, 16 Jul 2008 20:18:43 +0000 (22:18 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 16 Jul 2008 21:19:48 +0000 (23:19 +0200)
source/include/proto.h
source/lib/util_uuid.c
source/librpc/ndr/ndr_misc.c

index f7f0836c8faf48622b18ec659fa9957f93955616..246a3b75be972dec65a7cf7986b300efb91ec3f1 100644 (file)
@@ -1815,6 +1815,7 @@ void smb_uuid_generate_random(struct GUID *uu);
 const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu);
 bool smb_string_to_uuid(const char *in, struct GUID* uu);
 char *guid_binstring(const struct GUID *guid);
+bool guid_equal(const struct GUID *g1, const struct GUID *g2);
 
 /* The following definitions come from lib/version.c  */
 
@@ -4101,6 +4102,8 @@ void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct
 
 bool all_zero(const uint8_t *ptr, size_t size);
 void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
+bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1,
+                        const struct ndr_syntax_id *i2);
 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
index 36c04e9b8492868443df6490564a9699655c9416..0d788ac8b43e0b6079ba51880cbacd4433e059a1 100644 (file)
@@ -130,4 +130,12 @@ char *guid_binstring(const struct GUID *guid)
        return binary_string_rfc2254((char *)guid_flat.info, UUID_FLAT_SIZE);
 }
 
-
+bool guid_equal(const struct GUID *g1, const struct GUID *g2)
+{
+       return ((g1->time_low == g2->time_low)
+               && (g1->time_mid == g2->time_mid)
+               && (g1->time_hi_and_version == g2->time_hi_and_version)
+               && (memcmp(g1->clock_seq, g2->clock_seq,
+                          sizeof(g1->clock_seq)) == 0)
+               && (memcmp(g1->node, g2->node, sizeof(g1->node)) == 0));
+}
index 79761b9251b44116f2208b6d7210ec72b161dd79..f1468166ff95f9983fecdb402fd673a3e8d7eb0a 100644 (file)
@@ -43,6 +43,13 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *
        ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid));
 }
 
+bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1,
+                        const struct ndr_syntax_id *i2)
+{
+       return guid_equal(&i1->uuid, &i2->uuid)
+               && (i1->if_version == i2->if_version);
+}
+
 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r)
 {
        if (ndr_flags & NDR_SCALARS) {