#include "Array.h"
#include "cbdata.h"
+#include "defines.h"
#include "dlink.h"
+#include "MemPool.h"
+#include "structs.h"
+
+#if HAVE_OSTREAM
+#include <ostream>
+#endif
class ConfigParser;
class ACLChecklist;
/// \ingroup ACLAPI
typedef enum {
+ // Authorization ACL result states
ACCESS_DENIED,
ACCESS_ALLOWED,
ACCESS_DUNNO,
- ACCESS_REQ_PROXY_AUTH
-} allow_t;
+
+ // Authentication ACL result states
+ ACCESS_AUTH_REQUIRED, // Missing Credentials
+} 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) {
+ case ACCESS_DENIED:
+ o << "DENIED";
+ break;
+ case ACCESS_ALLOWED:
+ o << "ALLOWED";
+ break;
+ case ACCESS_DUNNO:
+ o << "DUNNO";
+ break;
+ case ACCESS_AUTH_REQUIRED:
+ o << "AUTH_REQUIRED";
+ break;
+ }
+ return o;
+}
/// \ingroup ACLAPI
class acl_access
MEMPROXY_CLASS_INLINE(acl_proxy_auth_match_cache);
-
/// \ingroup ACLAPI
extern const char *AclMatchedName; /* NULL */