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, NULL, data_blob_const(data, sizeof(data)), \
49 sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, 0, (bool (*) (struct torture_context *, void *)) check_fn);
51 #define torture_suite_add_ndr_pull_fn_test(suite,name,data,flags,check_fn) \
52 _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags, \
53 (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \
54 sizeof(struct name), flags, 0, (bool (*) (struct torture_context *, void *)) check_fn);
56 #define torture_suite_add_ndr_pull_fn_test_flags(suite,name,data,flags,flags2,check_fn) \
57 _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags "_" #flags2, \
58 (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \
59 sizeof(struct name), flags, flags2, (bool (*) (struct torture_context *, void *)) check_fn);
61 #define torture_suite_add_ndr_pullpush_test(suite,name,data_blob,check_fn) \
62 _torture_suite_add_ndr_pullpush_test(suite, #name, \
63 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
64 (ndr_push_flags_fn_t)ndr_push_ ## name, \
66 sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, 0, (bool (*) (struct torture_context *, void *)) check_fn);
68 #define torture_suite_add_ndr_pull_io_test(suite,name,data_in,data_out,check_fn_out) \
69 _torture_suite_add_ndr_pull_inout_test(suite, #name "_INOUT", \
70 (ndr_pull_flags_fn_t)ndr_pull_ ## name, \
71 data_blob_const(data_in, sizeof(data_in)), \
72 data_blob_const(data_out, sizeof(data_out)), \
73 sizeof(struct name), \
74 (bool (*) (struct torture_context *, void *)) check_fn_out);
76 #define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
77 do { struct dom_sid *__got = (got), *__expected = (expected); \
78 if (!dom_sid_equal(__got, __expected)) { \
79 torture_result(torture_ctx, TORTURE_FAIL, \
80 __location__": "#got" was %s, expected %s: %s", \
81 dom_sid_string(torture_ctx, __got), dom_sid_string(torture_ctx, __expected), cmt); \
86 #endif /* __TORTURE_NDR_H__ */