sdlz.h File Reference

#include <dns/clientinfo.h>
#include <dns/dlz.h>

Go to the source code of this file.

Data Structures

struct  dns_sdlzmethods

Defines

#define SDLZ_H   1
#define DNS_SDLZFLAG_THREADSAFE   0x00000001U
#define DNS_SDLZFLAG_RELATIVEOWNER   0x00000002U
#define DNS_SDLZFLAG_RELATIVERDATA   0x00000004U

Typedefs

typedef struct dns_sdlz_db dns_sdlz_db_t
typedef struct dns_sdlzlookup dns_sdlzlookup_t
typedef struct dns_sdlzallnodes dns_sdlzallnodes_t
typedef isc_result_t(* dns_sdlzallnodesfunc_t )(const char *zone, void *driverarg, void *dbdata, dns_sdlzallnodes_t *allnodes)
 Method prototype. Drivers implementing the SDLZ interface may supply an all nodes method. This method is called when the DNS server is performing a zone transfer query, after the allow zone transfer method has been called. This method is only called if the allow zone transfer method returned ISC_R_SUCCESS. This method and the allow zone transfer method are both required for zone transfers to be supported. If the driver generates data dynamically (instead of searching in a database for it) it should not implement this function as a zone transfer would be meaningless. A SDLZ driver does not have to implement an all nodes method.
typedef isc_result_t(* dns_sdlzallowzonexfr_t )(void *driverarg, void *dbdata, const char *name, const char *client)
 Method prototype. Drivers implementing the SDLZ interface may supply an allow zone transfer method. This method is called when the DNS server is performing a zone transfer query, before the all nodes method can be called. This method and the all node method are both required for zone transfers to be supported. If the driver generates data dynamically (instead of searching in a database for it) it should not implement this function as a zone transfer would be meaningless. A SDLZ driver does not have to implement an allow zone transfer method.
typedef isc_result_t(* dns_sdlzauthorityfunc_t )(const char *zone, void *driverarg, void *dbdata, dns_sdlzlookup_t *lookup)
 Method prototype. Drivers implementing the SDLZ interface may supply an authority method. This method is called when the DNS server is performing a query, after both the find zone and lookup methods have been called. This method is required if the lookup function does not supply authority information for the dns record. A SDLZ driver does not have to implement an authority method.
typedef isc_result_t(* dns_sdlzcreate_t )(const char *dlzname, unsigned int argc, char *argv[], void *driverarg, void **dbdata)
 Method prototype. Drivers implementing the SDLZ interface may supply a create method. This method is called when the DNS server is starting up and creating drivers for use later. A SDLZ driver does not have to implement a create method.
typedef void(* dns_sdlzdestroy_t )(void *driverarg, void *dbdata)
 Method prototype. Drivers implementing the SDLZ interface may supply a destroy method. This method is called when the DNS server is shutting down and no longer needs the driver. A SDLZ driver does not have to implement a destroy method.
typedef isc_result_t(* dns_sdlzfindzone_t )(void *driverarg, void *dbdata, const char *name, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo)
 Method prototype. Drivers implementing the SDLZ interface MUST supply a find zone method. This method is called when the DNS server is performing a query to to determine if 'name' is a supported dns zone. The find zone method will be called with the longest possible name first, and continue to be called with successively shorter domain names, until any of the following occur:.
typedef isc_result_t(* dns_sdlzlookupfunc_t )(const char *zone, const char *name, void *driverarg, void *dbdata, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo)
 Method prototype. Drivers implementing the SDLZ interface MUST supply a lookup method. This method is called when the DNS server is performing a query, after the find zone and before any other methods have been called. This function returns DNS record information using the dns_sdlz_putrr and dns_sdlz_putsoa functions. If this function supplies authority information for the DNS record the authority method is not required. If it does not, the authority function is required.
