summaryrefslogtreecommitdiffstats
path: root/source4/torture/rpc/torture_rpc.h
blob: 9217461a710258f7785637bd4c0a5f9a200b9196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* 
   Unix SMB/CIFS implementation.
   SMB torture tester
   Copyright (C) Andrew Tridgell 1997-2003
   Copyright (C) Jelmer Vernooij 2006
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __TORTURE_RPC_H__
#define __TORTURE_RPC_H__

#include "lib/torture/torture.h"
#include "auth/credentials/credentials.h"
#include "torture/rpc/drsuapi.h"
#include "libnet/libnet_join.h"
#include "librpc/rpc/dcerpc.h"
#include "libcli/raw/libcliraw.h"
#include "librpc/gen_ndr/ndr_spoolss.h"
#include "torture/rpc/proto.h"

struct torture_rpc_tcase {
	struct torture_tcase tcase;
	const struct ndr_interface_table *table;
	const char *machine_name;
	bool (*setup_fn)(struct torture_context *,
			 struct dcerpc_pipe *,
			 void *);
	bool (*teardown_fn)(struct torture_context *,
			    struct dcerpc_pipe *,
			    void *);
};

struct torture_rpc_tcase_data {
	struct test_join *join_ctx;
	struct dcerpc_pipe *pipe;
	struct cli_credentials *credentials;
};

NTSTATUS torture_rpc_connection(struct torture_context *tctx,
				struct dcerpc_pipe **p, 
				const struct ndr_interface_table *table);
NTSTATUS torture_rpc_connection_with_binding(struct torture_context *tctx,
					     struct dcerpc_binding *binding,
					     struct dcerpc_pipe **p,
					     const struct ndr_interface_table *table);

struct test_join *torture_join_domain(struct torture_context *tctx,
					       const char *machine_name, 
				      uint32_t acct_flags,
				      struct cli_credentials **machine_credentials);
const struct dom_sid *torture_join_sid(struct test_join *join);
void torture_leave_domain(struct torture_context *tctx, struct test_join *join);
struct torture_rpc_tcase *torture_suite_add_rpc_iface_tcase(struct torture_suite *suite, 
								const char *name,
								const struct ndr_interface_table *table);
struct torture_rpc_tcase *torture_suite_add_rpc_setup_tcase(
				struct torture_suite *suite,
				const char *name,
				const struct ndr_interface_table *table,
				bool (*setup_fn)(struct torture_context *,
						 struct dcerpc_pipe *,
						 void *),
				bool (*teardown_fn)(struct torture_context *,
						    struct dcerpc_pipe *,
						    void *));

struct torture_test *torture_rpc_tcase_add_test(
					struct torture_rpc_tcase *tcase, 
					const char *name, 
					bool (*fn) (struct torture_context *, struct dcerpc_pipe *));
struct torture_rpc_tcase *torture_suite_add_anon_rpc_iface_tcase(struct torture_suite *suite, 
								const char *name,
								const struct ndr_interface_table *table);

struct torture_test *torture_rpc_tcase_add_test_join(
	struct torture_rpc_tcase *tcase,
	const char *name,
	bool (*fn) (struct torture_context *, struct dcerpc_pipe *,
		    struct cli_credentials *, struct test_join *));
_PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_setup(
	struct torture_rpc_tcase *tcase,
	const char *name,
	bool (*fn)(struct torture_context *,
		   struct dcerpc_pipe *,
		   void *),
	void *userdata);
struct torture_test *torture_rpc_tcase_add_test_ex(
					struct torture_rpc_tcase *tcase, 
					const char *name, 
					bool (*fn) (struct torture_context *, struct dcerpc_pipe *,
								void *),
					void *userdata);
struct torture_rpc_tcase *torture_suite_add_machine_bdc_rpc_iface_tcase(
				struct torture_suite *suite,
				const char *name,
				const struct ndr_interface_table *table,
				const char *machine_name);
struct torture_rpc_tcase *torture_suite_add_machine_workstation_rpc_iface_tcase(
				struct torture_suite *suite, 
				const char *name,
				const struct ndr_interface_table *table,
				const char *machine_name);
struct torture_test *torture_rpc_tcase_add_test_creds(
					struct torture_rpc_tcase *tcase, 
					const char *name, 
					bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct cli_credentials *));
bool torture_suite_init_rpc_tcase(struct torture_suite *suite, 
					   struct torture_rpc_tcase *tcase, 
					   const char *name,
					   const struct ndr_interface_table *table);



#endif /* __TORTURE_RPC_H__ */