From 0915b3ef56dfac3113cce55a59a5765dc94976be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:34:54 +0200 Subject: Adding upstream version 2.13.6. Signed-off-by: Daniel Baumann --- lib/icinga/hostgroup.hpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lib/icinga/hostgroup.hpp (limited to 'lib/icinga/hostgroup.hpp') diff --git a/lib/icinga/hostgroup.hpp b/lib/icinga/hostgroup.hpp new file mode 100644 index 0000000..3ad5d26 --- /dev/null +++ b/lib/icinga/hostgroup.hpp @@ -0,0 +1,43 @@ +/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ + +#ifndef HOSTGROUP_H +#define HOSTGROUP_H + +#include "icinga/i2-icinga.hpp" +#include "icinga/hostgroup-ti.hpp" +#include "icinga/host.hpp" + +namespace icinga +{ + +class ConfigItem; + +/** + * An Icinga host group. + * + * @ingroup icinga + */ +class HostGroup final : public ObjectImpl +{ +public: + DECLARE_OBJECT(HostGroup); + DECLARE_OBJECTNAME(HostGroup); + + std::set GetMembers() const; + void AddMember(const Host::Ptr& host); + void RemoveMember(const Host::Ptr& host); + + bool ResolveGroupMembership(const Host::Ptr& host, bool add = true, int rstack = 0); + + static void EvaluateObjectRules(const Host::Ptr& host); + +private: + mutable std::mutex m_HostGroupMutex; + std::set m_Members; + + static bool EvaluateObjectRule(const Host::Ptr& host, const intrusive_ptr& item); +}; + +} + +#endif /* HOSTGROUP_H */ -- cgit v1.2.3