typedef isc_result_t(* dns_sdlznewversion_t )(const char *zone, void *driverarg, void *dbdata, void **versionp)
 Method prototype. Drivers implementing the SDLZ interface may supply a newversion method. This method is called to start a write transaction on a zone and should only be implemented by writeable backends. When implemented, the driver should create a new transaction, and fill *versionp with a pointer to the transaction state. The closeversion function will be called to close the transaction.
typedef void(* dns_sdlzcloseversion_t )(const char *zone, isc_boolean_t commit, void *driverarg, void *dbdata, void **versionp)
 Method prototype. Drivers implementing the SDLZ interface must supply a closeversion method if they supply a newversion method. When implemented, the driver should close the given transaction, committing changes if 'commit' is ISC_TRUE. If 'commit' is not true then all changes should be discarded and the database rolled back. If the call is successful then *versionp should be set to NULL.
typedef isc_result_t(* dns_sdlzconfigure_t )(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg, void *dbdata)
 Method prototype. Drivers implementing the SDLZ interface may supply a configure method. When supplied, it will be called immediately after the create method to give the driver a chance to configure writeable zones.
typedef isc_boolean_t(* dns_sdlzssumatch_t )(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, isc_uint32_t keydatalen, unsigned char *keydata, void *driverarg, void *dbdata)
 Method prototype. Drivers implementing the SDLZ interface may supply a ssumatch method. If supplied, then ssumatch will be called to authorize any zone updates. The driver should return ISC_TRUE to allow the update, and ISC_FALSE to deny it. For a DLZ controlled zone, this is the only access control on updates.
typedef isc_result_t(* dns_sdlzmodrdataset_t )(const char *name, const char *rdatastr, void *driverarg, void *dbdata, void *version)
 Method prototype. Drivers implementing the SDLZ interface may supply addrdataset and subtractrdataset methods. If supplied, then these will be called when rdatasets are added/subtracted during updates. The version parameter comes from a call to the sdlz newversion() method from the driver. The rdataset parameter is a linearise string representation of the rdataset change. The format is the same as used by dig when displaying records. The fields are tab delimited.
typedef isc_result_t(* dns_sdlzdelrdataset_t )(const char *name, const char *type, void *driverarg, void *dbdata, void *version)
 Method prototype. Drivers implementing the SDLZ interface may supply a delrdataset method. If supplied, then this function will be called when rdatasets are deleted during updates. The call should remove all rdatasets of the given type for the specified name.
typedef struct dns_sdlzmethods dns_sdlzmethods_t
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)
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_putsoa_t (dns_sdlzlookup_t *lookup, const char *mname, const char *rname, isc_uint32_t serial)
typedef isc_result_t dns_sdlz_setdb_t (dns_dlzdb_t *dlzdatabase, dns_rdataclass_t rdclass, dns_name_t *name, dns_db_t **dbp)

Functions

isc_result_t dns_sdlzregister (const char *drivername, const dns_sdlzmethods_t *methods, void *driverarg, unsigned int flags, isc_mem_t *mctx, dns_sdlzimplementation_t **sdlzimp)
 Register a dynamically loadable zones (dlz) driver for the database type 'drivername', implemented by the functions in '*methods'.
void dns_sdlzunregister (dns_sdlzimplementation_t **sdlzimp)
 Removes the sdlz driver from the list of registered sdlz drivers. There must be no active sdlz drivers of this type when this function is called.

Variables

dns_sdlz_putnamedrr_t dns_sdlz_putnamedrr
 Add a single resource record to the allnodes structure to be later parsed into a zone transfer response.
dns_sdlz_putrr_t dns_sdlz_putrr
 Add a single resource record to the lookup structure to be later parsed into a query response.
dns_sdlz_putsoa_t dns_sdlz_putsoa
 This function may optionally be called from the 'authority' callback to simplify construction of the SOA record for 'zone'. It will provide a SOA listing 'mname' as as the master server and 'rname' as the responsible person mailbox. It is the responsibility of the driver to increment the serial number between responses if necessary. All other SOA fields will have reasonable default values.
