2 Unix SMB/CIFS implementation.
4 Copyright (C) Jelmer Vernooij 2007
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __TORTURE_NDR_H__
21 #define __TORTURE_NDR_H__
23 #include "torture/torture.h"
24 #include "librpc/ndr/libndr.h"
25 #include "libcli/security/security.h"
27 _PUBLIC_
struct torture_test
*_torture_suite_add_ndr_pullpush_test(
28 struct torture_suite
*suite
,
30 ndr_pull_flags_fn_t pull_fn
,
31 ndr_push_flags_fn_t push_fn
,
35 bool (*check_fn
) (struct torture_context
*, void *data
));
37 _PUBLIC_
struct torture_test
*_torture_suite_add_ndr_pull_inout_test(
38 struct torture_suite
*suite
,
39 const char *name
, ndr_pull_flags_fn_t pull_fn
,
43 bool (*check_fn
) (struct torture_context
*ctx
, void *data
));
45 #define torture_suite_add_ndr_pull_test(suite,name,data,check_fn) \
46 _torture_suite_add_ndr_pullpush_test(suite, #name, \
47 (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \
48 sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, (bool (*) (struct torture_context *, void *)) check_fn);
50 #define torture_suite_add_ndr_pull_fn_test(suite,name,data,flags,check_fn) \
51 _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags, \
52 (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \
53 sizeof(struct name), flags, (bool (*) (struct torture_context *, void *)) check_fn);
55 #define torture_suite_add_ndr_pullpush_test(suite,name,data_blob,check_fn) \
56 _torture_suite_add_ndr_pullpush_test(suite, #name, \
57 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
58 (ndr_push_flags_fn_t)ndr_push_ ## name, \
60 sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, (bool (*) (struct torture_context *, void *)) check_fn);
62 #define torture_suite_add_ndr_pull_io_test(suite,name,data_in,data_out,check_fn_out) \
63 _torture_suite_add_ndr_pull_inout_test(suite, #name "_INOUT", \
64 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
65 data_blob_const(data_in, sizeof(data_in)), \
66 data_blob_const(data_out, sizeof(data_out)), \
67 sizeof(struct name), \
68 (bool (*) (struct torture_context *, void *)) check_fn_out);
70 #define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
71 do { struct dom_sid *__got = (got), *__expected = (expected); \
72 if (!dom_sid_equal(__got, __expected)) { \
73 torture_result(torture_ctx, TORTURE_FAIL, \
74 __location__": "#got" was %s, expected %s: %s", \
75 dom_sid_string(torture_ctx, __got), dom_sid_string(torture_ctx, __expected), cmt); \
80 #endif /* __TORTURE_NDR_H__ */