s4:drsuapi: add drsuapi_DsReplicaHighWaterMark_cmp()
authorStefan Metzmacher <metze@samba.org>
Mon, 17 Dec 2012 10:13:43 +0000 (11:13 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 1 Jan 2013 18:28:07 +0000 (19:28 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/rpc_server/drsuapi/getncchanges.c

index b3ceb50..1f597c6 100644 (file)
@@ -52,6 +52,26 @@ struct drsuapi_getncchanges_state {
        uint32_t la_idx;
 };
 
+static int drsuapi_DsReplicaHighWaterMark_cmp(const struct drsuapi_DsReplicaHighWaterMark *h1,
+                                             const struct drsuapi_DsReplicaHighWaterMark *h2)
+{
+       if (h1->highest_usn < h2->highest_usn) {
+               return -1;
+       } else if (h1->highest_usn > h2->highest_usn) {
+               return 1;
+       } else if (h1->tmp_highest_usn < h2->tmp_highest_usn) {
+               return -1;
+       } else if (h1->tmp_highest_usn > h2->tmp_highest_usn) {
+               return 1;
+       } else if (h1->reserved_usn < h2->reserved_usn) {
+               return -1;
+       } else if (h1->reserved_usn > h2->reserved_usn) {
+               return 1;
+       }
+
+       return 0;
+}
+
 /*
   build a DsReplicaObjectIdentifier from a ldb msg
  */