2 Unix SMB/CIFS implementation.
4 UUID/GUID/policy_handle functions
6 Copyright (C) Theodore Ts'o 1996, 1997,
7 Copyright (C) Jim McDonough 2002.
8 Copyright (C) Andrew Tridgell 2003.
9 Copyright (C) Stefan (metze) Metzmacher 2004.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 * see if a range of memory is all zero. A NULL pointer is considered
31 bool all_zero(const uint8_t *ptr
, size_t size
)
34 if (!ptr
) return True
;
35 for (i
=0;i
<size
;i
++) {
36 if (ptr
[i
]) return False
;
41 void ndr_print_GUID(struct ndr_print
*ndr
, const char *name
, const struct GUID
*guid
)
43 ndr
->print(ndr
, "%-25s: %s", name
, GUID_string(ndr
, guid
));
46 bool ndr_syntax_id_equal(const struct ndr_syntax_id
*i1
,
47 const struct ndr_syntax_id
*i2
)
49 return guid_equal(&i1
->uuid
, &i2
->uuid
)
50 && (i1
->if_version
== i2
->if_version
);
53 enum ndr_err_code
ndr_push_server_id(struct ndr_push
*ndr
, int ndr_flags
, const struct server_id
*r
)
55 if (ndr_flags
& NDR_SCALARS
) {
56 NDR_CHECK(ndr_push_align(ndr
, 4));
57 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
,
59 #ifdef CLUSTER_SUPPORT
60 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
,
64 if (ndr_flags
& NDR_BUFFERS
) {
66 return NDR_ERR_SUCCESS
;
69 enum ndr_err_code
ndr_pull_server_id(struct ndr_pull
*ndr
, int ndr_flags
, struct server_id
*r
)
71 if (ndr_flags
& NDR_SCALARS
) {
73 NDR_CHECK(ndr_pull_align(ndr
, 4));
74 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &pid
));
75 #ifdef CLUSTER_SUPPORT
76 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->vnn
));
80 if (ndr_flags
& NDR_BUFFERS
) {
82 return NDR_ERR_SUCCESS
;
85 void ndr_print_server_id(struct ndr_print
*ndr
, const char *name
, const struct server_id
*r
)
87 ndr_print_struct(ndr
, name
, "server_id");
89 ndr_print_uint32(ndr
, "id", (uint32_t)r
->pid
);
90 #ifdef CLUSTER_SUPPORT
91 ndr_print_uint32(ndr
, "vnn", (uint32_t)r
->vnn
);