{
Eui::Eui48 lookingFor;
if (lookingFor.lookup(c)) {
- Eui::Eui48 * const* lookupResult;
- lookupResult = (*dataptr)->find(&lookingFor,aclArpCompare);
+ Eui::Eui48 * const* lookupResult = (*dataptr)->find(&lookingFor,aclArpCompare);
debugs(28, 3, "aclMatchArp: '" << c << "' " << (lookupResult ? "found" : "NOT found"));
return (lookupResult != NULL);
}
#include "globals.h"
#include "ip/Address.h"
-static void aclParseEuiList(SplayNode<Eui::Eui64 *> **curlist);
-static int aclMatchEui(SplayNode<Eui::Eui64 *> **dataptr, Ip::Address &c);
+static void aclParseEuiList(Splay<Eui::Eui64 *> **curlist);
+static int aclMatchEui(Splay<Eui::Eui64 *> **dataptr, Ip::Address &c);
static SplayNode<Eui::Eui64 *>::SPLAYCMP aclEui64Compare;
-static SplayNode<Eui::Eui64 *>::SPLAYWALKEE aclDumpEuiListWalkee;
ACL *
ACLEui64::clone() const
ACLEui64::~ACLEui64()
{
if (data)
- data->destroy(SplayNode<Eui::Eui64*>::DefaultFree);
+ data->destroy();
}
char const *
}
void
-aclParseEuiList(SplayNode<Eui::Eui64 *> **curlist)
+aclParseEuiList(Splay<Eui::Eui64 *> **curlist)
{
char *t = NULL;
- SplayNode<Eui::Eui64*> **Top = curlist;
Eui::Eui64 *q = NULL;
while ((t = strtokFile())) {
if ((q = aclParseEuiData(t)) == NULL)
continue;
- *Top = (*Top)->insert(q, aclEui64Compare);
+ (*curlist)->insert(q, aclEui64Compare);
}
}
/* aclMatchEui */
/***************/
int
-aclMatchEui(SplayNode<Eui::Eui64 *> **dataptr, Ip::Address &c)
+aclMatchEui(Splay<Eui::Eui64 *> **dataptr, Ip::Address &c)
{
- Eui::Eui64 result;
- SplayNode<Eui::Eui64 *> **Top = dataptr;
-
- if (result.lookup(c)) {
- /* Do ACL match lookup */
- *Top = (*Top)->splay(&result, aclEui64Compare);
- debugs(28, 3, "aclMatchEui: '" << c << "' " << (splayLastResult ? "NOT found" : "found"));
- return (0 == splayLastResult);
+ Eui::Eui64 lookingFor;
+
+ if (lookingFor.lookup(c)) {
+ Eui::Eui64 * const * lookupResult = (*dataptr)->find(&lookingFor, aclEui64Compare);
+ debugs(28, 3, "aclMatchEui: '" << c << "' " << (lookupResult ? "found" : "NOT found"));
+ return (lookupResult != NULL);
}
/*
return memcmp(a, b, sizeof(Eui::Eui64));
}
-static void
-aclDumpEuiListWalkee(Eui::Eui64 * const &node, void *state)
-{
- static char buf[48];
- node->encode(buf, 48);
- static_cast<SBufList *>(state)->push_back(SBuf(buf));
-}
+struct AclEui64DumpVisitor {
+ SBufList contents;
+ void operator() ( const Eui::Eui64 * v) {
+ static char buf[48];
+ v->encode(buf, 48);
+ contents.push_back(SBuf(buf));
+ }
+};
SBufList
ACLEui64::dump() const
{
- SBufList w;
- data->walk(aclDumpEuiListWalkee, &w);
- return w;
+ AclEui64DumpVisitor visitor;
+ data->visit(visitor);
+ return visitor.contents;
}
#endif /* USE_SQUID_EUI */