dns_sdlz_setdb_t dns_sdlz_setdb
 Create the database pointers for a writeable SDLZ zone.


Detailed Description

Definition in file sdlz.h.


Define Documentation

#define SDLZ_H   1

Definition at line 58 of file sdlz.h.

#define DNS_SDLZFLAG_THREADSAFE   0x00000001U

Definition at line 65 of file sdlz.h.

Referenced by dns_sdlzregister().

#define DNS_SDLZFLAG_RELATIVEOWNER   0x00000002U

Definition at line 66 of file sdlz.h.

Referenced by dns_sdlzregister(), and getnodedata().

#define DNS_SDLZFLAG_RELATIVERDATA   0x00000004U

Definition at line 67 of file sdlz.h.

Referenced by dns_sdlz_putnamedrr(), dns_sdlz_putrr(), and dns_sdlzregister().


Typedef Documentation

typedef struct dns_sdlz_db dns_sdlz_db_t

Definition at line 70 of file sdlz.h.

typedef struct dns_sdlzlookup dns_sdlzlookup_t

Definition at line 73 of file sdlz.h.

typedef struct dns_sdlzallnodes dns_sdlzallnodes_t

Definition at line 76 of file sdlz.h.

typedef isc_result_t(* dns_sdlzallnodesfunc_t)(const char *zone, void *driverarg, void *dbdata, dns_sdlzallnodes_t *allnodes)

Method prototype. Drivers implementing the SDLZ interface may supply an all nodes method. This method is called when the DNS server is performing a zone transfer query, after the allow zone transfer method has been called. This method is only called if the allow zone transfer method returned ISC_R_SUCCESS. This method and the allow zone transfer method are both required for zone transfers to be supported. If the driver generates data dynamically (instead of searching in a database for it) it should not implement this function as a zone transfer would be meaningless. A SDLZ driver does not have to implement an all nodes method.

Definition at line 78 of file sdlz.h.

typedef isc_result_t(* dns_sdlzallowzonexfr_t)(void *driverarg, void *dbdata, const char *name, const char *client)

Method prototype. Drivers implementing the SDLZ interface may supply an allow zone transfer method. This method is called when the DNS server is performing a zone transfer query, before the all nodes method can be called. This method and the all node method are both required for zone transfers to be supported. If the driver generates data dynamically (instead of searching in a database for it) it should not implement this function as a zone transfer would be meaningless. A SDLZ driver does not have to implement an allow zone transfer method.

This method should return ISC_R_SUCCESS if the zone is supported by the database and a zone transfer is allowed for the specified client. If the zone is supported by the database, but zone transfers are not allowed for the specified client this method should return ISC_R_NOPERM.. Lastly the method should return ISC_R_NOTFOUND if the zone is not supported by the database. If an error occurs it should return a result code indicating the type of error.

Definition at line 95 of file sdlz.h.

typedef isc_result_t(* dns_sdlzauthorityfunc_t)(const char *zone, void *driverarg, void *dbdata, dns_sdlzlookup_t *lookup)

Method prototype. Drivers implementing the SDLZ interface may supply an authority method. This method is called when the DNS server is performing a query, after both the find zone and lookup methods have been called. This method is required if the lookup function does not supply authority information for the dns record. A SDLZ driver does not have to implement an authority method.

Definition at line 120 of file sdlz.h.

typedef isc_result_t(* dns_sdlzcreate_t)(const char *dlzname, unsigned int argc, char *argv[], void *driverarg, void **dbdata)

Method prototype. Drivers implementing the SDLZ interface may supply a create method. This method is called when the DNS server is starting up and creating drivers for use later. A SDLZ driver does not have to implement a create method.

Definition at line 134 of file sdlz.h.

typedef void(* dns_sdlzdestroy_t)(void *driverarg, void *dbdata)

Method prototype. Drivers implementing the SDLZ interface may supply a destroy method. This method is called when the DNS server is shutting down and no longer needs the driver. A SDLZ driver does not have to implement a destroy method.

