r23792: convert Samba4 to GPLv3
[mdw/samba.git] / source4 / torture / nbt / nbt.c
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB torture tester
4    Copyright (C) Jelmer Vernooij 2006
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 #include "includes.h"
21 #include "torture/torture.h"
22 #include "torture/nbt/proto.h"
23 #include "torture/ui.h"
24 #include "libcli/resolve/resolve.h"
25
26 bool torture_nbt_get_name(struct torture_context *tctx, 
27                                                                  struct nbt_name *name, 
28                                                                  const char **address)
29 {
30         make_nbt_name_server(name, strupper_talloc(tctx, 
31                                                  torture_setting_string(tctx, "host", NULL)));
32
33         /* do an initial name resolution to find its IP */
34         torture_assert_ntstatus_ok(tctx, 
35                                                            resolve_name(name, tctx, address, NULL), 
36                                                            talloc_asprintf(tctx, 
37                                                            "Failed to resolve %s", name->name));
38
39         return true;
40 }
41
42 NTSTATUS torture_nbt_init(void)
43 {
44         struct torture_suite *suite = torture_suite_create(
45                                                                                         talloc_autofree_context(),
46                                                                                         "NBT");
47         /* nbt tests */
48         torture_suite_add_suite(suite, torture_nbt_register());
49         torture_suite_add_suite(suite, torture_nbt_wins());
50         torture_suite_add_suite(suite, torture_nbt_dgram());
51         torture_suite_add_suite(suite, torture_nbt_winsreplication());
52         torture_suite_add_suite(suite, torture_bench_nbt());
53         torture_suite_add_suite(suite, torture_bench_wins());
54
55         suite->description = talloc_strdup(suite, 
56                                                         "NetBIOS over TCP/IP and WINS tests");
57
58         torture_register_suite(suite);
59
60         return NT_STATUS_OK;
61 }