]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Support multiple services and vectoring-point crossing in ICAP X-Next-Services.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 29 Jan 2011 18:18:12 +0000 (11:18 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sat, 29 Jan 2011 18:18:12 +0000 (11:18 -0700)
Adding source files forgotten in r11167.

Merged from the 3p1-rock branch (r9630).

src/adaptation/DynamicGroupCfg.cc [new file with mode: 0644]
src/adaptation/DynamicGroupCfg.h [new file with mode: 0644]

diff --git a/src/adaptation/DynamicGroupCfg.cc b/src/adaptation/DynamicGroupCfg.cc
new file mode 100644 (file)
index 0000000..f5ebf4a
--- /dev/null
@@ -0,0 +1,22 @@
+#include "squid.h"
+
+#include "adaptation/DynamicGroupCfg.h"
+
+void
+Adaptation::DynamicGroupCfg::add(const String &item)
+{
+    if (services.empty()) { // first item
+        id = item;
+    } else {
+        id.append(',');
+        id.append(item);
+    }
+    services.push_back(item);
+}
+
+void
+Adaptation::DynamicGroupCfg::clear()
+{
+    id.clean();
+    services.clean();
+}
diff --git a/src/adaptation/DynamicGroupCfg.h b/src/adaptation/DynamicGroupCfg.h
new file mode 100644 (file)
index 0000000..d67a519
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef SQUID_ADAPTATION__DYNAMIC_GROUP_CFG_H
+#define SQUID_ADAPTATION__DYNAMIC_GROUP_CFG_H
+
+#include "SquidString.h"
+#include "Array.h"
+
+namespace Adaptation
+{
+
+/// DynamicServiceGroup configuration to remember future dynamic chains
+class DynamicGroupCfg
+{
+public:
+    typedef Vector<String> Store;
+    typedef String Id;
+
+    Id id; ///< group id
+    Store services; ///< services in the group
+
+    bool empty() const { return services.empty(); } ///< no services added
+    void add(const String &item); ///< updates group id and services
+    void clear(); ///< makes the config empty
+};
+
+inline
+std::ostream &operator <<(std::ostream &os, const DynamicGroupCfg &cfg)
+{
+    return os << cfg.id;
+}
+
+} // namespace Adaptation
+
+#endif /* SQUID_ADAPTATION__DYNAMIC_GROUP_CFG_H */
+