Definition at line 145 of file sdlz.h.

typedef isc_result_t(* dns_sdlzfindzone_t)(void *driverarg, void *dbdata, const char *name, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo)

Method prototype. Drivers implementing the SDLZ interface MUST supply a find zone method. This method is called when the DNS server is performing a query to to determine if 'name' is a supported dns zone. The find zone method will be called with the longest possible name first, and continue to be called with successively shorter domain names, until any of the following occur:.

The driver's find zone method should return ISC_R_SUCCESS if the zone is supported by the database. Otherwise it should return ISC_R_NOTFOUND, if the zone is not supported. If an error occurs it should return a result code indicating the type of error.

Definition at line 155 of file sdlz.h.

typedef isc_result_t(* dns_sdlzlookupfunc_t)(const char *zone, const char *name, void *driverarg, void *dbdata, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo)

Method prototype. Drivers implementing the SDLZ interface MUST supply a lookup method. This method is called when the DNS server is performing a query, after the find zone and before any other methods have been called. This function returns DNS record information using the dns_sdlz_putrr and dns_sdlz_putsoa functions. If this function supplies authority information for the DNS record the authority method is not required. If it does not, the authority function is required.

The 'methods' and 'clientinfo' args allow an SDLZ driver to retrieve information about the querying client (such as source IP address) from the caller.

Definition at line 186 of file sdlz.h.

typedef isc_result_t(* dns_sdlznewversion_t)(const char *zone, void *driverarg, void *dbdata, void **versionp)

Method prototype. Drivers implementing the SDLZ interface may supply a newversion method. This method is called to start a write transaction on a zone and should only be implemented by writeable backends. When implemented, the driver should create a new transaction, and fill *versionp with a pointer to the transaction state. The closeversion function will be called to close the transaction.

Definition at line 206 of file sdlz.h.

typedef void(* dns_sdlzcloseversion_t)(const char *zone, isc_boolean_t commit, void *driverarg, void *dbdata, void **versionp)

Method prototype. Drivers implementing the SDLZ interface must supply a closeversion method if they supply a newversion method. When implemented, the driver should close the given transaction, committing changes if 'commit' is ISC_TRUE. If 'commit' is not true then all changes should be discarded and the database rolled back. If the call is successful then *versionp should be set to NULL.

Definition at line 219 of file sdlz.h.

typedef isc_result_t(* dns_sdlzconfigure_t)(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg, void *dbdata)

Method prototype. Drivers implementing the SDLZ interface may supply a configure method. When supplied, it will be called immediately after the create method to give the driver a chance to configure writeable zones.

Definition at line 231 of file sdlz.h.

typedef isc_boolean_t(* dns_sdlzssumatch_t)(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, isc_uint32_t keydatalen, unsigned char *keydata, void *driverarg, void *dbdata)

Method prototype. Drivers implementing the SDLZ interface may supply a ssumatch method. If supplied, then ssumatch will be called to authorize any zone updates. The driver should return ISC_TRUE to allow the update, and ISC_FALSE to deny it. For a DLZ controlled zone, this is the only access control on updates.

Definition at line 242 of file sdlz.h.

typedef isc_result_t(* dns_sdlzmodrdataset_t)(const char *name, const char *rdatastr, void *driverarg, void *dbdata, void *version)

Method prototype. Drivers implementing the SDLZ interface may supply addrdataset and subtractrdataset methods. If supplied, then these will be called when rdatasets are added/subtracted during updates. The version parameter comes from a call to the sdlz newversion() method from the driver. The rdataset parameter is a linearise string representation of the rdataset change. The format is the same as used by dig when displaying records. The fields are tab delimited.

Definition at line 261 of file sdlz.h.

typedef isc_result_t(* dns_sdlzdelrdataset_t)(const char *name, const char *type, void *driverarg, void *dbdata, void *version)

Method prototype. Drivers implementing the SDLZ interface may supply a delrdataset method. If supplied, then this function will be called when rdatasets are deleted during updates. The call should remove all rdatasets of the given type for the specified name.

