+/*
+ * 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"
-typedef enum {
- AUTHENTICATE_STATE_NONE,
- AUTHENTICATE_STATE_INITIAL,
- AUTHENTICATE_STATE_IN_PROGRESS,
- AUTHENTICATE_STATE_DONE,
- AUTHENTICATE_STATE_FAILED
-} auth_state_t; /* connection level auth state */
+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__ */
+