]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
ha: Add getter for the number of segments
authorTobias Brunner <tobias@strongswan.org>
Tue, 20 Nov 2018 15:39:04 +0000 (16:39 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 7 Dec 2018 09:15:05 +0000 (10:15 +0100)
src/libcharon/plugins/ha/ha_segments.c
src/libcharon/plugins/ha/ha_segments.h

index 0a407f9efd27227a11eb7a83038688cb3bfe65c4..153534915c3d3cf9077722c88c381de32c57e486 100644 (file)
@@ -433,6 +433,12 @@ METHOD(ha_segments_t, is_active, bool,
        return (this->active & SEGMENTS_BIT(segment)) != 0;
 }
 
+METHOD(ha_segments_t, count, u_int,
+       private_ha_segments_t *this)
+{
+       return this->count;
+}
+
 METHOD(ha_segments_t, destroy, void,
        private_ha_segments_t *this)
 {
@@ -459,6 +465,7 @@ ha_segments_t *ha_segments_create(ha_socket_t *socket, ha_kernel_t *kernel,
                        .deactivate = _deactivate,
                        .handle_status = _handle_status,
                        .is_active = _is_active,
+                       .count = _count,
                        .destroy = _destroy,
                },
                .socket = socket,
index 10d5812c6728c357ed90b78830ab354e9d1bbf7b..bc96a8d3ea616669917024c5d3c5f1e5abdcede8 100644 (file)
@@ -82,6 +82,13 @@ struct ha_segments_t {
         */
        bool (*is_active)(ha_segments_t *this, u_int segment);
 
+       /**
+        * Return the number of segments
+        *
+        * @return                      number of segments
+        */
+       u_int (*count)(ha_segments_t *this);
+
        /**
         * Destroy a ha_segments_t.
         */