Add length limit for user-defined values

Previously, the only limit for most user-defined values like id or name
was the one enforced by dbus, which was fairly big. In order to save
space used by persistent data, new meson options were added, with length
limit for those fields.

This directly impacts following dbus interfaces:
- TriggerManager.AddTrigger:
  - Id
  - Name
  - Reports
  - Thresholds (only name of discrete threshold)
- Trigger.Name
- Trigger.Reports
- Trigger.Thresholds (only name of discrete threshold)
- ReportManager.AddReport(FutureVersion):
  - Id
  - Name
  - MetricParameters (metricId)
- Report.Name
- Report.ReadingParameters (metricId)

For Id fields we support 'prefixes', which also are limited, but those
limit are separate. So if limit for prefix is set to 5 and limit for
id/name is set to 5, following Ids are fine:
- 12345/12345
- 12345
and following are not:
- 123456/1234
- 1/123456

Testing done:
- UTs are passing.
- new limits are reflected when calling mentioned dbus interfaces.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I29291a1cc56a344d92fb65491c9186fdb90a8529
diff --git a/src/trigger_manager.hpp b/src/trigger_manager.hpp
index 4db6941..65ee2af 100644
--- a/src/trigger_manager.hpp
+++ b/src/trigger_manager.hpp
@@ -27,6 +27,8 @@
     void removeTrigger(const interfaces::Trigger* trigger) override;
 
     static void verifyReportIds(const std::vector<std::string>& newReportIds);
+    static void verifyThresholdParams(
+        const LabeledTriggerThresholdParams& thresholdParams);
 
   private:
     std::unique_ptr<interfaces::TriggerFactory> triggerFactory;
@@ -34,9 +36,9 @@
     std::unique_ptr<sdbusplus::asio::dbus_interface> managerIface;
     std::vector<std::unique_ptr<interfaces::Trigger>> triggers;
 
-    void verifyAddTrigger(const std::string& triggerId,
-                          const std::string& triggerName,
-                          const std::vector<std::string>& newReportIds) const;
+    void verifyAddTrigger(
+        const std::vector<std::string>& reportIds,
+        const LabeledTriggerThresholdParams& thresholdParams) const;
 
     interfaces::Trigger&
         addTrigger(const std::string& triggerId, const std::string& triggerName,
@@ -48,12 +50,12 @@
 
   public:
     static constexpr size_t maxTriggers{TELEMETRY_MAX_TRIGGERS};
-    static constexpr size_t maxTriggerIdLength{
-        TELEMETRY_MAX_DBUS_PATH_LENGTH -
-        utils::constants::triggerDirStr.length()};
     static constexpr const char* triggerManagerIfaceName =
         "xyz.openbmc_project.Telemetry.TriggerManager";
     static constexpr const char* triggerManagerPath =
         "/xyz/openbmc_project/Telemetry/Triggers";
-    static constexpr const char* triggerNameDefault = "Trigger";
+    static constexpr std::string_view triggerNameDefault = "Trigger";
+
+    static_assert(!triggerNameDefault.empty(),
+                  "Default trigger name cannot be empty.");
 };