2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 23:55:27 +00:00

new functions cfg_obj_isnetprefix(), cfg_obj_asnetprefix()

This commit is contained in:
Andreas Gustafsson
2001-02-26 19:15:12 +00:00
parent 1c1156b6e7
commit 0136b4ef55
2 changed files with 38 additions and 4 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cfg.h,v 1.14 2001/02/23 01:00:58 gson Exp $ */
/* $Id: cfg.h,v 1.15 2001/02/26 19:15:12 gson Exp $ */
#ifndef DNS_CFG_H
#define DNS_CFG_H 1
@@ -256,13 +256,13 @@ cfg_obj_asboolean(cfg_obj_t *obj);
isc_boolean_t
cfg_obj_issockaddr(cfg_obj_t *obj);
/*
* Return true iff 'obj' is of sockaddr type.
* Return true iff 'obj' is a socket address.
*/
isc_sockaddr_t *
cfg_obj_assockaddr(cfg_obj_t *obj);
/*
* Returns the value of a configuration object of a socket address type.
* Returns the value of a configuration object representing a socket address.
*
* Requires:
* 'obj' points to a valid configuration object of a socket address type.
@@ -272,6 +272,25 @@ cfg_obj_assockaddr(cfg_obj_t *obj);
* if necessary.
*/
isc_boolean_t
cfg_obj_isnetprefix(cfg_obj_t *obj);
/*
* Return true iff 'obj' is a network prefix.
*/
void
cfg_obj_asnetprefix(cfg_obj_t *obj, isc_netaddr_t *netaddr,
unsigned int *prefixlen);
/*
* Gets the value of a configuration object representing a network
* prefix. The network address is returned through 'netaddr' and the
* prefix length in bits through 'prefixlen'.
*
* Requires:
* 'obj' points to a valid configuration object of network prefix type.
* 'netaddr' and 'prefixlen' are non-NULL.
*/
isc_boolean_t
cfg_obj_islist(cfg_obj_t *obj);
/*

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: parser.c,v 1.23 2001/02/26 18:58:36 gson Exp $ */
/* $Id: parser.c,v 1.24 2001/02/26 19:15:11 gson Exp $ */
#include <config.h>
@@ -2679,6 +2679,21 @@ print_netprefix(cfg_printer_t *pctx, cfg_obj_t *obj) {
print_uint(pctx, p->prefixlen);
}
isc_boolean_t
cfg_obj_isnetprefix(cfg_obj_t *obj) {
REQUIRE(obj != NULL);
return (ISC_TF(obj->type->rep == &cfg_rep_netprefix));
}
void
cfg_obj_asnetprefix(cfg_obj_t *obj, isc_netaddr_t *netaddr,
unsigned int *prefixlen) {
REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_netprefix);
*netaddr = obj->value.netprefix.address;
*prefixlen = obj->value.netprefix.prefixlen;
}
static cfg_type_t cfg_type_netprefix = {
"netprefix", parse_netprefix, print_netprefix, &cfg_rep_netprefix, NULL };