diff options
author | Günther Deschner <gd@samba.org> | 2011-02-15 17:37:03 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-02-16 00:02:33 +0100 |
commit | e34ba447ec8a54db744f0103d91ec05f7cfd60ce (patch) | |
tree | 6c8f8b40a6e37ea19f5439c6802c5b0b1910ba46 /source3/librpc | |
parent | ab85362cffbf844f4783b4e82fe7db8f9d5067bc (diff) | |
download | samba-e34ba447ec8a54db744f0103d91ec05f7cfd60ce.tar.gz samba-e34ba447ec8a54db744f0103d91ec05f7cfd60ce.tar.bz2 samba-e34ba447ec8a54db744f0103d91ec05f7cfd60ce.zip |
s3-librpc: move server_id marshalling to own helper file.
(in preparation of merging struct server_id).
Guenther
Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Feb 16 00:02:33 CET 2011 on sn-devel-104
Diffstat (limited to 'source3/librpc')
-rw-r--r-- | source3/librpc/idl/messaging.idl | 2 | ||||
-rw-r--r-- | source3/librpc/idl/notify.idl | 2 | ||||
-rw-r--r-- | source3/librpc/ndr/ndr_server_id.c | 66 | ||||
-rw-r--r-- | source3/librpc/ndr/ndr_server_id.h | 6 | ||||
-rw-r--r-- | source3/librpc/ndr/util.c | 43 | ||||
-rw-r--r-- | source3/librpc/ndr/util.h | 3 | ||||
-rw-r--r-- | source3/librpc/wscript_build | 9 |
7 files changed, 81 insertions, 50 deletions
diff --git a/source3/librpc/idl/messaging.idl b/source3/librpc/idl/messaging.idl index 22c34297e4..0ac7220995 100644 --- a/source3/librpc/idl/messaging.idl +++ b/source3/librpc/idl/messaging.idl @@ -5,7 +5,7 @@ */ [ - helper("../librpc/ndr/util.h"), + helper("../librpc/ndr/ndr_server_id.h"), pointer_default(unique) ] interface messaging diff --git a/source3/librpc/idl/notify.idl b/source3/librpc/idl/notify.idl index 592af19eeb..d65e8c5f86 100644 --- a/source3/librpc/idl/notify.idl +++ b/source3/librpc/idl/notify.idl @@ -10,7 +10,7 @@ import "file_id.idl"; */ [ - helper("../librpc/ndr/util.h"), + helper("../librpc/ndr/ndr_server_id.h"), pointer_default(unique) ] interface notify diff --git a/source3/librpc/ndr/ndr_server_id.c b/source3/librpc/ndr/ndr_server_id.c new file mode 100644 index 0000000000..a6152d755e --- /dev/null +++ b/source3/librpc/ndr/ndr_server_id.c @@ -0,0 +1,66 @@ +/* + Unix SMB/CIFS implementation. + + libndr interface + + Copyright (C) Andrew Tridgell 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "includes.h" +#include "librpc/ndr/ndr_server_id.h" + +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) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, + (uint32_t)r->pid)); +#ifdef CLUSTER_SUPPORT + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, + (uint32_t)r->vnn)); +#endif + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r) +{ + if (ndr_flags & NDR_SCALARS) { + uint32_t pid; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pid)); +#ifdef CLUSTER_SUPPORT + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->vnn)); +#endif + r->pid = (pid_t)pid; + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r) +{ + ndr_print_struct(ndr, name, "server_id"); + ndr->depth++; + ndr_print_uint32(ndr, "id", (uint32_t)r->pid); +#ifdef CLUSTER_SUPPORT + ndr_print_uint32(ndr, "vnn", (uint32_t)r->vnn); +#endif + ndr->depth--; +} diff --git a/source3/librpc/ndr/ndr_server_id.h b/source3/librpc/ndr/ndr_server_id.h new file mode 100644 index 0000000000..5975abc1f5 --- /dev/null +++ b/source3/librpc/ndr/ndr_server_id.h @@ -0,0 +1,6 @@ + +/* The following definitions come from librpc/ndr/ndr_server_id.c */ + +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); diff --git a/source3/librpc/ndr/util.c b/source3/librpc/ndr/util.c index d4e06df574..a026ecc9ed 100644 --- a/source3/librpc/ndr/util.c +++ b/source3/librpc/ndr/util.c @@ -22,49 +22,6 @@ #include "includes.h" #include "librpc/ndr/util.h" -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) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, - (uint32_t)r->pid)); -#ifdef CLUSTER_SUPPORT - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, - (uint32_t)r->vnn)); -#endif - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r) -{ - if (ndr_flags & NDR_SCALARS) { - uint32_t pid; - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pid)); -#ifdef CLUSTER_SUPPORT - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->vnn)); -#endif - r->pid = (pid_t)pid; - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r) -{ - ndr_print_struct(ndr, name, "server_id"); - ndr->depth++; - ndr_print_uint32(ndr, "id", (uint32_t)r->pid); -#ifdef CLUSTER_SUPPORT - ndr_print_uint32(ndr, "vnn", (uint32_t)r->vnn); -#endif - ndr->depth--; -} - _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss) { char addr[INET6_ADDRSTRLEN]; diff --git a/source3/librpc/ndr/util.h b/source3/librpc/ndr/util.h index 3f7be6bbaf..3bf9c0eb43 100644 --- a/source3/librpc/ndr/util.h +++ b/source3/librpc/ndr/util.h @@ -1,7 +1,4 @@ /* The following definitions come from librpc/ndr/util.c */ -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); _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss); diff --git a/source3/librpc/wscript_build b/source3/librpc/wscript_build index ae43531f39..a07d4bcee8 100644 --- a/source3/librpc/wscript_build +++ b/source3/librpc/wscript_build @@ -10,14 +10,19 @@ bld.SAMBA_SUBSYSTEM('NDR_LIBNET_JOIN', public_deps='ndr' ) +bld.SAMBA_SUBSYSTEM('NDR_SERVER_ID', + source='ndr/ndr_server_id.c', + public_deps='ndr' + ) + bld.SAMBA_SUBSYSTEM('NDR_MESSAGING', source='gen_ndr/ndr_messaging.c', - public_deps='ndr' + public_deps='ndr NDR_SERVER_ID' ) bld.SAMBA_SUBSYSTEM('NDR_NOTIFY', source='gen_ndr/ndr_notify.c', - public_deps='ndr NDR_FILE_ID' + public_deps='ndr NDR_FILE_ID NDR_SERVER_ID' ) bld.SAMBA_SUBSYSTEM('NDR_SECRETS', |