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,
36 bool (*check_fn) (struct torture_context *, void *data));
38 _PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_inout_test(
39 struct torture_suite *suite,
40 const char *name, ndr_pull_flags_fn_t pull_fn,
44 bool (*check_fn) (struct torture_context *ctx, void *data));
46 #define torture_suite_add_ndr_pull_test(suite,name,data,check_fn) \
47 _torture_suite_add_ndr_pullpush_test(suite, #name, \
48 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
50 data_blob_const(data, sizeof(data)), \
51 sizeof(struct name), \
52 NDR_SCALARS|NDR_BUFFERS, 0, \
53 (bool (*) (struct torture_context *, void *)) check_fn);
55 #define torture_suite_add_ndr_pull_fn_test(suite,name,data,flags,check_fn) \
56 _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags, \
57 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
59 data_blob_const(data, sizeof(data)), \
60 sizeof(struct name), \
62 (bool (*) (struct torture_context *, void *)) check_fn);
64 #define torture_suite_add_ndr_pull_fn_test_flags(suite,name,data,flags,flags2,check_fn) \
65 _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags "_" #flags2, \
66 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
68 data_blob_const(data, sizeof(data)), \
69 sizeof(struct name), \
71 (bool (*) (struct torture_context *, void *)) check_fn);
73 #define torture_suite_add_ndr_pullpush_test(suite,name,data_blob,check_fn) \
74 _torture_suite_add_ndr_pullpush_test(suite, #name, \
75 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
76 (ndr_push_flags_fn_t)ndr_push_ ## name, \
78 sizeof(struct name), \
79 NDR_SCALARS|NDR_BUFFERS, 0, \
80 (bool (*) (struct torture_context *, void *)) check_fn);
82 #define torture_suite_add_ndr_pull_io_test(suite,name,data_in,data_out,check_fn_out) \
83 _torture_suite_add_ndr_pull_inout_test(suite, #name "_INOUT", \
84 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
85 data_blob_const(data_in, sizeof(data_in)), \
86 data_blob_const(data_out, sizeof(data_out)), \
87 sizeof(struct name), \
88 (bool (*) (struct torture_context *, void *)) check_fn_out);
90 #endif /* __TORTURE_NDR_H__ */