initshutdown.idl: get rid of initshutdown_String and use lsa_StringLarge
[jelmer/samba4-debian.git] / source / torture / util.h
1 /* 
2    Unix SMB/CIFS implementation.
3    Samba utility functions
4    Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
5    
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.
10    
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.
15    
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/>.
18 */
19
20 #ifndef _TORTURE_PROVISION_H_
21 #define _TORTURE_PROVISION_H_
22
23 struct provision_settings {
24         const char *dns_name;
25         const char *site_name;
26         const char *root_dn_str; 
27         const char *domain_dn_str;
28         const char *config_dn_str;
29         const char *schema_dn_str;
30         const struct GUID *invocation_id;
31         const char *netbios_name;
32         const char *realm;
33         const char *domain;
34         const struct GUID *ntds_guid;
35         const char *ntds_dn_str;
36         const char *machine_password;
37         const char *samdb_ldb;
38         const char *secrets_ldb;
39         const char *secrets_keytab;
40         const char *schemadn_ldb;
41         const char *configdn_ldb;
42         const char *domaindn_ldb;
43         const char *templates_ldb;
44         const char *dns_keytab;
45 };
46
47 NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
48                                                 struct provision_settings *settings);
49
50
51 /**
52   setup a directory ready for a test
53 */
54 _PUBLIC_ bool torture_setup_dir(struct smbcli_state *cli, const char *dname);
55 NTSTATUS create_directory_handle(struct smbcli_tree *tree, const char *dname, int *fnum);
56
57 /**
58   sometimes we need a fairly complex file to work with, so we can test
59   all possible attributes. 
60 */
61 _PUBLIC_ int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname);
62 int create_complex_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *dname);
63 void *shm_setup(int size);
64
65 /**
66   check that a wire string matches the flags specified 
67   not 100% accurate, but close enough for testing
68 */
69 bool wire_bad_flags(struct smb_wire_string *str, int flags, 
70                     struct smbcli_transport *transport);
71 void dump_all_info(TALLOC_CTX *mem_ctx, union smb_fileinfo *finfo);
72 void torture_all_info(struct smbcli_tree *tree, const char *fname);
73 bool torture_set_file_attribute(struct smbcli_tree *tree, const char *fname, uint16_t attrib);
74 NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum);
75 NTSTATUS torture_check_ea(struct smbcli_state *cli, 
76                           const char *fname, const char *eaname, const char *value);
77 _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
78                                    struct smbcli_state **c, 
79                                    struct torture_context *tctx,
80                                    const char *hostname, 
81                                    const char *sharename,
82                                    struct event_context *ev);
83 _PUBLIC_ bool torture_get_conn_index(int conn_index,
84                                      TALLOC_CTX *mem_ctx,
85                                      struct torture_context *tctx,
86                                      char **host, char **share);
87 _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c,
88                                          int conn_index,
89                                          struct torture_context *tctx,
90                                          struct event_context *ev);
91 _PUBLIC_ bool torture_open_connection(struct smbcli_state **c, struct torture_context *tctx, int conn_index);
92 _PUBLIC_ bool torture_close_connection(struct smbcli_state *c);
93 _PUBLIC_ bool check_error(const char *location, struct smbcli_state *c, 
94                  uint8_t eclass, uint32_t ecode, NTSTATUS nterr);
95 double torture_create_procs(struct torture_context *tctx, 
96                                                         bool (*fn)(struct torture_context *, struct smbcli_state *, int), bool *result);
97 _PUBLIC_ struct torture_test *torture_suite_add_smb_multi_test(
98                                                                         struct torture_suite *suite,
99                                                                         const char *name,
100                                                                         bool (*run) (struct torture_context *,
101                                                                                                  struct smbcli_state *,
102                                                                                                 int i));
103 _PUBLIC_ struct torture_test *torture_suite_add_2smb_test(
104                                                                         struct torture_suite *suite,
105                                                                         const char *name,
106                                                                         bool (*run) (struct torture_context *,
107                                                                                                 struct smbcli_state *,
108                                                                                                 struct smbcli_state *));
109 _PUBLIC_ struct torture_test *torture_suite_add_1smb_test(
110                                 struct torture_suite *suite,
111                                 const char *name,
112                                 bool (*run) (struct torture_context *, struct smbcli_state *));
113 NTSTATUS torture_second_tcon(TALLOC_CTX *mem_ctx,
114                              struct smbcli_session *session,
115                              const char *sharename,
116                              struct smbcli_tree **res);
117
118
119
120 #endif /* _TORTURE_PROVISION_H_ */