s4:librpc/dcerpc_smb2: make use of smbXcli_session_application_key()
[Samba/gebeck_regimport.git] / source4 / torture / ndr / ndr.h
blobee4db0aa68a7c6710f94ea3de5cb3632d4cad81b
1 /*
2 Unix SMB/CIFS implementation.
3 SMB torture tester
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,
29 const char *name,
30 ndr_pull_flags_fn_t pull_fn,
31 ndr_push_flags_fn_t push_fn,
32 DATA_BLOB db,
33 size_t struct_size,
34 int ndr_flags,
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,
40 DATA_BLOB db_in,
41 DATA_BLOB db_out,
42 size_t struct_size,
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, \
59 data_blob, \
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); \
76 return false; \
77 } \
78 } while(0)
80 #endif /* __TORTURE_NDR_H__ */