1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 |
|
---|
4 | async "host" name resolution module
|
---|
5 |
|
---|
6 | Copyright (C) Andrew Tridgell 2005
|
---|
7 | Copyright (C) Stefan Metzmacher 2008
|
---|
8 |
|
---|
9 | This program is free software; you can redistribute it and/or modify
|
---|
10 | it under the terms of the GNU General Public License as published by
|
---|
11 | the Free Software Foundation; either version 3 of the License, or
|
---|
12 | (at your option) any later version.
|
---|
13 |
|
---|
14 | This program is distributed in the hope that it will be useful,
|
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | GNU General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU General Public License
|
---|
20 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #include "includes.h"
|
---|
24 | #include "lib/events/events.h"
|
---|
25 | #include "system/network.h"
|
---|
26 | #include "system/filesys.h"
|
---|
27 | #include "lib/socket/socket.h"
|
---|
28 | #include "libcli/composite/composite.h"
|
---|
29 | #include "librpc/gen_ndr/ndr_nbt.h"
|
---|
30 | #include "libcli/resolve/resolve.h"
|
---|
31 |
|
---|
32 | /*
|
---|
33 | getaddrinfo() (with fallback to dns_lookup()) name resolution method - async send
|
---|
34 | */
|
---|
35 | struct composite_context *resolve_name_host_send(TALLOC_CTX *mem_ctx,
|
---|
36 | struct tevent_context *event_ctx,
|
---|
37 | void *privdata, uint32_t flags,
|
---|
38 | uint16_t port,
|
---|
39 | struct nbt_name *name)
|
---|
40 | {
|
---|
41 | return resolve_name_dns_ex_send(mem_ctx, event_ctx, NULL, flags,
|
---|
42 | port, name, true);
|
---|
43 | }
|
---|
44 |
|
---|
45 | /*
|
---|
46 | getaddrinfo() (with fallback to dns_lookup()) name resolution method - recv side
|
---|
47 | */
|
---|
48 | NTSTATUS resolve_name_host_recv(struct composite_context *c,
|
---|
49 | TALLOC_CTX *mem_ctx,
|
---|
50 | struct socket_address ***addrs,
|
---|
51 | char ***names)
|
---|
52 | {
|
---|
53 | return resolve_name_dns_ex_recv(c, mem_ctx, addrs, names);
|
---|
54 | }
|
---|
55 |
|
---|
56 | bool resolve_context_add_host_method(struct resolve_context *ctx)
|
---|
57 | {
|
---|
58 | return resolve_context_add_method(ctx, resolve_name_host_send, resolve_name_host_recv,
|
---|
59 | NULL);
|
---|
60 | }
|
---|