summaryrefslogtreecommitdiff
path: root/src/libknot/zone
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2014-03-27 15:48:42 +0100
committerOndřej Surý <ondrej@sury.org>2014-03-27 15:48:42 +0100
commite61140dd0a78d91a8e5712b13250cae440344b3e (patch)
treeacfb30259f1eb02acd4ae8c6c2fed32b9bd2ee9a /src/libknot/zone
parent4c91a8dc40b68df3da7407b85c8afdf598e5ab09 (diff)
downloadknot-upstream.tar.gz
New upstream version 1.4.4upstream
Diffstat (limited to 'src/libknot/zone')
-rw-r--r--src/libknot/zone/node.c23
-rw-r--r--src/libknot/zone/node.h14
-rw-r--r--src/libknot/zone/zone-contents.c1
-rw-r--r--src/libknot/zone/zone.h8
4 files changed, 39 insertions, 7 deletions
diff --git a/src/libknot/zone/node.c b/src/libknot/zone/node.c
index 318f1ed..92e0fb4 100644
--- a/src/libknot/zone/node.c
+++ b/src/libknot/zone/node.c
@@ -605,6 +605,29 @@ void knot_node_clear_replaced_nsec(knot_node_t *node)
/*----------------------------------------------------------------------------*/
+void knot_node_set_apex(knot_node_t *node)
+{
+ if (node == NULL) {
+ return;
+ }
+
+ knot_node_flags_set(node, KNOT_NODE_FLAGS_APEX);
+}
+
+/*----------------------------------------------------------------------------*/
+
+int knot_node_is_apex(const knot_node_t *node)
+{
+ if (node == NULL) {
+ return KNOT_EINVAL;
+ }
+
+ return knot_node_flags_get(node, KNOT_NODE_FLAGS_APEX);
+}
+
+
+/*----------------------------------------------------------------------------*/
+
void knot_node_free_rrsets(knot_node_t *node)
{
if (node == NULL) {
diff --git a/src/libknot/zone/node.h b/src/libknot/zone/node.h
index 2e1dd25..6ea06a2 100644
--- a/src/libknot/zone/node.h
+++ b/src/libknot/zone/node.h
@@ -93,14 +93,16 @@ typedef struct knot_node knot_node_t;
/*! \brief Flags used to mark nodes with some property. */
typedef enum {
/*! \brief Node is a delegation point (i.e. marking a zone cut). */
- KNOT_NODE_FLAGS_DELEG = (uint8_t)0x01,
+ KNOT_NODE_FLAGS_DELEG = 1 << 0,
/*! \brief Node is not authoritative (i.e. below a zone cut). */
- KNOT_NODE_FLAGS_NONAUTH = (uint8_t)0x02,
+ KNOT_NODE_FLAGS_NONAUTH = 1 << 1,
+ /*! \brief Node is an apex node. */
+ KNOT_NODE_FLAGS_APEX = 1 << 2,
/*! \brief Node is empty and will be deleted after update.
* \todo Remove after dname refactoring, update description in node. */
- KNOT_NODE_FLAGS_EMPTY = (uint8_t)0x10,
+ KNOT_NODE_FLAGS_EMPTY = 1 << 3,
/*! \brief NSEC in this node needs new RRSIGs. Used for signing. */
- KNOT_NODE_FLAGS_REPLACED_NSEC = (uint8_t)0x20
+ KNOT_NODE_FLAGS_REPLACED_NSEC = 1 << 4,
} knot_node_flags_t;
/*----------------------------------------------------------------------------*/
@@ -377,6 +379,10 @@ void knot_node_set_replaced_nsec(knot_node_t *node);
void knot_node_clear_replaced_nsec(knot_node_t *node);
+void knot_node_set_apex(knot_node_t *node);
+
+int knot_node_is_apex(const knot_node_t *node);
+
//! \todo remove after dname refactoring
int knot_node_is_empty(const knot_node_t *node);
diff --git a/src/libknot/zone/zone-contents.c b/src/libknot/zone/zone-contents.c
index d6ca533..0e1c80c 100644
--- a/src/libknot/zone/zone-contents.c
+++ b/src/libknot/zone/zone-contents.c
@@ -1319,6 +1319,7 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone,
}
assert(zone->apex == adjust_arg.first_node);
+ knot_node_set_apex(zone->apex);
return KNOT_EOK;
}
diff --git a/src/libknot/zone/zone.h b/src/libknot/zone/zone.h
index 90cdf87..7bd5f83 100644
--- a/src/libknot/zone/zone.h
+++ b/src/libknot/zone/zone.h
@@ -55,9 +55,11 @@ typedef enum knot_zone_retvals knot_zone_retvals_t;
* \brief Zone flags.
*/
typedef enum knot_zone_flag_t {
- KNOT_ZONE_SLAVE = 0 << 0, /*! Slave zone */
- KNOT_ZONE_MASTER = 1 << 0, /*! Master zone. */
- KNOT_ZONE_DISCARDED = 1 << 1 /*! Zone waiting to be discarded. */
+ KNOT_ZONE_SLAVE = 0 << 0, /*! Slave zone */
+ KNOT_ZONE_MASTER = 1 << 0, /*! Master zone. */
+ KNOT_ZONE_DISCARDED = 1 << 1, /*! Zone waiting to be discarded. */
+ KNOT_ZONE_UPDATED = 1 << 2, /*! Zone is updated in this cycle. */
+ KNOT_ZONE_OBSOLETE = 1 << 3 /*! Zone is obsolete (forces retransfer). */
} knot_zone_flag_t;
/*----------------------------------------------------------------------------*/