2010-12-15 07:02:09 +03:00
/*
* Copyright ( C ) 2010 Andrew Tridgell
*
* Permission to use , copy , modify , and distribute this software for any
* purpose with or without fee is hereby granted , provided that the
* above copyright notice and this permission notice appear in all
* copies .
*
* THE SOFTWARE IS PROVIDED " AS IS " AND THE AUTHOR
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS . IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY SPECIAL , DIRECT , INDIRECT , OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE , DATA OR PROFITS , WHETHER IN AN ACTION OF CONTRACT , NEGLIGENCE
* OR OTHER TORTIOUS ACTION , ARISING OUT OF OR IN CONNECTION WITH THE
* USE OR PERFORMANCE OF THIS SOFTWARE .
*/
2014-10-20 08:31:30 +04:00
/* This header is updated based on BIND 9.10.1 source.
* contrib / dlz / modules / include / dlz_minimal . h
*/
# ifndef DLZ_MINIMAL_H
# define DLZ_MINIMAL_H 1
2012-04-05 10:45:01 +04:00
# ifdef BIND_VERSION_9_8
2014-10-19 05:57:55 +04:00
# define DLZ_DLOPEN_VERSION 1
# elif BIND_VERSION_9_9
# define DLZ_DLOPEN_VERSION 2
2014-10-20 08:31:30 +04:00
# elif BIND_VERSION_9_10
# define DLZ_DLOPEN_VERSION 3
# define DLZ_DLOPEN_AGE 0
2012-04-05 10:45:01 +04:00
# else
2014-10-19 05:57:55 +04:00
# error Unsupported BIND version
2012-04-05 10:45:01 +04:00
# endif
2010-12-15 07:02:09 +03:00
2014-10-19 05:57:55 +04:00
typedef unsigned int isc_result_t ;
# if DLZ_DLOPEN_VERSION == 1
typedef bool isc_boolean_t ;
2012-04-05 10:45:01 +04:00
# else
2014-10-19 05:57:55 +04:00
typedef int isc_boolean_t ;
2012-04-05 10:45:01 +04:00
# endif
2014-10-19 05:57:55 +04:00
typedef uint32_t dns_ttl_t ;
2010-12-15 07:02:09 +03:00
2014-10-20 08:31:30 +04:00
/* return these in flags from dlz_version() */
2010-12-15 07:02:09 +03:00
# define DNS_SDLZFLAG_THREADSAFE 0x00000001U
2014-10-20 08:31:30 +04:00
# define DNS_SDLZFLAG_RELATIVEOWNER 0x00000002U
# define DNS_SDLZFLAG_RELATIVERDATA 0x00000004U
2010-12-15 07:02:09 +03:00
/* result codes */
# define ISC_R_SUCCESS 0
# define ISC_R_NOMEMORY 1
2012-03-08 11:34:04 +04:00
# define ISC_R_NOPERM 6
2014-10-20 08:31:30 +04:00
# define ISC_R_NOSPACE 19
2010-12-15 07:02:09 +03:00
# define ISC_R_NOTFOUND 23
# define ISC_R_FAILURE 25
2014-10-20 08:31:30 +04:00
# define ISC_R_NOTIMPLEMENTED 27
2012-03-08 11:34:04 +04:00
# define ISC_R_NOMORE 29
2014-10-20 08:31:30 +04:00
# define ISC_R_INVALIDFILE 30
# define ISC_R_UNEXPECTED 34
# define ISC_R_FILENOTFOUND 38
2012-03-08 11:34:04 +04:00
/* boolean values */
# define ISC_TRUE 1
# define ISC_FALSE 0
2010-12-15 07:02:09 +03:00
/* log levels */
# define ISC_LOG_INFO (-1)
# define ISC_LOG_NOTICE (-2)
# define ISC_LOG_WARNING (-3)
# define ISC_LOG_ERROR (-4)
# define ISC_LOG_CRITICAL (-5)
2014-10-20 08:31:30 +04:00
# define ISC_LOG_DEBUG(level) (level)
2010-12-15 07:02:09 +03:00
2014-10-20 08:31:30 +04:00
/* opaque structures */
2010-12-15 07:02:09 +03:00
typedef void * dns_sdlzlookup_t ;
typedef void * dns_sdlzallnodes_t ;
typedef void * dns_view_t ;
2014-10-20 08:31:30 +04:00
typedef void * dns_dlzdb_t ;
2012-03-08 11:34:04 +04:00
2014-10-20 08:31:30 +04:00
# if DLZ_DLOPEN_VERSION > 1
2012-03-08 11:34:04 +04:00
/*
2014-10-20 08:31:30 +04:00
* Method and type definitions needed for retrieval of client info
* from the caller .
*/
typedef struct isc_sockaddr {
union {
struct sockaddr sa ;
struct sockaddr_in sin ;
struct sockaddr_in6 sin6 ;
struct sockaddr_un sunix ;
} type ;
unsigned int length ;
void * link ;
} isc_sockaddr_t ;
# define DNS_CLIENTINFO_VERSION 1
typedef struct dns_clientinfo {
uint16_t version ;
void * data ;
} dns_clientinfo_t ;
typedef isc_result_t ( * dns_clientinfo_sourceip_t ) ( dns_clientinfo_t * client ,
isc_sockaddr_t * * addrp ) ;
# define DNS_CLIENTINFOMETHODS_VERSION 1
# define DNS_CLIENTINFOMETHODS_AGE 0
typedef struct dns_clientinfomethods {
uint16_t version ;
uint16_t age ;
dns_clientinfo_sourceip_t sourceip ;
} dns_clientinfomethods_t ;
# endif /* DLZ_DLOPEN_VERSION > 1 */
/*
* Method definitions for callbacks provided by the dlopen driver
2012-03-08 11:34:04 +04:00
*/
typedef void log_t ( int level , const char * fmt , . . . ) ;
typedef isc_result_t dns_sdlz_putrr_t ( dns_sdlzlookup_t * lookup ,
const char * type ,
dns_ttl_t ttl ,
const char * data ) ;
typedef isc_result_t dns_sdlz_putnamedrr_t ( dns_sdlzallnodes_t * allnodes ,
const char * name ,
const char * type ,
dns_ttl_t ttl ,
const char * data ) ;
2014-10-20 08:31:30 +04:00
# if DLZ_DLOPEN_VERSION < 3
2012-03-08 11:34:04 +04:00
typedef isc_result_t dns_dlz_writeablezone_t ( dns_view_t * view ,
const char * zone_name ) ;
2014-10-20 08:31:30 +04:00
# else /* DLZ_DLOPEN_VERSION >= 3 */
typedef isc_result_t dns_dlz_writeablezone_t ( dns_view_t * view ,
dns_dlzdb_t * dlzdb ,
const char * zone_name ) ;
# endif /* DLZ_DLOPEN_VERSION */
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* prototypes for the functions you can include in your module
2010-12-15 07:02:09 +03:00
*/
/*
* dlz_version ( ) is required for all DLZ external drivers . It should
2014-10-20 08:31:30 +04:00
* return DLZ_DLOPEN_VERSION . ' flags ' is updated to indicate capabilities
* of the module . In particular , if the module is thread - safe then it
* sets ' flags ' to include DNS_SDLZFLAG_THREADSAFE . Other capability
* flags may be added in the future .
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
int
dlz_version ( unsigned int * flags ) ;
2010-12-15 07:02:09 +03:00
/*
* dlz_create ( ) is required for all DLZ external drivers .
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_create ( const char * dlzname , unsigned int argc , const char * argv [ ] ,
void * * dbdata , . . . ) ;
2010-12-15 07:02:09 +03:00
/*
* dlz_destroy ( ) is optional , and will be called when the driver is
* unloaded if supplied
*/
2014-10-20 08:31:30 +04:00
void
dlz_destroy ( void * dbdata ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_findzonedb is required for all DLZ external drivers
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
# if DLZ_DLOPEN_VERSION < 3
isc_result_t
dlz_findzonedb ( void * dbdata , const char * name ) ;
# else /* DLZ_DLOPEN_VERSION >= 3 */
isc_result_t
dlz_findzonedb ( void * dbdata , const char * name ,
dns_clientinfomethods_t * methods ,
dns_clientinfo_t * clientinfo ) ;
# endif /* DLZ_DLOPEN_VERSION */
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_lookup is required for all DLZ external drivers
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
# if DLZ_DLOPEN_VERSION == 1
isc_result_t
dlz_lookup ( const char * zone , const char * name , void * dbdata ,
dns_sdlzlookup_t * lookup ) ;
# else /* DLZ_DLOPEN_VERSION > 1 */
isc_result_t
dlz_lookup ( const char * zone , const char * name , void * dbdata ,
dns_sdlzlookup_t * lookup ,
dns_clientinfomethods_t * methods ,
dns_clientinfo_t * clientinfo ) ;
# endif /* DLZ_DLOPEN_VERSION */
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_authority ( ) is optional if dlz_lookup ( ) supplies
* authority information ( i . e . , SOA , NS ) for the dns record
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_authority ( const char * zone , void * dbdata , dns_sdlzlookup_t * lookup ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_allowzonexfr ( ) is optional , and should be supplied if you want to
* support zone transfers
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_allowzonexfr ( void * dbdata , const char * name , const char * client ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_allnodes ( ) is optional , but must be supplied if supply a
* dlz_allowzonexfr ( ) function
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_allnodes ( const char * zone , void * dbdata , dns_sdlzallnodes_t * allnodes ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_newversion ( ) is optional . It should be supplied if you want to
* support dynamic updates .
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_newversion ( const char * zone , void * dbdata , void * * versionp ) ;
/*
* dlz_closeversion ( ) is optional , but must be supplied if you supply a
* dlz_newversion ( ) function
*/
void
dlz_closeversion ( const char * zone , isc_boolean_t commit , void * dbdata ,
void * * versionp ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_configure ( ) is optional , but must be supplied if you want to support
* dynamic updates
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
# if DLZ_DLOPEN_VERSION < 3
isc_result_t
dlz_configure ( dns_view_t * view , void * dbdata ) ;
# else /* DLZ_DLOPEN_VERSION >= 3 */
isc_result_t
dlz_configure ( dns_view_t * view , dns_dlzdb_t * dlzdb , void * dbdata ) ;
# endif /* DLZ_DLOPEN_VERSION */
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_ssumatch ( ) is optional , but must be supplied if you want to support
* dynamic updates
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_boolean_t
dlz_ssumatch ( const char * signer , const char * name , const char * tcpaddr ,
const char * type , const char * key , uint32_t keydatalen ,
uint8_t * keydata , void * dbdata ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_addrdataset ( ) is optional , but must be supplied if you want to
* support dynamic updates
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_addrdataset ( const char * name , const char * rdatastr , void * dbdata ,
void * version ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_subrdataset ( ) is optional , but must be supplied if you want to
* support dynamic updates
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_subrdataset ( const char * name , const char * rdatastr , void * dbdata ,
void * version ) ;
2010-12-15 07:02:09 +03:00
/*
2014-10-20 08:31:30 +04:00
* dlz_delrdataset ( ) is optional , but must be supplied if you want to
* support dynamic updates
2010-12-15 07:02:09 +03:00
*/
2014-10-20 08:31:30 +04:00
isc_result_t
dlz_delrdataset ( const char * name , const char * type , void * dbdata ,
void * version ) ;
# endif /* DLZ_MINIMAL_H */