• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/samba-3.5.8/source4/torture/
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_UTIL_H_
21#define _TORTURE_UTIL_H_
22
23#include "lib/torture/torture.h"
24
25struct smbcli_state;
26struct smbcli_tree;
27
28/**
29  setup a directory ready for a test
30*/
31_PUBLIC_ bool torture_setup_dir(struct smbcli_state *cli, const char *dname);
32NTSTATUS create_directory_handle(struct smbcli_tree *tree, const char *dname, int *fnum);
33
34/**
35  sometimes we need a fairly complex file to work with, so we can test
36  all possible attributes.
37*/
38_PUBLIC_ int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname);
39int create_complex_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *dname);
40void *shm_setup(int size);
41
42/**
43  check that a wire string matches the flags specified
44  not 100% accurate, but close enough for testing
45*/
46bool wire_bad_flags(struct smb_wire_string *str, int flags,
47		    struct smbcli_transport *transport);
48void dump_all_info(TALLOC_CTX *mem_ctx, union smb_fileinfo *finfo);
49void torture_all_info(struct smbcli_tree *tree, const char *fname);
50bool torture_set_file_attribute(struct smbcli_tree *tree, const char *fname, uint16_t attrib);
51NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum);
52NTSTATUS torture_check_ea(struct smbcli_state *cli,
53			  const char *fname, const char *eaname, const char *value);
54_PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
55				   struct smbcli_state **c,
56				   struct torture_context *tctx,
57				   const char *hostname,
58				   const char *sharename,
59				   struct tevent_context *ev);
60_PUBLIC_ bool torture_get_conn_index(int conn_index,
61				     TALLOC_CTX *mem_ctx,
62				     struct torture_context *tctx,
63				     char **host, char **share);
64_PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c,
65					 int conn_index,
66					 struct torture_context *tctx,
67					 struct tevent_context *ev);
68_PUBLIC_ bool torture_open_connection(struct smbcli_state **c, struct torture_context *tctx, int conn_index);
69_PUBLIC_ bool torture_close_connection(struct smbcli_state *c);
70_PUBLIC_ bool check_error(const char *location, struct smbcli_state *c,
71		 uint8_t eclass, uint32_t ecode, NTSTATUS nterr);
72double torture_create_procs(struct torture_context *tctx,
73							bool (*fn)(struct torture_context *, struct smbcli_state *, int), bool *result);
74_PUBLIC_ struct torture_test *torture_suite_add_smb_multi_test(
75									struct torture_suite *suite,
76									const char *name,
77									bool (*run) (struct torture_context *,
78												 struct smbcli_state *,
79												int i));
80_PUBLIC_ struct torture_test *torture_suite_add_2smb_test(
81									struct torture_suite *suite,
82									const char *name,
83									bool (*run) (struct torture_context *,
84												struct smbcli_state *,
85												struct smbcli_state *));
86_PUBLIC_ struct torture_test *torture_suite_add_1smb_test(
87				struct torture_suite *suite,
88				const char *name,
89				bool (*run) (struct torture_context *, struct smbcli_state *));
90NTSTATUS torture_second_tcon(TALLOC_CTX *mem_ctx,
91			     struct smbcli_session *session,
92			     const char *sharename,
93			     struct smbcli_tree **res);
94
95
96
97#endif /* _TORTURE_UTIL_H_ */
98