s4-torture: add torture_rpc_connection_with_binding()
[samba.git] / source4 / torture / rpc / torture_rpc.h
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB torture tester
4    Copyright (C) Andrew Tridgell 1997-2003
5    Copyright (C) Jelmer Vernooij 2006
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __TORTURE_RPC_H__
22 #define __TORTURE_RPC_H__
23
24 #include "lib/torture/torture.h"
25 #include "auth/credentials/credentials.h"
26 #include "torture/rpc/drsuapi.h"
27 #include "libnet/libnet_join.h"
28 #include "librpc/rpc/dcerpc.h"
29 #include "libcli/raw/libcliraw.h"
30 #include "librpc/gen_ndr/ndr_spoolss.h"
31 #include "torture/rpc/proto.h"
32
33 struct torture_rpc_tcase {
34         struct torture_tcase tcase;
35         const struct ndr_interface_table *table;
36         const char *machine_name;
37 };
38
39 struct torture_rpc_tcase_data {
40         struct test_join *join_ctx;
41         struct dcerpc_pipe *pipe;
42         struct cli_credentials *credentials;
43 };
44
45 NTSTATUS torture_rpc_connection(struct torture_context *tctx,
46                                 struct dcerpc_pipe **p, 
47                                 const struct ndr_interface_table *table);
48 NTSTATUS torture_rpc_connection_with_binding(struct torture_context *tctx,
49                                              struct dcerpc_binding *binding,
50                                              struct dcerpc_pipe **p,
51                                              const struct ndr_interface_table *table);
52
53 struct test_join *torture_join_domain(struct torture_context *tctx,
54                                                const char *machine_name, 
55                                       uint32_t acct_flags,
56                                       struct cli_credentials **machine_credentials);
57 const struct dom_sid *torture_join_sid(struct test_join *join);
58 void torture_leave_domain(struct torture_context *tctx, struct test_join *join);
59 struct torture_rpc_tcase *torture_suite_add_rpc_iface_tcase(struct torture_suite *suite, 
60                                                                 const char *name,
61                                                                 const struct ndr_interface_table *table);
62
63 struct torture_test *torture_rpc_tcase_add_test(
64                                         struct torture_rpc_tcase *tcase, 
65                                         const char *name, 
66                                         bool (*fn) (struct torture_context *, struct dcerpc_pipe *));
67 struct torture_rpc_tcase *torture_suite_add_anon_rpc_iface_tcase(struct torture_suite *suite, 
68                                                                 const char *name,
69                                                                 const struct ndr_interface_table *table);
70
71 struct torture_test *torture_rpc_tcase_add_test_join(
72         struct torture_rpc_tcase *tcase,
73         const char *name,
74         bool (*fn) (struct torture_context *, struct dcerpc_pipe *,
75                     struct cli_credentials *, struct test_join *));
76
77 struct torture_test *torture_rpc_tcase_add_test_ex(
78                                         struct torture_rpc_tcase *tcase, 
79                                         const char *name, 
80                                         bool (*fn) (struct torture_context *, struct dcerpc_pipe *,
81                                                                 void *),
82                                         void *userdata);
83 struct torture_rpc_tcase *torture_suite_add_machine_bdc_rpc_iface_tcase(
84                                 struct torture_suite *suite,
85                                 const char *name,
86                                 const struct ndr_interface_table *table,
87                                 const char *machine_name);
88 struct torture_rpc_tcase *torture_suite_add_machine_workstation_rpc_iface_tcase(
89                                 struct torture_suite *suite, 
90                                 const char *name,
91                                 const struct ndr_interface_table *table,
92                                 const char *machine_name);
93 struct torture_test *torture_rpc_tcase_add_test_creds(
94                                         struct torture_rpc_tcase *tcase, 
95                                         const char *name, 
96                                         bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct cli_credentials *));
97 bool torture_suite_init_rpc_tcase(struct torture_suite *suite, 
98                                            struct torture_rpc_tcase *tcase, 
99                                            const char *name,
100                                            const struct ndr_interface_table *table);
101
102
103
104 #endif /* __TORTURE_RPC_H__ */