WHATSNEW: Start release notes for Samba 3.6.17.
[Samba.git] / source4 / libcli / resolve / host.c
blob755a4e8304a38c49b6056e52da878323a0cfc0c2
1 /*
2 Unix SMB/CIFS implementation.
4 async "host" name resolution module
6 Copyright (C) Andrew Tridgell 2005
7 Copyright (C) Stefan Metzmacher 2008
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.
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.
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/>.
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"
33 getaddrinfo() (with fallback to dns_lookup()) name resolution method - async send
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)
41 return resolve_name_dns_ex_send(mem_ctx, event_ctx, NULL, flags,
42 port, name, true);
46 getaddrinfo() (with fallback to dns_lookup()) name resolution method - recv side
48 NTSTATUS resolve_name_host_recv(struct composite_context *c,
49 TALLOC_CTX *mem_ctx,
50 struct socket_address ***addrs,
51 char ***names)
53 return resolve_name_dns_ex_recv(c, mem_ctx, addrs, names);
56 bool resolve_context_add_host_method(struct resolve_context *ctx)
58 return resolve_context_add_method(ctx, resolve_name_host_send, resolve_name_host_recv,
59 NULL);