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"
2015-09-22 03:10:00 +03:00
# include "dnsserver_common.h"
2010-10-12 08:23:32 +04:00
struct tsocket_address ;
2012-08-30 11:04:07 +04:00
struct dns_server_tkey {
const char * name ;
enum dns_tkey_mode mode ;
2012-09-05 10:27:28 +04:00
const char * algorithm ;
2012-08-30 11:04:07 +04:00
struct auth_session_info * session_info ;
struct gensec_security * gensec ;
bool complete ;
} ;
2012-08-31 15:41:19 +04:00
# define TKEY_BUFFER_SIZE 128
struct dns_server_tkey_store {
struct dns_server_tkey * * tkeys ;
uint16_t next_idx ;
uint16_t size ;
} ;
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 ;
2012-08-31 15:41:19 +04:00
struct dns_server_tkey_store * tkeys ;
2012-08-30 11:04:07 +04:00
struct cli_credentials * server_credentials ;
2010-10-12 08:23:32 +04:00
} ;
2012-03-27 15:59:03 +04:00
struct dns_request_state {
2014-10-14 11:34:29 +04:00
TALLOC_CTX * mem_ctx ;
2012-03-27 15:59:03 +04:00
uint16_t flags ;
2012-09-05 10:29:38 +04:00
bool authenticated ;
bool sign ;
char * key_name ;
struct dns_res_rec * tsig ;
uint16_t tsig_error ;
2017-03-01 04:19:50 +03:00
const struct tsocket_address * local_address ;
const struct tsocket_address * remote_address ;
2012-03-27 15:59:03 +04:00
} ;
2010-10-01 23:59:22 +04:00
2012-05-24 19:02:57 +04:00
struct tevent_req * dns_server_process_query_send (
TALLOC_CTX * mem_ctx , struct tevent_context * ev ,
struct dns_server * dns , struct dns_request_state * req_state ,
const struct dns_name_packet * in ) ;
WERROR dns_server_process_query_recv (
struct tevent_req * req , TALLOC_CTX * mem_ctx ,
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-12 01:39:44 +04:00
WERROR dns_server_process_update ( struct dns_server * dns ,
2014-10-14 11:30:43 +04:00
const struct dns_request_state * state ,
2010-10-12 01:39:44 +04:00
TALLOC_CTX * mem_ctx ,
2014-10-14 11:30:43 +04:00
const 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
2011-12-16 12:24:18 +04:00
bool dns_records_match ( struct dnsp_DnssrvRpcRecord * rec1 ,
struct dnsp_DnssrvRpcRecord * rec2 ) ;
2016-05-31 01:48:15 +03:00
bool dns_authoritative_for_zone ( struct dns_server * dns ,
const char * name ) ;
2014-10-29 15:35:36 +03:00
const char * dns_get_authoritative_zone ( struct dns_server * dns ,
const char * name ) ;
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 ,
2017-08-03 06:12:02 +03:00
uint16_t * rec_count ) ;
WERROR dns_lookup_records_wildcard ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
struct ldb_dn * dn ,
struct dnsp_DnssrvRpcRecord * * records ,
2011-12-16 12:43:47 +04:00
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 ,
2014-07-31 13:32:02 +04:00
struct dnsp_DnssrvRpcRecord * records ,
2011-12-16 17:21:52 +04:00
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 ) ;
2012-09-05 10:24:52 +04:00
struct dns_server_tkey * dns_find_tkey ( struct dns_server_tkey_store * store ,
const char * name ) ;
2012-09-05 10:34:49 +04:00
WERROR dns_verify_tsig ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
struct dns_request_state * state ,
struct dns_name_packet * packet ,
DATA_BLOB * in ) ;
2012-09-05 10:34:04 +04:00
WERROR dns_sign_tsig ( struct dns_server * dns ,
TALLOC_CTX * mem_ctx ,
struct dns_request_state * state ,
struct dns_name_packet * packet ,
uint16_t error ) ;
2010-10-01 23:59:22 +04:00
2014-07-30 10:01:11 +04:00
# include "source4/dns_server/dnsserver_common.h"
2010-10-12 08:23:32 +04:00
# endif /* __DNS_SERVER_H__ */