Definition at line 276 of file sdlz.h.

typedef struct dns_sdlzmethods dns_sdlzmethods_t

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)

Definition at line 328 of file sdlz.h.

typedef isc_result_t dns_sdlz_putrr_t(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl, const char *data)

Definition at line 340 of file sdlz.h.

typedef isc_result_t dns_sdlz_putsoa_t(dns_sdlzlookup_t *lookup, const char *mname, const char *rname, isc_uint32_t serial)

Definition at line 350 of file sdlz.h.

typedef isc_result_t dns_sdlz_setdb_t(dns_dlzdb_t *dlzdatabase, dns_rdataclass_t rdclass, dns_name_t *name, dns_db_t **dbp)

Definition at line 366 of file sdlz.h.


Function Documentation

isc_result_t dns_sdlzregister ( const char *  drivername,
const dns_sdlzmethods_t methods,
void *  driverarg,
unsigned int  flags,
isc_mem_t mctx,
dns_sdlzimplementation_t **  sdlzimp 
)

Register a dynamically loadable zones (dlz) driver for the database type 'drivername', implemented by the functions in '*methods'.

sdlzimp must point to a NULL dns_sdlzimplementation_t pointer. That is, sdlzimp != NULL && *sdlzimp == NULL. It will be assigned a value that will later be used to identify the driver when deregistering it.

Definition at line 2044 of file sdlz.c.

References DESTROYLOCK, dns_sdlzimplementation::dlz_imp, dns_dlzregister(), DNS_SDLZFLAG_RELATIVEOWNER, DNS_SDLZFLAG_RELATIVERDATA, DNS_SDLZFLAG_THREADSAFE, dns_sdlzimplementation::driverarg, dns_sdlzimplementation::driverlock, dns_sdlzmethods::findzone, dns_sdlzimplementation::flags, ISC_LOG_DEBUG, isc_mem_attach(), isc_mem_detach(), isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_result_totext(), dns_sdlzmethods::lookup, dns_sdlzimplementation::mctx, dns_sdlzimplementation::methods, REQUIRE, sdlz_log(), and UNEXPECTED_ERROR.

void dns_sdlzunregister ( dns_sdlzimplementation_t **  sdlzimp  ) 

Removes the sdlz driver from the list of registered sdlz drivers. There must be no active sdlz drivers of this type when this function is called.

Definition at line 2134 of file sdlz.c.

References DESTROYLOCK, dns_sdlzimplementation::dlz_imp, dns_dlzunregister(), dns_sdlzimplementation::driverlock, ISC_LOG_DEBUG, isc_mem_detach(), isc_mem_put, dns_sdlzimplementation::mctx, mctx, REQUIRE, and sdlz_log().


Variable Documentation

dns_sdlz_putnamedrr_t dns_sdlz_putnamedrr

Add a single resource record to the allnodes structure to be later parsed into a zone transfer response.

Definition at line 335 of file sdlz.h.

dns_sdlz_putrr_t dns_sdlz_putrr

Add a single resource record to the lookup structure to be later parsed into a query response.

Definition at line 345 of file sdlz.h.

Referenced by dns_sdlz_putnamedrr(), and dns_sdlz_putsoa().

dns_sdlz_putsoa_t dns_sdlz_putsoa

This function may optionally be called from the 'authority' callback to simplify construction of the SOA record for 'zone'. It will provide a SOA listing 'mname' as as the master server and 'rname' as the responsible person mailbox. It is the responsibility of the driver to increment the serial number between responses if necessary. All other SOA fields will have reasonable default values.

Definition at line 355 of file sdlz.h.

dns_sdlz_setdb_t dns_sdlz_setdb

Create the database pointers for a writeable SDLZ zone.

Definition at line 371 of file sdlz.h.

Referenced by ns_zone_configure_writeable_dlz().


Generated on Tue Apr 28 17:41:10 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha