/* when requiresRequest is made dynamic, review this too */
// virtual bool requiresReply() const {return true;}
virtual bool isProxyAuth() const;
- virtual wordlist *dump() const;
+ virtual SBufList dump() const;
virtual bool valid () const;
virtual bool empty () const;
void
ACLIP::DumpIpListWalkee(acl_ip_data * const & ip, void *state)
{
- char tmpbuf[ ((MAX_IPSTRLEN*2)+6) ]; // space for 2 IPs and a CIDR mask(3) and seperators(3).
- MemBuf mb;
- wordlist **W = static_cast<wordlist **>(state);
- tmpbuf[0] = '\0';
-
- mb.init();
- assert(mb.max_capacity > 0 && 1==1 );
-
- ip->toStr(tmpbuf, sizeof(tmpbuf) );
- assert(mb.max_capacity > 0 && 2==2 );
- mb.append(tmpbuf, strlen(tmpbuf) );
- assert(mb.max_capacity > 0 && 3==3);
- wordlistAdd(W, mb.buf);
- mb.clean();
+ static_cast<SBufList *>(state)->push_back(ip->toSBuf());
}
/**
b3[0] = '\0';
}
+SBuf
+acl_ip_data::toSBuf() const
+{
+ const int bufsz = MAX_IPSTRLEN*2+6;
+ static char tmpbuf[ bufsz ];
+ toStr(tmpbuf,bufsz);
+ return SBuf(tmpbuf);
+}
+
+
/*
* aclIpAddrNetworkCompare - The guts of the comparison for IP ACLs
* matching checks. The first argument (p) is a "host" address,
#include "PeerDigest.h"
#include "RefreshPattern.h"
#include "rfc1738.h"
+#include "SBufList.h"
#include "SquidConfig.h"
#include "SquidString.h"
#include "ssl/ProxyCerts.h"
return 0;
}
-/*****************************************************************************
- * Max
- *****************************************************************************/
-
static void
-dump_wordlist(StoreEntry * entry, wordlist *words)
+dump_SBufList(StoreEntry * entry, const SBufList &words)
{
- for (wordlist *word = words; word; word = word->next)
- storeAppendPrintf(entry, "%s ", word->key);
+ for (SBufList::const_iterator i = words.begin(); i != words.end(); ++i) {
+ entry->append(i->rawContent(), i->length());
+ entry->append(" ",1);
+ }
}
static void
ae->name,
ae->typeString(),
ae->flags.flagsStr());
- wordlist *w = ae->dump();
- dump_wordlist(entry, w);
-
- storeAppendPrintf(entry, "\n");
- wordlistDestroy(&w);
+ dump_SBufList(entry, ae->dump());
ae = ae->next;
}
}
void
dump_acl_list(StoreEntry * entry, ACLList * head)
{
- wordlist *values = head->dump();
- dump_wordlist(entry, values);
- wordlistDestroy(&values);
+ dump_SBufList(entry, head->dump());
}
void
dump_acl_access(StoreEntry * entry, const char *name, acl_access * head)
{
- if (head) {
- wordlist *lines = head->treeDump(name, NULL);
- dump_wordlist(entry, lines);
- wordlistDestroy(&lines);
- }
+ if (head)
+ dump_SBufList(entry, head->dump());
}
static void
static void dump_ftp_epsv(StoreEntry *entry, const char *name, acl_access *ftp_epsv)
{
- if (ftp_epsv) {
- wordlist *lines = ftp_epsv->treeDump(name, NULL);
- dump_wordlist(entry, lines);
- wordlistDestroy(&lines);
- }
+ if (ftp_epsv)
+ dump_SBufList(entry, ftp_epsv->treeDump(name, NULL));
}
static void free_ftp_epsv(acl_access **ftp_epsv)
}
}
-wordlist *
+SBufList
ACLExternal::dump() const
{
external_acl_data const *acl = data;
- wordlist *result = NULL;
- wordlist *arg;
- MemBuf mb;
- mb.init();
- mb.Printf("%s", acl->def->name);
+ SBufList rv;
+ rv.push_back(SBuf(acl->def->name));
- for (arg = acl->arguments; arg; arg = arg->next) {
- mb.Printf(" %s", arg->key);
+ for (wordlist *arg = acl->arguments; arg; arg = arg->next) {
+ SBuf s;
+ s.Printf(" %s", arg->key);
+ rv.push_back(s);
}
- wordlistAdd(&result, mb.buf);
- mb.clean();
- return result;
+ return rv;
}
/******************************************************************
return -1;
}
-wordlist *
+SBufList
ACLIdent::dump() const
{
return data->dump();
virtual bool isProxyAuth() const {return true;}
virtual int match(ACLChecklist *checklist);
- virtual wordlist *dump() const;
+ virtual SBufList dump() const;
virtual bool empty () const;
virtual ACL *clone()const;