diff options
author | Volker Lendecke <vl@samba.org> | 2014-09-16 02:11:19 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2015-02-13 23:32:07 +0100 |
commit | b47db91bafeee07b1671354dfde96b6513822521 (patch) | |
tree | 7871147615890661d4b54a9cbeeb57baeb534d3e /lib | |
parent | 975b9b03045eaf2654a77ecdf4a0c391999d7f67 (diff) | |
download | samba-b47db91bafeee07b1671354dfde96b6513822521.tar.gz samba-b47db91bafeee07b1671354dfde96b6513822521.tar.xz samba-b47db91bafeee07b1671354dfde96b6513822521.zip |
lib: Add server_id marshalling
Will be used soon to make source3 and source4 messaging-protocol
compatible.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/samba_util.h | 3 | ||||
-rw-r--r-- | lib/util/server_id.c | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index 1c7ae79b70..7adcdba11e 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 7d3de2f9f5..308ee2a492 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); +} |