summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-17 12:41:02 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-17 20:07:07 +0200
commit8149623ad4e07f03b92832972c6d36ada92cc810 (patch)
treecb95c836aaab8231c33b5cf64e8fcefea2669a8f /lib/util
parentf46c4dfe28831a6e8d610589c0d45193070c4864 (diff)
downloadsamba-8149623ad4e07f03b92832972c6d36ada92cc810.tar.gz
samba-8149623ad4e07f03b92832972c6d36ada92cc810.tar.bz2
samba-8149623ad4e07f03b92832972c6d36ada92cc810.zip
lib/util: add server_id_equal()
metze
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/samba_util.h1
-rw-r--r--lib/util/server_id.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 274dde811c..26a5c6872b 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -899,6 +899,7 @@ char *data_path(TALLOC_CTX *mem_ctx, const char *name);
const char *shlib_ext(void);
struct server_id;
+bool server_id_equal(const struct server_id *p1, const struct server_id *p2);
char *server_id_str(TALLOC_CTX *mem_ctx, const struct server_id *id);
#endif /* _SAMBA_UTIL_H_ */
diff --git a/lib/util/server_id.c b/lib/util/server_id.c
index 195deeac7c..7370ad9335 100644
--- a/lib/util/server_id.c
+++ b/lib/util/server_id.c
@@ -20,6 +20,27 @@
#include "includes.h"
#include "librpc/gen_ndr/server_id.h"
+bool server_id_equal(const struct server_id *p1, const struct server_id *p2)
+{
+ if (p1->pid != p2->pid) {
+ return false;
+ }
+
+ if (p1->task_id != p2->task_id) {
+ return false;
+ }
+
+ if (p1->vnn != p2->vnn) {
+ return false;
+ }
+
+ if (p1->unique_id != p2->unique_id) {
+ return false;
+ }
+
+ return true;
+}
+
char *server_id_str(TALLOC_CTX *mem_ctx, const struct server_id *id)
{
if (id->vnn == NONCLUSTER_VNN && id->task_id == 0) {