]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
new functions cfg_obj_isnetprefix(), cfg_obj_asnetprefix()
authorAndreas Gustafsson <source@isc.org>
Mon, 26 Feb 2001 19:15:12 +0000 (19:15 +0000)
committerAndreas Gustafsson <source@isc.org>
Mon, 26 Feb 2001 19:15:12 +0000 (19:15 +0000)
lib/isccfg/include/isccfg/cfg.h
lib/isccfg/parser.c

index 8beb0f1dcd2ee2f7a8072b54e409a7e0e2783800..fc01406d82393e9dc2d3cc2d3c1677be7303b551 100644 (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);
 /*
index e2c66c81898c9c934bf751b9bf6de89617eb5dd7..e0ac79cd1c6215f19a26b1564ea4af5e7ebfce75 100644 (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 };