]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/acl/Acl.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / acl / Acl.h
index 415784202b009327f1e1dab08f8f5a93a4dadff8..89eb9094575c84241b9a815e18c46684e64fc282 100644 (file)
 
 #include "Array.h"
 #include "cbdata.h"
+#include "defines.h"
 #include "dlink.h"
+#include "MemPool.h"
+#include "structs.h"
 
 #if HAVE_OSTREAM
 #include <ostream>
@@ -116,15 +119,38 @@ typedef enum {
 
     // Authentication ACL result states
     ACCESS_AUTH_REQUIRED,    // Missing Credentials
-    ACCESS_AUTH_EXPIRED_OK,  // Expired now. Were Okay.
-    ACCESS_AUTH_EXPIRED_BAD  // Expired now. Were Failed.
-} allow_t;
+} aclMatchCode;
+
+/// \ingroup ACLAPI
+/// ACL check answer; TODO: Rename to Acl::Answer
+class allow_t
+{
+public:
+    // not explicit: allow "aclMatchCode to allow_t" conversions (for now)
+    allow_t(const aclMatchCode aCode): code(aCode), kind(0) {}
+
+    allow_t(): code(ACCESS_DUNNO), kind(0) {}
+
+    bool operator ==(const aclMatchCode aCode) const {
+        return code == aCode;
+    }
+
+    bool operator !=(const aclMatchCode aCode) const {
+        return !(*this == aCode);
+    }
+
+    operator aclMatchCode() const {
+        return code;
+    }
+
+    aclMatchCode code; ///< ACCESS_* code
+    int kind; ///< which custom access list verb matched
+};
 
 inline std::ostream &
 operator <<(std::ostream &o, const allow_t a)
 {
-    switch(a)
-    {
+    switch (a) {
     case ACCESS_DENIED:
         o << "DENIED";
         break;
@@ -137,12 +163,6 @@ operator <<(std::ostream &o, const allow_t a)
     case ACCESS_AUTH_REQUIRED:
         o << "AUTH_REQUIRED";
         break;
-    case ACCESS_AUTH_EXPIRED_OK:
-        o << "AUTH_EXPIRED_OK";
-        break;
-    case ACCESS_AUTH_EXPIRED_BAD:
-        o << "AUTH_EXPIRED_BAD";
-        break;
     }
     return o;
 }
@@ -193,7 +213,6 @@ public:
 
 MEMPROXY_CLASS_INLINE(acl_proxy_auth_match_cache);
 
-
 /// \ingroup ACLAPI
 extern const char *AclMatchedName;     /* NULL */