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