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