From b47db91bafeee07b1671354dfde96b6513822521 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 16 Sep 2014 02:11:19 +0200 Subject: [PATCH] lib: Add server_id marshalling Will be used soon to make source3 and source4 messaging-protocol compatible. Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- lib/util/samba_util.h | 3 +++ lib/util/server_id.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index 1c7ae79b701..7adcdba11ed 100644 --- a/lib/util/samba_util.h +++ b/lib/util/samba_util.h @@ -899,6 +899,9 @@ void server_id_set_disconnected(struct server_id *id); */ bool server_id_is_disconnected(const struct server_id *id); +void server_id_put(uint8_t buf[24], const struct server_id id); +void server_id_get(struct server_id *id, const uint8_t buf[24]); + /* * Samba code should use samba_tevent_context_init() instead of * tevent_context_init() in order to get the debug output. diff --git a/lib/util/server_id.c b/lib/util/server_id.c index 7d3de2f9f55..308ee2a492e 100644 --- a/lib/util/server_id.c +++ b/lib/util/server_id.c @@ -150,3 +150,19 @@ bool server_id_is_disconnected(const struct server_id *id) return server_id_equal(id, &dis); } + +void server_id_put(uint8_t buf[24], const struct server_id id) +{ + SBVAL(buf, 0, id.pid); + SIVAL(buf, 8, id.task_id); + SIVAL(buf, 12, id.vnn); + SBVAL(buf, 16, id.unique_id); +} + +void server_id_get(struct server_id *id, const uint8_t buf[24]) +{ + id->pid = BVAL(buf, 0); + id->task_id = IVAL(buf, 8); + id->vnn = IVAL(buf, 12); + id->unique_id = BVAL(buf, 16); +} -- 2.11.4.GIT