#include "acl/Gadgets.h"
#include "acl/Options.h"
#include "anyp/PortCfg.h"
+#include "base/IoManip.h"
#include "cache_cf.h"
#include "ConfigParser.h"
#include "debug/Stream.h"
Acl::ParseFlags(allOptions);
}
-SBufList
-ACL::dumpOptions()
+void
+ACL::dumpWhole(const char * const directiveName, std::ostream &os)
{
- SBufList result;
-
- const auto &myOptions = options();
// XXX: No lineOptions() call here because we do not remember ACL "line"
// boundaries and associated "line" options; we cannot report them.
-
- // optimization: most ACLs do not have myOptions
- // this check also works around dump_SBufList() adding ' ' after empty items
- if (!myOptions.empty()) {
- SBufStream stream;
- stream << myOptions;
- const SBuf optionsImage = stream.buf();
- if (!optionsImage.isEmpty())
- result.push_back(optionsImage);
- }
- return result;
+ os << directiveName << ' ' << name << ' ' << typeString() << options() <<
+ asList(dump()).prefixedBy(" ").delimitedBy(" ") <<
+ '\n';
}
/* ACL result caching routines */
virtual void prepareForUse() {}
- SBufList dumpOptions(); ///< \returns approximate options configuration
+ // TODO: Find a way to make options() and this method constant
+ /// Prints aggregated "acl" (or similar) directive configuration, including
+ /// the given directive name, ACL name, ACL type, and ACL parameters. The
+ /// printed parameters are collected from all same-name "acl" directives.
+ void dumpWhole(const char *directiveName, std::ostream &);
char name[ACL_NAME_SZ];
char *cfgline;
static void
dump_acl(StoreEntry * entry, const char *name, ACL * ae)
{
+ PackableStream os(*entry);
while (ae != nullptr) {
debugs(3, 3, "dump_acl: " << name << " " << ae->name);
- storeAppendPrintf(entry, "%s %s %s ",
- name,
- ae->name,
- ae->typeString());
- SBufList tail;
- tail.splice(tail.end(), ae->dumpOptions());
- tail.splice(tail.end(), ae->dump()); // ACL parameters
- dump_SBufList(entry, tail);
+ ae->dumpWhole(name, os);
ae = ae->next;
}
}