]> git.ipfire.org Git - thirdparty/squid.git/blob - src/auth/QueueNode.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / auth / QueueNode.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_SRC_AUTH_QUEUENODE_H
10 #define SQUID_SRC_AUTH_QUEUENODE_H
11
12 #include "cbdata.h"
13
14 namespace Auth
15 {
16
17 /**
18 * A queue of auth requests waiting for verification to occur.
19 *
20 * Certain authentication schemes such a Basic and Bearer auth
21 * permit credentials tokens to be repeated from multiple sources
22 * simultaneously. This queue node allows multiple validation
23 * queries to be collapsed into one backend helper lookup.
24 * CBDATA and handlers stored in these queue nodes can be notified
25 * all at once with a result when the lookup completes.
26 */
27 class QueueNode
28 {
29 MEMPROXY_CLASS(Auth::QueueNode);
30
31 private:
32 // we store CBDATA here, copy is not safe
33 QueueNode(const QueueNode &);
34 QueueNode &operator =(const QueueNode &);
35
36 public:
37 QueueNode(Auth::UserRequest *aRequest, AUTHCB *aHandler, void *aData) :
38 next(NULL),
39 auth_user_request(aRequest),
40 handler(aHandler),
41 data(cbdataReference(aData)) {}
42 ~QueueNode() {
43 cbdataReferenceDone(data);
44 while (next) {
45 QueueNode *tmp = next->next;
46 next->next = NULL;
47 delete next;
48 next = tmp;
49 };
50 }
51
52 Auth::QueueNode *next;
53 Auth::UserRequest::Pointer auth_user_request;
54 AUTHCB *handler;
55 void *data;
56 };
57
58 } // namespace Auth
59
60 #endif /* SQUID_SRC_AUTH_QUEUENODE_H */
61