From: Tobias Brunner Date: Tue, 20 Nov 2018 15:39:04 +0000 (+0100) Subject: ha: Add getter for the number of segments X-Git-Tag: 5.7.2dr4~8^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16a898f5f75e21917e78ab65c43ec85efcfac5b2;p=thirdparty%2Fstrongswan.git ha: Add getter for the number of segments --- diff --git a/src/libcharon/plugins/ha/ha_segments.c b/src/libcharon/plugins/ha/ha_segments.c index 0a407f9efd..153534915c 100644 --- a/src/libcharon/plugins/ha/ha_segments.c +++ b/src/libcharon/plugins/ha/ha_segments.c @@ -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, diff --git a/src/libcharon/plugins/ha/ha_segments.h b/src/libcharon/plugins/ha/ha_segments.h index 10d5812c67..bc96a8d3ea 100644 --- a/src/libcharon/plugins/ha/ha_segments.h +++ b/src/libcharon/plugins/ha/ha_segments.h @@ -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. */