s3-librpc: move server_id marshalling to own helper file.
authorGünther Deschner <gd@samba.org>
Tue, 15 Feb 2011 16:37:03 +0000 (17:37 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 15 Feb 2011 23:02:33 +0000 (00:02 +0100)
(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

source3/Makefile.in
source3/librpc/idl/messaging.idl
source3/librpc/idl/notify.idl
source3/librpc/ndr/ndr_server_id.c [new file with mode: 0644]
source3/librpc/ndr/ndr_server_id.h [new file with mode: 0644]
source3/librpc/ndr/util.c
source3/librpc/ndr/util.h
source3/librpc/wscript_build

index b632d5d0bef5791e2cf918f675dbac1d5e196617..7dbb012b6dfe4b20c91b1ccd289ac3bb2cfd5e90 100644 (file)
@@ -318,6 +318,7 @@ LIBNDR_OBJ = ../librpc/ndr/ndr_basic.o \
             ../librpc/ndr/ndr_string.o \
             ../librpc/ndr/uuid.o \
             librpc/ndr/util.o \
+            librpc/ndr/ndr_server_id.o \
             librpc/gen_ndr/ndr_dcerpc.o
 
 LIBNDR_GEN_OBJ0 = librpc/gen_ndr/ndr_samr.o \
index 22c34297e481de4ff1bba96776619acc54e98cfb..0ac7220995b5304410c8e4baaab37633fe65fff4 100644 (file)
@@ -5,7 +5,7 @@
 */
 
 [
-  helper("../librpc/ndr/util.h"),
+  helper("../librpc/ndr/ndr_server_id.h"),
   pointer_default(unique)
 ]
 interface messaging
index 592af19eeb15e8e202402d250619aafa23f927db..d65e8c5f86cd909fb8893372d8a28ea2754c0b90 100644 (file)
@@ -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 (file)
index 0000000..a6152d7
--- /dev/null
@@ -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 (file)
index 0000000..5975abc
--- /dev/null
@@ -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);
index d4e06df574bdeef37f0e43f2f4f60d988389f1e1..a026ecc9edcb1a5201434ebface200011389a2cd 100644 (file)
 #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];
index 3f7be6bbaf875f90c249f8dbd5d1a310c2ade475..3bf9c0eb438d8da61cd72b2f5e9f2b67637825a7 100644 (file)
@@ -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);
index ae43531f3985eeb4946df3351046aa82aa0ab741..a07d4bcee88829a7ea789fead37ce817ba5edf07 100644 (file)
@@ -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',