2010-10-12 08:23:32 +04:00
/*
Unix SMB / CIFS implementation .
DNS structures
Copyright ( C ) 2010 Kai Blin < kai @ samba . org >
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
the Free Software Foundation ; either version 3 of the License , or
( at your option ) any later version .
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 .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef __DNS_SERVER_H__
# define __DNS_SERVER_H__
# include "librpc/gen_ndr/dns.h"
2011-12-16 12:24:18 +04:00
# include "librpc/gen_ndr/ndr_dnsp.h"
2010-10-12 08:23:32 +04:00
struct tsocket_address ;
2010-10-01 03:35:04 +04:00
struct dns_server_zone {
struct dns_server_zone * prev , * next ;
const char * name ;
struct ldb_dn * dn ;
} ;
2010-10-12 08:23:32 +04:00
struct dns_server {
struct task_server * task ;
2010-10-12 00:32:25 +04:00
struct ldb_context * samdb ;
2010-10-01 03:35:04 +04:00
struct dns_server_zone * zones ;
2010-10-12 08:23:32 +04:00
} ;
2010-10-01 23:59:22 +04:00
2010-10-12 01:39:44 +04:00
WERROR dns_server_process_query ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
struct dns_name_packet * in ,
struct dns_res_rec * * answers , uint16_t * ancount ,
struct dns_res_rec * * nsrecs , uint16_t * nscount ,
struct dns_res_rec * * additional , uint16_t * arcount ) ;
2010-10-01 23:59:22 +04:00
2010-10-12 01:39:44 +04:00
WERROR dns_server_process_update ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
struct dns_name_packet * in ,
2011-12-16 16:45:22 +04:00
struct dns_res_rec * * prereqs , uint16_t * prereq_count ,
2011-12-09 03:58:32 +04:00
struct dns_res_rec * * updates , uint16_t * update_count ,
struct dns_res_rec * * additional , uint16_t * arcount ) ;
2010-10-01 23:59:22 +04:00
2010-10-12 01:39:44 +04:00
uint8_t werr_to_dns_err ( WERROR werror ) ;
2010-10-01 23:59:22 +04:00
bool dns_name_match ( const char * zone , const char * name , size_t * host_part_len ) ;
2011-12-16 12:21:51 +04:00
bool dns_name_equal ( const char * name1 , const char * name2 ) ;
2011-12-16 12:24:18 +04:00
bool dns_records_match ( struct dnsp_DnssrvRpcRecord * rec1 ,
struct dnsp_DnssrvRpcRecord * rec2 ) ;
2011-12-16 12:43:47 +04:00
WERROR dns_lookup_records ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
struct ldb_dn * dn ,
struct dnsp_DnssrvRpcRecord * * records ,
uint16_t * rec_count ) ;
2011-12-16 17:21:52 +04:00
WERROR dns_replace_records ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
struct ldb_dn * dn ,
bool needs_add ,
const struct dnsp_DnssrvRpcRecord * records ,
uint16_t rec_count ) ;
2010-10-12 01:39:44 +04:00
WERROR dns_name2dn ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
const char * name ,
struct ldb_dn * * _dn ) ;
2010-10-01 23:59:22 +04:00
2010-10-12 01:39:44 +04:00
# define DNS_ERR(err_str) WERR_DNS_ERROR_RCODE_##err_str
2010-10-12 08:23:32 +04:00
# endif /* __DNS_SERVER_H__ */