]> git.ipfire.org Git - thirdparty/squid.git/blob - src/auth/QueueNode.h
Boilerplate: update copyright blurbs on src/
[thirdparty/squid.git] / src / auth / QueueNode.h
1 /*
2 * Copyright (C) 1996-2014 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 namespace Auth
13 {
14
15 /**
16 * A queue of auth requests waiting for verification to occur.
17 *
18 * Certain authentication schemes such a Basic and Bearer auth
19 * permit credentials tokens to be repeated from multiple sources
20 * simultaneously. This queue node allows multiple validation
21 * queries to be collapsed into one backend helper lookup.
22 * CBDATA and handlers stored in these queue nodes can be notified
23 * all at once with a result when the lookup completes.
24 */
25 class QueueNode
26 {
27
28 private:
29 // we store CBDATA here, copy is not safe
30 QueueNode(const QueueNode &);
31 QueueNode &operator =(const QueueNode &);
32
33 public:
34 QueueNode(Auth::UserRequest *aRequest, AUTHCB *aHandler, void *aData) :
35 next(NULL),
36 auth_user_request(aRequest),
37 handler(aHandler),
38 data(cbdataReference(aData)) {}
39 ~QueueNode() {
40 cbdataReferenceDone(data);
41 while (next) {
42 QueueNode *tmp = next->next;
43 next->next = NULL;
44 delete next;
45 next = tmp;
46 };
47 }
48
49 Auth::QueueNode *next;
50 Auth::UserRequest::Pointer auth_user_request;
51 AUTHCB *handler;
52 void *data;
53
54 MEMPROXY_CLASS(Auth::QueueNode);
55 };
56
57 MEMPROXY_CLASS_INLINE(Auth::QueueNode);
58
59 } // namespace Auth
60
61 #endif /* SQUID_SRC_AUTH_QUEUENODE_H */