From: Alex Rousskov Date: Sat, 29 Jan 2011 18:18:12 +0000 (-0700) Subject: Support multiple services and vectoring-point crossing in ICAP X-Next-Services. X-Git-Tag: take01~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7dc455054d3b62507886ebd333e1095950f54884;p=thirdparty%2Fsquid.git Support multiple services and vectoring-point crossing in ICAP X-Next-Services. Adding source files forgotten in r11167. Merged from the 3p1-rock branch (r9630). --- diff --git a/src/adaptation/DynamicGroupCfg.cc b/src/adaptation/DynamicGroupCfg.cc new file mode 100644 index 0000000000..f5ebf4a3d7 --- /dev/null +++ b/src/adaptation/DynamicGroupCfg.cc @@ -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 index 0000000000..d67a5195cf --- /dev/null +++ b/src/adaptation/DynamicGroupCfg.h @@ -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 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 */ +