]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/auth/State.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / auth / State.h
index cd19e72da7eec188bde58758e35b1cec8bf86bdf..679a92a589468950a1ddf2fba45920e602fdc1de 100644 (file)
@@ -1,19 +1,47 @@
+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #ifndef __AUTH_AUTHENTICATE_STATE_T__
 #define __AUTH_AUTHENTICATE_STATE_T__
 
+#if USE_AUTH
+
 #include "auth/UserRequest.h"
+#include "cbdata.h"
+
+namespace Auth
+{
 
 /**
  * CBDATA state for NTLM, Negotiate, and Digest stateful authentication.
  */
-typedef struct {
-    void *data;
-    AuthUserRequest::Pointer auth_user_request;
-    RH *handler;
-} authenticateStateData;
+class StateData
+{
+    CBDATA_CLASS(StateData);
 
-extern CBDATA_GLOBAL_TYPE(authenticateStateData);
+public:
+    StateData(const UserRequest::Pointer &r, AUTHCB *h, void *d) :
+        data(cbdataReference(d)),
+        auth_user_request(r),
+        handler(h) {}
 
-extern void authenticateStateFree(authenticateStateData * r);
+    ~StateData() {
+        auth_user_request = NULL;
+        cbdataReferenceDone(data);
+    }
 
+    void *data;
+    UserRequest::Pointer auth_user_request;
+    AUTHCB *handler;
+};
+
+} // namespace Auth
+
+#endif /* USE_AUTH */
 #endif /* __AUTH_AUTHENTICATE_STATE_T__ */
+